X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-File-KDBX;a=blobdiff_plain;f=t%2Fkdbx4.t;h=f1e9cbc69498b932b6b2b4953a13555fb5c95d27;hp=5fee0868d52b195aefc18cfcb3025fc833a901cf;hb=c98fc7d0294e641cf8844306808333bdec4fea2f;hpb=1d0a10e989a4d0487aa13cf4f56e533d3795469d diff --git a/t/kdbx4.t b/t/kdbx4.t index 5fee086..f1e9cbc 100644 --- a/t/kdbx4.t +++ b/t/kdbx4.t @@ -37,8 +37,8 @@ subtest 'Verify Format400' => sub { is $kdbx->meta->{database_name}, 'Format400', 'Extract database name from meta'; is $kdbx->root->name, 'Format400', 'Extract name of root group'; - my ($entry, @other) = $kdbx->find_entries([\'400', 'title']); - is @other, 0, 'Database has one entry'; + my ($entry, @other) = $kdbx->entries->grep(\'400', 'title')->each; + is scalar @other, 0, 'Database has one entry'; is $entry->title, 'Format400', 'Entry is titled'; is $entry->username, 'Format400', 'Entry has a username set'; @@ -81,9 +81,9 @@ subtest 'KDBX4 upgrade' => sub { subtest 'KDBX4.1 upgrade' => sub { my $kdbx = File::KDBX->new; - my $group1 = $kdbx->add_group; - my $group2 = $kdbx->add_group; - my $entry1 = $kdbx->add_entry; + my $group1 = $kdbx->add_group(label => 'One'); + my $group2 = $kdbx->add_group(label => 'Two'); + my $entry1 = $kdbx->add_entry(label => 'Meh'); $group1->tags('hi'); is $kdbx->minimum_version, KDBX_VERSION_4_1, 'Groups with tags requires upgrade'; @@ -205,12 +205,12 @@ subtest 'Custom data' => sub { ok isBoolean($kdbx2->public_custom_data->{bool}), 'Boolean is indeed a boolean'; is $kdbx2->public_custom_data->{bytes}, "\1\2\3\4", 'Store some bytes in public custom data'; - my ($group2) = $kdbx2->find_groups({label => 'Group'}); + my $group2 = $kdbx2->groups->grep(label => 'Group')->next; is_deeply $group2->custom_data_value('str'), '你好', 'Store a string in group custom data'; is_deeply $group2->custom_data_value('num'), '42', 'Store a number in group custom data'; is_deeply $group2->custom_data_value('bool'), '1', 'Store a boolean in group custom data'; - my ($entry2) = $kdbx2->find_entries({label => 'Entry'}); + my $entry2 = $kdbx2->entries->grep(label => 'Entry')->next; is_deeply $entry2->custom_data_value('str'), '你好', 'Store a string in entry custom data'; is_deeply $entry2->custom_data_value('num'), '42', 'Store a number in entry custom data'; is_deeply $entry2->custom_data_value('bool'), '0', 'Store a boolean in entry custom data';