Skip to content

Commit

Permalink
copy_field/move_field/add_field testing (metafacture/metafacture-fix#116
Browse files Browse the repository at this point in the history
)
  • Loading branch information
blackwinter committed Feb 3, 2022
1 parent bcd9bc1 commit 4d2f0e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions t/Catmandu-Fix-add_field.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ BEGIN {
is_deeply $pkg->new('job', 'fixer')->fix({}), {job => "fixer"},
"add field at root";

is_deeply $pkg->new('job', 'fixer')->fix({job => 42}), {job => "fixer"},
"add field to existing";

is_deeply $pkg->new('deeply.nested.$append.job', 'fixer')->fix({}),
{deeply => {nested => [{job => "fixer"}]}},
"add field creates intermediate path";
Expand Down
3 changes: 3 additions & 0 deletions t/Catmandu-Fix-copy_field.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ BEGIN {
is_deeply $pkg->new('old', 'new')->fix({old => 'old'}),
{old => 'old', new => 'old'}, "copy field at root";

is_deeply $pkg->new('old', 'new')->fix({old => 'old', new => 42}),
{old => 'old', new => 'old'}, "copy field to existing";

is_deeply $pkg->new('old', 'deeply.nested.$append.new')->fix({old => 'old'}),
{old => 'old', deeply => {nested => [{new => 'old'}]}},
"copy field creates intermediate path";
Expand Down
3 changes: 3 additions & 0 deletions t/Catmandu-Fix-move_field.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ BEGIN {
is_deeply $pkg->new('old', 'new')->fix({old => 'old'}), {new => 'old'},
"move field at root";

is_deeply $pkg->new('old', 'new')->fix({old => 'old', new => 42}), {new => 'old'},
"move field to existing";

is_deeply $pkg->new('old', 'deeply.nested.$append.new')->fix({old => 'old'}),
{deeply => {nested => [{new => 'old'}]}},
"move field creates intermediate path";
Expand Down

0 comments on commit 4d2f0e3

Please sign in to comment.