File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,11 @@ Standard library
16
16
(import "functional-tests.ark")
17
17
(import "lazy-tests.ark")
18
18
(import "list-tests.ark")
19
+ (import "macros-tests.ark")
20
+ (import "math-tests.ark")
19
21
(import "range-tests.ark")
20
22
(import "string-tests.ark")
21
23
(import "switch-tests.ark")
22
- (import "math-tests.ark")
23
24
24
25
(print " ------------------------------")
25
26
@@ -29,10 +30,11 @@ Standard library
29
30
passed-functional
30
31
passed-lazy
31
32
passed-list
33
+ passed-macros
34
+ passed-math
32
35
passed-range
33
36
passed-string
34
37
passed-switch
35
- passed-math
36
38
))
37
39
38
40
(print "Completed in " (* 1000 (- (time) start_time)) "ms")
Original file line number Diff line number Diff line change
1
+ (import "tests-tools.ark")
2
+
3
+ (import "Macros.ark")
4
+
5
+ (let macros-tests (fun () {
6
+ (mut tests 0)
7
+ (let start-time (time))
8
+
9
+ (let f1 (fun (data)
10
+ (+ data "-f1")))
11
+ (let f2 (fun (data)
12
+ (+ data "-f2")))
13
+ (let f3 (fun (data)
14
+ (+ data "-f3")))
15
+
16
+ (set tests (assert-eq (-> "f0" f1) "f0-f1" "Threading macro threaded the given functions" tests))
17
+ (set tests (assert-eq (-> "f0" f1 f2 f3) "f0-f1-f2-f3" "Threading macro threaded the given functions" tests))
18
+
19
+ (let test_func (fun (a b c) (* a b c)))
20
+ (let test_func1 (partial test_func 1))
21
+ (let test_func2 (partial test_func1 2))
22
+
23
+ (set tests (assert-eq (test_func1 2 3) 6 "Partial macro created a partial callable function" tests))
24
+ (set tests (assert-eq (argcount test_func1) 2 "Argcount of the partial function should be 2" tests))
25
+ (set tests (assert-eq (argcount test_func2) 1 "Argcount of the partial function should be 1" tests))
26
+
27
+ (recap "Macros tests passed" tests (- (time) start-time))
28
+
29
+ tests
30
+ }))
31
+
32
+ (let passed-macros (macros-tests))
You can’t perform that action at this time.
0 commit comments