diff -r 26a16a04219b -r d406a10b2965 RegressionTests__JavaScriptTests.st --- a/RegressionTests__JavaScriptTests.st Wed Jun 29 21:40:53 2016 +0100 +++ b/RegressionTests__JavaScriptTests.st Thu Jun 30 09:02:08 2016 +0100 @@ -16,7 +16,7 @@ documentation to be added. [author:] - cg (cg@FUSI) + cg (cg@FUSI) [instance variables:] @@ -34,62 +34,62 @@ !JavaScriptTests class methodsFor:'queries'! coveredClassNames - ^ #( - JavaScriptParser - JavaScriptScanner - JavaScriptCompiler - ) + ^ #( + JavaScriptParser + JavaScriptScanner + JavaScriptCompiler + ) ! ! !JavaScriptTests methodsFor:'helpers'! -doTestEachFromSpec:spec - spec do:[:triple | - |str checkSelectorOrNil valExpected val expectError| - - str := triple first. - checkSelectorOrNil := triple second. - expectError := false. - valExpected := triple third. - valExpected isArray ifTrue:[ - valExpected size > 0 ifTrue:[ - valExpected first == #eval ifTrue:[ - valExpected := Parser evaluate:valExpected second - ] ifFalse:[ - valExpected first == #error ifTrue:[ - expectError := true - ]. - ]. - ]. - ]. - expectError ifTrue:[ - self - should:[ (JavaScriptParser parseExpression:str) evaluate ] - raise:Error - ] ifFalse:[ - val := (JavaScriptParser parseExpression:str) evaluate. - checkSelectorOrNil notNil ifTrue:[ - self assert:(val perform:checkSelectorOrNil). - ]. - self assert:(val = valExpected). - ]. +doTestEachFromSpec:spec + spec do:[:triple | + |str checkSelectorOrNil valExpected val expectError| + + str := triple first. + checkSelectorOrNil := triple second. + expectError := false. + valExpected := triple third. + valExpected isArray ifTrue:[ + valExpected size > 0 ifTrue:[ + valExpected first == #eval ifTrue:[ + valExpected := Parser evaluate:valExpected second + ] ifFalse:[ + valExpected first == #error ifTrue:[ + expectError := true + ]. + ]. + ]. + ]. + expectError ifTrue:[ + self + should:[ (JavaScriptParser parseExpression:str) evaluate ] + raise:Error + ] ifFalse:[ + val := (JavaScriptParser parseExpression:str) evaluate. + checkSelectorOrNil notNil ifTrue:[ + self assert:(val perform:checkSelectorOrNil). + ]. + self assert:(val = valExpected). + ]. ] ! -doTestEachFunctionFromSpec:spec - spec do:[:tuple | - |source expectError| - - source := tuple first. - expectError := tuple second. - - expectError ifTrue:[ - self - should:[ JavaScriptParser parseFunction:source ] - raise:Error - ] ifFalse:[ - JavaScriptParser parseFunction:source. - ]. +doTestEachFunctionFromSpec:spec + spec do:[:tuple | + |source expectError| + + source := tuple first. + expectError := tuple second. + + expectError ifTrue:[ + self + should:[ JavaScriptParser parseFunction:source ] + raise:Error + ] ifFalse:[ + JavaScriptParser parseFunction:source. + ]. ] ! @@ -104,11 +104,11 @@ "/ Transcript showCR:(thisContext sender selector , '...'). f := JavaScriptCompiler - compile:code - forClass:(receiver class) - inCategory:nil - notifying:nil - install:false. + compile:code + forClass:(receiver class) + inCategory:nil + notifying:nil + install:false. "/ f inspect. @@ -117,7 +117,7 @@ "/ f decompileTo:Transcript. - result := f valueWithReceiver:receiver arguments:arguments selector:nil search:nil sender:nil. + result := f valueWithReceiver:receiver arguments:arguments selector:nil search:nil sender:nil. ^ result "Modified: / 09-10-2011 / 11:41:51 / cg" @@ -137,21 +137,21 @@ "/ Transcript showCR:(thisContext sender selector , '...'). Parser parseErrorSignal handle:[:ex | - errorEncountered := true. + errorEncountered := true. ] do:[ - f := JavaScriptCompiler - compile:code - forClass:(receiver class) - inCategory:nil - notifying:nil - install:false. - - errorEncountered := (f == #Error). + f := JavaScriptCompiler + compile:code + forClass:(receiver class) + inCategory:nil + notifying:nil + install:false. + + errorEncountered := (f == #Error). ]. expectedError == #ParseError ifTrue:[ - self assert:(errorEncountered). - ^ self + self assert:(errorEncountered). + ^ self ]. self assert:(errorEncountered not). @@ -159,9 +159,9 @@ "/ f decompileTo:Transcript. - self - should:[f valueWithReceiver:receiver arguments:arguments] - raise:expectedError + self + should:[f valueWithReceiver:receiver arguments:arguments] + raise:expectedError "Modified: / 09-10-2011 / 11:41:57 / cg" ! @@ -178,8 +178,8 @@ setUp JavaScriptCompiler isNil ifTrue:[ - Smalltalk loadPackage:'stx:libjavascript'. - JavaScriptParseNodeValidator autoload. + Smalltalk loadPackage:'stx:libjavascript'. + JavaScriptParseNodeValidator autoload. ]. "Created: / 09-08-2011 / 23:12:13 / cg" @@ -193,258 +193,258 @@ savedTranscript := Transcript. [ - Transcript := aStream. - aBlock value. + Transcript := aStream. + aBlock value. ] ensure:[ - Transcript := savedTranscript + Transcript := savedTranscript ]. ! ! !JavaScriptTests methodsFor:'tests'! testArray01 - self - execute:'test(arr) { - return arr[1]; - }' - for:nil - arguments:#( #(10 20 30) ) - expect:10 + self + execute:'test(arr) { + return arr[1]; + }' + for:nil + arguments:#( #(10 20 30) ) + expect:10 " self run:#testArray01 - self new testArray01 + self new testArray01 " ! testArray02 - self - execute:'test(arr) { - arr[1]; - }' - for:nil - arguments:#( #(10 20 30) ) - expect:nil + self + execute:'test(arr) { + arr[1]; + }' + for:nil + arguments:#( #(10 20 30) ) + expect:nil " self run:#testArray02 - self new testArray02 + self new testArray02 " "Modified: / 21-02-2007 / 13:02:39 / cg" ! testArray03 - self - execute:'test(arr, val) { - arr[1] = val; - return arr; - }' - for:nil - arguments:#( #(10 20 30) 99 ) deepCopy "deepCopy - this is immutable" - expect:#(99 20 30) + self + execute:'test(arr, val) { + arr[1] = val; + return arr; + }' + for:nil + arguments:#( #(10 20 30) 99 ) deepCopy "deepCopy - this is immutable" + expect:#(99 20 30) " self run:#testArray03 - self new testArray03 + self new testArray03 " ! testArray04 - self - execute:'test() { - var arr = new Array; - return arr; - }' - for:nil - arguments:#( ) - expect:#() + self + execute:'test() { + var arr = new Array; + return arr; + }' + for:nil + arguments:#( ) + expect:#() " self run:#testArray04 - self new testArray04 + self new testArray04 " "Modified: / 21-02-2007 / 13:03:22 / cg" ! testArray04a - self - execute:'test() { - var arr = new Array; - return arr; - }' - for:nil - arguments:#( ) - expect:#() + self + execute:'test() { + var arr = new Array; + return arr; + }' + for:nil + arguments:#( ) + expect:#() " self run:#testArray04a - self new testArray04a + self new testArray04a " "Created: / 21-02-2007 / 13:03:39 / cg" ! testArray04b - self - execute:'test() { - var arr = Array.new; - return arr; - }' - for:nil - arguments:#( ) - expect:#() + self + execute:'test() { + var arr = Array.new; + return arr; + }' + for:nil + arguments:#( ) + expect:#() " self run:#testArray04b - self new testArray04b + self new testArray04b " "Created: / 21-02-2007 / 13:03:48 / cg" ! testArray04c - self - execute:'test() { - var arr = Array.new(); - return arr; - }' - for:nil - arguments:#( ) - expect:#() + self + execute:'test() { + var arr = Array.new(); + return arr; + }' + for:nil + arguments:#( ) + expect:#() " self run:#testArray04c - self new testArray04c + self new testArray04c " "Created: / 21-02-2007 / 13:04:00 / cg" ! testArray04d - self - execute:'test() { - var arr = new Array(); - return arr; - }' - for:nil - arguments:#( ) - expect:#() + self + execute:'test() { + var arr = new Array(); + return arr; + }' + for:nil + arguments:#( ) + expect:#() " self run:#testArray04d - self new testArray04d + self new testArray04d " "Created: / 21-02-2007 / 13:04:25 / cg" ! testArray06a - self - execute:'test() { - var arr = new Array(5); - return arr; - }' - for:nil - arguments:#( ) - expect:#( nil nil nil nil nil ) + self + execute:'test() { + var arr = new Array(5); + return arr; + }' + for:nil + arguments:#( ) + expect:#( nil nil nil nil nil ) " self run:#testArray06a - self new testArray06a + self new testArray06a " "Created: / 21-02-2007 / 13:04:52 / cg" ! testArray06b - self - execute:'test() { - var arr = Array.new(5); - return arr; - }' - for:nil - arguments:#( ) - expect:#( nil nil nil nil nil ) + self + execute:'test() { + var arr = Array.new(5); + return arr; + }' + for:nil + arguments:#( ) + expect:#( nil nil nil nil nil ) " self run:#testArray06b - self new testArray06b + self new testArray06b " "Created: / 21-02-2007 / 13:05:08 / cg" ! testArray07 - self - execute:'test() { - var arr = new Array(3); - arr[1] = 41; - arr[2] = -5; - arr[3] = 20; - return arr; - }' - for:nil - arguments:#() - expect:#( 41 -5 20 ). + self + execute:'test() { + var arr = new Array(3); + arr[1] = 41; + arr[2] = -5; + arr[3] = 20; + return arr; + }' + for:nil + arguments:#() + expect:#( 41 -5 20 ). " self run:#testArray07 - self new testArray07 + self new testArray07 " ! testArray08 - self - execute:'test() { - var arr = new Array(3); - arr[1] = 41; - arr[2] = -5; - arr[3] = 20; - return arr; - }' - for:nil - arguments:#( ) - expect:#( 41 -5 20 ) + self + execute:'test() { + var arr = new Array(3); + arr[1] = 41; + arr[2] = -5; + arr[3] = 20; + return arr; + }' + for:nil + arguments:#( ) + expect:#( 41 -5 20 ) " self run:#testArray08 - self new testArray08 + self new testArray08 " ! testArray09 - self - execute:'test() { - var arr = [1,2,3]; - return arr; - }' - for:nil - arguments:#( ) - expect:#( 1 2 3 ) + self + execute:'test() { + var arr = [1,2,3]; + return arr; + }' + for:nil + arguments:#( ) + expect:#( 1 2 3 ) " self run:#testArray09 - self new testArray09 + self new testArray09 " "Created: / 21-02-2007 / 13:05:48 / cg" ! testAssignmentExpression01 - self - execute:'assign(a, b) { - var x, y; - - x = y = 0; - x = y = a; - x = y = b; - return (x + y); - }' - for:nil - arguments:#(10 20) - expect:40 + self + execute:'assign(a, b) { + var x, y; + + x = y = 0; + x = y = a; + x = y = b; + return (x + y); + }' + for:nil + arguments:#(10 20) + expect:40 " self run:#testAssignmentExpression01 @@ -455,16 +455,16 @@ testAssignmentExpression02 "yes, in JS you can change an argument variable" - self - execute:'assign(a, b) { - var x, y; - - a = x = y = 0; - return (a + b); - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'assign(a, b) { + var x, y; + + a = x = y = 0; + return (a + b); + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testAssignmentExpression02 @@ -473,13 +473,13 @@ ! testCommaExpression01 - self - execute:'comma(a, b, c) { - return (a , b , c); - }' - for:nil - arguments:#(10 20 30) - expect:30 + self + execute:'comma(a, b, c) { + return (a , b , c); + }' + for:nil + arguments:#(10 20 30) + expect:30 " self run:#testCommaExpression01 @@ -488,13 +488,13 @@ ! testCommaExpression02 - self - execute:'comma(a, b, c) { - return (a+10 , b+10 , c+10); - }' - for:nil - arguments:#(10 20 30) - expect:40 + self + execute:'comma(a, b, c) { + return (a+10 , b+10 , c+10); + }' + for:nil + arguments:#(10 20 30) + expect:40 " self run:#testCommaExpression02 @@ -505,9 +505,9 @@ testComments01 |savedTranscript collector expected| - savedTranscript := Smalltalk at:#Transcript. + savedTranscript := Smalltalk at:#Transcript. [ - Smalltalk at:#Transcript put:(collector := '' writeStream). + Smalltalk at:#Transcript put:(collector := '' writeStream). self execute:' testComments() { @@ -519,7 +519,7 @@ /***/ // Also valid // Need to test string literals and identifiers - println("All is well in Javascript"); + println("All is well in Javascript"); return null; } ' @@ -527,7 +527,7 @@ arguments:#( ) expect:nil ] ensure:[ - Smalltalk at:#Transcript put:savedTranscript + Smalltalk at:#Transcript put:savedTranscript ]. expected := String streamContents:[:s | s showCR:'All is well in Javascript']. @@ -535,18 +535,18 @@ " self run:#testComments01 - self new testComments01 + self new testComments01 " ! testConditionalExpression01 - self - execute:'max(a, b) { - return (a > b) ? a : b; - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'max(a, b) { + return (a > b) ? a : b; + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testConditionalExpression01 @@ -555,13 +555,13 @@ ! testConditionalExpression02 - self - execute:'max(a, b) { - return (a < b) ? a : b; - }' - for:nil - arguments:#(10 20) - expect:10 + self + execute:'max(a, b) { + return (a < b) ? a : b; + }' + for:nil + arguments:#(10 20) + expect:10 " self run:#testConditionalExpression02 @@ -573,19 +573,19 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - do { - Transcript.showCR(n); - } while (++n <= 3); - return n; - }' - for:nil - arguments:#(5) - expect:4 + self + execute:'test(arg) { + var n; + + n = 1; + do { + Transcript.showCR(n); + } while (++n <= 3); + return n; + }' + for:nil + arguments:#(5) + expect:4 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '1' '2' '3' )) @@ -599,20 +599,20 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - do { - Transcript.showCR(n); - break; - } while (true); - return n; - }' - for:nil - arguments:#(5) - expect:1 + self + execute:'test(arg) { + var n; + + n = 1; + do { + Transcript.showCR(n); + break; + } while (true); + return n; + }' + for:nil + arguments:#(5) + expect:1 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '1' )) @@ -626,20 +626,20 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - do { - break; - Transcript.showCR(n); - } while (true); - return n; - }' - for:nil - arguments:#(5) - expect:1 + self + execute:'test(arg) { + var n; + + n = 1; + do { + break; + Transcript.showCR(n); + } while (true); + return n; + }' + for:nil + arguments:#(5) + expect:1 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( )) @@ -653,20 +653,20 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - do { - if (++n == 3) continue; - Transcript.showCR(n); - } while (n <= 4); - return n; - }' - for:nil - arguments:#(5) - expect:5 + self + execute:'test(arg) { + var n; + + n = 1; + do { + if (++n == 3) continue; + Transcript.showCR(n); + } while (n <= 4); + return n; + }' + for:nil + arguments:#(5) + expect:5 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '2' '4' '5' )) @@ -680,20 +680,20 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - do { - if (++n == 3) break; - Transcript.showCR(n); - } while (n <= 4); - return n; - }' - for:nil - arguments:#(5) - expect:3 + self + execute:'test(arg) { + var n; + + n = 1; + do { + if (++n == 3) break; + Transcript.showCR(n); + } while (n <= 4); + return n; + }' + for:nil + arguments:#(5) + expect:3 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '2' )) @@ -704,19 +704,19 @@ ! testDoWhile06 - self - execute:'test(arg) { - var n; - - n = 1; - do - n += 1; - while (n < 4); - return n; - }' - for:nil - arguments:#(5) - expect:4 + self + execute:'test(arg) { + var n; + + n = 1; + do + n += 1; + while (n < 4); + return n; + }' + for:nil + arguments:#(5) + expect:4 " self run:#testDoWhile06 @@ -725,41 +725,41 @@ ! testException01 - self - execute:'test() { - try { - return 10; - } catch(Error); - return nil; - }' - for:nil - arguments:#( ) - expect:10 + self + execute:'test() { + try { + return 10; + } catch(Error); + return nil; + }' + for:nil + arguments:#( ) + expect:10 " self run:#testException01 - self new testException01 + self new testException01 " "Modified: / 21-02-2007 / 10:28:50 / cg" ! testException02 - self - execute:'test() { - try { - Error.raise(); - return 10; - } catch(Error); - return nil; - }' - for:nil - arguments:#( ) - expect:nil + self + execute:'test() { + try { + Error.raise(); + return 10; + } catch(Error); + return nil; + }' + for:nil + arguments:#( ) + expect:nil " self run:#testException02 - self new testException02 + self new testException02 " ! @@ -767,34 +767,34 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - for (n = 0; n < 10; n++) { - Transcript.show("hello "); - Transcript.showCR(n); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + for (n = 0; n < 10; n++) { + Transcript.show("hello "); + Transcript.showCR(n); + } + }' + for:nil + arguments:#(5) + expect:nil ]. - self assert:(output asCollectionOfLinesWithReturn asArray = #( - 'hello 0' - 'hello 1' - 'hello 2' - 'hello 3' - 'hello 4' - 'hello 5' - 'hello 6' - 'hello 7' - 'hello 8' - 'hello 9' )) + self assert:(output asCollectionOfLinesWithReturn asArray = #( + 'hello 0' + 'hello 1' + 'hello 2' + 'hello 3' + 'hello 4' + 'hello 5' + 'hello 6' + 'hello 7' + 'hello 8' + 'hello 9' )) " self run:#testFor01 - self new testFor01 + self new testFor01 " ! @@ -803,18 +803,18 @@ outStream := '' writeStream. - self - execute:'test(arg, out) { - var n; - - for (n = 0; n < arg; n++) { - out.show("hello "); - out.showCR(n); - } - }' - for:nil - arguments:(Array with:4 with:outStream) - expect:nil. + self + execute:'test(arg, out) { + var n; + + for (n = 0; n < arg; n++) { + out.show("hello "); + out.showCR(n); + } + }' + for:nil + arguments:(Array with:4 with:outStream) + expect:nil. output := outStream contents. self assert:(output = 'hello 0 @@ -825,28 +825,28 @@ " self run:#testFor01b - self new testFor01b + self new testFor01b " ! testFor01c - self - execute:'test(arg) { - var n, m; - - for (n = 0, m = 10; n < 10; n++, m--) { - Transcript.show(n); - Transcript.show(" -> "); - Transcript.showCR(m); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n, m; + + for (n = 0, m = 10; n < 10; n++, m--) { + Transcript.show(n); + Transcript.show(" -> "); + Transcript.showCR(m); + } + }' + for:nil + arguments:#(5) + expect:nil " self run:#testFor01c - self new testFor01c + self new testFor01c " ! @@ -855,18 +855,18 @@ outStream := '' writeStream. - self - execute:'test(arg, out) { - var n; - - for (n = 0; n < arg; n++) { - out.show("hello "); - out.showCR(n); - } - }' - for:nil - arguments:(Array with:4 with:outStream) - expect:nil. + self + execute:'test(arg, out) { + var n; + + for (n = 0; n < arg; n++) { + out.show("hello "); + out.showCR(n); + } + }' + for:nil + arguments:(Array with:4 with:outStream) + expect:nil. output := outStream contents. self assert:(output = 'hello 0 @@ -877,7 +877,7 @@ " self run:#testFor02 - self new testFor02 + self new testFor02 " ! @@ -886,18 +886,18 @@ outStream := '' writeStream. - self - execute:'test(arg, out) { - var n; - - for (n = 0; n < arg; ) { - out.show("hello "); - out.showCR(n++); - } - }' - for:nil - arguments:(Array with:4 with:outStream) - expect:nil. + self + execute:'test(arg, out) { + var n; + + for (n = 0; n < arg; ) { + out.show("hello "); + out.showCR(n++); + } + }' + for:nil + arguments:(Array with:4 with:outStream) + expect:nil. output := outStream contents. self assert:(output = 'hello 0 @@ -908,7 +908,7 @@ " self run:#testFor02b - self new testFor02b + self new testFor02b " ! @@ -917,18 +917,18 @@ outStream := '' writeStream. - self - execute:'test(arg, out) { - var n = 0; - - for (; n < arg; ) { - out.show("hello "); - out.showCR(n++); - } - }' - for:nil - arguments:(Array with:4 with:outStream) - expect:nil. + self + execute:'test(arg, out) { + var n = 0; + + for (; n < arg; ) { + out.show("hello "); + out.showCR(n++); + } + }' + for:nil + arguments:(Array with:4 with:outStream) + expect:nil. output := outStream contents. self assert:(output = 'hello 0 @@ -939,7 +939,7 @@ " self run:#testFor03b - self new testFor03b + self new testFor03b " ! @@ -948,19 +948,19 @@ outStream := '' writeStream. - self - execute:'test(arg, out) { - var n = 0; - - for (; ; ) { - if (n >= arg) return; - out.show("hello "); - out.showCR(n++); - } - }' - for:nil - arguments:(Array with:4 with:outStream) - expect:nil. + self + execute:'test(arg, out) { + var n = 0; + + for (; ; ) { + if (n >= arg) return; + out.show("hello "); + out.showCR(n++); + } + }' + for:nil + arguments:(Array with:4 with:outStream) + expect:nil. output := outStream contents. self assert:(output = 'hello 0 @@ -971,16 +971,16 @@ " self run:#testFor04b - self new testFor04b + self new testFor04b " ! testFor05 |savedTranscript collector expected| - savedTranscript := Smalltalk at:#Transcript. + savedTranscript := Smalltalk at:#Transcript. [ - Smalltalk at:#Transcript put:(collector := '' writeStream). + Smalltalk at:#Transcript put:(collector := '' writeStream). self execute:'test(arg) { for (var n = 0; n < arg; n++) { @@ -991,7 +991,7 @@ arguments:#(5) expect:nil ] ensure:[ - Smalltalk at:#Transcript put:savedTranscript + Smalltalk at:#Transcript put:savedTranscript ]. expected := String streamContents:[:s | 0 to:4 do:[:n | s showCR:n]]. @@ -999,7 +999,7 @@ " self run:#testFor05 - self new testFor05 + self new testFor05 " ! @@ -1008,19 +1008,19 @@ outStream := '' writeStream. - self - execute:'test(arg, out) { - var n = 0; - - for (; ; ) { - if (n >= arg) break; - out.show("hello "); - out.showCR(n++); - } - }' - for:nil - arguments:(Array with:4 with:outStream) - expect:nil. + self + execute:'test(arg, out) { + var n = 0; + + for (; ; ) { + if (n >= arg) break; + out.show("hello "); + out.showCR(n++); + } + }' + for:nil + arguments:(Array with:4 with:outStream) + expect:nil. output := outStream contents. self assert:(output = 'hello 0 @@ -1031,7 +1031,7 @@ " self run:#testFor05b - self new testFor05b + self new testFor05b " ! @@ -1039,29 +1039,29 @@ |output| output := '' writeStream. - self - execute:'test(arg, out) { - var n = 0; - - for (; ; ) { - if (n >= arg) break; - out.show("hello "); - out.showCR(n++); - } - }' - for:nil - arguments:(Array with:4 with:output) - expect:nil. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - 'hello 0' - 'hello 1' - 'hello 2' - 'hello 3')) + self + execute:'test(arg, out) { + var n = 0; + + for (; ; ) { + if (n >= arg) break; + out.show("hello "); + out.showCR(n++); + } + }' + for:nil + arguments:(Array with:4 with:output) + expect:nil. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + 'hello 0' + 'hello 1' + 'hello 2' + 'hello 3')) " self run:#testFor05c - self new testFor05c + self new testFor05c " ! @@ -1069,30 +1069,30 @@ |output| output := '' writeStream. - self - execute:'test(arg, out) { - var n = 0; - - for (; ; ) { - n++; - if (n >= arg) break; - if (n == 2) continue; - out.show("hello "); - out.showCR(n); - } - }' - for:nil - arguments:(Array with:5 with:output) - expect:nil. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - 'hello 1' - 'hello 3' - 'hello 4' )) + self + execute:'test(arg, out) { + var n = 0; + + for (; ; ) { + n++; + if (n >= arg) break; + if (n == 2) continue; + out.show("hello "); + out.showCR(n); + } + }' + for:nil + arguments:(Array with:5 with:output) + expect:nil. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + 'hello 1' + 'hello 3' + 'hello 4' )) " self run:#testFor05d - self new testFor05d + self new testFor05d " ! @@ -1100,34 +1100,34 @@ |output| output := '' writeStream. - self - execute:'test(arg, out) { - for (var n = 0, var m = 10; n < 10; n++, m--) { - out.show(n); - out.show(" -> "); - out.showCR(m); - } - }' - for:nil - arguments:(Array with:5 with:output) - expect:nil. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - '0 -> 10' - '1 -> 9' - '2 -> 8' - '3 -> 7' - '4 -> 6' - '5 -> 5' - '6 -> 4' - '7 -> 3' - '8 -> 2' - '9 -> 1' + self + execute:'test(arg, out) { + for (var n = 0, var m = 10; n < 10; n++, m--) { + out.show(n); + out.show(" -> "); + out.showCR(m); + } + }' + for:nil + arguments:(Array with:5 with:output) + expect:nil. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + '0 -> 10' + '1 -> 9' + '2 -> 8' + '3 -> 7' + '4 -> 6' + '5 -> 5' + '6 -> 4' + '7 -> 3' + '8 -> 2' + '9 -> 1' )) " self run:#testFor06 - self new testFor06 + self new testFor06 " ! @@ -1135,30 +1135,30 @@ |output| output := '' writeStream. - self - execute:'test(arg, out) { - for (var n = 0, var m = 10; n < 10; n++, m--) { - if ((n >= 3) && (n <= 6)) { - out.show(n); - out.show(" -> "); - out.showCR(m); - } - } - }' - for:nil - arguments:(Array with:5 with:output) - expect:nil. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - '3 -> 7' - '4 -> 6' - '5 -> 5' - '6 -> 4' + self + execute:'test(arg, out) { + for (var n = 0, var m = 10; n < 10; n++, m--) { + if ((n >= 3) && (n <= 6)) { + out.show(n); + out.show(" -> "); + out.showCR(m); + } + } + }' + for:nil + arguments:(Array with:5 with:output) + expect:nil. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + '3 -> 7' + '4 -> 6' + '5 -> 5' + '6 -> 4' )) " self run:#testFor06 - self new testFor06 + self new testFor06 " ! @@ -1166,32 +1166,32 @@ |output| output := '' writeStream. - self - execute:'test(arg, out) { - var x = 10; - - for (var n = 0, var m = 10; n < 10; n++, m--) { - if ((n >= 3) && (n <= 6)) { - if ((n >= 4) && (n <= 5)) { - out.show(n); - out.show(" -> "); - out.showCR(m); - } - } - } - }' - for:nil - arguments:(Array with:5 with:output) - expect:nil. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - '4 -> 6' - '5 -> 5' + self + execute:'test(arg, out) { + var x = 10; + + for (var n = 0, var m = 10; n < 10; n++, m--) { + if ((n >= 3) && (n <= 6)) { + if ((n >= 4) && (n <= 5)) { + out.show(n); + out.show(" -> "); + out.showCR(m); + } + } + } + }' + for:nil + arguments:(Array with:5 with:output) + expect:nil. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + '4 -> 6' + '5 -> 5' )) " self run:#testFor06 - self new testFor06 + self new testFor06 " ! @@ -1201,24 +1201,24 @@ JavaScriptParser forInAllowed ifFalse:[^ self]. output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var arr = [ "one", "two", "three" ]; - - for (var el in arr) { - Transcript.showCR(el); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var arr = [ "one", "two", "three" ]; + + for (var el in arr) { + Transcript.showCR(el); + } + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( 'one' 'two' 'three' )) " self run:#testForIn01 - self new testForIn01 + self new testForIn01 " ! @@ -1228,31 +1228,31 @@ JavaScriptParser forInAllowed ifFalse:[^ self]. output := '' writeStream. - self - execute:'test(arg, output) { - var sum = 0; - - for (var el in arg) { - var last = el; - output.showCR(el*el); - sum += el; - last = sum; - } - return last; - }' - for:nil - arguments:( Array with:#(1 2 3) with:output) - expect:6. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - '1' - '4' - '9' + self + execute:'test(arg, output) { + var sum = 0; + + for (var el in arg) { + var last = el; + output.showCR(el*el); + sum += el; + last = sum; + } + return last; + }' + for:nil + arguments:( Array with:#(1 2 3) with:output) + expect:6. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + '1' + '4' + '9' )) " self run:#testForIn01 - self new testForIn01 + self new testForIn01 " ! @@ -1262,30 +1262,30 @@ JavaScriptParser forInAllowed ifFalse:[^ self]. output := '' writeStream. - self - execute:'test(arg, output) { - var sum = 0; - - for (var el in arg) { - output.showCR(el*el); - if (el == 1) continue; - sum += el; - if (el == 2) break; - } - return sum; - }' - for:nil - arguments:( Array with:#(1 2 3) with:output) - expect:2. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - '1' - '4' + self + execute:'test(arg, output) { + var sum = 0; + + for (var el in arg) { + output.showCR(el*el); + if (el == 1) continue; + sum += el; + if (el == 2) break; + } + return sum; + }' + for:nil + arguments:( Array with:#(1 2 3) with:output) + expect:2. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + '1' + '4' )) " self run:#testForIn01 - self new testForIn01 + self new testForIn01 " ! @@ -1295,50 +1295,50 @@ JavaScriptParser forInAllowed ifFalse:[^ self]. output := '' writeStream. - self - execute:'test(arg, output) { - var sum = 0; - - for (var el in arg) { - output.showCR(el*el); - for (var i in ["a", "b", "c"]) { - output.showCR(i); - if (i == "b") break; - } - if (el == 1) continue; - sum += el; - if (el == 2) break; - } - return sum; - }' - for:nil - arguments:( Array with:#(1 2 3) with:output) - expect:2. - - self assert:(output contents asCollectionOfLinesWithReturn asArray = #( - '1' - 'a' - 'b' - '4' - 'a' - 'b' + self + execute:'test(arg, output) { + var sum = 0; + + for (var el in arg) { + output.showCR(el*el); + for (var i in ["a", "b", "c"]) { + output.showCR(i); + if (i == "b") break; + } + if (el == 1) continue; + sum += el; + if (el == 2) break; + } + return sum; + }' + for:nil + arguments:( Array with:#(1 2 3) with:output) + expect:2. + + self assert:(output contents asCollectionOfLinesWithReturn asArray = #( + '1' + 'a' + 'b' + '4' + 'a' + 'b' )) " self run:#testForIn01 - self new testForIn01 + self new testForIn01 " ! testIf01 - self - execute:'max(a, b) { - if (a > b) return a; - return b; - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'max(a, b) { + if (a > b) return a; + return b; + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testIf01 @@ -1347,15 +1347,15 @@ ! testIf02 - self - execute:'max(a, b) { - if (a > b) ; - else return b; - return a; - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'max(a, b) { + if (a > b) ; + else return b; + return a; + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testIf02 @@ -1364,14 +1364,14 @@ ! testIf03 - self - execute:'max(a, b) { - if (a > b) return a; - else return b; - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'max(a, b) { + if (a > b) return a; + else return b; + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testIf03 @@ -1383,65 +1383,65 @@ |savedTranscript collector expected| - savedTranscript := Smalltalk at:#Transcript. + savedTranscript := Smalltalk at:#Transcript. [ - Smalltalk at:#Transcript put:(collector := '' writeStream). + Smalltalk at:#Transcript put:(collector := '' writeStream). self execute:' execute() { function foo() { - Transcript.show("foo called\n"); + Transcript.show("foo called\n"); } function bar() { - Transcript.show("bar called\n"); + Transcript.show("bar called\n"); } function bla(n) { - Transcript.show("bla called\n"); + Transcript.show("bla called\n"); } function test() { - foo(); - bar(); - var _fecUs; - var _fecDs; - var _cvUs = Array.new(15); - var _cvDs = Array.new(15); - var _headerLength = 10; - var _headerLength2 = 10; - var _raw = Array.new(20); - - for(var l=_headerLength+2;l<=_raw.size;l++) - { - var x = _raw[l]; - if(l!!=_raw.size) - { var y = _raw[l+1]; } - - if(_cvUs.size >10 && _cvDs.size>10) - { - _fecUs = 15.asInteger - 12.asInteger; - _fecDs = 20.asInteger - 13.asInteger; - bla(_fecUs); - bla(_fecDs); - bla(_cvUs); - bla(_cvDs); - if(_fecUs >=0 && _fecUs >=0) - { - Transcript.show("hello\n"); - } - - } - if(_cvUs.size == 5) - { Transcript.show("end\n"); } - } - Transcript.show("bbb\n"); + foo(); + bar(); + var _fecUs; + var _fecDs; + var _cvUs = Array.new(15); + var _cvDs = Array.new(15); + var _headerLength = 10; + var _headerLength2 = 10; + var _raw = Array.new(20); + + for(var l=_headerLength+2;l<=_raw.size;l++) + { + var x = _raw[l]; + if(l!!=_raw.size) + { var y = _raw[l+1]; } + + if(_cvUs.size >10 && _cvDs.size>10) + { + _fecUs = 15.asInteger - 12.asInteger; + _fecDs = 20.asInteger - 13.asInteger; + bla(_fecUs); + bla(_fecDs); + bla(_cvUs); + bla(_cvDs); + if(_fecUs >=0 && _fecUs >=0) + { + Transcript.show("hello\n"); + } + + } + if(_cvUs.size == 5) + { Transcript.show("end\n"); } + } + Transcript.show("bbb\n"); } test(); @@ -1451,21 +1451,21 @@ arguments:#() expect:nil ] ensure:[ - Smalltalk at:#Transcript put:savedTranscript + Smalltalk at:#Transcript put:savedTranscript ]. - expected := String streamContents:[:s | - s showCR:'foo called'. - s showCR:'bar called'. - 9 timesRepeat:[ - s showCR:'bla called'. - s showCR:'bla called'. - s showCR:'bla called'. - s showCR:'bla called'. - s showCR:'hello'. - ]. - s showCR:'bbb'. - ]. + expected := String streamContents:[:s | + s showCR:'foo called'. + s showCR:'bar called'. + 9 timesRepeat:[ + s showCR:'bla called'. + s showCR:'bla called'. + s showCR:'bla called'. + s showCR:'bla called'. + s showCR:'hello'. + ]. + s showCR:'bbb'. + ]. self assert:(collector contents = expected). " @@ -1475,11 +1475,11 @@ ! testLiteralReturn01 - self - execute:'function f() { return (0); }' - for:nil - arguments:#() - expect:0 + self + execute:'function f() { return (0); }' + for:nil + arguments:#() + expect:0 " self run:#testLiteralReturn01 @@ -1488,11 +1488,11 @@ ! testLiteralReturn02 - self - execute:'function f() { return (0.0); }' - for:nil - arguments:#() - expect:0.0 + self + execute:'function f() { return (0.0); }' + for:nil + arguments:#() + expect:0.0 " self run:#testLiteralReturn02 @@ -1501,11 +1501,11 @@ ! testLiteralReturn03 - self - execute:'function f() { return ("foo"); }' - for:nil - arguments:#() - expect:'foo' + self + execute:'function f() { return ("foo"); }' + for:nil + arguments:#() + expect:'foo' " self run:#testLiteralReturn03 @@ -1514,11 +1514,11 @@ ! testLiteralReturn04 - self - execute:'function f() { return (true); }' - for:nil - arguments:#() - expect:true + self + execute:'function f() { return (true); }' + for:nil + arguments:#() + expect:true " self run:#testLiteralReturn04 @@ -1527,11 +1527,11 @@ ! testLiteralReturn05 - self - execute:'function f() { return (false); }' - for:nil - arguments:#() - expect:false + self + execute:'function f() { return (false); }' + for:nil + arguments:#() + expect:false " self run:#testLiteralReturn05 @@ -1540,11 +1540,11 @@ ! testLiteralReturn06 - self - execute:'function f() { return (null); }' - for:nil - arguments:#() - expect:nil + self + execute:'function f() { return (null); }' + for:nil + arguments:#() + expect:nil " self run:#testLiteralReturn06 @@ -1553,11 +1553,11 @@ ! testLiteralReturn07 - self - execute:'function f() { return (nil); }' - for:nil - arguments:#() - expect:nil + self + execute:'function f() { return (nil); }' + for:nil + arguments:#() + expect:nil " self run:#testLiteralReturn07 @@ -1566,11 +1566,11 @@ ! testLiteralReturn08 - self - execute:'function f() { return ("hello"); }' - for:nil - arguments:#() - expect:'hello' + self + execute:'function f() { return ("hello"); }' + for:nil + arguments:#() + expect:'hello' " self run:#testLiteralReturn08 @@ -1581,8 +1581,8 @@ testLiterals01 |t| - t := JavaScriptParser - evaluate:' + t := JavaScriptParser + evaluate:' [ {"params": {"name": "q"}, "method": "click"}, {"params": {"text": "hello world", "name": "q"}, "method": "type"}, @@ -1609,10 +1609,10 @@ testLiterals02 |t| - t := JavaScriptParser - evaluate:' - [ 1, 2, 3, 4, 5, 6, 7, 8 ]; - '. + t := JavaScriptParser + evaluate:' + [ 1, 2, 3, 4, 5, 6, 7, 8 ]; + '. self assert:(t isArray). self assert:(t size == 8). self assert:(t = #(1 2 3 4 5 6 7 8)). @@ -1624,18 +1624,18 @@ ! testLocalFunction01 - self - execute:'test(arg) { - var x ; - - function localFunction() { return 10 / arg; }; - - x = localFunction() + 1; - return x; - }' - for:nil - arguments:#(5) - expect:3 + self + execute:'test(arg) { + var x ; + + function localFunction() { return 10 / arg; }; + + x = localFunction() + 1; + return x; + }' + for:nil + arguments:#(5) + expect:3 " self run:#testLocalFunction01 @@ -1647,18 +1647,18 @@ ! testLocalFunction02 - self - execute:'test(arg) { - var x ; - - function localFunction() { return (10 / arg) from test; }; - - x = localFunction() + 1; - return x; - }' - for:nil - arguments:#(5) - expect:2 + self + execute:'test(arg) { + var x ; + + function localFunction() { return (10 / arg) from test; }; + + x = localFunction() + 1; + return x; + }' + for:nil + arguments:#(5) + expect:2 " self run:#testLocalFunction02 @@ -1669,75 +1669,75 @@ ! testNew01 - self - execute:'test() { - var a; - - a = Array.new(5); - return a; - }' - for:nil - arguments:#() - expect:#(nil nil nil nil nil). + self + execute:'test() { + var a; + + a = Array.new(5); + return a; + }' + for:nil + arguments:#() + expect:#(nil nil nil nil nil). " self run:#testNew01 - self new testNew01 + self new testNew01 " ! testNew02 - self - execute:'test() { - var a; - - a = new Array(5); - return a; - }' - for:nil - arguments:#() - expect:#(nil nil nil nil nil). + self + execute:'test() { + var a; + + a = new Array(5); + return a; + }' + for:nil + arguments:#() + expect:#(nil nil nil nil nil). " self run:#testNew02 - self new testNew02 + self new testNew02 " ! testNew03 - self - execute:'test() { - var days; - - days = new Array(7); - days[1] = "Monday"; - days[2] = "Tuesday"; - days[3] = "Wednesday"; - days[4] = "Thursday"; - days[5] = "Friday"; - days[6] = "Saturday"; - days[7] = "Sunday"; - - return days; - }' - for:nil - arguments:#() - expect:#('Monday' 'Tuesday' 'Wednesday' 'Thursday' 'Friday' 'Saturday' 'Sunday') + self + execute:'test() { + var days; + + days = new Array(7); + days[1] = "Monday"; + days[2] = "Tuesday"; + days[3] = "Wednesday"; + days[4] = "Thursday"; + days[5] = "Friday"; + days[6] = "Saturday"; + days[7] = "Sunday"; + + return days; + }' + for:nil + arguments:#() + expect:#('Monday' 'Tuesday' 'Wednesday' 'Thursday' 'Friday' 'Saturday' 'Sunday') " self run:#testNew03 - self new testNew03 + self new testNew03 " ! testOperators01_plus - self - execute:'expr(a, b) { - return (a + 0); - }' - for:nil - arguments:#(10 20) - expect:10 + self + execute:'expr(a, b) { + return (a + 0); + }' + for:nil + arguments:#(10 20) + expect:10 " self run:#testOperators01_plus @@ -1746,13 +1746,13 @@ ! testOperators02_plus - self - execute:'expr(a, b) { - return (a + 1); - }' - for:nil - arguments:#(10 20) - expect:11 + self + execute:'expr(a, b) { + return (a + 1); + }' + for:nil + arguments:#(10 20) + expect:11 " self run:#testOperators02_plus @@ -1761,13 +1761,13 @@ ! testOperators03_minus - self - execute:'expr(a, b) { - return (a - 1); - }' - for:nil - arguments:#(10 20) - expect:9 + self + execute:'expr(a, b) { + return (a - 1); + }' + for:nil + arguments:#(10 20) + expect:9 " self run:#testOperators03_minus @@ -1776,13 +1776,13 @@ ! testOperators04_plus - self - execute:'expr(a, b) { - return (a + a); - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'expr(a, b) { + return (a + a); + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testOperators04_plus @@ -1791,13 +1791,13 @@ ! testOperators05_mul - self - execute:'expr(a, b) { - return (a * 0); - }' - for:nil - arguments:#(10 20) - expect:0 + self + execute:'expr(a, b) { + return (a * 0); + }' + for:nil + arguments:#(10 20) + expect:0 " self run:#testOperators05_mul @@ -1806,13 +1806,13 @@ ! testOperators06_mul - self - execute:'expr(a, b) { - return (a * 1); - }' - for:nil - arguments:#(10 20) - expect:10 + self + execute:'expr(a, b) { + return (a * 1); + }' + for:nil + arguments:#(10 20) + expect:10 " self run:#testOperators06_mul @@ -1821,13 +1821,13 @@ ! testOperators07_mul - self - execute:'expr(a, b) { - return (a * -1); - }' - for:nil - arguments:#(10 20) - expect:-10 + self + execute:'expr(a, b) { + return (a * -1); + }' + for:nil + arguments:#(10 20) + expect:-10 " self run:#testOperators07_mul @@ -1836,13 +1836,13 @@ ! testOperators08_mul - self - execute:'expr(a, b) { - return (a * 10); - }' - for:nil - arguments:#(10 20) - expect:100 + self + execute:'expr(a, b) { + return (a * 10); + }' + for:nil + arguments:#(10 20) + expect:100 " self run:#testOperators08_mul @@ -1851,13 +1851,13 @@ ! testOperators09_mul - self - execute:'expr(a, b) { - return (a * a); - }' - for:nil - arguments:#(10 20) - expect:100 + self + execute:'expr(a, b) { + return (a * a); + }' + for:nil + arguments:#(10 20) + expect:100 " self run:#testOperators09_mul @@ -1866,13 +1866,13 @@ ! testOperators10_mul - self - execute:'expr(a, b) { - return (a * b); - }' - for:nil - arguments:#(10 20) - expect:200 + self + execute:'expr(a, b) { + return (a * b); + }' + for:nil + arguments:#(10 20) + expect:200 " self run:#testOperators10_mul @@ -1881,13 +1881,13 @@ ! testOperators11_minus - self - execute:'expr(a, b) { - return (a - b); - }' - for:nil - arguments:#(10 20) - expect:-10 + self + execute:'expr(a, b) { + return (a - b); + }' + for:nil + arguments:#(10 20) + expect:-10 " self run:#testOperators11_minus @@ -1896,13 +1896,13 @@ ! testOperators12_unaryMinus - self - execute:'expr(a) { - return (-a); - }' - for:nil - arguments:#(10) - expect:-10 + self + execute:'expr(a) { + return (-a); + }' + for:nil + arguments:#(10) + expect:-10 " self run:#testOperators12_unaryMinus @@ -1911,13 +1911,13 @@ ! testOperators13_minus - self - execute:'expr(a, b) { - return (a - -b); - }' - for:nil - arguments:#(10 20) - expect:30 + self + execute:'expr(a, b) { + return (a - -b); + }' + for:nil + arguments:#(10 20) + expect:30 " self run:#testOperators13_minus @@ -1926,13 +1926,13 @@ ! testOperators14_unaryMinus - self - execute:'expr(a, b) { - return (a * -b); - }' - for:nil - arguments:#(10 1) - expect:-10 + self + execute:'expr(a, b) { + return (a * -b); + }' + for:nil + arguments:#(10 1) + expect:-10 " self run:#testOperators14_unaryMinus @@ -1941,13 +1941,13 @@ ! testOperators15_div - self - execute:'expr(a, b) { - return (a / 1.0); - }' - for:nil - arguments:#(10 1) - expect:10.0 + self + execute:'expr(a, b) { + return (a / 1.0); + }' + for:nil + arguments:#(10 1) + expect:10.0 " self run:#testOperators15_div @@ -1956,13 +1956,13 @@ ! testOperators16a_postInc - self - execute:'expr(a, b) { - return (a++); - }' - for:nil - arguments:#(10 1) - expect:10 + self + execute:'expr(a, b) { + return (a++); + }' + for:nil + arguments:#(10 1) + expect:10 " self run:#testOperators16a_postInc @@ -1973,15 +1973,15 @@ ! testOperators16b_postInc - self - execute:'expr(a, b) { - var aa = a; - - return (aa++); - }' - for:nil - arguments:#(10 1) - expect:10 + self + execute:'expr(a, b) { + var aa = a; + + return (aa++); + }' + for:nil + arguments:#(10 1) + expect:10 " self run:#testOperators16b_postInc @@ -1990,14 +1990,14 @@ ! testOperators16c_postInc - self - execute:'expr(a, b) { - var t = a++; - return (t); - }' - for:nil - arguments:#(10 1) - expect:10 + self + execute:'expr(a, b) { + var t = a++; + return (t); + }' + for:nil + arguments:#(10 1) + expect:10 " self run:#testOperators16c_postInc @@ -2008,14 +2008,14 @@ ! testOperators16d_postInc - self - execute:'expr(a, b) { - var t = a++; - return (a); - }' - for:nil - arguments:#(10 1) - expect:11 + self + execute:'expr(a, b) { + var t = a++; + return (a); + }' + for:nil + arguments:#(10 1) + expect:11 " self run:#testOperators16d_postInc @@ -2026,14 +2026,14 @@ ! testOperators16e_postInc - self - execute:'expr(a, b) { - var t = a++; - return (b); - }' - for:nil - arguments:#(10 1) - expect:1 + self + execute:'expr(a, b) { + var t = a++; + return (b); + }' + for:nil + arguments:#(10 1) + expect:1 " self run:#testOperators16e_postInc @@ -2044,13 +2044,13 @@ ! testOperators17a_eq - self - execute:'expr(a, b) { - return (a == b); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(a, b) { + return (a == b); + }' + for:nil + arguments:#(10 10) + expect:true " self run:#testOperators17a_eq @@ -2059,13 +2059,13 @@ ! testOperators17b_eq - self - execute:'expr(a, b) { - return (a == b); - }' - for:nil - arguments:#(10 11) - expect:false + self + execute:'expr(a, b) { + return (a == b); + }' + for:nil + arguments:#(10 11) + expect:false " self run:#testOperators17b_eq @@ -2074,13 +2074,13 @@ ! testOperators17c_ne - self - execute:'expr(a, b) { - return (a !!= b); - }' - for:nil - arguments:#(10 10) - expect:false + self + execute:'expr(a, b) { + return (a !!= b); + }' + for:nil + arguments:#(10 10) + expect:false " self run:#testOperators17c_ne @@ -2089,13 +2089,13 @@ ! testOperators17d_ne - self - execute:'expr(a, b) { - return (a !!= b); - }' - for:nil - arguments:#(10 11) - expect:true + self + execute:'expr(a, b) { + return (a !!= b); + }' + for:nil + arguments:#(10 11) + expect:true " self run:#testOperators17d_ne @@ -2104,13 +2104,13 @@ ! testOperators18a_eq - self - execute:'expr(a, b) { - return (a == b); - }' - for:nil - arguments:#(10 10.0) - expect:true + self + execute:'expr(a, b) { + return (a == b); + }' + for:nil + arguments:#(10 10.0) + expect:true " self run:#testOperators18a_eq @@ -2119,13 +2119,13 @@ ! testOperators18b_ne - self - execute:'expr(a, b) { - return (a !!= b); - }' - for:nil - arguments:#(10 11.0) - expect:true + self + execute:'expr(a, b) { + return (a !!= b); + }' + for:nil + arguments:#(10 11.0) + expect:true " self run:#testOperators18b_ne @@ -2134,13 +2134,13 @@ ! testOperators19a_identical - self - execute:'expr(a, b) { - return (a === b); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(a, b) { + return (a === b); + }' + for:nil + arguments:#(10 10) + expect:true " self run:#testOperators19a_identical @@ -2149,13 +2149,13 @@ ! testOperators19b_identical - self - execute:'expr(a, b) { - return (a === b); - }' - for:nil - arguments:#( 10 10.0 ) - expect:false + self + execute:'expr(a, b) { + return (a === b); + }' + for:nil + arguments:#( 10 10.0 ) + expect:false " self run:#testOperators19b_identical @@ -2164,13 +2164,13 @@ ! testOperators19c_notIdentical - self - execute:'expr(a, b) { - return (a !!== b); - }' - for:nil - arguments:#( 10 10 ) - expect:false + self + execute:'expr(a, b) { + return (a !!== b); + }' + for:nil + arguments:#( 10 10 ) + expect:false " self run:#testOperators19c_notIdentical @@ -2179,13 +2179,13 @@ ! testOperators19d_notIdentical - self - execute:'expr(a, b) { - return (a !!== b); - }' - for:nil - arguments:#( 10 10.0 ) - expect:true + self + execute:'expr(a, b) { + return (a !!== b); + }' + for:nil + arguments:#( 10 10.0 ) + expect:true " self run:#testOperators19d_notIdentical @@ -2194,13 +2194,13 @@ ! testOperators20a_eq - self - execute:'expr(a, b) { - return (a == b); - }' - for:nil - arguments:#( 'foo' 'foo' ) - expect:true + self + execute:'expr(a, b) { + return (a == b); + }' + for:nil + arguments:#( 'foo' 'foo' ) + expect:true " self run:#testOperators20a_eq @@ -2209,13 +2209,13 @@ ! testOperators20b_eq - self - execute:'expr(a, b) { - return (a == b); - }' - for:nil - arguments:#( 'foo' 'Foo' ) - expect:false + self + execute:'expr(a, b) { + return (a == b); + }' + for:nil + arguments:#( 'foo' 'Foo' ) + expect:false " self run:#testOperators20b_eq @@ -2224,13 +2224,13 @@ ! testOperators20c_ne - self - execute:'expr(a, b) { - return (a !!= b); - }' - for:nil - arguments:#( 'foo' 'Foo' ) - expect:true + self + execute:'expr(a, b) { + return (a !!= b); + }' + for:nil + arguments:#( 'foo' 'Foo' ) + expect:true " self run:#testOperators20c_ne @@ -2239,13 +2239,13 @@ ! testOperators20d_ne - self - execute:'expr(a, b) { - return (a !!= b); - }' - for:nil - arguments:#( 'foo' 'foo' ) - expect:false + self + execute:'expr(a, b) { + return (a !!= b); + }' + for:nil + arguments:#( 'foo' 'foo' ) + expect:false " self run:#testOperators20d_ne @@ -2254,13 +2254,13 @@ ! testOperators21a_ne - self - execute:'expr(a) { - return (a !!= 0); - }' - for:nil - arguments:#('foo') - expect:true + self + execute:'expr(a) { + return (a !!= 0); + }' + for:nil + arguments:#('foo') + expect:true " self run:#testOperators21a_ne @@ -2269,13 +2269,13 @@ ! testOperators21b_ne - self - execute:'expr(a) { - return (a !!= 0); - }' - for:nil - arguments:#(0) - expect:false + self + execute:'expr(a) { + return (a !!= 0); + }' + for:nil + arguments:#(0) + expect:false " self run:#testOperators21b_ne @@ -2284,13 +2284,13 @@ ! testOperators22a_gt - self - execute:'expr(a) { - return (a > 0); - }' - for:nil - arguments:#(0) - expect:false + self + execute:'expr(a) { + return (a > 0); + }' + for:nil + arguments:#(0) + expect:false " self run:#testOperators22a_gt @@ -2299,13 +2299,13 @@ ! testOperators22b_gt - self - execute:'expr(a) { - return (a > 0); - }' - for:nil - arguments:#(1) - expect:true + self + execute:'expr(a) { + return (a > 0); + }' + for:nil + arguments:#(1) + expect:true " self run:#testOperators22b_gt @@ -2314,13 +2314,13 @@ ! testOperators23a_unaryMinus - self - execute:'expr(a) { - return (-a); - }' - for:nil - arguments:#(1) - expect:-1 + self + execute:'expr(a) { + return (-a); + }' + for:nil + arguments:#(1) + expect:-1 " self run:#testOperators23a_unaryMinus @@ -2329,13 +2329,13 @@ ! testOperators23b_unaryMinus - self - execute:'expr(a) { - return (0 - -a); - }' - for:nil - arguments:#(1) - expect:1 + self + execute:'expr(a) { + return (0 - -a); + }' + for:nil + arguments:#(1) + expect:1 " self run:#testOperators23b_unaryMinus @@ -2344,13 +2344,13 @@ ! testOperators24a_div - self - execute:'expr(a) { - return (a / 4); - }' - for:nil - arguments:#(4) - expect:1 + self + execute:'expr(a) { + return (a / 4); + }' + for:nil + arguments:#(4) + expect:1 " self run:#testOperators24a_div @@ -2359,13 +2359,13 @@ ! testOperators24b_div - self - execute:'expr(a) { - return (a / 4.0); - }' - for:nil - arguments:#(4) - expect:1.0 + self + execute:'expr(a) { + return (a / 4.0); + }' + for:nil + arguments:#(4) + expect:1.0 " self run:#testOperators24b_div @@ -2374,13 +2374,13 @@ ! testOperators24c_div - self - execute:'expr(a) { - return (a / 4); - }' - for:nil - arguments:#(4.0) - expect:1.0 + self + execute:'expr(a) { + return (a / 4); + }' + for:nil + arguments:#(4.0) + expect:1.0 " self run:#testOperators24c_div @@ -2389,13 +2389,13 @@ ! testOperators24d_div - self - execute:'expr(a) { - return (a / 4.0); - }' - for:nil - arguments:#(4.0) - expect:1.0 + self + execute:'expr(a) { + return (a / 4.0); + }' + for:nil + arguments:#(4.0) + expect:1.0 " self run:#testOperators24d_div @@ -2404,13 +2404,13 @@ ! testOperators25a_mod - self - execute:'expr(a) { - return (a % 4); - }' - for:nil - arguments:#(4) - expect:0 + self + execute:'expr(a) { + return (a % 4); + }' + for:nil + arguments:#(4) + expect:0 " self run:#testOperators25a_mod @@ -2419,13 +2419,13 @@ ! testOperators25b_mod - self - execute:'expr(a) { - return (a % 4.0); - }' - for:nil - arguments:#(4) - expect:0.0 + self + execute:'expr(a) { + return (a % 4.0); + }' + for:nil + arguments:#(4) + expect:0.0 " self run:#testOperators25b_mod @@ -2434,13 +2434,13 @@ ! testOperators25c_mod - self - execute:'expr(a) { - return (a % 4); - }' - for:nil - arguments:#(4.0) - expect:0.0 + self + execute:'expr(a) { + return (a % 4); + }' + for:nil + arguments:#(4.0) + expect:0.0 " self run:#testOperators25c_mod @@ -2449,13 +2449,13 @@ ! testOperators25d_mod - self - execute:'expr(a) { - return (a % 4.0); - }' - for:nil - arguments:#(4.0) - expect:0.0 + self + execute:'expr(a) { + return (a % 4.0); + }' + for:nil + arguments:#(4.0) + expect:0.0 " self run:#testOperators25d_mod @@ -2464,13 +2464,13 @@ ! testOperators25e_mod - self - execute:'expr(a) { - return (a % 4); - }' - for:nil - arguments:#(-4) - expect:0 + self + execute:'expr(a) { + return (a % 4); + }' + for:nil + arguments:#(-4) + expect:0 " self run:#testOperators25e_mod @@ -2479,13 +2479,13 @@ ! testOperators25f_mod - self - execute:'expr(a) { - return (a % 4.0); - }' - for:nil - arguments:#(-4) - expect:0.0 + self + execute:'expr(a) { + return (a % 4.0); + }' + for:nil + arguments:#(-4) + expect:0.0 " self run:#testOperators25f_mod @@ -2494,13 +2494,13 @@ ! testOperators25g_mod - self - execute:'expr(a) { - return (a % 4); - }' - for:nil - arguments:#(-4.0) - expect:0.0 + self + execute:'expr(a) { + return (a % 4); + }' + for:nil + arguments:#(-4.0) + expect:0.0 " self run:#testOperators25g_mod @@ -2509,13 +2509,13 @@ ! testOperators25h_mod - self - execute:'expr(a) { - return (a % 4.0); - }' - for:nil - arguments:#(-4.0) - expect:0.0 + self + execute:'expr(a) { + return (a % 4.0); + }' + for:nil + arguments:#(-4.0) + expect:0.0 " self run:#testOperators25h_mod @@ -2524,15 +2524,15 @@ ! testOperators26a_postInc - self - execute:'expr(a) { - var x = a; - - return (x++); - }' - for:nil - arguments:#(1) - expect:1 + self + execute:'expr(a) { + var x = a; + + return (x++); + }' + for:nil + arguments:#(1) + expect:1 " self run:#testOperators26a_postInc @@ -2541,15 +2541,15 @@ ! testOperators26b_postDec - self - execute:'expr(a) { - var x = a; - - return (x--); - }' - for:nil - arguments:#(1) - expect:1 + self + execute:'expr(a) { + var x = a; + + return (x--); + }' + for:nil + arguments:#(1) + expect:1 " self run:#testOperators26b_postDec @@ -2558,15 +2558,15 @@ ! testOperators26c_preInc - self - execute:'expr(a) { - var x = a; - - return (++x); - }' - for:nil - arguments:#(1) - expect:2 + self + execute:'expr(a) { + var x = a; + + return (++x); + }' + for:nil + arguments:#(1) + expect:2 " self run:#testOperators26c_preInc @@ -2575,15 +2575,15 @@ ! testOperators26d_preDec - self - execute:'expr(a) { - var x = a; - - return (--x); - }' - for:nil - arguments:#(1) - expect:0 + self + execute:'expr(a) { + var x = a; + + return (--x); + }' + for:nil + arguments:#(1) + expect:0 " self run:#testOperators26d_preDec @@ -2592,16 +2592,16 @@ ! testOperators27a_postInc - self - execute:'expr(a) { - var x = a; - - x++; - return (x); - }' - for:nil - arguments:#(1) - expect:2 + self + execute:'expr(a) { + var x = a; + + x++; + return (x); + }' + for:nil + arguments:#(1) + expect:2 " self run:#testOperators27a_postInc @@ -2610,16 +2610,16 @@ ! testOperators27b_postDec - self - execute:'expr(a) { - var x = a; - - x--; - return (x); - }' - for:nil - arguments:#(1) - expect:0 + self + execute:'expr(a) { + var x = a; + + x--; + return (x); + }' + for:nil + arguments:#(1) + expect:0 " self run:#testOperators27b_postDec @@ -2628,16 +2628,16 @@ ! testOperators27c_preInc - self - execute:'expr(a) { - var x = a; - - ++x; - return (x); - }' - for:nil - arguments:#(1) - expect:2 + self + execute:'expr(a) { + var x = a; + + ++x; + return (x); + }' + for:nil + arguments:#(1) + expect:2 " self run:#testOperators27c_preInc @@ -2646,16 +2646,16 @@ ! testOperators27d_preDec - self - execute:'expr(a) { - var x = a; - - --x; - return (x); - }' - for:nil - arguments:#(1) - expect:0 + self + execute:'expr(a) { + var x = a; + + --x; + return (x); + }' + for:nil + arguments:#(1) + expect:0 " self run:#testOperators27d_preDec @@ -2668,13 +2668,13 @@ arr := (1 to:15) asArray. - self - execute:'expr(a) { - return (a[10]++); - }' - for:nil - arguments:{ arr } - expect:10. + self + execute:'expr(a) { + return (a[10]++); + }' + for:nil + arguments:{ arr } + expect:10. self assert:(arr = #(1 2 3 4 5 6 7 8 9 11 11 12 13 14 15)) @@ -2689,13 +2689,13 @@ arr := (1 to:15) asArray. - self - execute:'expr(a) { - return (--a[10]); - }' - for:nil - arguments:{ arr } - expect:9. + self + execute:'expr(a) { + return (--a[10]); + }' + for:nil + arguments:{ arr } + expect:9. self assert:(arr = #(1 2 3 4 5 6 7 8 9 9 11 12 13 14 15)) @@ -2706,13 +2706,13 @@ ! testOperators28_not - self - execute:'expr(a) { - return (!! a); - }' - for:nil - arguments:#(true) - expect:false + self + execute:'expr(a) { + return (!! a); + }' + for:nil + arguments:#(true) + expect:false " self run:#testOperators28_not @@ -2721,19 +2721,19 @@ ! testOperators29a_plusAssign - self - execute:'expr(a, b, c, d) { - var s = 0; - s += a; - s += b; - s += c; - s += d; - s += 1; - return (s); - }' - for:nil - arguments:#( 1 2 3 4 ) - expect:11 + self + execute:'expr(a, b, c, d) { + var s = 0; + s += a; + s += b; + s += c; + s += d; + s += 1; + return (s); + }' + for:nil + arguments:#( 1 2 3 4 ) + expect:11 " self run:#testOperators29a_plusAssign @@ -2742,19 +2742,19 @@ ! testOperators29c_minusAssign - self - execute:'expr(a, b, c, d) { - var s = 0; - s -= a; - s -= b; - s -= c; - s -= d; - s -= 1; - return (s); - }' - for:nil - arguments:#( 1 2 3 4 ) - expect:-11 + self + execute:'expr(a, b, c, d) { + var s = 0; + s -= a; + s -= b; + s -= c; + s -= d; + s -= 1; + return (s); + }' + for:nil + arguments:#( 1 2 3 4 ) + expect:-11 " self run:#testOperators29c_minusAssign @@ -2763,19 +2763,19 @@ ! testOperators30_timesAssign - self - execute:'expr(a, b, c, d) { - var s = 1; - s *= a; - s *= b; - s *= c; - s *= d; - s *= 2; - return (s); - }' - for:nil - arguments:#( 1 2 3 4 ) - expect:48 + self + execute:'expr(a, b, c, d) { + var s = 1; + s *= a; + s *= b; + s *= c; + s *= d; + s *= 2; + return (s); + }' + for:nil + arguments:#( 1 2 3 4 ) + expect:48 " self run:#testOperators30_timesAssign @@ -2784,13 +2784,13 @@ ! testOperators31a_shiftLeft - self - execute:'expr(a) { - return (a << 1); - }' - for:nil - arguments:#( 1 ) - expect:2 + self + execute:'expr(a) { + return (a << 1); + }' + for:nil + arguments:#( 1 ) + expect:2 " self run:#testOperators31a_shiftLeft @@ -2799,13 +2799,13 @@ ! testOperators31b_shiftLeft - self - execute:'expr(a) { - return (a << 32); - }' - for:nil - arguments:#( 1 ) - expect:16r100000000 + self + execute:'expr(a) { + return (a << 32); + }' + for:nil + arguments:#( 1 ) + expect:16r100000000 " self run:#testOperators31b_shiftLeft @@ -2814,16 +2814,16 @@ ! testOperators31c_shiftLeftAssign - self - execute:'expr(a) { - var b = a; - - b <<= 1; - return b; - }' - for:nil - arguments:#( 1 ) - expect:2 + self + execute:'expr(a) { + var b = a; + + b <<= 1; + return b; + }' + for:nil + arguments:#( 1 ) + expect:2 " self run:#testOperators31c_shiftLeftAssign @@ -2832,13 +2832,13 @@ ! testOperators32a_shiftRight - self - execute:'expr(a) { - return (a >> 1); - }' - for:nil - arguments:#( 2 ) - expect:1 + self + execute:'expr(a) { + return (a >> 1); + }' + for:nil + arguments:#( 2 ) + expect:1 " self run:#testOperators32a_shiftRight @@ -2847,16 +2847,16 @@ ! testOperators32b_shiftRightAssign - self - execute:'expr(a) { - var b = a; - - b >>= 1; - return b; - }' - for:nil - arguments:#( 5 ) - expect:2 + self + execute:'expr(a) { + var b = a; + + b >>= 1; + return b; + }' + for:nil + arguments:#( 5 ) + expect:2 " self run:#testOperators32b_shiftRightAssign @@ -2865,16 +2865,16 @@ ! testOperators33_bitOrAssign - self - execute:'expr(a, b) { - var s = 0; - s |= a; - s |= b; - return (s); - }' - for:nil - arguments:#(1 4) - expect:5 + self + execute:'expr(a, b) { + var s = 0; + s |= a; + s |= b; + return (s); + }' + for:nil + arguments:#(1 4) + expect:5 " self run:#testOperators33_bitOrAssign @@ -2883,16 +2883,16 @@ ! testOperators34_bitAndAssign - self - execute:'expr(a, b) { - var s = 0xFFFF; - s &= a; - s &= b; - return (s); - }' - for:nil - arguments:#(3 5) - expect:1 + self + execute:'expr(a, b) { + var s = 0xFFFF; + s &= a; + s &= b; + return (s); + }' + for:nil + arguments:#(3 5) + expect:1 " self run:#testOperators34_bitAndAssign @@ -2901,15 +2901,15 @@ ! testOperators35a_bitXorAssign - self - execute:'expr(a) { - var s = 0xFFFF; - s ^= a; - return (s); - }' - for:nil - arguments:#( 1 ) - expect:16rFFFE + self + execute:'expr(a) { + var s = 0xFFFF; + s ^= a; + return (s); + }' + for:nil + arguments:#( 1 ) + expect:16rFFFE " self run:#testOperators35a_xorAssign @@ -2918,15 +2918,15 @@ ! testOperators35b_bitXor - self - execute:'expr(a) { - var s = 0xFFFF; - s = s ^ a; - return (s); - }' - for:nil - arguments:#( 1 ) - expect:16rFFFE + self + execute:'expr(a) { + var s = 0xFFFF; + s = s ^ a; + return (s); + }' + for:nil + arguments:#( 1 ) + expect:16rFFFE " self run:#testOperators35b_xor @@ -2935,13 +2935,13 @@ ! testOperators36a_mod - self - execute:'expr(a) { - return (a % 2); - }' - for:nil - arguments:#(10) - expect:0 + self + execute:'expr(a) { + return (a % 2); + }' + for:nil + arguments:#(10) + expect:0 " self run:#testOperators36a_mod @@ -2950,13 +2950,13 @@ ! testOperators36b_mod - self - execute:'expr(a) { - return (a % 2); - }' - for:nil - arguments:#(9) - expect:1 + self + execute:'expr(a) { + return (a % 2); + }' + for:nil + arguments:#(9) + expect:1 " self run:#testOperators36b_mod @@ -2965,13 +2965,13 @@ ! testOperators37a_cond - self - execute:'expr(a) { - return (a ? 1 : 0); - }' - for:nil - arguments:#(true) - expect:1 + self + execute:'expr(a) { + return (a ? 1 : 0); + }' + for:nil + arguments:#(true) + expect:1 " self run:#testOperators37a_cond @@ -2980,13 +2980,13 @@ ! testOperators37b_cond - self - execute:'expr(a) { - return (a ? 1 : 0); - }' - for:nil - arguments:#(false) - expect:0 + self + execute:'expr(a) { + return (a ? 1 : 0); + }' + for:nil + arguments:#(false) + expect:0 " self run:#testOperators37b_cond @@ -2995,13 +2995,13 @@ ! testOperators37c_cond - self - execute:'expr(a, b) { - return (a ? (b ? 0 : 1) : (b ? 2 : 3)); - }' - for:nil - arguments:#(false false) - expect:3 + self + execute:'expr(a, b) { + return (a ? (b ? 0 : 1) : (b ? 2 : 3)); + }' + for:nil + arguments:#(false false) + expect:3 " self run:#testOperators37c_cond @@ -3010,13 +3010,13 @@ ! testOperators37d_cond - self - execute:'expr(a) { - return (a == 1 ? 2 : 3); - }' - for:nil - arguments:#(1) - expect:2 + self + execute:'expr(a) { + return (a == 1 ? 2 : 3); + }' + for:nil + arguments:#(1) + expect:2 " self run:#testOperators37d_cond @@ -3025,13 +3025,13 @@ ! testOperators38a_eq - self - execute:'expr(a) { - return (a == 1); - }' - for:nil - arguments:#(1) - expect:true + self + execute:'expr(a) { + return (a == 1); + }' + for:nil + arguments:#(1) + expect:true " self run:#testOperators38a_eq @@ -3040,13 +3040,13 @@ ! testOperators38b_eq - self - execute:'expr(a) { - return (a == 1); - }' - for:nil - arguments:#(1.0) - expect:true + self + execute:'expr(a) { + return (a == 1); + }' + for:nil + arguments:#(1.0) + expect:true " self run:#testOperators38b_eq @@ -3055,13 +3055,13 @@ ! testOperators38c_eq - self - execute:'expr(a) { - return ( "hello"[1].asString == "h" ); - }' - for:nil - arguments:#(1.0) - expect:true + self + execute:'expr(a) { + return ( "hello"[1].asString == "h" ); + }' + for:nil + arguments:#(1.0) + expect:true " self run:#testOperators38c_eq @@ -3072,13 +3072,13 @@ ! testOperators38c_ne - self - execute:'expr(a) { - return (a !!= 1); - }' - for:nil - arguments:#(1.0) - expect:false + self + execute:'expr(a) { + return (a !!= 1); + }' + for:nil + arguments:#(1.0) + expect:false " self run:#testOperators38c_ne @@ -3087,13 +3087,13 @@ ! testOperators38d_eq - self - execute:'expr(a) { - return ("hello"[1] == $''h'' ); - }' - for:nil - arguments:#(1.0) - expect:true + self + execute:'expr(a) { + return ("hello"[1] == $''h'' ); + }' + for:nil + arguments:#(1.0) + expect:true " self run:#testOperators38d_eq @@ -3102,13 +3102,13 @@ ! testOperators38d_ne - self - execute:'expr(a) { - return (a !!= 1); - }' - for:nil - arguments:#(2.0) - expect:true + self + execute:'expr(a) { + return (a !!= 1); + }' + for:nil + arguments:#(2.0) + expect:true " self run:#testOperators38d_ne @@ -3117,13 +3117,13 @@ ! testOperators38e_eq - self - execute:'expr(a) { - return ( "hello"[1] == "h"[1] ); - }' - for:nil - arguments:#(1.0) - expect:true + self + execute:'expr(a) { + return ( "hello"[1] == "h"[1] ); + }' + for:nil + arguments:#(1.0) + expect:true " self run:#testOperators38e_eq @@ -3134,13 +3134,13 @@ ! testOperators38f_eq - self - execute:'expr(a) { - return ( ("hello"[1]).asString == "h" ); - }' - for:nil - arguments:#(1.0) - expect:true + self + execute:'expr(a) { + return ( ("hello"[1]).asString == "h" ); + }' + for:nil + arguments:#(1.0) + expect:true " self run:#testOperators38f_eq @@ -3151,13 +3151,13 @@ ! testOperators39a_identical - self - execute:'expr(a) { - return (a === 1); - }' - for:nil - arguments:#(1) - expect:true + self + execute:'expr(a) { + return (a === 1); + }' + for:nil + arguments:#(1) + expect:true " self run:#testOperators39a_identical @@ -3166,13 +3166,13 @@ ! testOperators39b_identical - self - execute:'expr(a) { - return (a === 1); - }' - for:nil - arguments:#(1.0) - expect:false + self + execute:'expr(a) { + return (a === 1); + }' + for:nil + arguments:#(1.0) + expect:false " self run:#testOperators39b_identical @@ -3181,13 +3181,13 @@ ! testOperators39c_notIdentical - self - execute:'expr(a) { - return (a !!== 1); - }' - for:nil - arguments:#(1.0) - expect:true + self + execute:'expr(a) { + return (a !!== 1); + }' + for:nil + arguments:#(1.0) + expect:true " self run:#testOperators39c_notIdentical @@ -3196,13 +3196,13 @@ ! testOperators39d_notIdentical - self - execute:'expr(a) { - return (a !!== 1); - }' - for:nil - arguments:#(1) - expect:false + self + execute:'expr(a) { + return (a !!== 1); + }' + for:nil + arguments:#(1) + expect:false " self run:#testOperators39d_notIdentical @@ -3211,13 +3211,13 @@ ! testOperators40a_bitAnd - self - execute:'expr(a) { - return (a & 1); - }' - for:nil - arguments:#(1) - expect:1 + self + execute:'expr(a) { + return (a & 1); + }' + for:nil + arguments:#(1) + expect:1 " self run:#testOperators40a_bitAnd @@ -3226,13 +3226,13 @@ ! testOperators40b_bitAnd - self - execute:'expr(a) { - return (a & 1); - }' - for:nil - arguments:#(7) - expect:1 + self + execute:'expr(a) { + return (a & 1); + }' + for:nil + arguments:#(7) + expect:1 " self run:#testOperators40b_bitAnd @@ -3241,13 +3241,13 @@ ! testOperators41a_bitOr - self - execute:'expr(a) { - return (a | 1); - }' - for:nil - arguments:#(6) - expect:7 + self + execute:'expr(a) { + return (a | 1); + }' + for:nil + arguments:#(6) + expect:7 " self run:#testOperators41a_bitOr @@ -3256,13 +3256,13 @@ ! testOperators42a_bitXor - self - execute:'expr(a) { - return (a ^ 1); - }' - for:nil - arguments:#(7) - expect:6 + self + execute:'expr(a) { + return (a ^ 1); + }' + for:nil + arguments:#(7) + expect:6 " self run:#testOperators42a_bitXor @@ -3271,13 +3271,13 @@ ! testOperators43a_bitNot - self - execute:'expr(a) { - return (~a); - }' - for:nil - arguments:#(1) - expect:-2 + self + execute:'expr(a) { + return (~a); + }' + for:nil + arguments:#(1) + expect:-2 " self run:#testOperators43a_bitNot @@ -3286,85 +3286,85 @@ ! testOperators44a_logAnd - self - execute:'expr(a, b) { - return (a && (b > 5)); - }' - for:nil - arguments:#(true 6) - expect:true. - - self - execute:'expr(a, b) { - return (a && (b > 5)); - }' - for:nil - arguments:#(true 5) - expect:false. - - self - execute:'expr(a, b) { - return (a > 10 && (b > 5)); - }' - for:nil - arguments:#(10 5) - expect:false. - - self - execute:'expr(a, b) { - return (a > 10 && (b > 5)); - }' - for:nil - arguments:#(11 5) - expect:false. - - self - execute:'expr(a, b) { - return (a > 10 && (b > 5)); - }' - for:nil - arguments:#(10 6) - expect:false. - - self - execute:'expr(a, b) { - return (a > 10 && (b > 5)); - }' - for:nil - arguments:#(11 15) - expect:true. - - self - execute:'expr(a, b) { - return (a.size > 10 && (b.size > 5)); - }' - for:nil - arguments:{Array new:10 . Array new:5} - expect:false. - - self - execute:'expr(a, b) { - return (a.size > 10 && (b.size > 5)); - }' - for:nil - arguments:{Array new:11 . Array new:5} - expect:false. - - self - execute:'expr(a, b) { - return (a.size > 10 && (b.size > 5)); - }' - for:nil - arguments:{Array new:10 . Array new:6} - expect:false. - - self - execute:'expr(a, b) { - return (a.size > 10 && (b.size > 5)); - }' - for:nil - arguments:{Array new:11 . Array new:15} - expect:true. + self + execute:'expr(a, b) { + return (a && (b > 5)); + }' + for:nil + arguments:#(true 6) + expect:true. + + self + execute:'expr(a, b) { + return (a && (b > 5)); + }' + for:nil + arguments:#(true 5) + expect:false. + + self + execute:'expr(a, b) { + return (a > 10 && (b > 5)); + }' + for:nil + arguments:#(10 5) + expect:false. + + self + execute:'expr(a, b) { + return (a > 10 && (b > 5)); + }' + for:nil + arguments:#(11 5) + expect:false. + + self + execute:'expr(a, b) { + return (a > 10 && (b > 5)); + }' + for:nil + arguments:#(10 6) + expect:false. + + self + execute:'expr(a, b) { + return (a > 10 && (b > 5)); + }' + for:nil + arguments:#(11 15) + expect:true. + + self + execute:'expr(a, b) { + return (a.size > 10 && (b.size > 5)); + }' + for:nil + arguments:{Array new:10 . Array new:5} + expect:false. + + self + execute:'expr(a, b) { + return (a.size > 10 && (b.size > 5)); + }' + for:nil + arguments:{Array new:11 . Array new:5} + expect:false. + + self + execute:'expr(a, b) { + return (a.size > 10 && (b.size > 5)); + }' + for:nil + arguments:{Array new:10 . Array new:6} + expect:false. + + self + execute:'expr(a, b) { + return (a.size > 10 && (b.size > 5)); + }' + for:nil + arguments:{Array new:11 . Array new:15} + expect:true. " self run:#testOperators44a_logAnd @@ -3376,29 +3376,29 @@ "the right part of a logical and should not be evaluated, if the left is already false" - self - execute:'expr(a, bIn) { - var x, b; - - b = bIn; - x = (a && (b++ > 5)); - return b; - }' - for:nil - arguments:#(true 5) - expect:6. - - self - execute:'expr(a, bIn) { - var x, b; - - b = bIn; - x = (a && (b++ > 5)); - return b; - }' - for:nil - arguments:#(false 5) - expect:5 + self + execute:'expr(a, bIn) { + var x, b; + + b = bIn; + x = (a && (b++ > 5)); + return b; + }' + for:nil + arguments:#(true 5) + expect:6. + + self + execute:'expr(a, bIn) { + var x, b; + + b = bIn; + x = (a && (b++ > 5)); + return b; + }' + for:nil + arguments:#(false 5) + expect:5 " self run:#testOperators44b_logAnd @@ -3407,29 +3407,29 @@ ! testOperators45a_logOr - self - execute:'expr(a, b) { - return (a || (b > 5)); - }' - for:nil - arguments:#(true 6) - expect:true. - - self - execute:'expr(a, b) { - return (a || (b > 5)); - }' - for:nil - arguments:#(false 6) - expect:true. - - self - execute:'expr(a, b) { - return (a || (b > 5)); - }' - for:nil - arguments:#(false 5) - expect:false + self + execute:'expr(a, b) { + return (a || (b > 5)); + }' + for:nil + arguments:#(true 6) + expect:true. + + self + execute:'expr(a, b) { + return (a || (b > 5)); + }' + for:nil + arguments:#(false 6) + expect:true. + + self + execute:'expr(a, b) { + return (a || (b > 5)); + }' + for:nil + arguments:#(false 5) + expect:false " self run:#testOperators45a_logOr @@ -3441,29 +3441,29 @@ "the right part of a logical or should not be evaluated, if the left is already true" - self - execute:'expr(a, bIn) { - var x, b; - - b = bIn; - x = (a || (b++ > 5)); - return b; - }' - for:nil - arguments:#(true 5) - expect:5. - - self - execute:'expr(a, bIn) { - var x, b; - - b = bIn; - x = (a || (b++ > 5)); - return b; - }' - for:nil - arguments:#(false 5) - expect:6 + self + execute:'expr(a, bIn) { + var x, b; + + b = bIn; + x = (a || (b++ > 5)); + return b; + }' + for:nil + arguments:#(true 5) + expect:5. + + self + execute:'expr(a, bIn) { + var x, b; + + b = bIn; + x = (a || (b++ > 5)); + return b; + }' + for:nil + arguments:#(false 5) + expect:6 " self run:#testOperators45b_logOr @@ -3472,72 +3472,72 @@ ! testOperators46_comma - self - execute:'expr(a, b, c) { - var x; - - x = a+1, b+1, c+1; - return x; - }' - for:nil - arguments:#(1 2 3) - expect:4. - - self - execute:'expr(aIn, bIn, cIn) { - var x; - var a = aIn; - var b = bIn; - var c = cIn; - - x = ++a , ++b, ++c, a+b+c; - return x; - }' - for:nil - arguments:#(1 2 3) - expect:9. - - self - execute:'expr(aIn, bIn, cIn) { - var x; - var a = aIn; - var b = bIn; - var c = cIn; - - x = a++ , b++, c++, a+b+c; - return x; - }' - for:nil - arguments:#(1 2 3) - expect:9. - - self - execute:'expr(aIn, bIn, cIn) { - var x; - var a = aIn; - var b = bIn; - var c = cIn; - - x = a++ , b++, c++, ++a + ++b + ++c; - return x; - }' - for:nil - arguments:#(1 2 3) - expect:12. - - self - execute:'expr(aIn, bIn, cIn) { - var x; - var a = aIn; - var b = bIn; - var c = cIn; - - x = a++ , b++, c++, a++ + b++ + c++; - return x; - }' - for:nil - arguments:#(1 2 3) - expect:9. + self + execute:'expr(a, b, c) { + var x; + + x = a+1, b+1, c+1; + return x; + }' + for:nil + arguments:#(1 2 3) + expect:4. + + self + execute:'expr(aIn, bIn, cIn) { + var x; + var a = aIn; + var b = bIn; + var c = cIn; + + x = ++a , ++b, ++c, a+b+c; + return x; + }' + for:nil + arguments:#(1 2 3) + expect:9. + + self + execute:'expr(aIn, bIn, cIn) { + var x; + var a = aIn; + var b = bIn; + var c = cIn; + + x = a++ , b++, c++, a+b+c; + return x; + }' + for:nil + arguments:#(1 2 3) + expect:9. + + self + execute:'expr(aIn, bIn, cIn) { + var x; + var a = aIn; + var b = bIn; + var c = cIn; + + x = a++ , b++, c++, ++a + ++b + ++c; + return x; + }' + for:nil + arguments:#(1 2 3) + expect:12. + + self + execute:'expr(aIn, bIn, cIn) { + var x; + var a = aIn; + var b = bIn; + var c = cIn; + + x = a++ , b++, c++, a++ + b++ + c++; + return x; + }' + for:nil + arguments:#(1 2 3) + expect:9. " self run:#testOperators46_comma self new testOperators46_comma @@ -3545,21 +3545,21 @@ ! testOperators47_asString - self - execute:'expr() { - return 123.asString; - }' - for:nil - arguments:#() - expect:'123'. - - self - execute:'expr() { - return 1.23.asString; - }' - for:nil - arguments:#() - expect:'1.23'. + self + execute:'expr() { + return 123.asString; + }' + for:nil + arguments:#() + expect:'123'. + + self + execute:'expr() { + return 1.23.asString; + }' + for:nil + arguments:#() + expect:'1.23'. " self run:#testOperators47_toString @@ -3568,29 +3568,29 @@ ! testOperators48_isArray - self - execute:'expr(arg) { - return arg.isArray() ; - }' - for:nil - arguments:#(123) - expect:false. - - self - execute:'expr(arg) { - return arg.isArray() ; - }' - for:nil - arguments:#('hello') - expect:false. - - self - execute:'expr(arg) { - return arg.isArray() ; - }' - for:nil - arguments:#( (1 2 3) ) - expect:true. + self + execute:'expr(arg) { + return arg.isArray() ; + }' + for:nil + arguments:#(123) + expect:false. + + self + execute:'expr(arg) { + return arg.isArray() ; + }' + for:nil + arguments:#('hello') + expect:false. + + self + execute:'expr(arg) { + return arg.isArray() ; + }' + for:nil + arguments:#( (1 2 3) ) + expect:true. " self run:#testOperators48_isArray @@ -3599,61 +3599,61 @@ ! testOperators49_concat - self - execute:'expr(arg1) { - return arg1.concat() ; - }' - for:nil - arguments:#( 'a') - expect:'a'. - - self - execute:'expr(arg1, arg2) { - return arg1.concat(arg2) ; - }' - for:nil - arguments:#( 'a' 'b') - expect:'ab'. - - self - execute:'expr(arg1, arg2, arg3) { - return arg1.concat(arg2, arg3) ; - }' - for:nil - arguments:#( 'a' 'b' 'c' ) - expect:'abc'. - - self - execute:'expr() { - return "a".concat("b", "c", "d", "e", "f") ; - }' - for:nil - arguments:nil - expect:'abcdef'. - - self - execute:'expr() { - return "a".concat("b", "c", "d", "e", "f", "g") ; - }' - for:nil - arguments:nil - expect:'abcdefg'. - - self - execute:'expr() { - return "a".concat("b", "c", "d", "e", "f", "g", "h") ; - }' - for:nil - arguments:nil - expect:'abcdefgh'. - - self - execute:'expr(arg1, arg2, arg3) { - return arg1.concat(arg2, arg3) ; - }' - for:nil - arguments:#( (1) (2) (3) ) - expect:#(1 2 3). + self + execute:'expr(arg1) { + return arg1.concat() ; + }' + for:nil + arguments:#( 'a') + expect:'a'. + + self + execute:'expr(arg1, arg2) { + return arg1.concat(arg2) ; + }' + for:nil + arguments:#( 'a' 'b') + expect:'ab'. + + self + execute:'expr(arg1, arg2, arg3) { + return arg1.concat(arg2, arg3) ; + }' + for:nil + arguments:#( 'a' 'b' 'c' ) + expect:'abc'. + + self + execute:'expr() { + return "a".concat("b", "c", "d", "e", "f") ; + }' + for:nil + arguments:nil + expect:'abcdef'. + + self + execute:'expr() { + return "a".concat("b", "c", "d", "e", "f", "g") ; + }' + for:nil + arguments:nil + expect:'abcdefg'. + + self + execute:'expr() { + return "a".concat("b", "c", "d", "e", "f", "g", "h") ; + }' + for:nil + arguments:nil + expect:'abcdefgh'. + + self + execute:'expr(arg1, arg2, arg3) { + return arg1.concat(arg2, arg3) ; + }' + for:nil + arguments:#( (1) (2) (3) ) + expect:#(1 2 3). " self run:#testOperators49_concat @@ -3663,63 +3663,63 @@ testParserErrors01 self should:[ - self - execute:'expr(a, ) { - return (a == b); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(a, ) { + return (a == b); + }' + for:nil + arguments:#(10 10) + expect:true ] raise:ParseError. self should:[ - self - execute:'expr(a b) { - return (a == b); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(a b) { + return (a == b); + }' + for:nil + arguments:#(10 10) + expect:true ] raise:ParseError. self should:[ - self - execute:'expr(x) { - return (x == 1 ?); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(x) { + return (x == 1 ?); + }' + for:nil + arguments:#(10 10) + expect:true ] raise:ParseError. self should:[ - self - execute:'expr(x) { - return (x == 1 ? 1 ); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(x) { + return (x == 1 ? 1 ); + }' + for:nil + arguments:#(10 10) + expect:true ] raise:ParseError. self should:[ - self - execute:'expr(x) { - return (x == 1 ? 1 : ); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(x) { + return (x == 1 ? 1 : ); + }' + for:nil + arguments:#(10 10) + expect:true ] raise:ParseError. self should:[ - self - execute:'expr(x) { - return (x == 1 ? 1 : +); - }' - for:nil - arguments:#(10 10) - expect:true + self + execute:'expr(x) { + return (x == 1 ? 1 : +); + }' + for:nil + arguments:#(10 10) + expect:true ] raise:ParseError. " @@ -3729,13 +3729,13 @@ ! testPrecidences01 - self - execute:'expr(a, b) { - return (a + 4 * 5 + b); - }' - for:nil - arguments:#(10 20) - expect:(10 + (4 * 5) + 20) + self + execute:'expr(a, b) { + return (a + 4 * 5 + b); + }' + for:nil + arguments:#(10 20) + expect:(10 + (4 * 5) + 20) " self run:#testPrecidences01 @@ -3744,13 +3744,13 @@ ! testPrecidences02 - self - execute:'expr(a, b) { - return (a * 4 + b * 5); - }' - for:nil - arguments:#(10 20) - expect:140 + self + execute:'expr(a, b) { + return (a * 4 + b * 5); + }' + for:nil + arguments:#(10 20) + expect:140 " self run:#testPrecidences02 @@ -3759,13 +3759,13 @@ ! testPrecidences03 - self - execute:'expr(a, b) { - return -(a + b); - }' - for:nil - arguments:#(10 20) - expect:-30 + self + execute:'expr(a, b) { + return -(a + b); + }' + for:nil + arguments:#(10 20) + expect:-30 " self run:#testPrecidences03 @@ -3774,13 +3774,13 @@ ! testPrecidences04 - self - execute:'expr(a, b) { - return -a + b; - }' - for:nil - arguments:#(10 20) - expect:10 + self + execute:'expr(a, b) { + return -a + b; + }' + for:nil + arguments:#(10 20) + expect:10 " self run:#testPrecidences04 @@ -3789,13 +3789,13 @@ ! testPrecidences05 - self - execute:'expr(a, b) { - return -a + -b; - }' - for:nil - arguments:#(10 20) - expect:-30 + self + execute:'expr(a, b) { + return -a + -b; + }' + for:nil + arguments:#(10 20) + expect:-30 " self run:#testPrecidences05 @@ -3807,44 +3807,44 @@ |output| output := self outputToTranscriptOf:[ - self - execute:' - testPrint() { - print("1 "); - print("2 "); - print("3 "); - println("4"); - return null; - } - ' - for:JavaScriptEnvironment new - arguments:#( ) - expect:nil. + self + execute:' + testPrint() { + print("1 "); + print("2 "); + print("3 "); + println("4"); + return null; + } + ' + for:JavaScriptEnvironment new + arguments:#( ) + expect:nil. ]. self assert:(output = '1 2 3 4\' withCRs). " self run:#testPrint - self new testPrint + self new testPrint " ! testRecursion01 - self - execute:'test(n) { - function factorial(n) { - if (n > 0) { - return n * factorial(n-1); - } else { - return 1; - } - }; - - return factorial(n); - }' - for:nil - arguments:#(10) - expect:(10 factorial) + self + execute:'test(n) { + function factorial(n) { + if (n > 0) { + return n * factorial(n-1); + } else { + return 1; + } + }; + + return factorial(n); + }' + for:nil + arguments:#(10) + expect:(10 factorial) " self run:#testRecursion01 @@ -3855,13 +3855,13 @@ ! testReturn01 - self - execute:'test(n) { - return 1; - }' - for:nil - arguments:#(10) - expect:1 + self + execute:'test(n) { + return 1; + }' + for:nil + arguments:#(10) + expect:1 " self run:#testReturn01 @@ -3872,16 +3872,16 @@ ! testReturn02 - self - execute:'test(n) { - function inner() { return 2 from test; }; - - inner(); - return 1; - }' - for:nil - arguments:#(10) - expect:2 + self + execute:'test(n) { + function inner() { return 2 from test; }; + + inner(); + return 1; + }' + for:nil + arguments:#(10) + expect:2 " self run:#testReturn02 @@ -3890,22 +3890,22 @@ ! testReturn03 - self - execute:'test(n) { - function inner1() { - function inner2() { - return 2 from test; - }; - - inner2(); - }; - - inner1(); - return 1; - }' - for:nil - arguments:#(10) - expect:2 + self + execute:'test(n) { + function inner1() { + function inner2() { + return 2 from test; + }; + + inner2(); + }; + + inner1(); + return 1; + }' + for:nil + arguments:#(10) + expect:2 " self run:#testReturn03 @@ -3917,22 +3917,22 @@ "/ currently fails. ^ self. - self - execute:'test(n) { - function inner1() { - function inner2() { - return 2 from inner1; - }; - - inner2(); - }; - - inner1(); - return 1; - }' - for:nil - arguments:#(10) - expectError:#ParseError + self + execute:'test(n) { + function inner1() { + function inner2() { + return 2 from inner1; + }; + + inner2(); + }; + + inner1(); + return 1; + }' + for:nil + arguments:#(10) + expectError:#ParseError " self run:#testReturn04 @@ -3943,15 +3943,15 @@ ! testReturn05 - self - execute:'test(n) { - function inner() { return 2; }; - - return inner() + 1; - }' - for:nil - arguments:#(10) - expect:3 + self + execute:'test(n) { + function inner() { return 2; }; + + return inner() + 1; + }' + for:nil + arguments:#(10) + expect:3 " self run:#testReturn05 @@ -3962,16 +3962,16 @@ ! testReturnNew01 - self - execute:'test() { - var someString; - - someString = "1234"; - return (new Point).x(someString.asInteger()); - }' - for:nil - arguments:#() - expect:(Point x:1234 y:nil). + self + execute:'test() { + var someString; + + someString = "1234"; + return (new Point).x(someString.asInteger()); + }' + for:nil + arguments:#() + expect:(Point x:1234 y:nil). " self run:#testReturnNew01 @@ -3984,15 +3984,15 @@ testReturnNew02 |result| - result := self - execute:'test() { - var someString; - - someString = "1234"; - return (new ValueHolder).value(someString.asInteger()); - }' - for:nil - arguments:#(). + result := self + execute:'test() { + var someString; + + someString = "1234"; + return (new ValueHolder).value(someString.asInteger()); + }' + for:nil + arguments:#(). self assert:(result isKindOf:ValueHolder). self assert:(result value = 1234). @@ -4005,11 +4005,11 @@ ! testScanner01 - self - execute:'f() { }' - for:nil - arguments:#() - expect:nil + self + execute:'f() { }' + for:nil + arguments:#() + expect:nil " self run:#testScanner01 @@ -4018,11 +4018,11 @@ ! testScanner02 - self - execute:'f(a) { }' - for:nil - arguments:#(1) - expect:nil + self + execute:'f(a) { }' + for:nil + arguments:#(1) + expect:nil " self run:#testScanner02 @@ -4031,11 +4031,11 @@ ! testScanner03 - self - execute:'f(a, b) { }' - for:nil - arguments:#(1 2) - expect:nil + self + execute:'f(a, b) { }' + for:nil + arguments:#(1 2) + expect:nil " self run:#testScanner03 @@ -4044,11 +4044,11 @@ ! testScanner04 - self - execute:'f(a, b) { return (null); }' - for:nil - arguments:#(1 2) - expect:nil + self + execute:'f(a, b) { return (null); }' + for:nil + arguments:#(1 2) + expect:nil " self run:#testScanner04 @@ -4057,11 +4057,11 @@ ! testScanner05 - self - execute:'f(a, b) { return (null); }' - for:nil - arguments:#(1) - expectError:(Method wongNumberOfArgumentsSignal) + self + execute:'f(a, b) { return (null); }' + for:nil + arguments:#(1) + expectError:(Method wongNumberOfArgumentsSignal) " self run:#testScanner05 @@ -4072,11 +4072,11 @@ ! testScanner06 - self - execute:'f() { /* a comment */ return (null); }' - for:nil - arguments:#() - expect:nil + self + execute:'f() { /* a comment */ return (null); }' + for:nil + arguments:#() + expect:nil " self run:#testScanner06 @@ -4085,12 +4085,12 @@ ! testScanner07 - self - execute:'f() { // an EOL comment + self + execute:'f() { // an EOL comment return (null); }' - for:nil - arguments:#() - expect:nil + for:nil + arguments:#() + expect:nil " self run:#testScanner07 @@ -4099,12 +4099,12 @@ ! testScanner08 - self - execute:'f() { // a comment in an /* an EOL comment + self + execute:'f() { // a comment in an /* an EOL comment return (null); }' - for:nil - arguments:#() - expect:nil + for:nil + arguments:#() + expect:nil " self run:#testScanner08 @@ -4113,12 +4113,12 @@ ! testScanner09 - self - execute:'f() { // a comment in an /* an EOL */ comment + self + execute:'f() { // a comment in an /* an EOL */ comment return (null); }' - for:nil - arguments:#() - expect:nil + for:nil + arguments:#() + expect:nil " self run:#testScanner09 @@ -4127,12 +4127,12 @@ ! testScanner10 - self - execute:'f() { /** a comment */ + self + execute:'f() { /** a comment */ return (null); }' - for:nil - arguments:#() - expect:nil + for:nil + arguments:#() + expect:nil " self run:#testScanner10 @@ -4141,12 +4141,12 @@ ! testScanner11 - self - execute:'f() { /**/ + self + execute:'f() { /**/ return (null); }' - for:nil - arguments:#() - expect:nil + for:nil + arguments:#() + expect:nil " self run:#testScanner11 @@ -4158,12 +4158,12 @@ "/ cg: is the comment below legal ? ^ self. "/ assume not - self - execute:'f() { /*/ + self + execute:'f() { /*/ return (null); }' - for:nil - arguments:#() - expectError:#ParseError + for:nil + arguments:#() + expectError:#ParseError " self run:#testScanner12 @@ -4175,12 +4175,12 @@ "/ cg: is the comment below legal ? ^ self. "/ assume not - self - execute:'f_1() { /*/ + self + execute:'f_1() { /*/ return (null); }' - for:nil - arguments:#() - expectError:#ParseError + for:nil + arguments:#() + expectError:#ParseError " self run:#testScanner13 @@ -4191,62 +4191,62 @@ testScanner20 #( - ' = ' $= - '/* ignored */= ' $= - '/* ignored */ = ' $= - ' + ' $+ - ' - ' $- - ' * ' $* - ' / ' $/ - ' % ' $% - ' & ' $& - ' ^ ' $^ - ' | ' $| - ' !! ' $!! - ' < ' $< - ' > ' $> - - ' << ' #'<<' - ' >> ' #'>>' - ' == ' #'==' - ' <= ' #'<=' - ' >= ' #'>=' - ' !!= ' #'!!=' - ' || ' #'||' - ' && ' #'&&' - ' ++ ' #'++' - ' -- ' #'--' - - ' += ' #'+=' - ' -= ' #'-=' - ' *= ' #'*=' - ' /= ' #'/=' - ' %= ' #'%=' - ' &= ' #'&=' - ' ^= ' #'^=' - ' |= ' #'|=' - - ' >>> ' #'>>>' - ' >>= ' #'>>=' - ' <<= ' #'<<=' - ' === ' #'===' - ' !!== ' #'!!==' - - ' 1 ' #Integer - ' 12345 ' #Integer - ' 1.0 ' #Float - ' 1e10 ' #Float - ' 1E10 ' #Float - ' 1E+10 ' #Float - ' 1E-10 ' #Float - ' 1.0d ' #Float - ' 1. ' #Float -"/ ' 1.' #Float + ' = ' $= + '/* ignored */= ' $= + '/* ignored */ = ' $= + ' + ' $+ + ' - ' $- + ' * ' $* + ' / ' $/ + ' % ' $% + ' & ' $& + ' ^ ' $^ + ' | ' $| + ' !! ' $!! + ' < ' $< + ' > ' $> + + ' << ' #'<<' + ' >> ' #'>>' + ' == ' #'==' + ' <= ' #'<=' + ' >= ' #'>=' + ' !!= ' #'!!=' + ' || ' #'||' + ' && ' #'&&' + ' ++ ' #'++' + ' -- ' #'--' + + ' += ' #'+=' + ' -= ' #'-=' + ' *= ' #'*=' + ' /= ' #'/=' + ' %= ' #'%=' + ' &= ' #'&=' + ' ^= ' #'^=' + ' |= ' #'|=' + + ' >>> ' #'>>>' + ' >>= ' #'>>=' + ' <<= ' #'<<=' + ' === ' #'===' + ' !!== ' #'!!==' + + ' 1 ' #Integer + ' 12345 ' #Integer + ' 1.0 ' #Float + ' 1e10 ' #Float + ' 1E10 ' #Float + ' 1E+10 ' #Float + ' 1E-10 ' #Float + ' 1.0d ' #Float + ' 1. ' #Float +"/ ' 1.' #Float ) pairWiseDo:[:src :expectedToken | - |scannedToken| - - scannedToken := (JavaScriptScanner for:src) nextToken. - self assert:(scannedToken == expectedToken) + |scannedToken| + + scannedToken := (JavaScriptScanner for:src) nextToken. + self assert:(scannedToken == expectedToken) ]. " @@ -4256,107 +4256,107 @@ ! testString01 - self - execute:'test(str) { - return "foo".size; - }' - for:nil - arguments:#( nil ) - expect:3 + self + execute:'test(str) { + return "foo".size; + }' + for:nil + arguments:#( nil ) + expect:3 " self run:#testString01 - self new testString01 + self new testString01 " ! testString02 - self - execute:'test(str) { - return str.size(); - }' - for:nil - arguments:#( 'hello' ) - expect:5 + self + execute:'test(str) { + return str.size(); + }' + for:nil + arguments:#( 'hello' ) + expect:5 " self run:#testString02 - self new testString02 + self new testString02 " ! testString03 - self - execute:'test(str) { - return str.size; - }' - for:nil - arguments:#( 'hello' ) - expect:5 + self + execute:'test(str) { + return str.size; + }' + for:nil + arguments:#( 'hello' ) + expect:5 " self run:#testString03 - self new testString03 + self new testString03 " ! testString04 - self - execute:'test(str) { - return str[1]; - }' - for:nil - arguments:#( 'hello' ) - expect:$h + self + execute:'test(str) { + return str[1]; + }' + for:nil + arguments:#( 'hello' ) + expect:$h " self run:#testString04 - self new testString04 + self new testString04 " ! testString05 - self - execute:'test(str) { - return str[1] == "h"[1]; - }' - for:nil - arguments:#( 'hello' ) - expect:true + self + execute:'test(str) { + return str[1] == "h"[1]; + }' + for:nil + arguments:#( 'hello' ) + expect:true " self run:#testString05 - self new testString05 + self new testString05 " ! testString06 - self - execute:'test(str) { - return str[1] == $''h''; - }' - for:nil - arguments:#( 'hello' ) - expect:true + self + execute:'test(str) { + return str[1] == $''h''; + }' + for:nil + arguments:#( 'hello' ) + expect:true " self run:#testString06 - self new testString06 + self new testString06 " ! testString07 - self - execute:'test(str) { - return str[1].isLowercase; - }' - for:nil - arguments:#( 'hello' ) - expect:true + self + execute:'test(str) { + return str[1].isLowercase; + }' + for:nil + arguments:#( 'hello' ) + expect:true " self run:#testString07 - self new testString07 + self new testString07 " ! @@ -4364,36 +4364,36 @@ |class1 class2| Class withoutUpdatingChangesDo:[ - class1 := Class name:'T1' subclassOf:Object. - class2 := Class name:'T2' subclassOf:class1. - - JavaScriptCompiler - compile:'foo() { return 1; }' - forClass:class1 - inCategory:nil - notifying:nil - install:true. - - JavaScriptCompiler - compile:'foo() { return 2; }' - forClass:class2 - inCategory:nil - notifying:nil - install:true. - - JavaScriptCompiler - compile:'callFoo() { return foo(); }' - forClass:class2 - inCategory:nil - notifying:nil - install:true. - - JavaScriptCompiler - compile:'callSuperFoo() { return super.foo(); }' - forClass:class2 - inCategory:nil - notifying:nil - install:true. + class1 := Class name:'T1' subclassOf:Object. + class2 := Class name:'T2' subclassOf:class1. + + JavaScriptCompiler + compile:'foo() { return 1; }' + forClass:class1 + inCategory:nil + notifying:nil + install:true. + + JavaScriptCompiler + compile:'foo() { return 2; }' + forClass:class2 + inCategory:nil + notifying:nil + install:true. + + JavaScriptCompiler + compile:'callFoo() { return foo(); }' + forClass:class2 + inCategory:nil + notifying:nil + install:true. + + JavaScriptCompiler + compile:'callSuperFoo() { return super.foo(); }' + forClass:class2 + inCategory:nil + notifying:nil + install:true. ]. self assert:(class2 new callFoo == 2). @@ -4406,18 +4406,18 @@ ! testSwitch01 - self - execute:'test(arg) { - switch (arg) { - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + switch (arg) { + } + }' + for:nil + arguments:#(5) + expect:nil " self run:#testSwitch01 - self new testSwitch01 + self new testSwitch01 " ! @@ -4425,23 +4425,23 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - Transcript.show("hello "); - return 1; - } - return 0; - }' - for:nil - arguments:#(5) - expect:0 + self + execute:'test(arg) { + switch (arg) { + Transcript.show("hello "); + return 1; + } + return 0; + }' + for:nil + arguments:#(5) + expect:0 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( )) " self run:#testSwitch02 - self new testSwitch02 + self new testSwitch02 " ! @@ -4449,25 +4449,25 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - Transcript.show("hello "); - Transcript.show("world "); - Transcript.cr(); - return 1; - } - return 0; - }' - for:nil - arguments:#(5) - expect:0 + self + execute:'test(arg) { + switch (arg) { + Transcript.show("hello "); + Transcript.show("world "); + Transcript.cr(); + return 1; + } + return 0; + }' + for:nil + arguments:#(5) + expect:0 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #() ) " self run:#testSwitch03 - self new testSwitch03 + self new testSwitch03 " ! @@ -4475,26 +4475,26 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - default: - Transcript.show("hello "); - Transcript.show("world "); - Transcript.cr(); - return 1; - } - return 0; - }' - for:nil - arguments:#(5) - expect:1 + self + execute:'test(arg) { + switch (arg) { + default: + Transcript.show("hello "); + Transcript.show("world "); + Transcript.cr(); + return 1; + } + return 0; + }' + for:nil + arguments:#(5) + expect:1 ]. self assert:(output = 'hello world \' withCRs). " self run:#testSwitch04 - self new testSwitch04 + self new testSwitch04 " ! @@ -4502,26 +4502,26 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - default: - Transcript.show("hello "); - Transcript.show("world "); - return 1; - Transcript.cr(); - } - return 0; - }' - for:nil - arguments:#(5) - expect:1 + self + execute:'test(arg) { + switch (arg) { + default: + Transcript.show("hello "); + Transcript.show("world "); + return 1; + Transcript.cr(); + } + return 0; + }' + for:nil + arguments:#(5) + expect:1 ]. self assert:(output = 'hello world '). " self run:#testSwitch05 - self new testSwitch05 + self new testSwitch05 " ! @@ -4529,27 +4529,27 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - case 1: - Transcript.showCR("one"); - return 10; - case 2: - Transcript.showCR("two"); - return 20; - } - return 0; - }' - for:nil - arguments:#(5) - expect:0 + self + execute:'test(arg) { + switch (arg) { + case 1: + Transcript.showCR("one"); + return 10; + case 2: + Transcript.showCR("two"); + return 20; + } + return 0; + }' + for:nil + arguments:#(5) + expect:0 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( )) " self run:#testSwitch06a - self new testSwitch06a + self new testSwitch06a " ! @@ -4557,27 +4557,27 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - case 1: - Transcript.showCR("one"); - return 10; - case 2: - Transcript.showCR("two"); - return 20; - } - return 0; - }' - for:nil - arguments:#(1) - expect:10 + self + execute:'test(arg) { + switch (arg) { + case 1: + Transcript.showCR("one"); + return 10; + case 2: + Transcript.showCR("two"); + return 20; + } + return 0; + }' + for:nil + arguments:#(1) + expect:10 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( 'one')) " self run:#testSwitch06b - self new testSwitch06b + self new testSwitch06b " ! @@ -4585,27 +4585,27 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - case 1: - Transcript.showCR("one"); - return 10; - case 2: - Transcript.showCR("two"); - return 20; - } - return 0; - }' - for:nil - arguments:#(2) - expect:20 + self + execute:'test(arg) { + switch (arg) { + case 1: + Transcript.showCR("one"); + return 10; + case 2: + Transcript.showCR("two"); + return 20; + } + return 0; + }' + for:nil + arguments:#(2) + expect:20 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( 'two')) " self run:#testSwitch06c - self new testSwitch06c + self new testSwitch06c " ! @@ -4613,146 +4613,146 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - switch (arg) { - case "hallo": - Transcript.showCR("Hallo"); - return 10; - case "hello": - Transcript.showCR("Hello"); - return 20; - } - return 0; - }' - for:nil - arguments:#('hello') - expect:20 + self + execute:'test(arg) { + switch (arg) { + case "hallo": + Transcript.showCR("Hallo"); + return 10; + case "hello": + Transcript.showCR("Hello"); + return 20; + } + return 0; + }' + for:nil + arguments:#('hello') + expect:20 ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( 'Hello')) " self run:#testSwitch06d - self new testSwitch06d + self new testSwitch06d " ! testSwitch06e - self - execute:'test(arg) { - switch (arg) { - case 1: - Transcript.showCR("Hallo"); - return 10; - case 2: - Transcript.showCR("Hello"); - return 20; - } - return 0; - }' - for:nil - arguments:#(3) - expect:0 + self + execute:'test(arg) { + switch (arg) { + case 1: + Transcript.showCR("Hallo"); + return 10; + case 2: + Transcript.showCR("Hello"); + return 20; + } + return 0; + }' + for:nil + arguments:#(3) + expect:0 " self run:#testSwitch06e - self new testSwitch06e + self new testSwitch06e " ! testSwitch06f - self - execute:'test(arg) { - var a = 0; - switch (arg) { - case 1: - a = 10; - break; - case 2: - a = 20; - break; - } - return a; - }' - for:nil - arguments:#(1) - expect:10 + self + execute:'test(arg) { + var a = 0; + switch (arg) { + case 1: + a = 10; + break; + case 2: + a = 20; + break; + } + return a; + }' + for:nil + arguments:#(1) + expect:10 " self run:#testSwitch06f - self new testSwitch06f + self new testSwitch06f " ! testSwitch06g - self - execute:'test(arg) { - var a = 0; - switch (arg) { - case 1: - a = 10; - break; - case 2: - a = 20; - break; - } - return a; - }' - for:nil - arguments:#(2) - expect:20 + self + execute:'test(arg) { + var a = 0; + switch (arg) { + case 1: + a = 10; + break; + case 2: + a = 20; + break; + } + return a; + }' + for:nil + arguments:#(2) + expect:20 " self run:#testSwitch06g - self new testSwitch06g + self new testSwitch06g " ! testSwitch06h - self - execute:'test(arg) { - var a = 0; - switch (arg) { - case 1: - a = 10; - break; - case 2: - a = 20; - break; - } - return a; - }' - for:nil - arguments:#(3) - expect:0 + self + execute:'test(arg) { + var a = 0; + switch (arg) { + case 1: + a = 10; + break; + case 2: + a = 20; + break; + } + return a; + }' + for:nil + arguments:#(3) + expect:0 " self run:#testSwitch06h - self new testSwitch06h + self new testSwitch06h " ! testThrow01 "an exception is thrown" - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { - throw Error; - }; - - try { - failingMethod(); - } catch (Error e) { - handlerWasCalled = true; - } - return handlerWasCalled; - }' - for:nil - arguments:#(0) - expect:true + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { + throw Error; + }; + + try { + failingMethod(); + } catch (Error e) { + handlerWasCalled = true; + } + return handlerWasCalled; + }' + for:nil + arguments:#(0) + expect:true " self run:#testThrow01 @@ -4763,24 +4763,24 @@ testTryCatch01a "in this testcase, arg is 5, so no exception should be thrown" - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { - return 10 / arg; - }; - - try { - failingMethod(); - } catch (Error e) { - handlerWasCalled = true; - } - return handlerWasCalled; - }' - for:nil - arguments:#(5) - expect:false + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { + return 10 / arg; + }; + + try { + failingMethod(); + } catch (Error e) { + handlerWasCalled = true; + } + return handlerWasCalled; + }' + for:nil + arguments:#(5) + expect:false " self run:#testTryCatch01a @@ -4791,22 +4791,22 @@ testTryCatch01b "in this testcase, arg is 0, so an exception should be thrown" - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { return 10 / arg; }; - - try { - failingMethod(); - } catch (Error e) { - handlerWasCalled = true; - } - return handlerWasCalled; - }' - for:nil - arguments:#(0) - expect:true + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { return 10 / arg; }; + + try { + failingMethod(); + } catch (Error e) { + handlerWasCalled = true; + } + return handlerWasCalled; + }' + for:nil + arguments:#(0) + expect:true " self run:#testTryCatch01b @@ -4815,23 +4815,23 @@ ! testTryCatch02a - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { return 10 / arg; }; - function exceptionRaised() { handlerWasCalled = true; }; - - try { - failingMethod(); - } catch (Error e) { - exceptionRaised(); - } - return handlerWasCalled; - }' - for:nil - arguments:#(5) - expect:false + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { return 10 / arg; }; + function exceptionRaised() { handlerWasCalled = true; }; + + try { + failingMethod(); + } catch (Error e) { + exceptionRaised(); + } + return handlerWasCalled; + }' + for:nil + arguments:#(5) + expect:false " self run:#testTryCatch02a @@ -4840,23 +4840,23 @@ ! testTryCatch02b - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { return 10 / arg; }; - function exceptionRaised() { handlerWasCalled = true; }; - - try { - failingMethod(); - } catch (Error e) { - exceptionRaised(); - } - return handlerWasCalled; - }' - for:nil - arguments:#(0) - expect:true + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { return 10 / arg; }; + function exceptionRaised() { handlerWasCalled = true; }; + + try { + failingMethod(); + } catch (Error e) { + exceptionRaised(); + } + return handlerWasCalled; + }' + for:nil + arguments:#(0) + expect:true " self run:#testTryCatch02b @@ -4865,23 +4865,23 @@ ! testTryCatch03a - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { return 10 / arg; }; - function exceptionRaised(e) { handlerWasCalled = true; }; - - try { - failingMethod(); - } catch (Error e) { - exceptionRaised(e); - } - return handlerWasCalled; - }' - for:nil - arguments:#(5) - expect:false + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { return 10 / arg; }; + function exceptionRaised(e) { handlerWasCalled = true; }; + + try { + failingMethod(); + } catch (Error e) { + exceptionRaised(e); + } + return handlerWasCalled; + }' + for:nil + arguments:#(5) + expect:false " self run:#testTryCatch03a @@ -4890,23 +4890,23 @@ ! testTryCatch03b - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { return 10 / arg; }; - function exceptionRaised(e) { handlerWasCalled = true; }; - - try { - failingMethod(); - } catch (Error e) { - exceptionRaised(e); - } - return handlerWasCalled; - }' - for:nil - arguments:#(0) - expect:true + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { return 10 / arg; }; + function exceptionRaised(e) { handlerWasCalled = true; }; + + try { + failingMethod(); + } catch (Error e) { + exceptionRaised(e); + } + return handlerWasCalled; + }' + for:nil + arguments:#(0) + expect:true " self run:#testTryCatch03b @@ -4917,23 +4917,23 @@ testTryCatch04b self should:[ - self - execute:'test(arg) { - var handlerWasCalled = false; - - function failingMethod() { return 10 / arg; }; - function exceptionRaised() { handlerWasCalled = true; }; - - try { - failingMethod(); - } catch (Error e) { - exceptionRaised(e); - } - return handlerWasCalled; - }' - for:nil - arguments:#(0) - expect:true + self + execute:'test(arg) { + var handlerWasCalled = false; + + function failingMethod() { return 10 / arg; }; + function exceptionRaised() { handlerWasCalled = true; }; + + try { + failingMethod(); + } catch (Error e) { + exceptionRaised(e); + } + return handlerWasCalled; + }' + for:nil + arguments:#(0) + expect:true ] raise: Error. @@ -4946,12 +4946,12 @@ testTryCatchExceptionInfo |savedTranscript collector expected| - savedTranscript := Smalltalk at:#Transcript. + savedTranscript := Smalltalk at:#Transcript. [ - Smalltalk at:#Transcript put:(collector := '' writeStream). + Smalltalk at:#Transcript put:(collector := '' writeStream). self - execute:' + execute:' test(arg) { var handlerWasCalled = false; @@ -4967,9 +4967,9 @@ }' for:JavaScriptEnvironment new arguments:#(0) - expect:true. + expect:true. ] ensure:[ - Smalltalk at:#Transcript put:savedTranscript + Smalltalk at:#Transcript put:savedTranscript ]. expected := String streamContents:[:s | s showCR:'division by zero']. @@ -4982,8 +4982,8 @@ ! testTryCatchFinally01 - self - execute: + self + execute: 'test(arg) { var handlerWasCalled = false; var finallyExecuted = false; @@ -5002,7 +5002,7 @@ }' for:nil arguments:#(0) - expect:true. + expect:true. " self run:#testTryCatchFinally01 @@ -5013,11 +5013,11 @@ testTryFinally01 |savedTranscript collector expected| - savedTranscript := Smalltalk at:#Transcript. + savedTranscript := Smalltalk at:#Transcript. [ - Smalltalk at:#Transcript put:(collector := '' writeStream). + Smalltalk at:#Transcript put:(collector := '' writeStream). self - execute: + execute: 'test(arg) { var handlerWasCalled = false; @@ -5060,6 +5060,20 @@ ]. self assert:(collector contents = expected). + ] ensure:[ + Smalltalk at:#Transcript put:savedTranscript + ]. + + expected := String streamContents:[:s | + s showCR:'1'. + s showCR:'2'. + s showCR:'2a'. + s showCR:'2b'. + s showCR:'2c'. + s showCR:'4'. + ]. + self assert:(collector contents = expected). + " self run:#testTryFinally01 self new testTryFinally01 @@ -5070,43 +5084,43 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var handler1WasCalled = false; - var handler2WasCalled = false; - var finallyActionWasEvaluated = false; - - println("1"); - try { - - function dummy () { - println("2a"); - try { - println("2b"); - return 10 / arg; - } finally { - println("2c"); - handler1WasCalled = true; - } - }; - - println("2"); - dummy(); - println("3"); - } catch(Error e) { - println("e"); - handler2WasCalled = true; - } finally { - println("f"); - finallyActionWasEvaluated = true; - }; - - println("4"); - return handler1WasCalled && handler2WasCalled && finallyActionWasEvaluated; - }' - for:JavaScriptEnvironment new - arguments:#(0) - expect:true + self + execute:'test(arg) { + var handler1WasCalled = false; + var handler2WasCalled = false; + var finallyActionWasEvaluated = false; + + println("1"); + try { + + function dummy () { + println("2a"); + try { + println("2b"); + return 10 / arg; + } finally { + println("2c"); + handler1WasCalled = true; + } + }; + + println("2"); + dummy(); + println("3"); + } catch(Error e) { + println("e"); + handler2WasCalled = true; + } finally { + println("f"); + finallyActionWasEvaluated = true; + }; + + println("4"); + return handler1WasCalled && handler2WasCalled && finallyActionWasEvaluated; + }' + for:JavaScriptEnvironment new + arguments:#(0) + expect:true ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '1' '2' '2a' '2b' 'e' '2c' 'f' '4')) @@ -5120,32 +5134,32 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var handlerWasCalled = false; - var finallyActionWasEvaluated = false; - - println("1"); - try { - function dummy() {}; - - println("2"); - dummy(); - println("3"); - } catch(Error e) { - println("e"); - handlerWasCalled = true; - } finally { - println("f"); - finallyActionWasEvaluated = true; - }; - - println("4"); - return !!handlerWasCalled && finallyActionWasEvaluated; - }' - for:JavaScriptEnvironment new - arguments:#(0) - expect:true + self + execute:'test(arg) { + var handlerWasCalled = false; + var finallyActionWasEvaluated = false; + + println("1"); + try { + function dummy() {}; + + println("2"); + dummy(); + println("3"); + } catch(Error e) { + println("e"); + handlerWasCalled = true; + } finally { + println("f"); + finallyActionWasEvaluated = true; + }; + + println("4"); + return !!handlerWasCalled && finallyActionWasEvaluated; + }' + for:JavaScriptEnvironment new + arguments:#(0) + expect:true ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '1' '2' '3' 'f' '4')) @@ -5156,77 +5170,77 @@ ! testTypeof01 - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:#(0) - expect:'number'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:#('foo') - expect:'string'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:#(true) - expect:'boolean'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:#(false) - expect:'boolean'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:#(nil) - expect:'undefined'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:#( #[1 2 3] ) - expect:'object'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:#( #(1 2 3) ) - expect:'object'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:(Array with:(Point new)) - expect:'object'. - - self - execute:'test(arg) { - return typeof(arg); - }' - for:nil - arguments:(Array with:Integer) - expect:'object'. + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:#(0) + expect:'number'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:#('foo') + expect:'string'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:#(true) + expect:'boolean'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:#(false) + expect:'boolean'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:#(nil) + expect:'undefined'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:#( #[1 2 3] ) + expect:'object'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:#( #(1 2 3) ) + expect:'object'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:(Array with:(Point new)) + expect:'object'. + + self + execute:'test(arg) { + return typeof(arg); + }' + for:nil + arguments:(Array with:Integer) + expect:'object'. " self run:#testTypeof01 @@ -5235,15 +5249,15 @@ ! testVarDeclaration01 - self - execute:'expr(a, b) { - var x = 10; - - return x; - }' - for:nil - arguments:#(10 20) - expect:10 + self + execute:'expr(a, b) { + var x = 10; + + return x; + }' + for:nil + arguments:#(10 20) + expect:10 " self run:#testVarDeclaration01 @@ -5252,15 +5266,15 @@ ! testVarDeclaration02 - self - execute:'expr(a, b) { - var x = 10; - - return (a + x); - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'expr(a, b) { + var x = 10; + + return (a + x); + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testVarDeclaration02 @@ -5269,16 +5283,16 @@ ! testVarDeclaration03 - self - execute:'expr(a, b) { - var x = 10; - var y = x+10; - - return (y); - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'expr(a, b) { + var x = 10; + var y = x+10; + + return (y); + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testVarDeclaration03 @@ -5287,16 +5301,16 @@ ! testVarDeclaration04 - self - execute:'expr(a, b) { - var y = x+10; - var x = 10; - - return (y); - }' - for:nil - arguments:#(10 20) - expectError:#ParseError + self + execute:'expr(a, b) { + var y = x+10; + var x = 10; + + return (y); + }' + for:nil + arguments:#(10 20) + expectError:#ParseError " self run:#testVarDeclaration04 @@ -5309,19 +5323,19 @@ testVarDeclaration05 "our JS only allows variables declarations at a blocks top" - self - execute:'expr(a, b) { - var y = 10; - - y = y + 10; - - var x = 10; - - return (y); - }' - for:nil - arguments:#(10 20) - expect:20 + self + execute:'expr(a, b) { + var y = 10; + + y = y + 10; + + var x = 10; + + return (y); + }' + for:nil + arguments:#(10 20) + expect:20 " self run:#testVarDeclaration05 @@ -5333,15 +5347,15 @@ testVarDeclaration06 - self - execute:'expr(x) { - var y = x + 20; - - return (y); - }' - for:nil - arguments:#(10) - expect:30 + self + execute:'expr(x) { + var y = x + 20; + + return (y); + }' + for:nil + arguments:#(10) + expect:30 " self run:#testVarDeclaration06 @@ -5351,15 +5365,15 @@ testVarDeclaration07 - self - execute:'expr(x) { - var x = x + 20; - - return (x); - }' - for:nil - arguments:#(10) - expectError:Error + self + execute:'expr(x) { + var x = x + 20; + + return (x); + }' + for:nil + arguments:#(10) + expectError:Error " self run:#testVarDeclaration07 @@ -5369,15 +5383,15 @@ testVarDeclaration08 - self - execute:'expr(aIn, bIn, cIn) { - var a = aIn, b = bIn, c = cIn; - - return (a); - }' - for:nil - arguments:#(1 2 3) - expect:1 + self + execute:'expr(aIn, bIn, cIn) { + var a = aIn, b = bIn, c = cIn; + + return (a); + }' + for:nil + arguments:#(1 2 3) + expect:1 " self run:#testVarDeclaration08 @@ -5389,25 +5403,25 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = arg; - while (n > 0) { - n--; - Transcript.showCR("hello"); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + n = arg; + while (n > 0) { + n--; + Transcript.showCR("hello"); + } + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( 'hello' 'hello' 'hello' 'hello' 'hello' )) " self run:#testWhile01 - self new testWhile01 + self new testWhile01 " ! @@ -5415,19 +5429,19 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - while (n <= arg) { - n++; - Transcript.showCR("hello"); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + n = 1; + while (n <= arg) { + n++; + Transcript.showCR("hello"); + } + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( 'hello' 'hello' 'hello' 'hello' 'hello' )) @@ -5441,18 +5455,18 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - while (n <= arg) { - Transcript.showCR(n++); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + n = 1; + while (n <= arg) { + Transcript.showCR(n++); + } + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '1' '2' '3' '4' '5' )) @@ -5466,18 +5480,18 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - while (n++ <= arg) { - Transcript.showCR(n); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + n = 1; + while (n++ <= arg) { + Transcript.showCR(n); + } + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '2' '3' '4' '5' '6')) @@ -5491,18 +5505,18 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - while (n++ <= arg) { - Transcript.showCR(n); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + n = 1; + while (n++ <= arg) { + Transcript.showCR(n); + } + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '2' '3' '4' '5' '6')) @@ -5516,19 +5530,19 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - while (n++ <= arg) { - if (n == 3) continue; - Transcript.showCR(n); - } - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + n = 1; + while (n++ <= arg) { + if (n == 3) continue; + Transcript.showCR(n); + } + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '2' '4' '5' '6')) @@ -5545,18 +5559,18 @@ |output| output := self outputToTranscriptOf:[ - self - execute:'test(arg) { - var n; - - n = 1; - while (n++ < arg) { - } - Transcript.showCR(n); - }' - for:nil - arguments:#(5) - expect:nil + self + execute:'test(arg) { + var n; + + n = 1; + while (n++ < arg) { + } + Transcript.showCR(n); + }' + for:nil + arguments:#(5) + expect:nil ]. self assert:(output asCollectionOfLinesWithReturn asArray = #( '6')) @@ -5572,48 +5586,48 @@ |spec| spec := #( - ('1' #isInteger 1) - ('0' #isInteger 0) - ('-1' #isInteger -1) - ('12345678901234567890' #isInteger 12345678901234567890) - ('0x0' #isInteger 0) - ('0x1' #isInteger 1) - ('0xFFFF' #isInteger 16rFFFF) - ('0xffff' #isInteger 16rFFFF) - ('0xFFFFFFFFFFFFFFFF' #isInteger 16rFFFFFFFFFFFFFFFF) - ('0777' #isInteger 8r777) - - ('1.2345' #isFloat 1.2345) - ('-1.2345' #isFloat -1.2345) - - ('nil' #isNil nil) - ('null' #isNil nil) - ('true' nil true) - ('false' nil false) - - ('"aString"' #isString 'aString' ) - ('''anotherString''' #isString 'anotherString' ) - ('''anoth"er"String''' #isString 'anoth"er"String' ) - ('"anoth''er''String"' #isString 'anoth''er''String' ) - ('"hello"' #isString 'hello' ) - ('"\b"' #isString (#eval 'Character backspace asString') ) - ('"\f"' #isString (#eval 'Character ff asString') ) - ('"\t"' #isString (#eval 'Character tab asString') ) - ('"\r"' #isString (#eval 'Character return asString') ) - ('"\n"' #isString (#eval 'Character nl asString') ) - ('"\''"' #isString '''' ) - ('"\""' #isString '"' ) - - ('[ 1 , 2 , 3]' #isArray #(1 2 3) ) - ('[1,2,3]' #isArray #(1 2 3) ) - ('[1,2,3]' #isArray #(1 2 3) ) - ('["a","b","c"]' #isArray #('a' 'b' 'c') ) - ('[]' #isArray #() ) - ('[null]' #isArray #( nil ) ) - - ('[1,[2,[3]]]' #isArray #(1 (2 (3))) ) - - ). + ('1' #isInteger 1) + ('0' #isInteger 0) + ('-1' #isInteger -1) + ('12345678901234567890' #isInteger 12345678901234567890) + ('0x0' #isInteger 0) + ('0x1' #isInteger 1) + ('0xFFFF' #isInteger 16rFFFF) + ('0xffff' #isInteger 16rFFFF) + ('0xFFFFFFFFFFFFFFFF' #isInteger 16rFFFFFFFFFFFFFFFF) + ('0777' #isInteger 8r777) + + ('1.2345' #isFloat 1.2345) + ('-1.2345' #isFloat -1.2345) + + ('nil' #isNil nil) + ('null' #isNil nil) + ('true' nil true) + ('false' nil false) + + ('"aString"' #isString 'aString' ) + ('''anotherString''' #isString 'anotherString' ) + ('''anoth"er"String''' #isString 'anoth"er"String' ) + ('"anoth''er''String"' #isString 'anoth''er''String' ) + ('"hello"' #isString 'hello' ) + ('"\b"' #isString (#eval 'Character backspace asString') ) + ('"\f"' #isString (#eval 'Character ff asString') ) + ('"\t"' #isString (#eval 'Character tab asString') ) + ('"\r"' #isString (#eval 'Character return asString') ) + ('"\n"' #isString (#eval 'Character nl asString') ) + ('"\''"' #isString '''' ) + ('"\""' #isString '"' ) + + ('[ 1 , 2 , 3]' #isArray #(1 2 3) ) + ('[1,2,3]' #isArray #(1 2 3) ) + ('[1,2,3]' #isArray #(1 2 3) ) + ('["a","b","c"]' #isArray #('a' 'b' 'c') ) + ('[]' #isArray #() ) + ('[null]' #isArray #( nil ) ) + + ('[1,[2,[3]]]' #isArray #(1 (2 (3))) ) + + ). self doTestEachFromSpec:spec. @@ -5627,17 +5641,17 @@ |spec| spec := #( - ('"\x00"' #isString (#eval '(Character value:0) asString') ) - ('"\x01"' #isString (#eval '(Character value:1) asString') ) - ('"\x1a"' #isString (#eval '(Character value:16r1a) asString') ) - ('"\x000"' #isString (#eval '(Character value:0) asString , ''0'' ') ) - ('"\xgg"' #isString (#error ) ) - ('"\xg"' #isString (#error ) ) - ('"\x"' #isString (#error ) ) - ('"\x0g"' #isString (#error ) ) - ('"\u1234"' #isString (#eval '(Character value:16r1234) asString ') ) - ('"\uFFFF"' #isString (#eval '(Character value:16rFFFF) asString ') ) - ). + ('"\x00"' #isString (#eval '(Character value:0) asString') ) + ('"\x01"' #isString (#eval '(Character value:1) asString') ) + ('"\x1a"' #isString (#eval '(Character value:16r1a) asString') ) + ('"\x000"' #isString (#eval '(Character value:0) asString , ''0'' ') ) + ('"\xgg"' #isString (#error ) ) + ('"\xg"' #isString (#error ) ) + ('"\x"' #isString (#error ) ) + ('"\x0g"' #isString (#error ) ) + ('"\u1234"' #isString (#eval '(Character value:16r1234) asString ') ) + ('"\uFFFF"' #isString (#eval '(Character value:16rFFFF) asString ') ) + ). self doTestEachFromSpec:spec. @@ -5651,11 +5665,11 @@ |spec| spec := #( - ('// ignored - 1' #isInteger 1 ) - ('/* ignored */ 2' #isInteger 2 ) - ('/* ign//ored */ 3' #isInteger 3 ) - ). + ('// ignored + 1' #isInteger 1 ) + ('/* ignored */ 2' #isInteger 2 ) + ('/* ign//ored */ 3' #isInteger 3 ) + ). self doTestEachFromSpec:spec. @@ -5671,21 +5685,21 @@ |spec| spec := #( - ('$''a''' #isCharacter (#eval '$a ') ) - ('$''\n''' #isCharacter (#eval '(Character nl)') ) - ('$''\r''' #isCharacter (#eval '(Character return)') ) - ('$''\b''' #isCharacter (#eval '(Character backspace)') ) - ('$''\x00''' #isCharacter (#eval '(Character value:0)') ) - ('$''\x01''' #isCharacter (#eval '(Character value:1)') ) - ('$''\x1a''' #isCharacter (#eval '(Character value:16r1a)') ) - ('$''\x000''' #isCharacter (#error ) ) - ('$''\xgg''' #isCharacter (#error ) ) - ('$''\xg''' #isCharacter (#error ) ) - ('$''\x''' #isCharacter (#error ) ) - ('$''\x0g''' #isCharacter (#error ) ) - ('$''\u1234''' #isCharacter (#eval '(Character value:16r1234) ') ) - ('$''\uFFFF''' #isCharacter (#eval '(Character value:16rFFFF) ') ) - ). + ('$''a''' #isCharacter (#eval '$a ') ) + ('$''\n''' #isCharacter (#eval '(Character nl)') ) + ('$''\r''' #isCharacter (#eval '(Character return)') ) + ('$''\b''' #isCharacter (#eval '(Character backspace)') ) + ('$''\x00''' #isCharacter (#eval '(Character value:0)') ) + ('$''\x01''' #isCharacter (#eval '(Character value:1)') ) + ('$''\x1a''' #isCharacter (#eval '(Character value:16r1a)') ) + ('$''\x000''' #isCharacter (#error ) ) + ('$''\xgg''' #isCharacter (#error ) ) + ('$''\xg''' #isCharacter (#error ) ) + ('$''\x''' #isCharacter (#error ) ) + ('$''\x0g''' #isCharacter (#error ) ) + ('$''\u1234''' #isCharacter (#eval '(Character value:16r1234) ') ) + ('$''\uFFFF''' #isCharacter (#eval '(Character value:16rFFFF) ') ) + ). self doTestEachFromSpec:spec. @@ -5698,28 +5712,28 @@ test_10_parse_expression1 |spec| - spec := #( - ('1+1' nil 2 ) - ('1-1' nil 0 ) - ('2*2' nil 4 ) - ('4/2' nil 2 ) - ('5%3' nil 2 ) - ('1234567890*1234567890' nil 1524157875019052100 ) - ('1234567890/1234567890' nil 1 ) - ('1234567890/1234567890.0' nil 1.0 ) - - ('1>0' nil true ) - ('1<0' nil false ) - ('1<=0' nil false ) - ('1>=0' nil true ) - ('1==0' nil false ) - ('1!!=0' nil true ) - ('1!!=1' nil false ) - - ('3&5' nil 1 ) - ('3|5' nil 7 ) - ('5^1' nil 4 ) - ). + spec := #( + ('1+1' nil 2 ) + ('1-1' nil 0 ) + ('2*2' nil 4 ) + ('4/2' nil 2 ) + ('5%3' nil 2 ) + ('1234567890*1234567890' nil 1524157875019052100 ) + ('1234567890/1234567890' nil 1 ) + ('1234567890/1234567890.0' nil 1.0 ) + + ('1>0' nil true ) + ('1<0' nil false ) + ('1<=0' nil false ) + ('1>=0' nil true ) + ('1==0' nil false ) + ('1!!=0' nil true ) + ('1!!=1' nil false ) + + ('3&5' nil 1 ) + ('3|5' nil 7 ) + ('5^1' nil 4 ) + ). self doTestEachFromSpec:spec. " @@ -5733,11 +5747,11 @@ test_11_parse_expression2 |spec| - spec := #( - ('1=0' nil ( #error ) ) - ('"abc"[0]' nil ( #error ) ) - ('"abc"[1]' nil $a ) - ). + spec := #( + ('1=0' nil ( #error ) ) + ('"abc"[0]' nil ( #error ) ) + ('"abc"[1]' nil $a ) + ). self doTestEachFromSpec:spec. " @@ -5750,17 +5764,17 @@ |spec| "/ spec is { source shouldErrBoolean } - spec := #( - (' + spec := #( + (' execute(in1) { var t; Dialog.information((t = in1.value()) == nil ? "nil" : t); -}' +}' false - ) - - ). + ) + + ). self doTestEachFunctionFromSpec:spec. " @@ -5772,7 +5786,7 @@ test_40_parse_function | tree | - tree := JavaScriptParser parseExpression:'this.bar("arg1", 1)'. + tree := JavaScriptParser parseExpression:'this.bar("arg1", 1)'. self assert: tree selectorPosition = (6 to: 8) "Created: / 17-11-2014 / 13:28:08 / Jan Vrany " @@ -5781,7 +5795,7 @@ test_41_parse_function | tree | - tree := JavaScriptParser parseExpression:'this.bar'. + tree := JavaScriptParser parseExpression:'this.bar'. self assert: tree selectorPosition = (6 to: 8) "Created: / 17-11-2014 / 13:31:31 / Jan Vrany " @@ -5789,8 +5803,8 @@ xtestInnerFunctionWithInitializedLocals - self - execute:' + self + execute:' execute() { function foo() {} function bar() {} @@ -5798,22 +5812,22 @@ function test() { - foo(); - bar(); - var a; - var b; - var c = Array.new(15); - var d = 20; - - return [ a , b , c , d ]; + foo(); + bar(); + var a; + var b; + var c = Array.new(15); + var d = 20; + + return [ a , b , c , d ]; } test(); } ' - for:nil - arguments:#() - expect:{ nil . nil . (Array new:15) . 20 } + for:nil + arguments:#() + expect:{ nil . nil . (Array new:15) . 20 } " self run:#testInnerFunctionWithInitializedLocals @@ -5822,28 +5836,28 @@ ! xtestNew04 - self - execute:'test() { - var days; - - days = new Array(7,2); - days[1,1] = "Monday"; - days[2,1] = "Tuesday"; - days[3,1] = "Wednesday"; - days[4,1] = "Thursday"; - days[5,1] = "Friday"; - days[6,1] = "Saturday"; - days[7,1] = "Sunday"; - - return days; - }' - for:nil - arguments:#() - expect:#('Monday' 'Tuesday' 'Wednesday' 'Thursday' 'Friday' 'Saturday' 'Sunday') + self + execute:'test() { + var days; + + days = new Array(7,2); + days[1,1] = "Monday"; + days[2,1] = "Tuesday"; + days[3,1] = "Wednesday"; + days[4,1] = "Thursday"; + days[5,1] = "Friday"; + days[6,1] = "Saturday"; + days[7,1] = "Sunday"; + + return days; + }' + for:nil + arguments:#() + expect:#('Monday' 'Tuesday' 'Wednesday' 'Thursday' 'Friday' 'Saturday' 'Sunday') " self run:#testNew04 - self new testNew04 + self new testNew04 " "Created: / 23-02-2007 / 12:24:50 / cg"