forked from graphviz-perl/GraphViz2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2 syntax pod corrections + 2 new test files that increase to coverage of
sub's tested with mostly empty data.
- Loading branch information
Steve Thorn
committed
Feb 22, 2018
1 parent
b41aa51
commit 484e3be
Showing
4 changed files
with
75 additions
and
4 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 |
---|---|---|
|
@@ -72,9 +72,9 @@ has global => | |
|
||
has graph => | ||
( | ||
default => sub{return ''}, | ||
default => sub{return {} }, | ||
This comment has been minimized.
Sorry, something went wrong. |
||
is => 'rw', | ||
#isa => HashRef, | ||
isa => HashRef, | ||
required => 0, | ||
); | ||
|
||
|
@@ -1742,7 +1742,7 @@ $level defaults to 'debug', and $message defaults to ''. | |
If called with $level eq 'error', it dies with $message. | ||
=head2 logger($logger_object]) | ||
=head2 logger($logger_object) | ||
This comment has been minimized.
Sorry, something went wrong.
ThornyS
Owner
|
||
Gets or sets the log object. | ||
|
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,53 @@ | ||
use strict; | ||
use utf8; | ||
use warnings; | ||
use warnings qw(FATAL utf8); # Fatalize encoding glitches. | ||
use open qw(:std :utf8); # Undeclared streams in UTF-8. | ||
use charnames qw(:full :short); # Unneeded in v5.16. | ||
|
||
use Data::Dumper; | ||
use Test::More; | ||
use GraphViz2; | ||
|
||
# ------------------------------------------------ | ||
|
||
my $GraphViz2 = GraphViz2->new(); | ||
my $count = 0; | ||
|
||
my %methods = ( | ||
add_node => { id => 1, args => { name => 'TestNode1', label => 'n1' } }, | ||
add_edge => { id => 2, args => { from => 'TestNode1', to => '' } }, | ||
default_subgraph => { id => 3, args => {} }, | ||
escape_some_chars => { id => 4, args => { $GraphViz2, "abc123[]()" } }, | ||
push_subgraph => { | ||
id => 5, | ||
args => { | ||
name => 'subgraph_test', | ||
edge => {}, | ||
graph => { bgcolor => 'grey', label => 'subgraph_test' } | ||
} | ||
}, | ||
pop_subgraph => { id => 6, args => {} }, | ||
report_valid_attributes => { id => 7, args => {} }, | ||
run => { id => 8, args => {} }, | ||
run_map => { id => 9, args => {} }, | ||
run_mapless => { id => 10, args => {} }, | ||
); | ||
foreach my $sub ( sort { $methods{$a}{id} <=> $methods{$b}{id} } keys %methods ) | ||
{ | ||
|
||
# Check we can call this function/method/sub | ||
$count++; | ||
can_ok( $GraphViz2, $sub ); | ||
|
||
$count++; | ||
ok( | ||
$GraphViz2->$sub( %{ $methods{$sub}{'args'} } ), | ||
"Run $sub with -> " | ||
. join( | ||
", ", map { "$_:$methods{$sub}{'args'}{$_}" } keys %{ $methods{$sub}{'args'} } | ||
) | ||
); | ||
} | ||
done_testing($count); | ||
|
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,18 @@ | ||
use strict; | ||
use utf8; | ||
use warnings; | ||
use warnings qw(FATAL utf8); # Fatalize encoding glitches. | ||
use open qw(:std :utf8); # Undeclared streams in UTF-8. | ||
use charnames qw(:full :short); # Unneeded in v5.16. | ||
|
||
use Test::More; | ||
|
||
# ------------------------------------------------ | ||
|
||
BEGIN{ use_ok('GraphViz2'); } | ||
|
||
my($count) = 1; # Counting the use_ok above. | ||
$count++; | ||
my $GraphViz2 = new_ok('GraphViz2'); | ||
done_testing($count); | ||
|
initialisation in the BEGIN sub attempts to use 'default' as 'HashRef' which errors when it sees empty string.
Changed as part of expanding test coverage for subs