Test::More.skip() was missing; add it
---
runtime/parrot/library/Test/More.pir | 27 +++++++++++++++++++++++++++
t/library/test_more.t | 12 +++++++++++-
2 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library/Test/More.pir
index ac5f440..b972d0e 100644
--- a/runtime/parrot/library/Test/More.pir
+++ b/runtime/parrot/library/Test/More.pir
@@ -737,6 +737,33 @@ optional test description in C<description>.
done:
.end
+=item C<skip( why, how_many )>
+
+Pass a number of tests, but with a comment that marks the test was
+actually skipped. Arguments are are optional.
+
+Note that the arguments are in reverse compared to
+C<Test::Builder.test>. They are in the order of the Perl5 Test::More
+module.
+
+=cut
+
+.sub skip
+ .param string description :optional
+ .param int has_description :opt_flag
+ .param int how_many :optional
+ .param int has_how_many :opt_flag
+
+ $I0 = how_many
+ if has_how_many goto just_say_it
+ $I0 = 1
+just_say_it:
+
+ .local pmc test
+ find_global test, 'Test::More', '_test'
+ test.'skip'($I0, description)
+.end
+
.sub _make_diagnostic
.param string received
.param string expected
diff --git a/t/library/test_more.t b/t/library/test_more.t
index 9f548e0..f9a6044 100644
--- a/t/library/test_more.t
+++ b/t/library/test_more.t
@@ -23,6 +23,7 @@
.IMPORT( 'Test::More', 'is' )
.IMPORT( 'Test::More', 'diag' )
.IMPORT( 'Test::More', 'like' )
+ .IMPORT( 'Test::More', 'skip' )
.IMPORT( 'Test::More', 'is_deeply' )
.IMPORT( 'Test::Builder::Tester', 'plan' )
.IMPORT( 'Test::Builder::Tester', 'test_out' )
@@ -31,7 +32,7 @@
.IMPORT( 'Test::Builder::Tester', 'test_pass' )
.IMPORT( 'Test::Builder::Tester', 'test_test' )
- plan( 43 )
+ plan( 45 )
test_ok()
test_is()
test_like()
@@ -341,4 +342,13 @@
test_out( 'ok 44 #skip skipping' )
test.'skip'( 2, 'skipping' )
test_test( 'skip test should pass' )
+
+ test_out( 'ok 45 #skip jumping' )
+ skip( "jumping" )
+ test_test( 'skip(string)' )
+
+ test_out( 'ok 46 #skip lunch' )
+ test_out( 'ok 47 #skip lunch' )
+ skip( "lunch", 2 )
+ test_test( 'skip(string, int)' )
.end
--
1.4.4.1.gc070
skip(5, 'lengthy message about reasoning')
is more readable than:
skip('lengthy message about reasoning', 5)
Is the assumption that skipping a single test with a message is more
common than skipping a number of tests without a message?
skip('lengthy message about reasoning')
vs.
skip(5)
Could you tweak your git options to produce patches as attached files?
(Is there a .gitrc file or something to set defaults for a particular
repository?)
Allison
Well, it's not reversed from Perl 5's Test::Builder
=item B<SKIP: BLOCK>
SKIP: {
skip $why, $how_many if $condition;
...normal testing code goes here...
}
> It seems that:
> skip(5, 'lengthy message about reasoning')
>
> is more readable than:
>
> skip('lengthy message about reasoning', 5)
I agree. I believe that I've made this mistake before in writing tests in
Perl 5.
> Is the assumption that skipping a single test with a message is more
> common than skipping a number of tests without a message?
This is my guess too. Probably need to as Schwern to find out the original
(Perl 5) reason.
Nicholas Clark
> >> Why the reversed order of arguments from Test::Builder.skip?
> multi-sub?
>
> skip string
> skip int, string
Seems appropriate to me. Now if the former were a curried version of the
latter, installed as a multi....
-- c
I just committed (r17010) a version of the original patch, shifted over
to a multisub.
Allison