Imported Robodoc.
[robodoc.git] / Source / t / robodoc_rc.t
1 #!perl -w
2 # vim: spell ff=unix
3 #****h* ROBODoc System Tests/ROBODoc Configuration File
4 # FUNCTION
5 #    Test stuff that can be specified in the robodoc.rc file.
6 #*****
7
8 use strict;
9 use warnings;
10 use ROBOTestFrame;
11 use Test::More 'no_plan';
12 use XML::Simple;
13 use Data::Dumper;
14
15 #****x* ROBODoc Configuration File/Custom Header Markers
16 # FUNCTION
17 #   Test whether custum header markers can be specified.
18 # SOURCE
19 #
20
21 {
22     my $source = <<'EOF';
23 / ****f* Test/test
24 / NAME
25 /   Test
26 / FUNCTION
27 /   Test1
28 / SOURCE
29 / ****
30
31 / ****F* Foo/foo
32 / NAME
33 /   Foo
34 / FUNCTION
35 /   Test2
36 / SOURCE
37 / ****
38
39 EOF
40
41     my $rc_file = <<'EOF';
42 header markers:
43   / ****
44 remark markers:
45   /
46 end markers:
47   / ****
48 headertypes:
49   f functions 1
50   F Foos      2
51 EOF
52
53     add_source( "test.c", $source );
54     add_source( "robodoc.rc", $rc_file );
55     my ($out, $err) = runrobo( qw(--src Src --doc Doc --multidoc 
56         --test --rc Src/robodoc.rc ) );
57     is( $out, '', 'no output' );
58     is( $err, '', 'no error' );
59     my $documentation = XMLin( 'Doc/test_c.xml' );
60     my $header = $documentation->{'header'};
61 #    print Dumper( $documentation );
62     isnt ( $header->{'Foo/foo'}, undef, 'There is a header named Foo/foo' );
63     isnt ( $header->{'Test/test'}, undef, 'There is a header named Test/foo' );
64     clean();
65 }
66
67 #****
68
69 #****x* ROBODoc Configuration File/line-endings.
70 # FUNCTION
71 #   ROBODoc should not care about the kind of line-endings that
72 #   are used.  Either cr/lf or cr, or even lf should work without
73 #   any problem.   We test this with two .rc files that have
74 #   different kind of line-endings.
75 # SOURCE
76 #
77
78 {
79     my $source = <<'EOF';
80 /****f* Test/test
81  * FOO
82  *   test
83  ******/
84 EOF
85     # A rc file with 'unix' line-endings.
86     my $config = read_hexdump( 'TestData/robodoc_unix_rc.xxd' );
87     add_configuration( "test.rc", $config, 'binary' );
88     add_source( "test.rc", $source );
89     mkdocdir();
90     my ( $out, $err ) = runrobo(qw(
91         --src Src
92         --doc Doc/test
93         --rc Config/test.rc
94         --singledoc --test --nopre ));
95     # expected results:
96     is( $out, '', 'No ouput' );
97     is( $err, '', '... and no error' );
98     clean();
99
100     # A rc file with 'windows' line-endings.
101     $config = read_hexdump( 'TestData/robodoc_windows_rc.xxd' );
102     add_configuration( "test.rc", $config, 'binary' );
103     add_source( "test.rc", $source );
104     mkdocdir();
105     ( $out, $err ) = runrobo(qw(
106         --src Src
107         --doc Doc/test
108         --rc Config/test.rc
109         --singledoc --test --nopre ));
110     # expected results:
111     is( $out, '', 'No ouput' );
112     is( $err, '', '... and no error' );
113     clean();
114 }
115
116 #******
117