forked from Test-More/test-more
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Test-More#265 from geistteufel/Test-Builder1.5
Issue Test-More#264: Stringify the name attribute Fix ok( $test, qr/.../ );
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
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
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,42 @@ | ||
#!/usr/bin/env perl -w | ||
|
||
use strict; | ||
use warnings; | ||
|
||
BEGIN { require "t/test.pl" } | ||
|
||
|
||
note "Stringify"; { | ||
{ | ||
package My::Stringify; | ||
|
||
use TB2::Mouse; | ||
use TB2::Types; | ||
|
||
has stringify => | ||
is => 'rw', | ||
isa => 'TB2::Stringify', | ||
coerce => 1; | ||
} | ||
|
||
my $obj = My::Stringify->new; | ||
|
||
my $tests_ref = { | ||
'regex' => qr/hello/, | ||
'empty string' => '', | ||
'string' => 'string', | ||
'hashref' => { my => 'test' }, | ||
'arrayref' => ['my','test'], | ||
'object' => $obj, | ||
'sub' => sub { 1 }, | ||
}; | ||
|
||
while(my ($test, $ref) = each %$tests_ref) { | ||
is $obj->stringify($ref), "$ref", 'stringify '.$test; | ||
} | ||
|
||
} | ||
|
||
|
||
done_testing; | ||
|