|
112 | 112 | '(hello you))) |
113 | 113 |
|
114 | 114 |
|
115 | | -(is (= 1 (reader/read-string "1"))) |
116 | | -(is (= 2 (reader/read-string "#_nope 2"))) |
117 | | -(is (= -1 (reader/read-string "-1"))) |
118 | | -(is (= -1.5 (reader/read-string "-1.5"))) |
119 | | -(is (= [3 4] (reader/read-string "[3 4]"))) |
120 | | -(is (= "foo" (reader/read-string "\"foo\""))) |
121 | | -(is (= ':hello (reader/read-string ":hello"))) |
122 | | -(is (= 'goodbye (reader/read-string "goodbye"))) |
123 | | -(is (= '#{1 2 3} (reader/read-string "#{1 2 3}"))) |
124 | | -(is (= '(7 8 9) (reader/read-string "(7 8 9)"))) |
125 | | -(is (= '(deref foo) (reader/read-string "@foo"))) |
126 | | -(is (= '(quote bar) (reader/read-string "'bar"))) |
| 115 | +(is (= 1 (read-string "1"))) |
| 116 | +(is (= 2 (read-string "#_nope 2"))) |
| 117 | +(is (= -1 (read-string "-1"))) |
| 118 | +(is (= -1.5 (read-string "-1.5"))) |
| 119 | +(is (= [3 4] (read-string "[3 4]"))) |
| 120 | +(is (= "foo" (read-string "\"foo\""))) |
| 121 | +(is (= ':hello (read-string ":hello"))) |
| 122 | +(is (= 'goodbye (read-string "goodbye"))) |
| 123 | +(is (= '#{1 2 3} (read-string "#{1 2 3}"))) |
| 124 | +(is (= '(7 8 9) (read-string "(7 8 9)"))) |
| 125 | +(is (= '(deref foo) (read-string "@foo"))) |
| 126 | +(is (= '(quote bar) (read-string "'bar"))) |
127 | 127 |
|
128 | 128 | ;; TODO: Implement `namespace` fn and proper namespace support ? |
129 | | -;;(assert (= 'foo/bar (reader/read-string "foo/bar"))) |
130 | | -;;(assert (= ':foo/bar (reader/read-string ":foo/bar"))) |
131 | | -(is (= \a (reader/read-string "\\a"))) |
| 129 | +;;(assert (= 'foo/bar (read-string "foo/bar"))) |
| 130 | +;;(assert (= ':foo/bar (read-string ":foo/bar"))) |
| 131 | +(is (= \a (read-string "\\a"))) |
132 | 132 | (is (= 'String |
133 | | - (:tag (meta (reader/read-string "^String {:a 1}"))))) |
| 133 | + (:tag (meta (read-string "^String {:a 1}"))))) |
134 | 134 | ;; TODO: In quoted sets both keys and values should remain quoted |
135 | 135 | ;; (assert (= [:a 'b '#{c {:d [:e :f :g]}}] |
136 | | -;; (reader/read-string "[:a b #{c {:d [:e :f :g]}}]"))) |
137 | | -(is (= nil (reader/read-string "nil"))) |
138 | | -(is (= true (reader/read-string "true"))) |
139 | | -(is (= false (reader/read-string "false"))) |
140 | | -(is (= "string" (reader/read-string "\"string\""))) |
| 136 | +;; (read-string "[:a b #{c {:d [:e :f :g]}}]"))) |
| 137 | +(is (= nil (read-string "nil"))) |
| 138 | +(is (= true (read-string "true"))) |
| 139 | +(is (= false (read-string "false"))) |
| 140 | +(is (= "string" (read-string "\"string\""))) |
141 | 141 | (is (= "escape chars \t \r \n \\ \" \b \f" |
142 | | - (reader/read-string "\"escape chars \\t \\r \\n \\\\ \\\" \\b \\f\""))) |
| 142 | + (read-string "\"escape chars \\t \\r \\n \\\\ \\\" \\b \\f\""))) |
143 | 143 |
|
144 | 144 |
|
145 | 145 | ;; queue literals |
146 | 146 | (is (= '(PersistentQueue. []) |
147 | | - (reader/read-string "#queue []"))) |
| 147 | + (read-string "#queue []"))) |
148 | 148 | (is (= '(PersistentQueue. [1]) |
149 | | - (reader/read-string "#queue [1]"))) |
| 149 | + (read-string "#queue [1]"))) |
150 | 150 | (is (= '(PersistentQueue. [1 2]) |
151 | | - (reader/read-string "#queue [1 2]"))) |
| 151 | + (read-string "#queue [1 2]"))) |
152 | 152 |
|
153 | 153 | ;; uuid literals |
154 | 154 | (is (= '(UUID. "550e8400-e29b-41d4-a716-446655440000") |
155 | | - (reader/read-string "#uuid \"550e8400-e29b-41d4-a716-446655440000\""))) |
| 155 | + (read-string "#uuid \"550e8400-e29b-41d4-a716-446655440000\""))) |
156 | 156 |
|
157 | 157 | (let [assets |
158 | 158 | ["اختبار" ; arabic |
|
204 | 204 | (is |
205 | 205 | (= :threw |
206 | 206 | (try |
207 | | - (reader/read-string unicode-error) |
| 207 | + (read-string unicode-error) |
208 | 208 | :failed-to-throw |
209 | 209 | (catch e :threw))) |
210 | 210 | (str "Failed to throw reader error for: " unicode-error))) |
|
0 commit comments