Aion-Format
view release on metacpan or search on metacpan
t/aion/format/yaml.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Format::Yaml - конвеÑÑÐµÑ Ð¸Ð·/в yaml
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Format::Yaml qw/from_yaml to_yaml/;
local ($::_g0 = do {to_yaml {foo => 'bar'}}, $::_e0 = do {"foo: bar\n"}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'to_yaml {foo => \'bar\'} # -> "foo: bar\n"' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: b"}, $::_e0 = do {{a => "b"}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: b" # --> {a => "b"}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# # DESCRIPTION
#
# ÐонвеÑÑиÑÑÐµÑ Ð¸Ð·/в yaml. Ðод капоÑом иÑполÑзÑÐµÑ `YAML::Syck`, наÑÑÑоеннÑÑ Ð² ÑооÑвеÑÑÑвии Ñ ÑÑебованиÑми Aion.
#
# # SUBROUTINES
#
# ## to_yaml ($struct)
#
# Ð yaml.
#
::done_testing; }; subtest 'to_yaml ($struct)' => sub {
local ($::_g0 = do {to_yaml {foo => undef}}, $::_e0 = "foo: ~\n"); ::ok $::_g0 eq $::_e0, 'to_yaml {foo => undef} # => foo: ~\n' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {to_yaml {foo => 'true'}}, $::_e0 = "foo: 'true'\n"); ::ok $::_g0 eq $::_e0, 'to_yaml {foo => \'true\'} # => foo: \'true\'\n' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## from_yaml ($string)
#
# Ðз yaml.
#
# ÐÑÐ»ÐµÐ²Ñ Ð·Ð½Ð°ÑениÑ:
#
# y|Y|yes|Yes|YES|n|N|no|No|NO|
# true|True|TRUE|false|False|FALSE|
# on|On|ON|off|Off|OFF
#
::done_testing; }; subtest 'from_yaml ($string)' => sub {
local ($::_g0 = do {from_yaml "a: true"}, $::_e0 = do {{a => 1}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: true" # --> {a => 1}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: yes"}, $::_e0 = do {{a => 1}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: yes" # --> {a => 1}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: y"}, $::_e0 = do {{a => 1}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: y" # --> {a => 1}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: ON"}, $::_e0 = do {{a => 1}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: ON" # --> {a => 1}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: FALSE"}, $::_e0 = do {{a => ""}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: FALSE" # --> {a => ""}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: No"}, $::_e0 = do {{a => ""}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: No" # --> {a => ""}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: N"}, $::_e0 = do {{a => ""}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: N" # --> {a => ""}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_yaml "a: off"}, $::_e0 = do {{a => ""}}); ::is_deeply $::_g0, $::_e0, 'from_yaml "a: off" # --> {a => ""}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# # AUTHOR
#
# Yaroslav O. Kosmina <dart@cpan.org>
#
# # LICENSE
#
# â **GPLv3**
#
# # COPYRIGHT
( run in 0.978 second using v1.01-cache-2.11-cpan-39bf76dae61 )