Imported Robodoc.
[robodoc.git] / Source / Test / link_test.pl
1 #!/usr/bin/perl -w
2 use strict;
3 use ROBOTest;
4
5 #****x* SystemTest/link_test_pl
6 # FUNCTION
7 #   Test if ROBODoc correctly creates links between words
8 #   and headers.
9 #
10 #   There are four links, link_1_, _link_2_, link3, and -link4
11 #   they should each occur four times in a <A HREF></A>
12 # SOURCE
13 #
14
15
16 ROBOTest::start("Link Test");
17
18 my %count = ();
19 $count{"link_1_"} = 0;
20 $count{"_link_2_"} = 0;
21 $count{"link3"} = 0; 
22 $count{"-link4"} = 0; 
23 $count{"Llink5"} = 0; 
24
25 while (my $line = <>) {
26     if ($line =~ m#<A\sHREF=[^>]+>([^<]+)</A>#i) {
27         my $link_name = $1;
28         ++$count{$link_name};
29     }
30 }
31
32 ROBOTest::assert( 
33     ($count{"link_1_"} == 4) and
34     ($count{"_link_2_"} == 4) and
35     ($count{"link3"} == 4) and
36     ($count{"-link4"} == 4) and
37     ($count{"Llink5"} == 4),
38     "linking");
39
40 #*****