summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Listopadov <andreyorst@gmail.com>2021-04-24 15:32:55 +0300
committerAndrey Listopadov <andreyorst@gmail.com>2021-04-24 15:35:15 +0300
commita8948ed1964033a437933db8c687d8c8e26bde44 (patch)
treeff8b31a2155b5360bc94aea44c8bf99394e76efa
parent54294f7c864b9597c3775793015f600b1022594f (diff)
fix: move test library to separate project
-rw-r--r--.depend.mk6
-rw-r--r--.fenneldoc9
-rw-r--r--.gitmodules4
-rw-r--r--CHANGELOG.md8
-rw-r--r--Makefile2
-rw-r--r--doc/cljlib.md4
-rw-r--r--doc/macros.md4
-rw-r--r--doc/tests/test.md97
m---------fennel-test0
-rw-r--r--init.fnl5
-rw-r--r--macros.fnl5
-rw-r--r--tests/core.fnl2
-rw-r--r--tests/fn.fnl2
-rw-r--r--tests/macros.fnl2
-rw-r--r--tests/test.fnl136
15 files changed, 31 insertions, 255 deletions
diff --git a/.depend.mk b/.depend.mk
index a93e35b..cce5b25 100644
--- a/.depend.mk
+++ b/.depend.mk
@@ -1,4 +1,4 @@
init.lua: init.fnl macros.fnl
-tests/core.lua: tests/core.fnl macros.fnl tests/test.fnl init.fnl
-tests/macros.lua: tests/macros.fnl macros.fnl tests/test.fnl
-tests/fn.lua: tests/fn.fnl macros.fnl tests/test.fnl
+tests/core.lua: tests/core.fnl macros.fnl init.fnl
+tests/macros.lua: tests/macros.fnl macros.fnl
+tests/fn.lua: tests/fn.fnl macros.fnl
diff --git a/.fenneldoc b/.fenneldoc
index f21f4b9..720ab5e 100644
--- a/.fenneldoc
+++ b/.fenneldoc
@@ -3,8 +3,11 @@
;; https://gitlab.com/andreyorst/fenneldoc
{:ignored-args-patterns ["[a-z]" "%.%.%." "[xkf]s" "kvs" "col[0-9]" "cols?" "rest" "more" "keys" "tbl" "args"]
- :test-requirements {:init.fnl "(import-macros {: assert-eq : assert-ne : assert-is : assert-not} :tests.test)"
+ :project-version "0.5.3"
+ :project-license "[MIT](https://gitlab.com/andreyorst/fennel-cljlib/-/raw/master/LICENSE)"
+ :project-copyright "Copyright (C) 2020-2021 Andrey Listopadov"
+ :test-requirements {:init.fnl "(import-macros {: assert-eq : assert-ne : assert-is : assert-not} :fennel-test.test)"
:macros.fnl "(require-macros :macros)
- (import-macros {: assert-eq} :tests.test)
+ (import-macros {: assert-eq} :fennel-test.test)
(local {: eq : vector : hash-map} (require :init))"
- :tests/test.fnl "(require-macros :tests.test)"}}
+ :tests/test.fnl "(require-macros :fennel-test.test)"}}
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..a7b93c6
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "fennel-test"]
+ path = fennel-test
+ url = https://gitlab.com/andreyorst/fennel-test.git
+ branch = v0.0.1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84f6366..fa03491 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## Cljlib v0.5.3 (2021-04-24)
+
+- test library is now external dependency.
+
+## Cljlib v0.5.2 (2021-03-16)
+
+- `conj` fix for better Luajit compatibility.
+
## Cljlib v0.5.1 (2021-02-19)
- `eq` will no longer change metamethods of tables.
diff --git a/Makefile b/Makefile
index 43682e5..864842d 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ FENNEL ?= fennel
FNLSOURCES = init.fnl
LUASOURCES = $(FNLSOURCES:.fnl=.lua)
FNLTESTS = tests/fn.fnl tests/macros.fnl tests/core.fnl
-FNLDOCS = init.fnl macros.fnl tests/test.fnl
+FNLDOCS = init.fnl macros.fnl
LUATESTS = $(FNLTESTS:.fnl=.lua)
LUA_EXECUTABLES ?= lua luajit
FENNELDOC := $(shell command -v fenneldoc)
diff --git a/doc/cljlib.md b/doc/cljlib.md
index a486bdf..8f6df8b 100644
--- a/doc/cljlib.md
+++ b/doc/cljlib.md
@@ -1,4 +1,4 @@
-# Cljlib (0.5.1)
+# Cljlib (0.5.3)
Fennel-cljlib - functions from Clojure's core.clj implemented on top
of Fennel.
@@ -1258,5 +1258,5 @@ Copyright (C) 2020-2021 Andrey Listopadov
License: [MIT](https://gitlab.com/andreyorst/fennel-cljlib/-/raw/master/LICENSE)
-<!-- Generated with Fenneldoc v0.1.3
+<!-- Generated with Fenneldoc v0.1.5
https://gitlab.com/andreyorst/fenneldoc -->
diff --git a/doc/macros.md b/doc/macros.md
index e347e96..6df90fd 100644
--- a/doc/macros.md
+++ b/doc/macros.md
@@ -1,4 +1,4 @@
-# Macros.fnl (0.5.1)
+# Macros.fnl (0.5.3)
Macros for Cljlib that implement various facilities from Clojure.
**Table of contents**
@@ -594,5 +594,5 @@ Copyright (C) 2020-2021 Andrey Listopadov
License: [MIT](https://gitlab.com/andreyorst/fennel-cljlib/-/raw/master/LICENSE)
-<!-- Generated with Fenneldoc v0.1.3
+<!-- Generated with Fenneldoc v0.1.5
https://gitlab.com/andreyorst/fenneldoc -->
diff --git a/doc/tests/test.md b/doc/tests/test.md
deleted file mode 100644
index cb97a81..0000000
--- a/doc/tests/test.md
+++ /dev/null
@@ -1,97 +0,0 @@
-# Test.fnl
-
-**Table of contents**
-
-- [`deftest`](#deftest)
-- [`testing`](#testing)
-- [`assert-eq`](#assert-eq)
-- [`assert-ne`](#assert-ne)
-- [`assert-is`](#assert-is)
-- [`assert-not`](#assert-not)
-
-## `deftest`
-Function signature:
-
-```
-(deftest name ...)
-```
-
-Simple way of grouping tests with `name`.
-
-## `testing`
-Function signature:
-
-```
-(testing description ...)
-```
-
-Print test `description` and run it.
-
-## `assert-eq`
-Function signature:
-
-```
-(assert-eq expr1 expr2 msg)
-```
-
-Like `assert`, except compares results of `expr1` and `expr2` for equality.
-Generates formatted message if `msg` is not set to other message.
-
-### Example
-Compare two expressions:
-
-``` fennel
-;; (assert-eq 1 (+1 1))
-;; => runtime error: equality assertion failed
-;; => Left: 1
-;; => Right: 3
-```
-
-Deep compare values:
-
-``` fennel
-;; (assert-eq [1 {[2 3] [4 5 6]}] [1 {[2 3] [4 5]}])
-;; => runtime error: equality assertion failed
-;; => Left: [1 {[2 3] [4 5 6]}]
-;; => Right: [1 {[2 3] [4 5]}]
-```
-
-## `assert-ne`
-Function signature:
-
-```
-(assert-ne expr1 expr2 msg)
-```
-
-Assert for unequality. Like `assert`, except compares results of
-`expr1` and `expr2` for equality. Generates formatted message if
-`msg` is not set to other message. Same as [`assert-eq`](#assert-eq).
-
-## `assert-is`
-Function signature:
-
-```
-(assert-is expr msg)
-```
-
-Assert `expr` for truth. Same as inbuilt `assert`, except generates more
- verbose message if `msg` is not set.
-
-``` fennel
-;; (assert-is (= 1 2 3))
-;; => runtime error: assertion failed for (= 1 2 3)
-```
-
-## `assert-not`
-Function signature:
-
-```
-(assert-not expr msg)
-```
-
-Assert `expr` for not truth. Generates more verbose message if
- `msg` is not set. Works the same as [`assert-is`](#assert-is).
-
-
-<!-- Generated with Fenneldoc v0.1.3
- https://gitlab.com/andreyorst/fenneldoc -->
diff --git a/fennel-test b/fennel-test
new file mode 160000
+Subproject 5994a113cd08969f63a92e3e6923b9dc51770ec
diff --git a/init.fnl b/init.fnl
index 7522005..2eafa45 100644
--- a/init.fnl
+++ b/init.fnl
@@ -1,8 +1,5 @@
(local module-info
- {:_VERSION "0.5.1"
- :_LICENSE "[MIT](https://gitlab.com/andreyorst/fennel-cljlib/-/raw/master/LICENSE)"
- :_COPYRIGHT "Copyright (C) 2020-2021 Andrey Listopadov"
- :_MODULE_NAME "cljlib"
+ {:_MODULE_NAME "cljlib"
:_DESCRIPTION "Fennel-cljlib - functions from Clojure's core.clj implemented on top
of Fennel.
diff --git a/macros.fnl b/macros.fnl
index c7a42b9..004c2ab 100644
--- a/macros.fnl
+++ b/macros.fnl
@@ -1212,10 +1212,7 @@ Always run some side effect action:
: def
: defonce}
{:__index
- {:_VERSION "0.5.1"
- :_LICENSE "[MIT](https://gitlab.com/andreyorst/fennel-cljlib/-/raw/master/LICENSE)"
- :_COPYRIGHT "Copyright (C) 2020-2021 Andrey Listopadov"
- :_DOC_ORDER [:fn*
+ {:_DOC_ORDER [:fn*
:try
:def :defonce :defmulti :defmethod
:into :empty
diff --git a/tests/core.fnl b/tests/core.fnl
index f76e58c..fb532d3 100644
--- a/tests/core.fnl
+++ b/tests/core.fnl
@@ -1,5 +1,5 @@
(require-macros :macros)
-(require-macros :tests.test)
+(require-macros :fennel-test.test)
(macro require-module [module]
`(local ,(collect [k (pairs (require module))]
diff --git a/tests/fn.fnl b/tests/fn.fnl
index 5697aab..9b99119 100644
--- a/tests/fn.fnl
+++ b/tests/fn.fnl
@@ -1,4 +1,4 @@
-(require-macros :tests.test)
+(require-macros :fennel-test.test)
(require-macros :macros)
(deftest fn*
diff --git a/tests/macros.fnl b/tests/macros.fnl
index c3b54c9..ec8aebd 100644
--- a/tests/macros.fnl
+++ b/tests/macros.fnl
@@ -1,4 +1,4 @@
-(require-macros :tests.test)
+(require-macros :fennel-test.test)
(require-macros :macros)
(deftest into
diff --git a/tests/test.fnl b/tests/test.fnl
deleted file mode 100644
index 7941f2c..0000000
--- a/tests/test.fnl
+++ /dev/null
@@ -1,136 +0,0 @@
-(local test {})
-
-(fn eq-fn []
- ;; Returns recursive equality function.
- ;;
- ;; This function is able to compare tables of any depth, even if one of
- ;; the tables uses tables as keys.
- `(fn eq# [x# y#]
- (if (= x# y#)
- true
- (and (= (type x#) :table) (= (type y#) :table))
- (do (var [res# count-x# count-y#] [true 0 0])
- (each [k# v# (pairs x#)]
- (set res# (eq# v# ((fn deep-index# [tbl# key#]
- (var res# nil)
- (each [k# v# (pairs tbl#)]
- (when (eq# k# key#)
- (set res# v#)
- (lua :break)))
- res#)
- y# k#)))
- (set count-x# (+ count-x# 1))
- (when (not res#)
- (lua :break)))
- (when res#
- (each [_# _# (pairs y#)]
- (set count-y# (+ count-y# 1)))
- (set res# (= count-x# count-y#)))
- res#)
- :else
- false)))
-
-(fn test.assert-eq
- [expr1 expr2 msg]
- "Like `assert', except compares results of `expr1' and `expr2' for equality.
-Generates formatted message if `msg' is not set to other message.
-
-# Example
-Compare two expressions:
-
-``` fennel
-;; (assert-eq 1 (+1 1))
-;; => runtime error: equality assertion failed
-;; => Left: 1
-;; => Right: 3
-```
-
-Deep compare values:
-
-``` fennel
-;; (assert-eq [1 {[2 3] [4 5 6]}] [1 {[2 3] [4 5]}])
-;; => runtime error: equality assertion failed
-;; => Left: [1 {[2 3] [4 5 6]}]
-;; => Right: [1 {[2 3] [4 5]}]
-```"
- `(let [left# ,expr1
- right# ,expr2
- eq# ,(eq-fn)
- fennel# (require :fennel)
- (suc# res#) (pcall eq# left# right#)]
- (if suc#
- (assert res# (or ,msg (.. "assertion failed for expression:
-(= " ,(view expr1 {:one-line? true}) " " ,(view expr2 {:one-line? true}) ")
- Left: " (fennel#.view left# {:one-line? true}) "
- Right: " (fennel#.view right# {:one-line? true}) "\n")))
- (error (.. "in expression:
-(= " ,(view expr1 {:one-line? true}) " " ,(view expr2 {:one-line? true}) ")
- " res#" \n")))))
-
-(fn test.assert-ne
- [expr1 expr2 msg]
- "Assert for unequality. Like `assert', except compares results of
-`expr1' and `expr2' for equality. Generates formatted message if
-`msg' is not set to other message. Same as `assert-eq'."
- `(let [left# ,expr1
- right# ,expr2
- eq# ,(eq-fn)
- fennel# (require :fennel)
- (suc# res#) (pcall eq# left# right#)]
- (if suc#
- (assert (not res#) (or ,msg (.. "assertion failed for expression:
-(not= " ,(view expr1 {:one-line? true}) " " ,(view expr2 {:one-line? true}) ")
- Left: " (fennel#.view left# {:one-line? true}) "
- Right: " (fennel#.view right# {:one-line? true}) "\n")))
- (error (.. "in expression:
-(not= " ,(view expr1 {:one-line? true}) " " ,(view expr2 {:one-line? true}) ")
- " res#" \n")))))
-
-(fn test.assert-is
- [expr msg]
- "Assert `expr' for truth. Same as inbuilt `assert', except generates more
- verbose message if `msg' is not set.
-
-``` fennel
-;; (assert-is (= 1 2 3))
-;; => runtime error: assertion failed for (= 1 2 3)
-```"
- `(let [(suc# res#) (pcall #(do ,expr))]
- (if suc#
- (assert res#
- (.. "assertion failed: "
- (or ,msg ,(view expr {:one-line? true}))))
- (error (.. "in expression: "
- ,(view expr {:one-line? true}) "
- " res#" \n")))))
-
-(fn test.assert-not
- [expr msg]
- "Assert `expr' for not truth. Generates more verbose message if
- `msg' is not set. Works the same as `assert-is'."
- `(let [(suc# res#) (pcall #(not ,expr))]
- (if suc#
- (assert res#
- (.. "assertion failed: "
- (or ,msg ,(view expr {:one-line? true}))))
- (error (.. "in expression: "
- ,(view expr {:one-line? true}) "
- " res#" \n")))))
-
-(fn test.deftest
- [name ...]
- "Simple way of grouping tests with `name'."
- `(do ,...))
-
-(fn test.testing
- [description ...]
- "Print test `description' and run it."
- `(do (io.stdout:write (.. "testing: " ,description "\n"))
- ,...))
-
-(setmetatable
- test
- {:__index
- {:_DOC_ORDER [:deftest :testing
- :assert-eq :assert-ne
- :assert-is :assert-not]}})