diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-27 17:58:48 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-27 17:58:48 -0500 |
| commit | cc021efe10380039a13da5300990639203450634 (patch) | |
| tree | 02977d571ee6b42e7d5429ff8e922f183422eeb5 /js/tests | |
| parent | b58698b257fb6552e053cd245d63a140d3f7a478 (diff) | |
| download | mal-cc021efe10380039a13da5300990639203450634.tar.gz mal-cc021efe10380039a13da5300990639203450634.zip | |
Add step5/9 tests for impls that support it.
- Also remove broken make/tests/*.mk tests. Not used any more.
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/step5_tco.js | 22 | ||||
| -rw-r--r-- | js/tests/step9_interop.mal | 24 |
2 files changed, 24 insertions, 22 deletions
diff --git a/js/tests/step5_tco.js b/js/tests/step5_tco.js deleted file mode 100644 index 60c0576..0000000 --- a/js/tests/step5_tco.js +++ /dev/null @@ -1,22 +0,0 @@ -common = require('./common.js'); -var assert_eq = common.assert_eq; -var rep = require('../step5_tco.js').rep; - -console.log("Testing Stack Exhaustion Function"); -rep('(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1))))))'); -try { - rep('(sum-to 10000)'); - throw new Error("Did not get expected stack exhaustion"); -} catch (e) { - if (e.toString().match(/RangeError/)) { - console.log("Got expected stack exhaustion"); - } else { - throw new Error("Unexpected error: " + e); - } -} - -console.log("Testing Tail Call Optimization/Elimination"); -rep('(def! sum2 (fn* (n acc) (if (= n 0) acc (sum2 (- n 1) (+ n acc)))))'); -rep('(sum2 10000 0)'); - -console.log("All tests completed"); diff --git a/js/tests/step9_interop.mal b/js/tests/step9_interop.mal new file mode 100644 index 0000000..f785292 --- /dev/null +++ b/js/tests/step9_interop.mal @@ -0,0 +1,24 @@ +;; Testing basic bash interop + +(js* "7") +;=>7 + +(js* "'7'") +;=>"7" + +(js* "[7,8,9]") +;=>(7 8 9) + +(js* "console.log('hello');") +; hello +;=>nil + +(js* "foo=8;") +(js* "foo;") +;=>8 + +(js* "['a','b','c'].map(function(x){return 'X'+x+'Y'}).join(' ')") +;=>"XaY XbY XcY" + +(js* "[1,2,3].map(function(x){return 1+x})") +;=>(2 3 4) |
