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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
#
# nagios-mode test suite.
#
# Copyright Michael Orlitzky
#
# http://michael.orlitzky.com/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# http://www.fsf.org/licensing/licenses/gpl.html
#
Test 1: Comments should be colored correctly.
# First comment form.
; Second comment form.
; A comment not starting at the beginning of a line.
# And the second form of the above.
How about # a comment that starts after some non-comment text?
Test 2: Directives, specials, macros, definitions, and strings
within comments should appear as part of the comment.
# contacts is a directive.
# use, name, and register are specials.
# $USER1$ is an example of a macro.
# and define host is one of the possible definitions.
# Heck, let's try "strings" while we're at it.
Test 3: The standard "define host" below should be function-name-faced.
define host {
}
Test 4: The "define host" should be colored, but the braces *should not* be.
define host{
}
Test 5: Multiple spaces before the brace.
define host {
}
Test 6: Closing brace on the same line.
define host {}
Test 7: Directive coloring should work at the beginning of a line.
contacts
Test 8: Directive coloring should work after any number of spaces.
contacts
Test 9: Directive coloring should work after a tab.
contacts
Test 10: Directives should not be colored in the middle of sentences.
Such as contacts in the middle of a sentence.
Test 11: Directives should not be colored at the end of a line.
For example, contacts
Test 12: Directives should only be colored when they are stand-alone
words. Therefore, the following should *not* be colored.
example-contacts
example_contacts
contacts-test
contacts_test
test-contacts-example
test_contacts_example
Test 13: Definitions must be stand-alone as well. The following
should *not* be colored.
undefine host
undefine host{ }
define-host
define_host
-define host-
_undefine_host_
Test 14: Text inside of a open/close brace pair should be indented
by default.
{
This should be indented.
}
define host {
As should this.
}
Test 15: Braces within comments should appear as part of the comment.
# For { example }.
; { Ditto }
Test 16: Comments (and closing braces) that come after an curly
brace should all be comment-colored.
define host { # Everything hereafter is a { comment }.
} ; As well as here {}.
Test 17: Macros should be constant-faced under normal circumstances.
$USER1$
$USER1$ $USER2$
$ADMINEMAIL$ $ADMINPAGER$
Test 18: Macros should appear constant-faced even when they don't
occur along a word boundary.
$USER1$=something
$ADMINPAGER$="string"
$USER1$=$USER2$
Test 19: Macros within strings appear as part of the string
"I'm unsure if string $USER1$ interpolation is possible."
Test 20: Macros can occur within a directive/special value.
define host {
name $USER1$
contacts $ADMINPAGER$
friday I'm $USER1$ love.
}
Test 21: Directives that occur as a special value should
be neither special- nor directive-faced.
define host {
name contacts
use monday
}
Test 22: Directives that occur as directive values should
not be directive-faced.
define host {
monday tuesday wednesday thursday friday
}
Test 23: Specials that occur as special values should
not be special-faced.
define host {
use register name
}
Test 24: Specials that occur as a directive value should
be neither special- nor directive-faced.
define host {
contacts name
monday use
}
Test 25: Definitions should work when not at the beginning
of a line.
define service {}
Test 26: Definitions that,
a) End with a curly brace followed by a newline
b) Have a special as the first entry
should be colored properly.
define service{
use whatever
}
Test 27: Comment characters within strings should be ignored,
that is, treated like strings.
"Here comes a #comment"
"And the ;second form"
Test 28: Strings within comments should be ignored as well.
# The "string" should be comment-faced.
Test 29: Text between two strings should not be string-faced.
"String1" between "String2"
Test 30: The ARG0 and USER0 macros don't exist.
$ARG0$
$USER0$
Test 31: Commented opening braces should not cause indentation.
# {
This line should not be indented.
;{
Neither should this line.
Test 32: Commented closing braces should not close a block.
define host {
This is indented.
# This is just a comment }
So this should be indented too.
}
But not this.
Test 33: Double opening/closing braces shouldn't cause things
to go haywire.
define host {# {
#{}}}}}{}{{}}}{{;{}{}{}
Still normal indentation.
}#{}}}}}}}{{{{{{{{{{{{{{{
Here too.
|