3 #****h* ROBODoc System Tests/Handling Errors
5 # Test wether calling ROBODoc with wrong options or input leads
6 # to the correct error messages.
12 use Test::More 'no_plan';
14 # A dummy header to put into dummy source files.
24 #****x* Handling Errors/Error on Non-existing Option
26 # ROBODoc should complain about non-existing options.
30 my ($out, $err) = runrobo( '--foobar' );
31 like($out, qr/Usage/, 'Unknown option should print usage' );
32 like($err, qr/Invalid/, 'and an error message' );
37 #****x* Handling Errors/Error on Mutual Excluding Options
39 # ROBODoc should complain about options that can not be used
44 add_source( "test.c", $source );
45 my ($out, $err) = runrobo( qw(--src Src --doc Doc --multidoc --singledoc --html) );
46 like($out, qr/Usage/, 'Mutual excluding options should print usage' );
48 like($err, qr/together/, 'and an error message' );
53 #****x* Handling Errors/Error on Mutual Excluding Options II
55 # ROBODoc should complain about options that can not be used
60 add_source( "test.c", $source );
61 my ($out, $err) = runrobo( qw(--src Src --doc Doc --multidoc --test --dbxml --html) );
62 like($out, qr/Usage/, 'Mutual excluding options should print usage' );
64 like($err, qr/together/, 'and an error message' );
69 #****x* Handling Errors/Error on Duplicate Options
71 # ROBODoc should complain about options that are specifed more
76 add_source( "test.c", $source );
77 my ($out, $err) = runrobo( qw( --src Src --doc Doc --multidoc --test --test --test) );
79 like($out, qr/Usage/, 'Duplicate options should print usage' );
81 like($err, qr/than\sonce/, 'and an error message' );
86 #****x* Handling Errors/Error on Non-existing rc file
88 # When given a non-existing .rc file, ROBODc should
89 # at least report the name of the .rc file.
92 my ($out, $err) = runrobo( '--rc foobar.rc' );
93 like($err, qr/foobar/, 'should give an error message about foorbar.rc' );
97 #****x* Handling Errors/Impossible output file
99 # When given a impossible output filename ROBODoc should
100 # at least report the filename.
103 add_source( "test.c", $source );
104 my ($out, $err) = runrobo( qw(--src Src --doc Foo/Bar/document --singledoc --html) );
105 like($err, qr/document/, 'should give an error message about document' );
110 #****x* Handling Errors/Non-existing css file
112 # When given a impossible css filename ROBODoc should
113 # at least report the filename.
116 add_source( "test.c", $source );
117 my ($out, $err) = runrobo( qw(--src Src --doc Doc --multidoc --html --css Foo/Bar/cascade.css) );
118 like($err, qr/cascade/, 'should give an error message about css file' );
125 #****x* Handling Errors/Header without end marker
127 # Test ROBODoc's response on a header without an
128 # end marker. ROBODoc should detect this.
133 my $source = <<'EOF';
144 and no end of the header ....
148 add_source( "test.c", $source );
149 my ($out, $err) = runrobo( qw(--src Src --doc Doc --multidoc --test) );
150 is( $out, '', 'no output' );
151 like( $err, qr/end\smarker/, 'error about end marker' );
157 #****x* Handling Errors/Headers with duplicate names
159 # Test ROBODoc's response to a file with two headers that
160 # have the same name. This should be reported as an error.
164 my $source = <<'EOF';
183 add_source( "test.c", $source );
184 my ($out, $err) = runrobo( qw(--src Src --doc Doc --multidoc --test) );
185 is( $out, '', 'no output' );
186 like( $err, qr/already\sexists/, 'error duplicate header' );
193 my $source = <<'EOF';
200 my $rc_file = <<'EOF';
211 add_configuration( "robodoc.rc", $rc_file );
212 add_source( "test.c", $source );
215 my ($out, $err) = runrobo( qw(
219 --rc Config/robodoc.rc --test) );
220 is( $out, '', 'no output' );
221 like( $err, qr/item/, 'An unknown item is reported' );