Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Struct::Diff diff conversion supported in diff()
- Loading branch information
Showing
3 changed files
with
35 additions
and
5 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,23 @@ | ||
#!perl -T | ||
|
||
use strict; | ||
use warnings FATAL => 'all'; | ||
|
||
use Test::More tests => 1; | ||
|
||
require Struct::Diff; | ||
require JSON::Patch; | ||
|
||
my $patch = JSON::Patch::diff( | ||
Struct::Diff::diff( | ||
{foo => ['bar']}, | ||
{foo => ['bar', 'baz']} | ||
) | ||
); | ||
is_deeply( | ||
$patch, | ||
[ | ||
{op => 'add', path => '/foo/1', value => 'baz'} | ||
] | ||
); | ||
|