git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
A few tests using shelltestrunner
commit3f38a6eaff4061c0baec2b4096374c5f72199fec authorPhil Freeman <paf31@cantab.net> dateFri 18 Oct 2013, 12:30 (13 years ago) parentdd540b4
5 files changed+29−1
examples/.gitignore+1 examples/List.js+7 examples/List.ps+1−1 examples/Maybe.js+5 examples/runAll.test+15
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
55 ; tail :: List a
66 }
77
8−null = \l -> case l of
8+isNull = \l -> case l of
99 Nil -> true
1010 _ -> false
1111
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