@@ -168,6 +168,10 @@ def test_print_readably(lcompile: CompileFn):
168168 ("##Inf" , "(pr-str ##Inf)" ),
169169 ("##-Inf" , "(pr-str ##-Inf)" ),
170170 ('"hi"' , '(pr-str "hi")' ),
171+ ("sym" , "(pr-str 'sym)" ),
172+ ("some.ns/sym" , "(pr-str 'some.ns/sym)" ),
173+ (":kw" , "(pr-str :kw)" ),
174+ (":some.ns/kw" , "(pr-str :some.ns/kw)" ),
171175 ('"Hello\\ nworld!"' , '(pr-str "Hello\n world!")' ),
172176 (r'"\"Hello world!\""' , r'(pr-str "\"Hello world!\"")' ),
173177 (
@@ -196,6 +200,8 @@ def test_print_readably(lcompile: CompileFn):
196200 ("#py #{:a}" , "(pr-str #py #{:a})" ),
197201 ("#py ()" , "(pr-str #py ())" ),
198202 ('#py (:a 1 "s")' , '(pr-str #py (:a 1 "s"))' ),
203+ ("#'basilisp.core/pr-str" , "(pr-str #'pr-str)" ),
204+ ("basilisp.lrepr-test" , "(pr-str *ns*)" ),
199205 ],
200206)
201207def test_lrepr (lcompile : CompileFn , repr : str , code : str ):
@@ -267,6 +273,10 @@ def test_lrepr_round_trip_special_cases(lcompile: CompileFn):
267273 ("##NaN" , "(print-str ##NaN)" ),
268274 ("##Inf" , "(print-str ##Inf)" ),
269275 ("##-Inf" , "(print-str ##-Inf)" ),
276+ ("sym" , "(print-str 'sym)" ),
277+ ("some.ns/sym" , "(print-str 'some.ns/sym)" ),
278+ (":kw" , "(print-str :kw)" ),
279+ (":some.ns/kw" , "(print-str :some.ns/kw)" ),
270280 ("hi" , '(print-str "hi")' ),
271281 ("Hello\n world!" , '(print-str "Hello\n world!")' ),
272282 ('"Hello world!"' , r'(print-str "\"Hello world!\"")' ),
@@ -277,14 +287,8 @@ def test_lrepr_round_trip_special_cases(lcompile: CompileFn):
277287 ),
278288 # In Clojure, (print-str #uuid "...") produces '#uuid "..."' but in Basilisp
279289 # print-str is tied directly to str (which in Clojure simply returns the string
280- # part of the UUID).
281- #
282- # I'm not sure which one is right, but it feels a little inconsistent on the
283- # Clojure side. For now, I'm erring on the side of preferring for str to return
284- # only the string portion of the UUID and have print-str be slightly wrong.
285- #
286- # Maybe at some point, we can deep dive on whether Clojure is in error or if
287- # Basilisp should just try harder to match the Clojure side regardless.
290+ # part of the UUID). I believe the more correct approach is Basilisp's, so
291+ # I am leaving this as it is.
288292 (
289293 "81f35603-0408-4b3d-bbc0-462e3702747f" ,
290294 '(print-str #uuid "81f35603-0408-4b3d-bbc0-462e3702747f")' ,
@@ -298,6 +302,8 @@ def test_lrepr_round_trip_special_cases(lcompile: CompileFn):
298302 ("#py ()" , "(print-str #py ())" ),
299303 ("#py {}" , "(print-str #py {})" ),
300304 ("#py #{}" , "(print-str #py #{})" ),
305+ ("#'basilisp.core/print-str" , "(print-str #'print-str)" ),
306+ ("basilisp.lrepr-test" , "(print-str *ns*)" ),
301307 ],
302308)
303309def test_lstr (lcompile : CompileFn , s : str , code : str ):
@@ -320,6 +326,10 @@ def test_lstr(lcompile: CompileFn, s: str, code: str):
320326 ("##NaN" , "(str ##NaN)" ),
321327 ("##Inf" , "(str ##Inf)" ),
322328 ("##-Inf" , "(str ##-Inf)" ),
329+ ("sym" , "(str 'sym)" ),
330+ ("some.ns/sym" , "(str 'some.ns/sym)" ),
331+ (":kw" , "(str :kw)" ),
332+ (":some.ns/kw" , "(str :some.ns/kw)" ),
323333 ("hi" , '(str "hi")' ),
324334 ("Hello\n world!" , '(str "Hello\n world!")' ),
325335 ('"Hello world!"' , r'(str "\"Hello world!\"")' ),
@@ -332,7 +342,7 @@ def test_lstr(lcompile: CompileFn, s: str, code: str):
332342 "81f35603-0408-4b3d-bbc0-462e3702747f" ,
333343 '(str #uuid "81f35603-0408-4b3d-bbc0-462e3702747f")' ,
334344 ),
335- ('# "\\ s"' , '(str #"\\ s")' ),
345+ ("\\ s" , '(str #"\\ s")' ),
336346 (
337347 '#inst "2018-11-28T12:43:25.477000+00:00"' ,
338348 '(str #inst "2018-11-28T12:43:25.477-00:00")' ,
@@ -341,6 +351,8 @@ def test_lstr(lcompile: CompileFn, s: str, code: str):
341351 ('#py ("a" 1 false)' , '(str #py ("a" 1 false))' ),
342352 ('#py {"a" "b"}' , '(str #py {"a" "b"})' ),
343353 ("#py #{}" , "(str #py #{})" ),
354+ ("#'basilisp.core/str" , "(str #'str)" ),
355+ ("basilisp.lrepr-test" , "(str *ns*)" ),
344356 ("abc" , '(str "abc")' ),
345357 ("false" , "(str false)" ),
346358 ("123" , "(str 123)" ),
0 commit comments