Skip to content

Commit 7922a97

Browse files
committed
move compile time tests to the right places, remove default directive compile time tests
1 parent 3b62686 commit 7922a97

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

‎src/test/cljs/cljs/destructuring_test.cljs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,7 @@
442442
(testing "all turns nothing into something"
443443
(is (= {:a 42} (let [{:keys [a] :or {a 42} :all m} nil] m)))
444444
(is (= {:a 42} (let [{:keys [a] :or {a 42} :all m} {}] m)))
445-
(is (= {:n {:a 42}} (let [{{a :a :or {a 42}} :n :all m} {:n nil}] m))))
446-
#_(testing ":or defaults must correspond to binding with :all"
447-
(is (thrown? Exception (eval '(let [{:keys [a] :or {a 1 z 2} :all m} {}] m))))))
445+
(is (= {:n {:a 42}} (let [{{a :a :or {a 42}} :n :all m} {:n nil}] m)))))
448446
(testing ":or defaults applied in :all"
449447
(is (= {:a 1} (let [{:keys [a] :or {a 42} :all m} {:a 1}] m)))
450448
(is (= {:n {:a 42}} (let [{{a :a :or {a 42}} :n :all m} nil] m)))
@@ -460,9 +458,7 @@
460458
(is (= {:z 42 :a 1 :b 2}
461459
(let [{:keys [a b & :c :z] :or {:z 42} :all m} {:a 1 :b 2}] m)))
462460
(is (= {:z 100 :a 1 :b 2}
463-
(let [{:keys [a b & :c :z] :or {:z 42} :all m} {:a 1 :b 2 :z 100}] m)))
464-
#_(testing ":or defaults must correspond to binding with :all plus &"
465-
(is (thrown? Exception (eval '(let [{:keys [a b & :c] :or {c 42} :all m} {:a 1 :b 2}] m))))))
461+
(let [{:keys [a b & :c :z] :or {:z 42} :all m} {:a 1 :b 2 :z 100}] m))))
466462
(testing "combinations"
467463
(let [sample-map {:a 1, :b 2, :c {:aa 10},
468464
'd 4, 'e 5, 'f {'dd 40},

‎src/test/clojure/cljs/compiler_tests.clj‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@
452452
(deftest syms-bang
453453
(testing "that right of & is unbound (compile-time errors)"
454454
(is (undeclared-warning? '(let [{:syms! [a & 'b]} (quote {a 1 b 2})] b) 'b))
455-
#_(is (undeclared-warning? '(let [{a a {aa a :as m :syms [b c & 'e]} :b} (quote {a 1 b 2})] e) 'e))
456455
(is (undeclared-warning? '(let [{:syms! [foo/a & 'foo/c]} (quote {a 1 b 2})] c) 'c))
457456
(is (undeclared-warning? '(let [{:foo/syms! [foo/aa & 'foo/cc]} (quote {foo/aa 1 bb 2 foo/cc 3})] cc) 'cc))))
458457

@@ -461,14 +460,11 @@
461460
(is (undeclared-warning? '(let [{:strs! [a & "b"]} {"a" 1 "b" 2}] b) 'b))
462461
(is (undeclared-warning? '(let [{a "a" {aa "a" :as m :keys [b c & "e"]} "b"} {"a" 1 "b" 2}] e) 'e))))
463462

464-
(deftest select-or-defaults
465-
(testing ":defaults"
466-
(is (thrown? Exception
467-
(compile-simple-form
468-
'(let [{:defaults d :or {:a 1}} {}] d)))))
469-
(testing "known compile-time errors"
470-
(is (thrown? Exception (compile-simple-form '(let [{:keys [a] :defaults d :or {:a 1, a 1}} {}] d))))
471-
(is (thrown? Exception (compile-simple-form '(let [{:defaults d} {}] d))))))
463+
(deftest all-directive
464+
(testing ":or defaults must correspond to binding with :all"
465+
(is (thrown? Exception (compile-simple-form '(let [{:keys [a] :or {a 1 z 2} :all m} {}] m)))))
466+
(testing ":or defaults must correspond to binding with :all plus &"
467+
(is (thrown? Exception (compile-simple-form '(let [{:keys [a b & :c] :or {c 42} :all m} {:a 1 :b 2}] m))))))
472468

473469
;; CLJS-1225
474470

0 commit comments

Comments
 (0)