Skip to content

Commit

Permalink
Properly fail on try verify a seahaven sol when in freecell mode
Browse files Browse the repository at this point in the history
There are Likely many similar bugs
  • Loading branch information
shlomif committed Nov 28, 2024
1 parent 6584ee7 commit ed179b9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,14 @@ sub verify
{
return { error => $err, line_num => $self->_ln(), };
}
else
elsif (
$err = Exception::Class->caught(
'Games::Solitaire::Verify::Exception::State::MissingCards')
)
{
return { error => $err, line_num => $self->_ln(), };
}
elsif (1)
{
$err = Exception::Class->caught();
ref $err ? $err->rethrow : die $err;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if ($@)
}
else
{
plan tests => 2;
plan tests => 4;
}

{
Expand All @@ -36,3 +36,30 @@ else
like( $trap->stderr(), qr#\AWrong.*\n\z#, "Trailing newline in error line.",
);
}

{
my $exit_code;
trap(
sub {
$exit_code = system(
$^X, "-I", "lib",
"bin/verify-solitaire-solution",
"t/data/sample-solutions/fcs-seahaven-towers-1977.txt"
);
}
);

# TEST
ok( $exit_code,
"[Freecell mode trying to verify Seahaven Towers] Non zero (failure) process exit code."
);

# TEST
like(
$trap->stderr(),

# qr#\AWrong.*\n\z#,
qr#\S#ms,
"[Freecell mode trying to verify Seahaven Towers] Trailing newline in error line.",
);
}

0 comments on commit ed179b9

Please sign in to comment.