summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2024-06-06 03:09:00 -0300
committerSoniEx2 <endermoneymod@gmail.com>2024-06-06 03:09:00 -0300
commitd865925d050f13e1097721d2b1f3ae352b49c484 (patch)
tree05d1c2bd1435571a1c4ae4064b2d50535cc87692 /test
parent1f8140c95ced6b7ce291e16c26c80800fa4f1f9d (diff)
Fix long string parsing
Diffstat (limited to 'test')
-rw-r--r--test/line-numbers.cratera45
-rw-r--r--test/strings.cratera6
2 files changed, 51 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")
diff --git a/test/strings.cratera b/test/strings.cratera
new file mode 100644
index 0000000..d2189a5
--- /dev/null
+++ b/test/strings.cratera
@@ -0,0 +1,6 @@
+local longstring = [[
+Test.
+Test.
+]]
+
+assert(longstring == "Test.\nTest.\n", longstring)