RegressionTests__JavaScriptTests.st
branchjv
changeset 1470 25364ea42469
parent 1281 cdfbc80e4791
child 1367 f356e0666d36
child 1485 5a1aadddbc7f
equal deleted inserted replaced
1469:ced1f24b34f1 1470:25364ea42469
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "{ Package: 'exept:regression' }"
     1 "{ Package: 'exept:regression' }"
     4 
     2 
     5 "{ NameSpace: RegressionTests }"
     3 "{ NameSpace: RegressionTests }"
     6 
     4 
     7 TestCase subclass:#JavaScriptTests
     5 TestCase subclass:#JavaScriptTests
   117     self assert:(f ~~ #Error).
   115     self assert:(f ~~ #Error).
   118     self assert:(f notNil).
   116     self assert:(f notNil).
   119 
   117 
   120 "/    f decompileTo:Transcript.
   118 "/    f decompileTo:Transcript.
   121 
   119 
   122     result := f valueWithReceiver:receiver arguments:arguments.    
   120     result := f valueWithReceiver:receiver arguments:arguments selector:nil search:nil sender:nil.    
   123     ^ result
   121     ^ result
   124 
   122 
   125     "Modified: / 09-10-2011 / 11:41:51 / cg"
   123     "Modified: / 09-10-2011 / 11:41:51 / cg"
   126     "Modified (format): / 20-09-2013 / 11:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   124     "Modified (format): / 20-09-2013 / 11:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   127 !
   125 !
  3522      self run:#testOperators47_toString
  3520      self run:#testOperators47_toString
  3523      self new testOperators47_toString
  3521      self new testOperators47_toString
  3524     "
  3522     "
  3525 !
  3523 !
  3526 
  3524 
       
  3525 testOperators48_isArray
       
  3526     self 
       
  3527         execute:'expr(arg) {
       
  3528                     return arg.isArray() ;
       
  3529                  }'
       
  3530         for:nil
       
  3531         arguments:#(123)
       
  3532         expect:false.
       
  3533 
       
  3534     self 
       
  3535         execute:'expr(arg) {
       
  3536                     return arg.isArray() ;
       
  3537                  }'
       
  3538         for:nil
       
  3539         arguments:#('hello')
       
  3540         expect:false.
       
  3541 
       
  3542     self 
       
  3543         execute:'expr(arg) {
       
  3544                     return arg.isArray() ;
       
  3545                  }'
       
  3546         for:nil
       
  3547         arguments:#( (1 2 3) )
       
  3548         expect:true.
       
  3549 
       
  3550     "
       
  3551      self run:#testOperators48_isArray
       
  3552      self new testOperators48_isArray
       
  3553     "
       
  3554 !
       
  3555 
       
  3556 testOperators49_concat
       
  3557     self 
       
  3558         execute:'expr(arg1) {
       
  3559                     return arg1.concat() ;
       
  3560                  }'
       
  3561         for:nil
       
  3562         arguments:#( 'a')
       
  3563         expect:'a'.
       
  3564 
       
  3565     self 
       
  3566         execute:'expr(arg1, arg2) {
       
  3567                     return arg1.concat(arg2) ;
       
  3568                  }'
       
  3569         for:nil
       
  3570         arguments:#( 'a' 'b')
       
  3571         expect:'ab'.
       
  3572 
       
  3573     self 
       
  3574         execute:'expr(arg1, arg2, arg3) {
       
  3575                     return arg1.concat(arg2, arg3) ;
       
  3576                  }'
       
  3577         for:nil
       
  3578         arguments:#( 'a' 'b' 'c' )
       
  3579         expect:'abc'.
       
  3580 
       
  3581     self 
       
  3582         execute:'expr() {
       
  3583                     return "a".concat("b", "c", "d", "e", "f") ;
       
  3584                  }'
       
  3585         for:nil
       
  3586         arguments:nil
       
  3587         expect:'abcdef'.
       
  3588 
       
  3589     self 
       
  3590         execute:'expr() {
       
  3591                     return "a".concat("b", "c", "d", "e", "f", "g") ;
       
  3592                  }'
       
  3593         for:nil
       
  3594         arguments:nil
       
  3595         expect:'abcdefg'.
       
  3596 
       
  3597     self 
       
  3598         execute:'expr() {
       
  3599                     return "a".concat("b", "c", "d", "e", "f", "g", "h") ;
       
  3600                  }'
       
  3601         for:nil
       
  3602         arguments:nil
       
  3603         expect:'abcdefgh'.
       
  3604 
       
  3605     self 
       
  3606         execute:'expr(arg1, arg2, arg3) {
       
  3607                     return arg1.concat(arg2, arg3) ;
       
  3608                  }'
       
  3609         for:nil
       
  3610         arguments:#( (1) (2) (3) )
       
  3611         expect:#(1 2 3).
       
  3612 
       
  3613     "
       
  3614      self run:#testOperators49_concat
       
  3615      self new testOperators49_concat
       
  3616     "
       
  3617 !
       
  3618 
  3527 testParserErrors01
  3619 testParserErrors01
  3528     self should:[
  3620     self should:[
  3529         self 
  3621         self 
  3530             execute:'expr(a, ) {
  3622             execute:'expr(a, ) {
  3531                         return (a == b);
  3623                         return (a == b);