diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-04-18 15:03:28 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-04-18 15:03:28 +0000 |
commit | 2fe5b8de1e9d06482aa76303e7342bc6605700ea (patch) | |
tree | cccc47c409970b2db7a8f64f6c25e993270ddf9b /t/global-api.t | |
download | YAML-tarball-master.tar.gz |
Diffstat (limited to 't/global-api.t')
-rw-r--r-- | t/global-api.t | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/global-api.t b/t/global-api.t new file mode 100644 index 0000000..5932ef9 --- /dev/null +++ b/t/global-api.t @@ -0,0 +1,32 @@ +use strict; +use lib -e 't' ? 't' : 'test'; +use lib 'inc'; +use Test::YAML(); +BEGIN { + @Test::YAML::EXPORT = + grep { not /^(Dump|Load)(File)?$/ } @Test::YAML::EXPORT; +} +use TestYAML tests => 4; +use YAML; + +{ + no warnings qw'once redefine'; + require YAML::Dumper; + + local *YAML::Dumper::dump = + sub { return 'got to dumper' }; + + require YAML::Loader; + local *YAML::Loader::load = + sub { return 'got to loader' }; + + is Dump(\%ENV), 'got to dumper', + 'Dump got to the business end'; + is Load(\%ENV), 'got to loader', + 'Load got to the business end'; + + is Dump(\%ENV), 'got to dumper', + 'YAML::Dump got to the business end'; + is Load(\%ENV), 'got to loader', + 'YAML::Load got to the business end'; +} |