Skip Menu |

This queue is for tickets about the Struct-Diff CPAN distribution.

Report information
The Basics
Id: 128169
Status: resolved
Worked: 1 min
Priority: 0/
Queue: Struct-Diff

People
Owner: MIXAS [...] cpan.org
Requestors: paxunix [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in split_diff() - Struct::Diff v0.97
Date: Fri, 4 Jan 2019 21:14:30 -0800
To: bug-Struct-Diff [...] rt.cpan.org
From: Shawn Halpenny <paxunix [...] gmail.com>
I think I have found a bug in split_diff() where it doesn't correctly preserve empty structures in either {a} or {b}. I've not had the time to debug it further and submit a patch. -- Shawn Halpenny ------8<------ test case code use Struct::Diff; use Test::Deep; use Test::More; my $old = { o_arr => [ ], o_hsh => { }, n_arr => [ 3 ], n_hsh => { k => 4 }, }; my $new = { o_arr => [ 1 ], o_hsh => { k => 2 }, n_arr => [ ], n_hsh => { }, }; my $diff = Struct::Diff::diff($old, $new); my $split = Struct::Diff::split_diff($diff); cmp_deeply($split->{a}, $old, "old empty array and hash are preserved by split_diff()"); cmp_deeply($split->{b}, $new, "new empty array and hash are preserved by split_diff()"); done_testing(); ------8<------ test case output $ PERL5LIB=/home/paxunix/Downloads/Struct-Diff-0.97/lib perl ./split_diff.t not ok 1 - old empty array and hash are preserved by split_diff() # Failed test 'old empty array and hash are preserved by split_diff()' # at ./split_diff.t line 23. # Comparing hash keys of $data # Missing: 'o_arr', 'o_hsh' not ok 2 - new empty array and hash are preserved by split_diff() # Failed test 'new empty array and hash are preserved by split_diff()' # at ./split_diff.t line 27. # Comparing hash keys of $data # Missing: 'n_arr', 'n_hsh' 1..2 # Looks like you failed 2 tests of 2. ------8<------ miscellaneous $ perl -v This is perl 5, version 26, subversion 2 (v5.26.2) built for x86_64-linux-gnu-thread-multi (with 63 registered patches, see perl -V for more detail) $ uname -a Linux breakdown 4.18.0-13-generic #14-Ubuntu SMP Wed Dec 5 09:04:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
On Sat Jan 05 00:15:24 2019, paxunix@gmail.com wrote: Show quoted text
> I think I have found a bug in split_diff() where it doesn't correctly > preserve empty structures in either {a} or {b}. I've not had the time to > debug it further and submit a patch. >
Hi Shawn, Fixed in 0.98 Thanx for the report! -- Michael