-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_line_numbers.nim
58 lines (43 loc) · 1.08 KB
/
test_line_numbers.nim
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
46
47
48
49
50
51
52
53
54
55
56
57
58
import unittest
import cirru_parser/types
import cirru_parser/lexer
import cirru_parser/helpers
import cirru_parser
test "Nodes has position info":
echo()
echo lexCode("a\n b")
echo()
echo parseCirru("a\n b")
echo()
test "Line number results":
echo()
let code = "a \""
try:
echo lexCode(code)
except CirruParseError as e:
echo formatParserFailure(code, e.msg, "tmp", e.line, e.column)
echo()
let code2 = "a\n b"
try:
echo lexCode(code2)
except CirruParseError as e:
echo formatParserFailure(code2, e.msg, "tmp", e.line, e.column)
echo()
let code3 = "a b c d e ) f"
try:
echo parseCirru(code3)
except CirruParseError as e:
echo formatParserFailure(code3, e.msg, "tmp", e.line, e.column)
echo()
let code4 = "a (a b"
try:
echo parseCirru(code4)
except CirruParseError as e:
echo formatParserFailure(code4, e.msg, "tmp", e.line, e.column)
echo()
let code5 = "a\n b("
try:
echo parseCirru(code5)
except CirruParseError as e:
echo formatParserFailure(code5, e.msg, "tmp", e.line, e.column)
echo()