-
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.
Feature: CONSTRAINT also allows Data::Validator, Poz and hashref
- Loading branch information
Showing
8 changed files
with
229 additions
and
40 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
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,11 @@ | ||
package TestDataValidator; | ||
|
||
use Exporter 'import'; | ||
use Data::Validator; | ||
|
||
use kura Book => Data::Validator->new( | ||
title => 'Str', | ||
author => 'Str', | ||
); | ||
|
||
1; |
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,24 @@ | ||
use Test2::V0; | ||
use Test2::Require::Module 'Poz', '0.02'; | ||
|
||
use FindBin qw($Bin); | ||
use lib "$Bin"; | ||
|
||
use TestDataValidator qw(Book); | ||
|
||
subtest 'Test `kura` with Data::Validator' => sub { | ||
isa_ok Book, 'Data::Validator'; | ||
|
||
my $data = { title => "Spidering Hacks", author => "Kevin Hemenway" }; | ||
|
||
my $got = Book->validate($data); | ||
is $got, $data; | ||
|
||
ok dies { | ||
Book->validate({ | ||
isbn => "978-0-596-00797-3", | ||
}); | ||
}; | ||
}; | ||
|
||
done_testing; |
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
package MyConstraint; | ||
|
||
sub new { bless {}, shift } | ||
sub new { | ||
my ($class, %args) = @_; | ||
bless \%args, $class; | ||
} | ||
|
||
sub check { 1 } | ||
|
||
1; |
Oops, something went wrong.