-
Notifications
You must be signed in to change notification settings - Fork 192
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
Add assert_screen_change #689
Conversation
15e1f7f
to
c082982
Compare
I think this CODEREF is a bit too perl specific. I suggest to add an example for perl beginners |
this comes from |
Linking will do, yes. |
c082982
to
bae1ebe
Compare
updated |
@@ -396,6 +397,24 @@ sub wait_screen_change(&@) { | |||
return 0; | |||
} | |||
|
|||
=head2 assert_screen_change | |||
|
|||
assert_screen_change { CODEREF [,$timeout] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actual incorrect syntax because the CODEREF is the {} - and the optinal timeout is after it. The same error is in the wait_screen_change reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this better?
diff --git a/testapi.pm b/testapi.pm
index 25a4157..165a8aa 100755
--- a/testapi.pm
+++ b/testapi.pm
@@ -354,7 +354,7 @@ sub assert_and_dclick {
=head2 wait_screen_change
- wait_screen_change { CODEREF [,$timeout] };
+ wait_screen_change(CODEREF [,$timeout]);
Wrapper around code that is supposed to change the screen.
This is the opposite to C<wait_still_screen>. Make sure to put the commands to change the screen
@@ -399,7 +399,7 @@ sub wait_screen_change(&@) {
=head2 assert_screen_change
- assert_screen_change { CODEREF [,$timeout] };
+ assert_screen_change(CODEREF [,$timeout]);
Run C<CODEREF> with C<wait_screen_change> but C<die> if screen did not change
within timeout. Look into C<wait_screen_change> for details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Variant of wait_screen_change but dying on no screen change.
bae1ebe
to
efc2234
Compare
os-autoinst/os-autoinst#689 added a new function to the testapi 'assert_screen_change' which should be used wherever there is no explicit checking of the return value of 'wait_screen_change'. Leaving alone the occurences of 'wait_screen_change' where the return code is checked.
os-autoinst/os-autoinst#689 added a new function to the testapi 'assert_screen_change' which should be used wherever there is no explicit checking of the return value of 'wait_screen_change'. Leaving alone the occurences of 'wait_screen_change' where the return code is checked. Verification run: http://lord.arch/tests/5552
=cut | ||
|
||
sub assert_screen_change(&@) { | ||
::wait_screen_change(@_) or die 'assert_screen_change failed to detect a screen change'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know perl, what does ::
do here? I just want to call the other method in the same file and without that it didn't work. Also, deleting the parameter part (&@)
on both wait_screen_change
and assert_screen_change
did not work, ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perl black magic, ::wait_screen_change
is short for main::wait_screen_change
use strict;
use warnings;
sub foo {
print "They called me!";
}
::foo;
foo;
os-autoinst/os-autoinst#689 added a new function to the testapi 'assert_screen_change' which should be used wherever there is no explicit checking of the return value of 'wait_screen_change'. Leaving alone the occurences of 'wait_screen_change' where the return code is checked.
os-autoinst/os-autoinst#689 added a new function to the testapi 'assert_screen_change' which should be used wherever there is no explicit checking of the return value of 'wait_screen_change'. Leaving alone the occurences of 'wait_screen_change' where the return code is checked.
Variant of wait_screen_change but dying on no screen change.