From: Michael Orlitzky Date: Mon, 16 Feb 2009 03:41:01 +0000 (-0500) Subject: Added a test suite for the syntax highlighting. X-Git-Tag: v0.1~19 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=nagios-mode.git;a=commitdiff_plain;h=e9eca64e077f1856c4bf019f8321bf1c7bc33c15 Added a test suite for the syntax highlighting. --- diff --git a/test_suite.cfg b/test_suite.cfg new file mode 100644 index 0000000..478287a --- /dev/null +++ b/test_suite.cfg @@ -0,0 +1,188 @@ +# +# 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 +}