Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change required:no handling for undefined data
See #1
- Loading branch information
Showing
3 changed files
with
76 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/perl -w | ||
# -*- cperl -*- | ||
|
||
# | ||
# Author: Slaven Rezic | ||
# | ||
|
||
use strict; | ||
|
||
BEGIN { | ||
if (!eval q{ | ||
use Test::More; | ||
1; | ||
}) { | ||
print "1..0 # skip: no Test::More module\n"; | ||
exit; | ||
} | ||
|
||
if ($] < 5.005) { | ||
print "1..0 # skip: test works only with perl 5.005 or better\n"; | ||
exit; | ||
} | ||
} | ||
|
||
use Kwalify qw(validate); | ||
|
||
plan tests => 1; | ||
|
||
# from https://github.com/eserte/p5-Kwalify/issues/1 | ||
# translated yaml to perl | ||
my $schema = { | ||
'mapping' => { | ||
'foo' => { | ||
'mapping' => { | ||
'bar' => { | ||
'sequence' => [ | ||
{ | ||
'required' => 'no', | ||
'type' => 'str' | ||
} | ||
], | ||
'required' => 'no', | ||
'type' => 'seq' | ||
} | ||
}, | ||
'required' => 'yes', | ||
'type' => 'map' | ||
} | ||
}, | ||
'desc' => 'test for tilde', | ||
'name' => 'test', | ||
'type' => 'map' | ||
}; | ||
|
||
my $data = { | ||
'foo' => { | ||
'bar' => undef | ||
} | ||
}; | ||
|
||
ok validate $schema, $data; | ||
|
||
__END__ |