aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/test/script/lexer/comment.test
blob: 0092ed9e73732cf5e5f02e2c6a3c5314d8392fbd (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# @@ This one should be moved to build2/lexer since we use base lexer
#    functionality as is.
#
test.arguments += script-line

# Single-line comments.

$* <<EOI >>:EOO # single-only
# comment
EOI
EOO

$* <<EOI >>EOO # single-first
# comment
foo
EOI
'foo'
<newline>
EOO

$* <<EOI >>EOO # single-last
foo
# comment
EOI
'foo'
<newline>
EOO

$* <<EOI >>EOO # single-few
foo
# comment
# comment
EOI
'foo'
<newline>
EOO

$* <<EOI >>EOO # single-cont
foo
# comment\\
bar
EOI
'foo'
<newline>
'bar'
<newline>
EOO

$* <<EOI >>EOO # single-same
foo # comment
bar # comment
EOI
'foo'
<newline>
'bar'
<newline>
EOO

# Multi-line comments.
#

$* <<EOI >>:EOO # multi-only
#\\
comment
comment
#\\
EOI
EOO

$* <<EOI >>:EOO # multi-empty
#\\
#\\
EOI
EOO

$* <<EOI >>EOO # multi-start-same
foo #\\
comment
comment
#\\
EOI
'foo'
<newline>
EOO

$* <<EOI >>EOO # multi-end-same
#\\
comment
comment
foo #\\
bar
EOI
'bar'
<newline>
EOO

$* <<EOI >>EOO # multi-end-not
#\\
comment
#\\ not an end
foo #\\
bar
EOI
'bar'
<newline>
EOO

$* <<EOI 2>>EOE != 0 # multi-unterm
#\\
comment
EOI
stdin:3:1: error: unterminated multi-line comment
EOE