1Test::YAML::Valid(3) User Contributed Perl Documentation Test::YAML::Valid(3)
2
3
4
6 Test::YAML::Valid - Test for valid YAML
7
9 Version 0.04
10
12 This module lets you easily test the validity of YAML:
13
14 use Test::More tests => 3;
15 use Test::YAML::Valid;
16
17 yaml_string_ok(YAML::Dump({foo => 'bar'}), 'YAML generates good YAML?');
18 yaml_string_ok('this is not YAML, is it?', 'This one will fail');
19 yaml_file_ok('/path/to/some/YAML', '/path/to/some/YAML is YAML');
20 yaml_files_ok('/path/to/YAML/files/*', 'all YAML files are valid');
21
22 You can also test with YAML::Syck instead of YAML by passing "-Syck" in
23 the import list:
24
25 use Test::YAML::Valid qw(-Syck);
26 yaml_string_ok(...); # uses YAML::Syck::Load instead of YAML::Load
27
28 It's up to you to make sure you have YAML::Syck if you specify the
29 "-Syck" option, since it's an optional prerequisite to this module. If
30 it's requested but not found, a warning will be issued and YAML will be
31 used instead.
32
33 As of version 0.04, you can use any module you want in the same way;
34 "-Tiny" for YAML::Tiny and "-XS" for YAML::XS.
35
37 · yaml_string_ok
38
39 · yaml_file_ok
40
41 · yaml_files_ok
42
44 yaml_string_ok($yaml, [$message])
45 Test will pass if $yaml contains valid YAML (according to YAML.pm) and
46 fail otherwise. Returns the result of loading the YAML.
47
48 yaml_file_ok($filename, [$message])
49 Test will pass if $filename is a valid YAML file (according to YAML.pm)
50 and fail otherwise. Returns the result of loading the YAML.
51
52 yaml_files_ok($file_glob_string, [$message])
53 Test will pass if all files matching the glob $file_glob_string contain
54 valid YAML. If a file is not valid, the test will fail and no further
55 files will be examined.
56
57 Returns a list of all loaded YAML;
58
60 Jonathan Rockway, "<jrockway at cpan.org>"
61
63 Please report any bugs or feature requests to "bug-test-yaml-valid at
64 rt.cpan.org", or through the web interface at
65 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-YAML-Valid>. I
66 will be notified, and then you'll automatically be notified of progress
67 on your bug as I make changes.
68
70 You can find documentation for this module with the perldoc command.
71
72 perldoc Test::YAML::Valid
73
74 You can also look for information at:
75
76 · AnnoCPAN: Annotated CPAN documentation
77
78 <http://annocpan.org/dist/Test-YAML-Valid>
79
80 · CPAN Ratings
81
82 <http://cpanratings.perl.org/d/Test-YAML-Valid>
83
84 · RT: CPAN's request tracker
85
86 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-YAML-Valid>
87
88 · Search CPAN
89
90 <http://search.cpan.org/dist/Test-YAML-Valid>
91
93 Stevan Little "<stevan.little@iinteractive.com>" contributed
94 "yaml_files_ok" and some more tests.
95
97 Copyright 2007 Jonathan Rockway, all rights reserved.
98
99 This program is free software; you can redistribute it and/or modify it
100 under the same terms as Perl itself.
101
102
103
104perl v5.30.1 2020-01-30 Test::YAML::Valid(3)