Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created November 17, 2020 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Whateverable/09ff0cb76e366c724c2a7568a376de38 to your computer and use it in GitHub Desktop.
Save Whateverable/09ff0cb76e366c724c2a7568a376de38 to your computer and use it in GitHub Desktop.
bisectable6
use Test; dd &trait_mod:<is>(sub { }, :test-assertion)
Bisecting: 55 revisions left to test after this (roughly 6 steps)
[46477cd27194f685c5b16a276df012f6c4005506] Merge pull request #4012 from usev6/shapedarray_fix
»»»»» Testing 46477cd27194f685c5b16a276df012f6c4005506
»»»»» Script output:
sub { #`(Sub+{Test::is-test-assertion}|94851128562736) ... }
»»»»» Script exit code: 0
»»»»» Bisecting by exit code
»»»»» Current exit code is 0, exit code on “old” revision is 1
»»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
»»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 35213f66a39d07549c147aea5335e7a5b2563411
»»»»» Script output:
sub { #`(Sub+{Test::is-test-assertion}|94486365272976) ... }
»»»»» Script exit code: 0
»»»»» Bisecting by exit code
»»»»» Current exit code is 0, exit code on “old” revision is 1
»»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
»»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing f4b38a173f1407de85551d68b72bdc4ea1e84e77
»»»»» Script output:
Can't use unknown trait 'is' -> 'test-assertion' in a sub declaration.
in block <unit> at /tmp/UfhJjB16pM line 1
»»»»» Script exit code: 1
»»»»» Bisecting by exit code
»»»»» Current exit code is 1, exit code on “old” revision is 1
»»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
»»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”
»»»»» Therefore, marking this revision as “old”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 97d473b9a5768add0d326da3676f1038e384e62a
»»»»» Script output:
sub { #`(Sub+{Test::is-test-assertion}|94659565950736) ... }
»»»»» Script exit code: 0
»»»»» Bisecting by exit code
»»»»» Current exit code is 0, exit code on “old” revision is 1
»»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
»»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 18882bf6fb7b5a8b6df071589a28e05b0fc58592
»»»»» Script output:
sub { #`(Sub+{Test::is-test-assertion}|93893953158080) ... }
»»»»» Script exit code: 0
»»»»» Bisecting by exit code
»»»»» Current exit code is 0, exit code on “old” revision is 1
»»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
»»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 585db59c9a33c609beda49b68b76b6ce81c664ab
»»»»» Script output:
sub { #`(Sub+{Test::is-test-assertion}|94831452877056) ... }
»»»»» Script exit code: 0
»»»»» Bisecting by exit code
»»»»» Current exit code is 0, exit code on “old” revision is 1
»»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
»»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 084b92a3289e87ad6067c5533fa31868d0ed0653
»»»»» Script output:
Can't use unknown trait 'is' -> 'test-assertion' in a sub declaration.
in block <unit> at /tmp/UfhJjB16pM line 1
»»»»» Script exit code: 1
»»»»» Bisecting by exit code
»»»»» Current exit code is 1, exit code on “old” revision is 1
»»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
»»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”
»»»»» Therefore, marking this revision as “old”
585db59c9a33c609beda49b68b76b6ce81c664ab is the first new commit
commit 585db59c9a33c609beda49b68b76b6ce81c664ab
Author: Elizabeth Mattijsen <liz@wenzperl.nl>
Date: Fri Oct 30 10:36:12 2020 +0100
Introducing Routine is test-assertion trait (#3991)
Introducing Routine is test-assertion trait
Marking a subroutine with the "is test-assertion" trait, indicates that
the subroutine produces Test (aka TAP) output. All of the exported
subroutines in Test implicitely have this trait.
When a test fails and a failure needs to be reported, the file and
line at which a test assertion is *called* is shown. However, if you build
your own subroutines for doing several similar tests depending
on arguments given, any failure will be reported *inside* that subroutine
rather than at the location where your own subroutine was called. Which
is extremely annoying when writing extensive, parameter driven tests.
With this trait, you can mark your own testing subroutines to get failing
tests to report at the place your own testing subroutine is called!
use Test;
sub foo-test($value) is test-assertion {
is $value, 42, "is the value 42?"; # <-- do *not* report this line
}
foo-test(666); # <-- report *this* line
You can even nest such test assertion subroutines: any failures will
always point to the call to the outer subroutine;
sub bar-test($value) is test-assertion {
foo-test($value); # <-- do *not* report this line
}
bar-test(666); # <-- report this line
:040000 040000 3d27c4d947a44da9bb5ed86165e0c2346cf88d86 4f47c4db65a3930abb49a29b19039c0b8eed874d M lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment