summary refs log tree commit diff stats
path: root/test/line-numbers.cratera
blob: f2f977b7b369b5a8f4f468999be9e1c284f71253 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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")