From 265df51045f6aaaaa5f5456ce14ed63ea2f47010 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 15 Nov 2012 08:27:15 +0000 Subject: Raise an exception on a bogus line - and test for that. --- t/test-parser.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 't') 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. # -- cgit v1.2.1