From 80512fcc844d8ee9f24cbdf3b568865e8bf32f5e Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 7 Jul 2019 18:36:07 +0100 Subject: [PATCH] steps 1 and 9: Test that hash-map keys stay as strings. 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 | 2 ++ tests/step9_try.mal | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tests/step1_read_print.mal b/tests/step1_read_print.mal index 5a2b9155..2abb4e9c 100644 --- a/tests/step1_read_print.mal +++ b/tests/step1_read_print.mal @@ -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) diff --git a/tests/step9_try.mal b/tests/step9_try.mal index 077c2c44..1f90e31a 100644 --- a/tests/step9_try.mal +++ b/tests/step9_try.mal @@ -233,6 +233,9 @@ (keys hm2) ;=>("a") +(keys {"1" 1}) +;=>("1") + ;;; TODO: fix. Clojure returns nil but this breaks mal impl (vals hm1) ;=>()