Skip to content

Commit

Permalink
STONReaderTests
Browse files Browse the repository at this point in the history
- added testMultiple
- added testStreaming
- added testWhitespace
- improved testError
  • Loading branch information
svenvc committed May 7, 2012
1 parent 6e1c2f1 commit 7498c50
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
tests
testError
self should: [ STON fromString: 'foo' ] raise: STONReaderError.
self should: [ STON fromString: '{foo:}' ] raise: STONReaderError.
self should: [ STON fromString: '{foo,}' ] raise: STONReaderError.
self should: [ STON fromString: '[1,]' ] raise: STONReaderError.
self should: [ STON fromString: '+1' ] raise: STONReaderError.
self should: [ STON fromString: ']' ] raise: STONReaderError.
self should: [ STON fromString: '#' ] raise: STONReaderError
#( 'foo' '{foo:}' '{foo,}' '[1,]' '+1' ']' '#' '' ' ' ' ' 'nul' 'tru' 'fals' ) do: [ :each |
self
should: [ self materialize: each ]
raise: STONReaderError ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tests
testMultiple
| reader |
reader := STON reader
on: '123 -123 nil #foo true [ 0 ] false { #one : 1 }' readStream.
self deny: reader atEnd.
self assert: reader next equals: 123.
self assert: reader next equals: -123.
self assert: reader next equals: nil.
self assert: reader next equals: #foo.
self assert: reader next equals: true.
self assert: reader next equals: { 0 }.
self assert: reader next equals: false.
self assert: reader next equals: (Dictionary with: #one -> 1).
self assert: reader atEnd.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests
testStreaming
| reader |
reader := STON reader
on: '1 2 3 4 5 6 7 8 9 10' readStream.
self
assert: (Array streamContents: [ :stream |
[ reader atEnd] whileFalse: [
stream nextPut: reader next ] ]) sum
equals: #(1 2 3 4 5 6 7 8 9 10) sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests
testWhitespace
| whitespace |
whitespace := { Character space. Character tab. Character cr. Character lf }.
self assert: (self materialize: whitespace, '123') = 123

2 changes: 1 addition & 1 deletion repository/Ston-Tests.package/monticello.meta/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(name 'Ston-Tests-SvenVanCaekenberghe.31' message 'various improvements to the test suite:- use STON to create readers and writers- use STON listClass and mapClass everywhere- use serialize and materialize helper methods- added tests for new empty pretty printed list and map representation' id '027f388e-c237-4d0a-b380-07796844bd8d' date '5 May 2012' time '8:42:20 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.30' message 'Fixed STONWriterTests>>#testFloat in Squeak 4.3' id 'f4c33e92-f025-45ab-9a85-fdb6a79943e6' date '3 May 2012' time '8:57:37.66 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-dkh.29' message 'add explicit tests for Dictionary and IdentityDictionary: 86 run, 86 passes, 0 expected failures, 0 failures, 0 errors, 0 unexpected passes' id 'e8c465d7-edbb-4d0c-adce-12029041544e' date '29 April 2012' time '8:48:15 am' author 'dkh' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.28' message 'tests for JSON backwards compatibility' id 'f1afbac1-b9b5-4042-99b6-eceb9444dd8f' date '27 April 2012' time '2:25:30 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.27' message 'added STONReaderTests>>#testNewSymbol as suggested by Eliot Miranda' id '75770487-03e3-4733-ba3d-6e1af5b88f1c' date '25 April 2012' time '11:32:42 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.26' message 'extended the parser to allow either single or double quotes as String delimiters which gives us JSON backward compatibilty ! (thanks Dale Henrichs for this great idea).' id '4c03b66f-715e-4f00-9ef3-5759faf192a0' date '24 April 2012' time '10:21:58 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.25' message 'changed String from being treated as regular shareable objects to primitive non-shareable objecst (like symbols)' id 'facc5ffd-d2ee-4ca9-bcc8-f53d2e24017c' date '29 February 2012' time '9:55:28 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.24' message 'added STONReaderTests>>#testCharacter' id 'c0399455-9434-4e15-8529-b3f1bb56f740' date '20 February 2012' time '12:51:39 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.23' message 'fixed a bug with simple symbol encoding' id '7e3cc8ec-d11a-4e45-aaa6-4b91e070e815' date '14 February 2012' time '5:55:02 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.22' message 'added a STONTests>>#testPrettyPrinting' id '9c288a67-4219-473c-9b5b-3285a63f886d' date '12 February 2012' time '8:21:42 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.21' message 'various refactoring & cleanup' id '2cc81c5f-9142-4f31-bd0c-81fc6467a5e5' date '12 February 2012' time '7:32:30 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.20' message 'rewrote STONTestUser2>>#fromSton: to new API/semantics' id '13ad4b9e-9dbd-46e4-9c77-7e948ef19e8f' date '12 February 2012' time '3:34:16 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.19' message 'added a mechanism to allow renaming classes, see #stonClass' id '6252296d-92cc-40f2-940d-6108a98169f0' date '12 February 2012' time '10:26:53 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.18' message 'added tests for STONTestDomainObject' id '532104bd-b434-4c03-9c3b-f0059400a039' date '10 February 2012' time '8:55:35 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.17' message 'first optimizations: faster character classification, reusable string stream while reading strings, symbols and class names' id '617a8ffd-ee1d-46bd-96f6-bf16bd227276' date '10 February 2012' time '8:39:27 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.16' message 'implemented generic Collection serialization;added #testCollections' id '2849e545-527d-42ce-8f30-177b646df83e' date '8 February 2012' time '9:10:22 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.15' message 'added tests for Character and Association' id 'a6f2970a-7bf9-4132-9be6-0aef514a12e8' date '8 February 2012' time '3:09:35 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.14' message 'added STONTestUser2 and related tests' id 'edcb2154-f429-4384-89d8-716146309d91' date '8 February 2012' time '9:10:03 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.13' message 'introduced STONReaderError' id '204ef0a1-e10f-46d3-b0a0-d4e7ffcbfbb5' date '24 January 2012' time '10:50:32 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.12' message 'renamed array -> list and dictionary -> map;using STON listClass and mapClass consistently' id '84be935a-121b-4dfc-b267-a600ef302c24' date '24 January 2012' time '10:23:38 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.11' message 'introduction of STON class;renamed array -> list and dictionary -> map' id 'ce040754-f2d2-44cd-b8f8-41a87e43845a' date '24 January 2012' time '10:14:20 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.10' message 'introduced streaming encoding with STONWriter>>#writeObject:stream[ShortArray|Array|Dictionary]:added #testUser tests' id '06f7188c-b4a5-4456-8103-46a094b97df9' date '23 January 2012' time '5:08:46 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.9' message 'moved some methods on STONTestUser from Ston-Core to Ston-Tests' id '191d0826-6aa2-4161-806b-61ae4d94968e' date '23 January 2012' time '2:32:57 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.8' message 'debugged pretty printed output parsing;added support for OrderedCollection;changed pretty printing to write closing tags on a new line' id 'b77073ec-aa89-493e-82e5-da04ed4a7040' date '23 January 2012' time '12:34:35 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.7' message 'added pretty printing to STONWriter;introduced STONWriter>>#encodeShortArray:new STONTestUser class;introduced STONWritePrettyPrintedReadTests subclass of STONWriteReadTests' id 'a16954dc-33c2-4466-9798-fb348f29fedd' date '23 January 2012' time '11:56:08 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.6' message 'added Time and Date support;added STONWriteReadTests' id 'a4072911-13c1-46a7-82a8-68e84944bde6' date '23 January 2012' time '9:55:33 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.5' message 'fixed STONWriterTests>>#testReferenceCycle one should not create cycles in literal method constantsand probably not modify literal method constants in teststhanks a lot Mariano Peck!' id '57792967-d3b8-4c73-bbef-435d0b5f1570' date '22 January 2012' time '8:02:58 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.4' message 'added tests for DateAndTime and TimeStamp' id 'dbbe9cbc-bb66-4cae-8032-000b59b4e751' date '19 January 2012' time '10:07:46 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.3' message 'first working version, except ByteArray materialize' id '6e695c70-abad-474d-9f1f-ce92e3a1c88a' date '18 January 2012' time '9:58:59 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.2' message 'first implementation of Objects and shared references; problems with cycle references' id '6743d4a3-5e93-4f14-b121-707d1c45ab96' date '17 January 2012' time '10:20:11 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.1' message 'basic code working, except full objects and references' id '791d9fce-0b66-412d-b336-16e9058f5b76' date '16 January 2012' time '1:47:22 pm' author 'SvenVanCaekenberghe' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'Ston-Tests-SvenVanCaekenberghe.32' message 'STONReaderTests - added testMultiple- added testStreaming- added testWhitespace- improved testError' id '30414b43-be1e-47ce-a850-dc46f4c04edc' date '7 May 2012' time '2:07:41 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.31' message 'various improvements to the test suite:- use STON to create readers and writers- use STON listClass and mapClass everywhere- use serialize and materialize helper methods- added tests for new empty pretty printed list and map representation' id '027f388e-c237-4d0a-b380-07796844bd8d' date '5 May 2012' time '8:42:20 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.30' message 'Fixed STONWriterTests>>#testFloat in Squeak 4.3' id 'f4c33e92-f025-45ab-9a85-fdb6a79943e6' date '3 May 2012' time '8:57:37.66 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-dkh.29' message 'add explicit tests for Dictionary and IdentityDictionary: 86 run, 86 passes, 0 expected failures, 0 failures, 0 errors, 0 unexpected passes' id 'e8c465d7-edbb-4d0c-adce-12029041544e' date '29 April 2012' time '8:48:15 am' author 'dkh' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.28' message 'tests for JSON backwards compatibility' id 'f1afbac1-b9b5-4042-99b6-eceb9444dd8f' date '27 April 2012' time '2:25:30 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.27' message 'added STONReaderTests>>#testNewSymbol as suggested by Eliot Miranda' id '75770487-03e3-4733-ba3d-6e1af5b88f1c' date '25 April 2012' time '11:32:42 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.26' message 'extended the parser to allow either single or double quotes as String delimiters which gives us JSON backward compatibilty ! (thanks Dale Henrichs for this great idea).' id '4c03b66f-715e-4f00-9ef3-5759faf192a0' date '24 April 2012' time '10:21:58 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.25' message 'changed String from being treated as regular shareable objects to primitive non-shareable objecst (like symbols)' id 'facc5ffd-d2ee-4ca9-bcc8-f53d2e24017c' date '29 February 2012' time '9:55:28 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.24' message 'added STONReaderTests>>#testCharacter' id 'c0399455-9434-4e15-8529-b3f1bb56f740' date '20 February 2012' time '12:51:39 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.23' message 'fixed a bug with simple symbol encoding' id '7e3cc8ec-d11a-4e45-aaa6-4b91e070e815' date '14 February 2012' time '5:55:02 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.22' message 'added a STONTests>>#testPrettyPrinting' id '9c288a67-4219-473c-9b5b-3285a63f886d' date '12 February 2012' time '8:21:42 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.21' message 'various refactoring & cleanup' id '2cc81c5f-9142-4f31-bd0c-81fc6467a5e5' date '12 February 2012' time '7:32:30 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.20' message 'rewrote STONTestUser2>>#fromSton: to new API/semantics' id '13ad4b9e-9dbd-46e4-9c77-7e948ef19e8f' date '12 February 2012' time '3:34:16 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.19' message 'added a mechanism to allow renaming classes, see #stonClass' id '6252296d-92cc-40f2-940d-6108a98169f0' date '12 February 2012' time '10:26:53 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.18' message 'added tests for STONTestDomainObject' id '532104bd-b434-4c03-9c3b-f0059400a039' date '10 February 2012' time '8:55:35 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.17' message 'first optimizations: faster character classification, reusable string stream while reading strings, symbols and class names' id '617a8ffd-ee1d-46bd-96f6-bf16bd227276' date '10 February 2012' time '8:39:27 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.16' message 'implemented generic Collection serialization;added #testCollections' id '2849e545-527d-42ce-8f30-177b646df83e' date '8 February 2012' time '9:10:22 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.15' message 'added tests for Character and Association' id 'a6f2970a-7bf9-4132-9be6-0aef514a12e8' date '8 February 2012' time '3:09:35 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.14' message 'added STONTestUser2 and related tests' id 'edcb2154-f429-4384-89d8-716146309d91' date '8 February 2012' time '9:10:03 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.13' message 'introduced STONReaderError' id '204ef0a1-e10f-46d3-b0a0-d4e7ffcbfbb5' date '24 January 2012' time '10:50:32 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.12' message 'renamed array -> list and dictionary -> map;using STON listClass and mapClass consistently' id '84be935a-121b-4dfc-b267-a600ef302c24' date '24 January 2012' time '10:23:38 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.11' message 'introduction of STON class;renamed array -> list and dictionary -> map' id 'ce040754-f2d2-44cd-b8f8-41a87e43845a' date '24 January 2012' time '10:14:20 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.10' message 'introduced streaming encoding with STONWriter>>#writeObject:stream[ShortArray|Array|Dictionary]:added #testUser tests' id '06f7188c-b4a5-4456-8103-46a094b97df9' date '23 January 2012' time '5:08:46 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.9' message 'moved some methods on STONTestUser from Ston-Core to Ston-Tests' id '191d0826-6aa2-4161-806b-61ae4d94968e' date '23 January 2012' time '2:32:57 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.8' message 'debugged pretty printed output parsing;added support for OrderedCollection;changed pretty printing to write closing tags on a new line' id 'b77073ec-aa89-493e-82e5-da04ed4a7040' date '23 January 2012' time '12:34:35 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.7' message 'added pretty printing to STONWriter;introduced STONWriter>>#encodeShortArray:new STONTestUser class;introduced STONWritePrettyPrintedReadTests subclass of STONWriteReadTests' id 'a16954dc-33c2-4466-9798-fb348f29fedd' date '23 January 2012' time '11:56:08 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.6' message 'added Time and Date support;added STONWriteReadTests' id 'a4072911-13c1-46a7-82a8-68e84944bde6' date '23 January 2012' time '9:55:33 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.5' message 'fixed STONWriterTests>>#testReferenceCycle one should not create cycles in literal method constantsand probably not modify literal method constants in teststhanks a lot Mariano Peck!' id '57792967-d3b8-4c73-bbef-435d0b5f1570' date '22 January 2012' time '8:02:58 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.4' message 'added tests for DateAndTime and TimeStamp' id 'dbbe9cbc-bb66-4cae-8032-000b59b4e751' date '19 January 2012' time '10:07:46 am' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.3' message 'first working version, except ByteArray materialize' id '6e695c70-abad-474d-9f1f-ce92e3a1c88a' date '18 January 2012' time '9:58:59 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.2' message 'first implementation of Objects and shared references; problems with cycle references' id '6743d4a3-5e93-4f14-b121-707d1c45ab96' date '17 January 2012' time '10:20:11 pm' author 'SvenVanCaekenberghe' ancestors ((name 'Ston-Tests-SvenVanCaekenberghe.1' message 'basic code working, except full objects and references' id '791d9fce-0b66-412d-b336-16e9058f5b76' date '16 January 2012' time '1:47:22 pm' author 'SvenVanCaekenberghe' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
Expand Down

0 comments on commit 7498c50

Please sign in to comment.