From 5cd4100a4e9e7b7cf77b21f2759f6401cd9a06d9 Mon Sep 17 00:00:00 2001 From: Andrey Listopadov Date: Fri, 23 Jul 2021 21:41:22 +0300 Subject: fix: don't generate mulitarity arglist doc for single-arity functions --- tests/fn.fnl | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/fn.fnl b/tests/fn.fnl index 36fd395..a4b342b 100644 --- a/tests/fn.fnl +++ b/tests/fn.fnl @@ -4,46 +4,46 @@ (deftest fn* (testing "fn* meta" (fn* f - "docstring" + "single arity" [x] x) (assert-eq (meta f) - {:fnl/docstring "docstring" - :fnl/arglist ["([x])"]}) + {:fnl/docstring "single arity" + :fnl/arglist ["[x]"]}) (fn* f - "docstring" + "single empty arity" []) (assert-eq (meta f) - {:fnl/docstring "docstring" - :fnl/arglist ["([])"]}) + {:fnl/docstring "single empty arity" + :fnl/arglist ["[]"]}) (fn* f - "docstring" + "multiarity with single entry" ([x] x)) (assert-eq (meta f) - {:fnl/docstring "docstring" - :fnl/arglist ["([x])"]}) + {:fnl/docstring "multiarity with single entry" + :fnl/arglist ["[x]"]}) (fn* f - "docstring" + "multiarity" ([x] x) ([x y] (+ x y))) (assert-eq (meta f) - {:fnl/docstring "docstring" + {:fnl/docstring "multiarity" :fnl/arglist ["([x])" "([x y])"]}) (fn* f - "docstring" + "multiarity with one empty arity" ([]) ([x y] (+ x y))) (assert-eq (meta f) - {:fnl/docstring "docstring" + {:fnl/docstring "multiarity with one empty arity" :fnl/arglist ["([])" "([x y])"]}) (fn* f - "docstring" + "multiarity with two or more arity" ([x] x) ([x y] (+ x y)) ([x y & z] (+ x y))) (assert-eq (meta f) - {:fnl/docstring "docstring" + {:fnl/docstring "multiarity with two or more arity" :fnl/arglist ["([x])" "([x y])" "([x y & z])"]})) @@ -51,7 +51,10 @@ (testing "fn* doc destructuring" (fn* f [[a b c]]) (assert-eq (meta f) - {:fnl/arglist ["([[a b c]])"]}) + {:fnl/arglist ["[[a b c]]"]}) + (fn* f ([[a b c]])) + (assert-eq (meta f) + {:fnl/arglist ["[[a b c]]"]}) (fn* f ([[a b c]]) ([{: a}]) ([[{:a [a b c]}]])) (assert-eq (meta f) {:fnl/arglist ["([[a b c]])" -- cgit v1.2.3