Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CLJS-787: cljs.reader does not read blank string as nil

set `cljs.reader/read-string` `eof-is-error` param to `cljs.reader/read`
to false just like Clojure's EDN reader
  • Loading branch information...
commit 279157ac526f7aa0b01b95091821491f574024eb 1 parent c1a29f1
David Nolen authored
Showing with 7 additions and 5 deletions.
  1. +1 −1  src/cljs/cljs/reader.cljs
  2. +6 −4 test/cljs/cljs/reader_test.cljs
2  src/cljs/cljs/reader.cljs
View
@@ -432,7 +432,7 @@ nil if the end of stream has been reached")
"Reads one object from the string s"
[s]
(let [r (push-back-reader s)]
- (read r true nil false)))
+ (read r false nil false)))
;; read instances
10 test/cljs/cljs/reader_test.cljs
View
@@ -43,10 +43,8 @@
(reader/read-string "#queue [1 2]")))
;; comments
- (assert (= :threw (try
- (reader/read-string ";foo")
- :failed-to-throw
- (catch js/Error e :threw))))
+ (assert (nil? (reader/read-string ";foo")))
+
(assert (= 3 (try
(reader/read-string ";foo\n3")
(catch js/Error e :threw))))
@@ -166,4 +164,8 @@
(assert (array? (aget (reader/read-string "#js {\"foo\" #js [1 2 3]}") "foo")))
(assert (= (seq (aget (reader/read-string "#js {\"foo\" #js [1 2 3]}") "foo")) '(1 2 3)))
+ ;; CLJS-787
+
+ (assert (nil? (reader/read-string "")))
+
:ok)
Please sign in to comment.
Something went wrong with that request. Please try again.