steps 1 and 9: Test that hash-map keys stay as strings.
authorBen Harris <bjh21@bjh21.me.uk>
Sun, 7 Jul 2019 17:36:07 +0000 (18:36 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Sun, 7 Jul 2019 17:36:07 +0000 (18:36 +0100)
Specifically, test that when "1" is used as a hash-map key, it is
represented as a string when printed (step 1) and when returned by
'keys' (step 9).  PHP used to get both of these wrong.

tests/step1_read_print.mal
tests/step9_try.mal

index 5a2b915..2abb4e9 100644 (file)
@@ -155,6 +155,8 @@ false
 ;=>{"a" {"b" {"cde" 3}}}
 {  :a  {:b   {  :cde     3   }  }}
 ;=>{:a {:b {:cde 3}}}
+{"1" 1}
+;=>{"1" 1}
 
 ;; Testing read of comments
  ;; whole line comment (not an exception)
index 077c2c4..1f90e31 100644 (file)
 (keys hm2)
 ;=>("a")
 
+(keys {"1" 1})
+;=>("1")
+
 ;;; TODO: fix. Clojure returns nil but this breaks mal impl
 (vals hm1)
 ;=>()