File: version.t

package info (click to toggle)
libdoxygen-filter-perl 1.73-2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 288 kB
  • sloc: perl: 1,015; makefile: 2
file content (101 lines) | stat: -rw-r--r-- 3,422 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/perl
#####################################################################
# This program is not guaranteed to work at all, and by using this  #
# program you release the author of any and all liability.          #
#                                                                   #
# You may use this code as long as you are in compliance with the   #
# license (see the LICENSE file) and this notice, disclaimer and    #
# comment box remain intact and unchanged.                          #
#                                                                   #
# Package:     Doxygen::Filter::Perl                                #
# UnitTest:    version.t                                            #
# Description: Unit test and verification for checking VERSIONs     #
#                                                                   #
# Written by:  Bret Jordan (jordan at open1x littledot org)         #
# Created:     2011-11-07                                           #
##################################################################### 
#
#
#
#

use lib "lib/";

use strict;
use warnings;
use Doxygen::Filter::Perl;
use Test::More;
use Test::Output;

my $test = new Doxygen::Filter::Perl();
$test->ProcessFile();


my @aFileData;
my $sCorrectValue;
my $sTestValue;


print "\n";
print "######################################################################\n";
print "# Version Test 1                                                     #\n";
print "# Can we create the object                                           #\n";
print "######################################################################\n";
ok( defined $test, 'verify new() created an object' );



print "\n";
print "######################################################################\n";
print "# Version Test 2                                                     #\n";
print "# our \$VERSION = '0.99_21'                                          #\n";
print "# Should get a version of 0.99_21                                    #\n";
print "######################################################################\n";
@aFileData = (
    '', 
    'our $VERSION     = \'0.99_21\';', 
    '$VERSION = eval $VERSION;', 
    ''
);
$test->{'_aRawFileData'} = \@aFileData;
$test->ProcessFile();
$sCorrectValue = '0.99_21';
$sTestValue = $test->{'_hData'}->{'filename'}->{'version'};
is("$sTestValue", "$sCorrectValue",                "verify VERSION string of $sCorrectValue was parsed correctly" );
&RESET_TEST;



print "\n";
print "######################################################################\n";
print "# Version Test 3                                                     #\n";
print "# use version; our \$VERSION = qv('0.3.1')                           #\n";
print "# Should get a version of 0.3.1                                      #\n";
print "######################################################################\n";
@aFileData = (
    '', 
    'use version; our $VERSION = qv(\'0.3.1\');', 
    ''
);
$test->{'_aRawFileData'} = \@aFileData;
$test->ProcessFile();
$sCorrectValue = '0.3.1';
$sTestValue = $test->{'_hData'}->{'filename'}->{'version'};
is("$sTestValue", "$sCorrectValue",                "verify VERSION string of $sCorrectValue was parsed correctly" );
&RESET_TEST;



done_testing();

sub RESET_TEST
{
    @aFileData      = undef;
    $sCorrectValue  = undef;
    $sTestValue   = undef;
}