Skip to content

Commit

Permalink
Merge pull request #965 from okurz/feature/check_screen
Browse files Browse the repository at this point in the history
testapi: Adapt check_screen timeout default to proposal in documentation
  • Loading branch information
foursixnine committed Jul 21, 2018
2 parents bbcae8b + 002b7e2 commit 3f5ca00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion t/03-testapi.t
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ subtest 'check_assert_screen' => sub {
stderr_like { assert_screen('foo', 3, timeout => 2) } qr/timeout=2/, 'named over positional';
stderr_like { assert_screen('foo') } qr/timeout=30/, 'default timeout';
stderr_like { assert_screen('foo', no_wait => 1) } qr/no_wait=1/, 'no wait option';
stderr_like { check_screen('foo') } qr/timeout=30/, 'check_screen with same default timeout';
stderr_like { check_screen('foo') } qr/timeout=0/, 'check_screen with timeout of 0';
stderr_like { check_screen('foo', 42) } qr/timeout=42/, 'check_screen with timeout variable';
};

Expand Down
4 changes: 2 additions & 2 deletions testapi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,15 @@ can be replaced by C<assert_screen> with multiple tags using an C<ARRAYREF> in
combination with C<match_has_tag> or another synchronization call in before,
for example C<wait_screen_change> or C<wait_still_screen>.
Returns matched needle or C<undef> if timeout is hit. Default timeout is 30s.
Returns matched needle or C<undef> if timeout is hit. Default timeout is 0s.
=cut

sub check_screen {
my ($mustmatch) = shift;
my $timeout;
$timeout = shift if (@_ % 2);
my %args = (timeout => $timeout // $bmwqemu::default_timeout, @_);
my %args = (timeout => $timeout // 0, @_);
bmwqemu::log_call(mustmatch => $mustmatch, %args);
return _check_or_assert($mustmatch, 1, %args);
}
Expand Down

0 comments on commit 3f5ca00

Please sign in to comment.