Imported Robodoc.
[robodoc.git] / Source / t / wiki_formatting.t
1 #!perl
2 # vi: spell ff=unix
3 #****h* ROBODoc System Tests/Wiki Formatting
4 # FUNCTION
5 #    Tests that test the Wiki like formatting that ROBODoc supports.
6 #*****
7
8
9 #------------------------------------------------------------------------------
10 use strict;
11 use warnings;
12 use ROBOTestFrame;
13 use Test::More 'no_plan';
14 use Test::File;
15 use XML::Simple;
16 use Data::Dumper;
17
18 #****x* Wiki Formatting/Wiki Basics
19 # FUNCTION
20 #   Test a simple header: contains three lists, some paragraphs,
21 #   and some source.  All should be recognized.
22 # SOURCE
23
24 {
25     my $source = <<'EOF';
26 /****f* Test/Test
27  * NAME
28  *
29  *   Implements serializers for the following
30  *   files:
31  *   - DZB_ACG - SAP accounting file record.
32  *   - DZB_RRP - regularoty reporting file record.
33  *   - DZB_MVT - Exchange Position File Record.
34  *
35  *   A test
36  *     
37  *   Implements the following
38  *   functions:
39  *   - S99304_SERIALIZE_DZB_ACG
40  *   - S99304_SERIALIZE_DZB_ACG_TBL
41  *   - S99304_SERIALIZE_DZB_MVT
42  *   and the functions:
43  *   - S99304_SERIALIZE_DZB_MVT_TBL
44  *   - S99304_SERIALIZE_DZB_RRP
45  *   - S99304_SERIALIZE_DZB_RRP_TBL
46  * SOURCE
47  */
48     test()
49
50  /******/
51
52 EOF
53
54     add_source( "test.c", $source );
55     my ( $out, $err ) = runrobo(qw(--src Src --doc Doc --nopre --multidoc --test));
56     # expected results:
57     is( $out, '', 'No ouput' );
58     is( $err, '', '... and no error' );
59
60     my $documentation = XMLin( 'Doc/test_c.xml' );
61     my $header = $documentation->{'header'};
62     is ( $header->{'name'}, 'Test/Test', 'Header is named Test/Test' );
63     my $items = $header->{'item'};
64     ok ( exists( $items->{'NAME'} ),   'header has an item NAME' );
65     ok ( exists( $items->{'SOURCE'} ), 'header has an item SOURCE' );
66     my $body = $items->{'NAME'}->{'item_body'};
67
68     # There are paragraphs.
69     ok ( exists( $body->{'para'} ),    'item has paragraphs' );
70
71     # There are three lists.
72     is ( scalar( @{ $body->{'list'} } ), 3, 'item has three lists' );
73     clean();
74 }
75
76 #******
77
78