aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/closure.resp5
-rw-r--r--test/def.resp4
-rw-r--r--test/deffn.resp3
-rw-r--r--test/inlinefn.resp1
-rw-r--r--test/nest.resp2
5 files changed, 12 insertions, 3 deletions
diff --git a/test/closure.resp b/test/closure.resp
new file mode 100644
index 0000000..fb5a41d
--- /dev/null
+++ b/test/closure.resp
@@ -0,0 +1,5 @@
+(def (multiplier factor) (fn (x) (* (+ x 0) factor)))
+
+(def doubler (multiplier 2))
+
+(doubler 3)
diff --git a/test/def.resp b/test/def.resp
index dd9a0c8..52605b0 100644
--- a/test/def.resp
+++ b/test/def.resp
@@ -1,7 +1,7 @@
(def foo
(fn (x)
- (def y 2)
- (def z 3)
+ (def y x)
+ (def z (+ x 1))
z))
(foo 3)
diff --git a/test/deffn.resp b/test/deffn.resp
new file mode 100644
index 0000000..c413ecd
--- /dev/null
+++ b/test/deffn.resp
@@ -0,0 +1,3 @@
+(def f (fn (x) (+ x 1)))
+
+(f 2)
diff --git a/test/inlinefn.resp b/test/inlinefn.resp
new file mode 100644
index 0000000..2f055bd
--- /dev/null
+++ b/test/inlinefn.resp
@@ -0,0 +1 @@
+((fn (x) (+ x 1)) 1)
diff --git a/test/nest.resp b/test/nest.resp
index 3085737..c15c453 100644
--- a/test/nest.resp
+++ b/test/nest.resp
@@ -1,6 +1,6 @@
(def (f x)
(def (g y)
(* y 2))
- (g x))
+ (g (+ x 1)))
(f 3)