X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-File-KDBX;a=blobdiff_plain;f=t%2Fplaceholders.t;h=88744813412c34d0f5d6078f551eeeb1f65c07ef;hp=0b77510cc7b950e7cbf4ac8efbe07f9a5686cf8c;hb=eefcd42a336641c8927b29d12c5c59443212468f;hpb=cec3705c27fbb9fd9bdfead7103480294b673ed1 diff --git a/t/placeholders.t b/t/placeholders.t index 0b77510..8874481 100644 --- a/t/placeholders.t +++ b/t/placeholders.t @@ -28,33 +28,33 @@ my $entry3 = $kdbx->add_entry( notes => '%MISSING% %% %NOT AVAR% %LYRIC%', ); -is $entry1->expanded_username, 'User Foo', 'Basic placeholder expansion'; -is $entry2->expanded_username, 'User Foo', 'Reference to another entry'; -is $entry3->expanded_username, 'User Foo', 'Reference to another entry through another'; +is $entry1->expand_username, 'User Foo', 'Basic placeholder expansion'; +is $entry2->expand_username, 'User Foo', 'Reference to another entry'; +is $entry3->expand_username, 'User Foo', 'Reference to another entry through another'; my $recursive_expected = 'url notes ' x 10 . 'url {NOTES}'; my $recursive; -my $warning = warning { $recursive = $entry2->expanded_url }; +my $warning = warning { $recursive = $entry2->expand_url }; like $warning, qr/detected deep recursion/i, 'Deep recursion causes a warning' or diag 'Warnings: ', explain $warning; is $recursive, $recursive_expected, 'Recursive placeholders resolve to... something'; { my $entry = File::KDBX::Entry->new(url => 'http://example.com?{EXPLODE}'); - is $entry->expanded_url, 'http://example.com?{EXPLODE}', + is $entry->expand_url, 'http://example.com?{EXPLODE}', 'Unhandled placeholders are not replaced'; local $File::KDBX::PLACEHOLDERS{EXPLODE} = sub { 'boom' }; - is $entry->expanded_url, 'http://example.com?boom', 'Custom placeholders can be set'; + is $entry->expand_url, 'http://example.com?boom', 'Custom placeholders can be set'; $entry->url('{eXplOde}!!'); - is $entry->expanded_url, 'boom!!', 'Placeholder tags are match case-insensitively'; + is $entry->expand_url, 'boom!!', 'Placeholder tags are match case-insensitively'; } { local $ENV{LYRIC} = 'I am the very model of a modern Major-General'; - is $entry3->expanded_password, "lyric:$ENV{LYRIC}", 'Environment variable placeholders'; - is $entry3->expanded_notes, qq{%MISSING% %% %NOT AVAR% $ENV{LYRIC}}, + is $entry3->expand_password, "lyric:$ENV{LYRIC}", 'Environment variable placeholders'; + is $entry3->expand_notes, qq{%MISSING% %% %NOT AVAR% $ENV{LYRIC}}, 'Do not replace things that look like environment variables but are not'; } @@ -68,9 +68,9 @@ is $recursive, $recursive_expected, 'Recursive placeholders resolve to... someth url => '{COUNTER} {USERNAME}', username => '{COUNTER}x{COUNTER}y{COUNTER:-1}', ); - like $entry4->expanded_username, qr/^1x1y-1$/, + like $entry4->expand_username, qr/^1x1y-1$/, 'Each unique placeholder is evaluated once'; - like $entry4->expanded_url, qr/^2 3x3y-1$/, + like $entry4->expand_url, qr/^2 3x3y-1$/, 'Each unique placeholder is evaluated once per string'; }