summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-15 08:27:15 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-15 08:27:15 +0000
commit8f13c6078d6aac3d53d755d27c4450f97fdd83bd (patch)
tree59c8c05dafc7b698def7f51a1f72aa2c9c01bd76 /t
parent59adcbd8ba1a91547c49ce29ebc3f4cdd8ed94b2 (diff)
Raise an exception on a bogus line - and test for that.
Diffstat (limited to 't')
-rwxr-xr-xt/test-parser.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/test-parser.rb b/t/test-parser.rb
index f405433..8de513b 100755
--- a/t/test-parser.rb
+++ b/t/test-parser.rb
@@ -510,6 +510,32 @@ class TestParser < Test::Unit::TestCase
+
+ #
+ # Test that an exception is raised on a malformed line.
+ #
+ def test_bogus
+
+ parser = MonitorConfig.new("/dev/null" )
+
+
+ assert_nothing_raised do
+ parser.parse_line( "# This is a test" )
+ parser.parse_line( "foo must run ssh." )
+ end
+
+ assert_raise ArgumentError do
+ parser.parse_line( "steve is bored." )
+ end
+
+ assert_raise ArgumentError do
+ parser.parse_line( "steve.com must ." )
+ end
+
+ end
+
+
+
#
# Test we can add tests which don't contain a trailing period.
#