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

test[m8n] 71 SmalltalkParser

--comments
if (('"aComment" 1'):evaluate()~=1) then error("Must be 1") end
if (('" single line comment " 1'):evaluate()~=1) then error("Must be 1") end
if (('" multi-line\ncomment " 1'):evaluate()~=1) then error("Must be 1") end

--separators
if ((' 		\n\t1'):evaluate()~=1) then error("Must be 1") end

--strings
if (("'hello'"):evaluate()~="hello") then error("Must be 'hello'") end
if (("#hello"):evaluate()~="hello") then error("Must be #hello") end
if (("'hello''world'"):evaluate()~="hello'world") then error("Failed") end
if (("$A"):evaluate()~="A") then error("Must be A") end
if (("$#,$'"):evaluate()~="#'") then error("Must be #'") end

--hashedstrings
if (("#'hello'=#hello"):evaluate()~=true) then error("Must be true") end
if ((smalltalk.SmalltalkParser:new():_comma("#'"):_comma(smalltalk.PPStStringParser:new())):parse_(("#'hello'"):stream()):size()~=2) then error("Must be Array of size 2") end
if ((smalltalk.SmalltalkParser:new():_comma("#'"):_comma(smalltalk.PPStStringParser:new())):parse_(("#'hello'"):stream()):first()~="#'") then error("Must be #'") end
if ((smalltalk.SmalltalkParser:new():_comma("#'"):_comma(smalltalk.PPStStringParser:new())):parse_(("#'hello'"):stream()):last()~="hello") then error("Must be hello") end