[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[sharing] S8-VSE 01 literals
Reading tests of well known S8 literals.
To evaluate this tests in VSE
- Ensure Objectifier is loaded
- add the method Object>>#asObject (from the index page of this tests)
- evaluate the following expressions in a workspace
Testset
"Reading nil"
'{"origin":"S8","id":1,"contents":null}' asObject notNil ifTrue: [ self error: 'Must be nil' ].
"Reading #hello"
'{"origin":"S8","id":1,"contents":"hello"}' asObject ~= 'hello' ifTrue: [ self error: 'Wrong result' ].
"Reading 123"
'{"origin":"S8","id":1,"contents":123}' asObject ~= 123 ifTrue: [ self error: 'Wrong result' ].
"Reading 0"
'{"origin":"S8","id":1,"contents":0}' asObject ~= 0 ifTrue: [ self error: 'Wrong result' ].
"Reading 0.123"
'{"origin":"S8","id":1,"contents":0.123}' asObject ~= 0.123 ifTrue: [ self error: 'Wrong result' ].
"Reading a Class"
'{"origin":"S8","id":2,"contents":{"id":2,"global":"Point","allInstVarNames":["x","y"]}}' asObject ~= Point ifTrue: [ self error: 'Wrong result' ].
"Reading a Metaclass"
'{"origin":"S8","id":2,"contents":{"id":2,"global":["Point","class"]}}' asObject ~= Point class ifTrue: [ self error: 'Wrong result' ].
"Reading true"
'{"origin":"S8","id":1,"contents":true}' asObject ~= true ifTrue: [ self error: 'Wrong result' ].
| "Reading anArray - Note that we return OrderedCollection in VSE"
'{"origin":"S8","id":1,"contents":[1,2,"three",123]}' asObject asArray ~= #(1 2 three 123) ifTrue: [ self error: 'Wrong result' ].
|