From 3126de536ecc00b924ae8b1253d461455778c61c Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 26 Jul 2024 06:56:57 +0200 Subject: [PATCH] feat: more unit tests --- test/stencil/merger_test.clj | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/stencil/merger_test.clj b/test/stencil/merger_test.clj index f0f7d224..73cd7966 100644 --- a/test/stencil/merger_test.clj +++ b/test/stencil/merger_test.clj @@ -56,11 +56,18 @@ [{:text "asdf{{aaa"}]))) (deftest cleanup-runs-test-redefined-tags - (with-redefs [stencil.types/open-tag "{{" - stencil.types/close-tag "}}"] - (are [x expected] (= expected (vec (cleanup-runs x))) - [{:text "asdf{{1234}}ghi"}] - [{:text "asdf"} {:action "1234"} {:text "ghi"}]))) + (testing "Open-close tags consist of repeating characters" + (with-redefs [stencil.types/open-tag "{{" + stencil.types/close-tag "}}"] + (are [x expected] (= expected (vec (cleanup-runs x))) + [{:text "asdf{{1234}}ghi"}] + [{:text "asdf"} {:action "1234"} {:text "ghi"}]))) + (testing "Open-close tags are more than 2 characters" + (with-redefs [stencil.types/open-tag "<%!" + stencil.types/close-tag "!%>"] + (are [x expected] (= expected (vec (cleanup-runs x))) + [{:text "asdf<%!1234!%>ghi"}] + [{:text "asdf"} {:action "1234"} {:text "ghi"}])))) (defmacro are+ [argv [& exprs] & bodies] (list* 'do (for [e exprs] `(are ~argv ~e ~@bodies))))