Skip to content

Commit

Permalink
CLJ-1234: Reader allows whitespace after #record.name and before {
Browse files Browse the repository at this point in the history
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information
jafingerhut authored and stuarthalloway committed Oct 25, 2013
1 parent 0b73494 commit 67c02f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jvm/clojure/lang/LispReader.java
Expand Up @@ -1201,8 +1201,8 @@ private Object readRecord(PushbackReader r, Symbol recordName){
int ch = read1(r);

// flush whitespace
//while(isWhitespace(ch))
// ch = read1(r);
while(isWhitespace(ch))
ch = read1(r);

// A defrecord ctor can take two forms. Check for map->R version first.
if(ch == '{')
Expand Down
4 changes: 4 additions & 0 deletions test/clojure/test_clojure/protocols.clj
Expand Up @@ -436,6 +436,10 @@
(is (thrown? Exception (read-string "(let [s \"en\"] #java.util.Locale[(str 'en)])")))
(is (thrown? Exception (read-string "#clojure.test_clojure.protocols.RecordToTestLiterals{(keyword \"a\") 42}"))))

(testing "that ctors can have whitespace after class name but before {"
(is (= (RecordToTestLiterals. 42)
(read-string "#clojure.test_clojure.protocols.RecordToTestLiterals {:a 42}"))))

(testing "that the correct errors are thrown with malformed literals"
(is (thrown-with-msg?
Exception
Expand Down

0 comments on commit 67c02f2

Please sign in to comment.