summary refs log tree commit diff stats
path: root/test/line-numbers.cratera
diff options
context:
space:
mode:
Diffstat (limited to 'test/line-numbers.cratera')
-rw-r--r--test/line-numbers.cratera45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/line-numbers.cratera b/test/line-numbers.cratera
new file mode 100644
index 0000000..f2f977b
--- /dev/null
+++ b/test/line-numbers.cratera
@@ -0,0 +1,45 @@
+local function mkerror(key)
+    if key == "a" then
+        error("test failed")
+    elseif key == "b" then
+        -- hello
+        error("test failed")
+    elseif key == "c" then
+
+
+        error("test failed")
+    elseif key == "d" then
+-- hmm...
+        error("test failed")
+    elseif key == "e" then
+
+-- hmm...
+        error("test failed")
+    elseif key == "f" then
+-- increasingly confused about this
+-- hmm...
+        error("test failed")
+    elseif key == "g" then
+local foo = [[
+Test.
+Test.
+]]
+        error("test failed")
+    end
+end
+
+local ok, msg = pcall(mkerror,"a")
+assert(not ok and msg:match(":3"), msg)
+local ok, msg = pcall(mkerror,"b")
+assert(not ok and msg:match(":6"), msg)
+local ok, msg = pcall(mkerror,"c")
+assert(not ok and msg:match(":10"), msg)
+local ok, msg = pcall(mkerror,"d")
+assert(not ok and msg:match(":13"), msg)
+local ok, msg = pcall(mkerror,"e")
+assert(not ok and msg:match(":17"), msg)
+local ok, msg = pcall(mkerror,"f")
+assert(not ok and msg:match(":21"), msg)
+local ok, msg = pcall(mkerror,"g")
+assert(not ok and msg:match(":27"), msg)
+print("line number tests pass")