summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Listopadov <andreyorst@gmail.com>2023-08-28 22:13:21 +0300
committerAndrey Listopadov <andreyorst@gmail.com>2023-08-28 22:13:21 +0300
commitae389b9480d46091bfd9b6843aebdc48aa577c16 (patch)
treed484cbde3aa9394b8134d40bd55a5bdaaf9bdb17
parent3332e86562d9381c5fcf6a6f5205240f5e9d4f39 (diff)
Update fennel-test, and add test runner script
-rw-r--r--.fennel-test4
-rw-r--r--README.md10
-rw-r--r--cljlib.fnl4
m---------fennel-test0
-rw-r--r--run-tests.fnl8
l---------tests/.dir-locals.el1
-rw-r--r--tests/core.fnl2
-rw-r--r--tests/fn.fnl8
-rw-r--r--tests/macros.fnl2
-rw-r--r--utils/build (renamed from build.fnl)0
-rw-r--r--utils/run-tests8
11 files changed, 35 insertions, 12 deletions
diff --git a/.fennel-test b/.fennel-test
new file mode 100644
index 0000000..d4ab1c7
--- /dev/null
+++ b/.fennel-test
@@ -0,0 +1,4 @@
+;; -*- mode: fennel -*-
+
+{:reporter :dots
+ :searcher-opts {:useMetadata true}}
diff --git a/README.md b/README.md
index 1a879be..4888419 100644
--- a/README.md
+++ b/README.md
@@ -35,11 +35,15 @@ Documentation is auto-generated with [Fenneldoc](https://gitlab.com/andreyorst/f
Please make sure you've read [contribution guidelines][2].
-In order to work on the library, edit the `src/cljlib.fnl` file, then run the `build.fnl` script to produce a self-contained version of the library.
+In order to work on the library, edit the `src/cljlib.fnl` file, then run the following command in the project root:
-Tests can be ran with
+ fennel utils/build
- for test in tests/*.fnl; do fennel --metadata $test; done
+This produces a self-contained version of the library with all dependencies properly included.
+
+Tests can be ran with:
+
+ fennel utils/run-tests
[1]: https://gitlab.com/andreyorst/fennel-cljlib/-/raw/master/cljlib.fnl
[2]: https://gitlab.com/andreyorst/fennel-cljlib/-/tree/master/CONTRIBUTING.md
diff --git a/cljlib.fnl b/cljlib.fnl
index de753ad..29be35e 100644
--- a/cljlib.fnl
+++ b/cljlib.fnl
@@ -675,6 +675,7 @@ accepts sorting function `f`. "
(eval-compiler
(local lib-name (or :lazy-seq))
+
(fn lazy-seq [...]
"Create lazy sequence from the result provided by running the `body'.
Delays the execution until the resulting sequence is consumed.
@@ -1875,8 +1876,7 @@ called. Early termination is supported via `reduced`.
;;; cljlib
(eval-compiler
- (local lib-name
- (or ... :cljlib))
+ (local lib-name (or ... :cljlib))
(fn string? [x]
(= :string (type x)))
diff --git a/fennel-test b/fennel-test
-Subproject 6c27e215aa4f9458463fb1002d9de5177320f57
+Subproject b78eb4c7c8a0abfe26b19ea8468f7904693cfa1
diff --git a/run-tests.fnl b/run-tests.fnl
new file mode 100644
index 0000000..e70fae1
--- /dev/null
+++ b/run-tests.fnl
@@ -0,0 +1,8 @@
+(local t (require :fennel-test.fennel-test))
+
+(local test-modules
+ [:tests.core
+ :tests.fn
+ :tests.macros])
+
+(t.run-tests test-modules)
diff --git a/tests/.dir-locals.el b/tests/.dir-locals.el
deleted file mode 120000
index 0b353b0..0000000
--- a/tests/.dir-locals.el
+++ /dev/null
@@ -1 +0,0 @@
-../fennel-test/.dir-locals.el \ No newline at end of file
diff --git a/tests/core.fnl b/tests/core.fnl
index bd3a4aa..a317436 100644
--- a/tests/core.fnl
+++ b/tests/core.fnl
@@ -1,4 +1,4 @@
-(require-macros :fennel-test)
+(require-macros (doto :fennel-test.fennel-test require))
(import-macros clj (doto :cljlib require))
(local core (require :cljlib))
diff --git a/tests/fn.fnl b/tests/fn.fnl
index eeee017..886c763 100644
--- a/tests/fn.fnl
+++ b/tests/fn.fnl
@@ -1,13 +1,13 @@
-(require-macros :fennel-test)
+(require-macros (doto :fennel-test.fennel-test require))
(require-macros (doto :cljlib require))
(local (meta? fennel) (pcall require :fennel))
(fn meta [x]
(fennel.metadata:get x))
-(deftest test-fn*
+(deftest test-defn
(when meta?
- (testing "fn* meta"
+ (testing "defn meta"
(defn f
"single arity"
[x] x)
@@ -66,7 +66,7 @@
"([[{:a [a b c]}] d e])"]}
(meta f)))
- (testing "defn anonymous calls"
+ (testing "fn* anonymous calls"
(assert-eq ((fn* [])) (values))
(assert-eq ((fn* [] nil)) nil)
(assert-eq ((fn* [x] x) 5) 5)
diff --git a/tests/macros.fnl b/tests/macros.fnl
index 3b3eeba..cf3d455 100644
--- a/tests/macros.fnl
+++ b/tests/macros.fnl
@@ -1,4 +1,4 @@
-(require-macros :fennel-test)
+(require-macros (doto :fennel-test.fennel-test require))
(require-macros (doto :cljlib require))
(local (meta? fennel) (pcall require :fennel))
diff --git a/build.fnl b/utils/build
index 4c3c3db..4c3c3db 100644
--- a/build.fnl
+++ b/utils/build
diff --git a/utils/run-tests b/utils/run-tests
new file mode 100644
index 0000000..e70fae1
--- /dev/null
+++ b/utils/run-tests
@@ -0,0 +1,8 @@
+(local t (require :fennel-test.fennel-test))
+
+(local test-modules
+ [:tests.core
+ :tests.fn
+ :tests.macros])
+
+(t.run-tests test-modules)