summaryrefslogtreecommitdiff
path: root/tests/javascript/check-syntax.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/javascript/check-syntax.js')
-rwxr-xr-xtests/javascript/check-syntax.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/javascript/check-syntax.js b/tests/javascript/check-syntax.js
new file mode 100755
index 0000000..007c8ae
--- /dev/null
+++ b/tests/javascript/check-syntax.js
@@ -0,0 +1,32 @@
+#!/usr/bin/env seed
+
+testsuite = imports.testsuite
+
+try
+{
+ Seed.check_syntax("5+5;")
+}
+catch(e)
+{
+ testsuite.unreachable("5+5; is not a syntax error")
+}
+
+try
+{
+ Seed.check_syntax("asdfasdf.jsdf()")
+}
+catch(e)
+{
+ testsuite.unreachable("asdfasdf.jsdf() is not a syntax error")
+}
+
+try
+{
+ Seed.check_syntax("one[)")
+ testsuite.unreachable("one[) should be a syntax error")
+}
+catch(e)
+{
+ testsuite.assert(e instanceof SyntaxError)
+}
+