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

test[m8n] 45 UndefinedObject


--setup
test=nil

--singleton for Collections
if (smalltalk.Array:with_with_(smalltalk.UndefinedObject:basicNew(),2):first()~=nil) then error("Must be nil") end
if (smalltalk.Array:with_with_(smalltalk.UndefinedObject:basicNew(),2):size()~=2) then error("Size must be 2") end
if (smalltalk.Array:with_with_(smalltalk.UndefinedObject:basicNew(),2):at_(1):notNil()) then error("First element must be nil") end


--comparing
if (test:_eq_eq(12)) then error("Must return false") end
if (test:_eq_eq(0)) then error("Must return false") end
if (test:_eq_eq("")) then error("Must return false") end
if (test:_eq_eq({})) then error("Must return false") end
if (test:_eq_eq(-1)) then error("Must return false") end
if (not test:_eq_eq(nil)) then error("Must return true") end
if (not test:_no_no(12)) then error("Must return true") end
if (not test:_no_no(0)) then error("Must return true") end
if (not test:_no_no("")) then error("Must return true") end
if (not test:_no_no({})) then error("Must return true") end
if (not test:_no_no(-1)) then error("Must return true") end
if (test:_no_no(nil)) then error("Must return false") end
if (test:_eq(12)) then error("Must return false") end
if (test:_eq(0)) then error("Must return false") end
if (test:_eq("")) then error("Must return false") end
if (test:_eq({})) then error("Must return false") end
if (test:_eq(-1)) then error("Must return false") end
if (not test:_eq(nil)) then error("Must return true") end
if (not test:_no_eq(12)) then error("Must return true") end
if (not test:_no_eq(0)) then error("Must return true") end
if (not test:_no_eq("")) then error("Must return true") end
if (not test:_no_eq({})) then error("Must return true") end
if (not test:_no_eq(-1)) then error("Must return true") end
if (test:_no_eq(nil)) then error("Must return false") end


--converting
if (test:_at(10):class()~=smalltalk.Point) then error("Must be aPoint") end
if (test:_at(10):y()~=10) then error("Must be 10") end
if (test:asJSONObject()~=nil) then error("Must be nil") end
if (test:json()~=nil) then error("Must be nil") end


--evaluating
if (test:evaluate()~=nil) then error("Must be nil") end
if (test:value()~=nil) then error("Must be nil") end


Uploaded Image: needsWork.png
--instantiation
--to do tests for subclass:...


--printing
if (test:printString()~="nil") then error("Must be nil") end


--testing
if (test:ifNil_(function() return 43 end)~=43) then error("Must return result of evaluation of aBlock") end
if (test:ifNotNil_(function() return 43 end)~=nil) then error("Must return nil") end
if (test:ifNotNil_ifNil_(nil,function() return 43 end)~=43) then error("Must return 43") end
if (not test:isNil()) then error("Must return true") end
if (test:notNil()) then error("Must return false") end


--cleanup
test=nil