diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2020-10-30 22:06:00 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2020-10-30 22:06:00 +0300 |
| commit | 7f006094a4a82cc267e687d040c15b59b149415c (patch) | |
| tree | 3d9b9a2ae62605d347e48b77370b4d421cd48405 | |
| parent | fe9c621140eedabecee11d6ff29f7e63fa747e15 (diff) | |
fix(core): add docstrings and improve tests
Also add editorconfig script
| -rw-r--r-- | .editorconfig | 14 | ||||
| -rw-r--r-- | core.fnl | 4 | ||||
| -rw-r--r-- | core_test.fnl | 9 |
3 files changed, 23 insertions, 4 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..14919c3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# Cross-editor formatting rules +# see: https://editorconfig.org + +root = true + +[*] +charset=utf-8 +end_of_line=lf +insert_final_newline=true +trim_trailing_whitespace=true + +[*.lua] +indent_size=4 +indent_style=space @@ -380,8 +380,8 @@ oppisite truth value." (when-some [tbl (seq tbl)] (reduce -consj [] tbl))) -(fn& core.inc [x] (+ x 1)) -(fn& core.dec [x] (- x 1)) +(fn* core.inc "Increase number by one" [x] (+ x 1)) +(fn* core.dec "Decrease number by one" [x] (- x 1)) (fn* core.assoc "Associate key `k' with value `v' in `tbl'." diff --git a/core_test.fnl b/core_test.fnl index c618e9e..25f9e1d 100644 --- a/core_test.fnl +++ b/core_test.fnl @@ -423,10 +423,15 @@ (deftest math-functions (testing inc (assert-eq (inc 1) 2) - (assert-eq (inc -1) 0)) + (assert-eq (inc -1) 0) + (assert* (not (pcall inc))) + (assert* (not (pcall inc nil)))) + (testing dec (assert-eq (dec 1) 0) - (assert-eq (dec -1) -2))) + (assert-eq (dec -1) -2) + (assert* (not (pcall dec))) + (assert* (not (pcall dec nil))))) (deftest table-access (testing get |