ed56ff3ab224

Add simple test for multiple objects in a stream
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 11 Aug 2020 23:45:07 -0400
parents b8a38e34e840
children a450f8f200cd
branches/tags (none)
files .TODO.done TODO test/tests.lisp

Changes

--- a/.TODO.done	Tue Aug 11 23:27:35 2020 -0400
+++ b/.TODO.done	Tue Aug 11 23:45:07 2020 -0400
@@ -0,0 +1,1 @@
+Add basic unit tests | id:ed372a368fce619ce8230043635de5258212f607
--- a/TODO	Tue Aug 11 23:27:35 2020 -0400
+++ b/TODO	Tue Aug 11 23:45:07 2020 -0400
@@ -6,4 +6,3 @@
 Add dynamic extent wrapper definition | id:a937f1179ff1fac77ca501ce7c70449464411f58
 Add fuzz tests against other implementations | id:cd53968480f72453ee820d65a180efe6da0fef71
 Add extra key preservation | id:cfb63b37d87893083fc98477ec3d488fb909a984
-Add basic unit tests | id:ed372a368fce619ce8230043635de5258212f607
--- a/test/tests.lisp	Tue Aug 11 23:27:35 2020 -0400
+++ b/test/tests.lisp	Tue Aug 11 23:45:07 2020 -0400
@@ -127,6 +127,17 @@
   (#(1 2 3 4 5) "  [  1,    2   ,3,    4,5]"))
 
 
+(define-test multiple-objects
+  (with-input-from-string (s (json "{} 1 2 [true, false] {'foo': null}"))
+    (is (same (h) (jarl:read t s)))
+    (is (same 1 (jarl:read t s)))
+    (is (same 2 (jarl:read t s)))
+    (is (same #(:true :false) (jarl:read t s)))
+    (is (same (h "foo" nil) (jarl:read t s)))
+    (is (eql :eof (jarl:read t s nil :eof)))
+    (signals end-of-file (jarl:read t s))))
+
+
 ;;;; Real-World Data ----------------------------------------------------------
 (defmacro define-file-test (name (object path) &body body)
   `(define-test ,name