-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eliminate use vars, and add test that all vars are populated.
- Loading branch information
Showing
3 changed files
with
87 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ Makefile.PL | |
MANIFEST | ||
README.md | ||
t/00-load.t | ||
t/01-populated.t | ||
t/pod.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!perl | ||
|
||
# Verify that all the hashes and arrays are populated. | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More tests => 32; | ||
|
||
use HTML::Tagset; | ||
|
||
my @vars = qw( | ||
%emptyElement | ||
%optionalEndTag | ||
%linkElements | ||
%boolean_attr | ||
%isPhraseMarkup | ||
%is_Possible_Strict_P_Content | ||
%isHeadElement | ||
%isList | ||
%isTableElement | ||
%isFormElement | ||
%isBodyElement | ||
%isHeadOrBodyElement | ||
%isKnown | ||
%canTighten | ||
%isCDATA_Parent | ||
@p_closure_barriers | ||
); | ||
|
||
|
||
HASHES: { | ||
for my $var ( grep { /%/ } @vars ) { | ||
$var =~ s/^%(.+)/%HTML::Tagset::$1/ or die; | ||
|
||
my %h = eval "$var"; | ||
cmp_ok( scalar keys %h, '>', 0, "$var is not an empty hash" ); | ||
|
||
my @undefs = grep { !defined } values %h; | ||
is( scalar @undefs, 0, "$var has no undef values" ); | ||
} | ||
} | ||
|
||
|
||
ARRAYS: { | ||
for my $var ( grep { /@/ } @vars ) { | ||
$var =~ s/^\@(.+)/\@HTML::Tagset::$1/ or die; | ||
|
||
my @a = eval "$var"; | ||
cmp_ok( scalar @a, '>', 0, "$var is not an empty array" ); | ||
|
||
my @undefs = grep { !defined } @a; | ||
is( scalar @undefs, 0, "$var has no undef values" ); | ||
} | ||
} | ||
|
||
|
||
exit; |