git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
A few tests using shelltestrunner
3f38a6ePhil Freeman
examples/.gitignorenew file+1
@@ -0,0 +1 @@
1+tests
examples/List.jsnew file+7
@@ -0,0 +1,7 @@
1+var l1 = Cons({ head: 1, tail: Nil });
2+var l2 = Cons({ head: 2, tail: Nil });
3+var l3 = Cons({ head: l1, tail: Cons({ head: l2, tail: Nil }) });
4+var flat = flatten(l3);
5+var f1 = flat.value.head;
6+var f2 = flat.value.tail.value.head
7+console.log([f1, f2]);
examples/List.ps+1−1
@@ -5,7 +5,7 @@ data List a
5 ; tail :: List a
5 ; tail :: List a
6 }
6 }
7
7
8−null = \l -> case l of
8+isNull = \l -> case l of
9 Nil -> true
9 Nil -> true
10 _ -> false
10 _ -> false
11
11
examples/Maybe.jsnew file+5
@@ -0,0 +1,5 @@
1+console.log(bind(Just("a"))(function(a) {
2+ return bind(Just("b"))(function(b) {
3+ return Just(a + b);
4+ });
5+}));
examples/runAll.testnew file+15
@@ -0,0 +1,15 @@
1+# Maybe
2+mkdir -p tests && ../dist/build/psc/psc Maybe.ps -o tests/Maybe.js && cat tests/Maybe.js Maybe.js | node
3+<<<
4+>>>
5+{ ctor: 'Just', value: 'ab' }
6+>>>2
7+>>>= 0
8+
9+# List
10+mkdir -p tests && ../dist/build/psc/psc List.ps -o tests/List.js && cat tests/List.js List.js | node
11+<<<
12+>>>
13+[ 1, 2 ]
14+>>>2
15+>>>= 0