Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testapi: Adapt check_screen timeout default to proposal in documentation #965

Merged
merged 1 commit into from Jul 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion isotovideo
Expand Up @@ -63,7 +63,7 @@ BEGIN {

# this shall be an integer increased by every change of the API
# either to the worker or the tests
our $INTERFACE = 11;
our $INTERFACE = 12;

use bmwqemu;
use needle;
Expand Down
2 changes: 1 addition & 1 deletion t/03-testapi.t
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
Expand Up @@ -363,15 +363,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