From 3d667c179c0578241fbc25dc24e0025eca7d88a7 Mon Sep 17 00:00:00 2001 From: nicolas-p Date: Sun, 26 Apr 2015 18:19:01 +0200 Subject: [PATCH] Tests for ap-pipe and ap-compose Added tests for the ap-pipe and ap-compose anaphoric macros. --- tests/native_tests/contrib/anaphoric.hy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/native_tests/contrib/anaphoric.hy b/tests/native_tests/contrib/anaphoric.hy index 50281fa..8b37905 100644 --- a/tests/native_tests/contrib/anaphoric.hy +++ b/tests/native_tests/contrib/anaphoric.hy @@ -103,3 +103,13 @@ (assert-equal (ap-reduce (+ acc " on " it) ["Hy" "meth"]) "Hy on meth") (assert-equal (ap-reduce (+ acc it) [] 1) 1)) + +(defn test-ap-pipe [] + "NATIVE: testing anaphoric pipe" + (assert-equal (ap-pipe 2 (+ it 1) (* it 3)) 9) + (assert-equal (ap-pipe [4 5 6 7] (list (rest it)) (len it)) 3)) + +(defn test-ap-compose [] + "NATIVE: testing anaphoric compose" + (assert-equal ((ap-compose (+ it 1) (* it 3)) 2) 9) + (assert-equal ((ap-compose (list (rest it)) (len it)) [4 5 6 7]) 3))