babashka/test-resources/lib_tests/comb/test/template.clj
Gabriel Horner 4e7d04f672
Add libtest (#1112)
* Add add-libtest script and add 2 libraries with it

* Add tests for 3 existing libraries
2021-12-21 19:25:10 +01:00

15 lines
456 B
Clojure

(ns comb.test.template
(:use clojure.test)
(:require [comb.template :as t] :reload))
(deftest eval-test
(is (= (t/eval "foo") "foo"))
(is (= (t/eval "<%= 10 %>") "10"))
(is (= (t/eval "<%= x %>" {:x "foo"}) "foo"))
(is (= (t/eval "<%=x%>" {:x "foo"}) "foo"))
(is (= (t/eval "<% (doseq [x xs] %>foo<%= x %> <% ) %>" {:xs [1 2 3]})
"foo1 foo2 foo3 ")))
(deftest fn-test
(is (= ((t/fn [x] "foo<%= x %>") "bar")
"foobar")))