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

test[sharing] S8-S8 01 literals

Prerequisites

"Ensure Stringifier is present"
self
    require: #Stringifier
    in: #('u8:aleReimondo/sharing/Stringifier.st.js')


Two way sharing of literals.

"I/O nil"
(Stringifier @ nil) asObject notNil ifTrue: [ self error: 'Must be nil' ].


"I/O #hello"
(Stringifier @ #hello) asObject ~= #hello ifTrue: [ self error: 'Wrong result' ].


"I/O 123"
(Stringifier @ 123) asObject ~= 123 ifTrue: [ self error: 'Wrong result' ].


"I/O 0"
(Stringifier @ 0) asObject ~= 0 ifTrue: [ self error: 'Wrong result' ].


"I/O 0.123"
(Stringifier @ 0.123) asObject ~= 0.123 ifTrue: [ self error: 'Wrong result' ].


"I/O a Class"
(Stringifier @ Point) asObject ~= Point ifTrue: [ self error: 'Wrong result' ].


"I/O a Metaclass"
(Stringifier @ Point class) asObject ~= Point class ifTrue: [ self error: 'Wrong result' ].


"I/O true"
(Stringifier @ true) asObject ~= true ifTrue: [ self error: 'Wrong result' ].


"I/O anArray"
(Stringifier @ #(1 2 three 123)) asObject ~= #(1 2 three 123) ifTrue: [ self error: 'Wrong result' ].