Skip to content

Commit

Permalink
Add tests for cleanup() and init()
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-josef-spacek committed Feb 26, 2024
1 parent 33b1340 commit c003718
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.03
- Add error to init() and prepare() without data.
- Add tests for cleanup() and init().
- Fix link to image in doc.

0.02 2024-02-08T22:35:31+01:00
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ SIGNATURE
t/Tags-HTML-ChangePassword/01-use.t
t/Tags-HTML-ChangePassword/02-version.t
t/Tags-HTML-ChangePassword/03-new.t
t/Tags-HTML-ChangePassword/04-cleanup.t
t/Tags-HTML-ChangePassword/05-init.t
xt/Tags-HTML-ChangePassword/01-pod_coverage.t
xt/Tags-HTML-ChangePassword/02-pod.t
2 changes: 2 additions & 0 deletions META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ build_requires:
CSS::Struct::Output::Raw: 0
CSS::Struct::Output::Structure: 0
Data::Message::Simple: 0
English: 0
Error::Pure::Utils: 0
ExtUtils::MakeMaker: 6.59
Tags::Output::Raw: 0
Tags::Output::Structure: 0
Expand Down
2 changes: 2 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ resources 'repository' => 'git://github.com/michal-josef-spacek/Tags-HTML-Change
test_requires 'CSS::Struct::Output::Raw' => 0;
test_requires 'CSS::Struct::Output::Structure' => 0;
test_requires 'Data::Message::Simple' => 0;
test_requires 'English' => 0;
test_requires 'Error::Pure::Utils' => 0;
test_requires 'Tags::Output::Raw' => 0;
test_requires 'Tags::Output::Structure' => 0;
test_requires 'Test::MockObject' => 0;
Expand Down
11 changes: 11 additions & 0 deletions t/Tags-HTML-ChangePassword/04-cleanup.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use strict;
use warnings;

use Tags::HTML::ChangePassword;
use Test::More 'tests' => 2;
use Test::NoWarnings;

# Test.
my $obj = Tags::HTML::ChangePassword->new;
my $ret = $obj->cleanup;
is($ret, undef, 'Cleanup returns undef.');
28 changes: 28 additions & 0 deletions t/Tags-HTML-ChangePassword/05-init.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use strict;
use warnings;

use Data::Message::Simple;
use English;
use Error::Pure::Utils qw(clean);
use Tags::HTML::ChangePassword;
use Test::More 'tests' => 3;
use Test::NoWarnings;

# Test.
my $obj = Tags::HTML::ChangePassword->new;
my $messages_ar = [
Data::Message::Simple->new(
'text' => 'Error #1',
'type' => 'error',
),
];
my $ret = $obj->init($messages_ar);
is($ret, undef, 'Init returns undef.');

# Test.
$obj = Tags::HTML::ChangePassword->new;
eval {
$obj->init;
};
is($EVAL_ERROR, "No messages to init.\n", "No messages to init.");
clean();

0 comments on commit c003718

Please sign in to comment.