[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[s8] equality tests



"equality operator on multiple targets..."
|code| code := '
1 + 1 / 2 = 1 = true
1 + 1 - 1 = 2 = false
1 + 1 - 1 = #1 = false
1 + 1 - 1 = $1 = false
1 + 1 - 1 = true = false
1 - 1 = nil = false
1 - 1 = false = false
1 - 1 = (1 - 2) = false
| x | x := 5@3. x = x = true
$a = #a = true
12 = 12 = true
nil = nil = true
1 + 1 = (8 - 6) = true
#(1 2 3) = #(3 2 1) reversed = true
true = #true = false
#12 = (10 + 2) = false
#1 = (1 + 1 - 1) = false
Array new = 0 = false
0 = Array new = false
0 = XXXX = false
#(0) = 0 = false
0 = #(0) = false
#(#(0 1)) first first = 0 = true
#(#(0 1)) last last = 1 = true
#(98) = nil = false
#(7 nil) last = nil = true
nil = #(98) = false
nil = #(98 nil) last = true
#(98) last - 98 = 0 = true
5 @ 3 = false = false
5 @ 3 = true = false
5 @ 3 = nil = false
1 @ 1 = 1 = true
1 @ 1 = #hello = false
1 @ 1 = 3 = false
self print:''// multiple equality tests complete''. true
' stream.
[code atEnd] whileFalse: [ | line |
    line := code nextLine trimBlanks.
    line notEmpty ifTrue: [
        line evaluate = true ifFalse: [
            self print: '//Eq test failed: ',line printString
        ]
    ].
].


"Dangerous Eq tests..."
XXXX = 0 = false "undefined receiver - Cannot read property '_eq' of undefined "