Skip to content

Commit

Permalink
Add recur tail tests
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Oct 11, 2024
1 parent 9aebc2b commit 09589dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/sci/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,9 @@
(it-works '(fn [] (and 1 2 3 (recur))))
(is (thrown-with-msg?
Exception #"Cannot recur across try"
(sci/eval-string "(defn foo [] (try (recur)))")))))
(sci/eval-string "(defn foo [] (try (recur)))")))
#?(:clj (do (throws-tail-ex '(String/new (recur)))
(throws-tail-ex '(String/.length (recur)))))))

(deftest loop-test
(is (= 2 (tu/eval* "(loop [[x y] [1 2]] (if (= x 3) y (recur [(inc x) y])))" {})))
Expand Down

0 comments on commit 09589dd

Please sign in to comment.