]> Nishi Git Mirror - gwion.git/commitdiff
:white_check_mark: Add testing
authorJérémie Astor <fennecdjay@gmail.com>
Tue, 26 Apr 2022 19:56:50 +0000 (21:56 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Tue, 26 Apr 2022 19:56:50 +0000 (21:56 +0200)
src/parse/partial.c
tests/captures/lambda_captures.gw [new file with mode: 0644]
tests/captures/not_upvalue.gw [new file with mode: 0644]
tests/captures/spork_capture.gw [new file with mode: 0644]
tests/lambdas/partial_lambda.gw [new file with mode: 0644]

index a539c5978c63b9caca8551af73e53254a15a70ea..8a32be05f0c4c5ef98f1a7c3c77f6668fa5a8a98 100644 (file)
@@ -194,7 +194,7 @@ ANN static Exp expand(const Env env, const Func func, const Exp e, const loc_t l
 
 ANN Type partial_type(const Env env, Exp_Call *const call) {
   const Func base = call->func->type->info->func;
-  if(!base) ERR_O(call->func->pos, _("can't do partiall application on a literal lambda"));
+  if(!base) ERR_O(call->func->pos, _("can't do partial application on a literal lambda"));
   const Func f = partial_match(env, base, call->args, call->func->pos);
   if(!f) {
     const Exp e = expand(env, call->func->type->info->func, call->args, call->func->pos);
diff --git a/tests/captures/lambda_captures.gw b/tests/captures/lambda_captures.gw
new file mode 100644 (file)
index 0000000..2a8b3dd
--- /dev/null
@@ -0,0 +1,5 @@
+#! [contains] 42
+40 => var int a;
+{
+\ : a : { <<< a + 2 >>>; }();
+}
diff --git a/tests/captures/not_upvalue.gw b/tests/captures/not_upvalue.gw
new file mode 100644 (file)
index 0000000..3074e01
--- /dev/null
@@ -0,0 +1,3 @@
+#! [contains] can't take ref of a scoped value
+foreach(a : [1,2])
+  spork : &a :{ <<< "${a}" >>>; samp => now; <<< "${a}" >>>; };
diff --git a/tests/captures/spork_capture.gw b/tests/captures/spork_capture.gw
new file mode 100644 (file)
index 0000000..ee0c7cc
--- /dev/null
@@ -0,0 +1,4 @@
+#! [contains] 42 1
+foreach(a : [ 1, 2])
+  spork : a : { <<< "42 ${a}" >>>; };
+samp => now;
diff --git a/tests/lambdas/partial_lambda.gw b/tests/lambdas/partial_lambda.gw
new file mode 100644 (file)
index 0000000..3dab18a
--- /dev/null
@@ -0,0 +1,2 @@
+#! [contains] can't do partial application on a literal lambda
+<<< \a {  }(_) >>>;