diff --git a/S11-modules/versioning.t b/S11-modules/versioning.t index fa37245fe6..eed474cd2f 100644 --- a/S11-modules/versioning.t +++ b/S11-modules/versioning.t @@ -1,25 +1,32 @@ use Test; -use lib ; -use Test::Helpers; +use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); +use Test::Util; my $lib-path = $?FILE.IO.parent(2).add("packages/S11-modules/lib"); plan 9; +my @compiler-args = '-I', $lib-path.absolute; + for -> $from-rev { for -> $mod-rev { subtest "6.$mod-rev from 6.$from-rev", { plan 8; for (:core-revision($mod-rev), :raku-version("6.$mod-rev")) -> (:key($routine), :value($response)) { for (:use(''), :require(" <\&$routine>")) -> (:key($statement), :value($starg)) { - is-run 'use v6.' ~$from-rev ~ '; ' ~ $statement ~ ' Module_6' ~ $mod-rev ~ $starg ~ '; print ' ~ $routine, - "$statement: $routine is $response", - :compiler-args('-I', $lib-path), - :out($response), :err(""), :exitcode(0); - is-run 'use v6.' ~ $from-rev ~ '; print EVAL("' ~ $statement ~ ' Module_6' ~ $mod-rev ~ $starg ~ '; ' ~ $routine ~ '")', - "$statement in EVAL: $routine is $response", - :compiler-args('-I', $lib-path), - :out($response), :exitcode(0); + is_run 'use v6.' ~$from-rev ~ '; ' ~ $statement ~ ' Module_6' ~ $mod-rev ~ $starg ~ '; print ' ~ $routine, + :@compiler-args, + { + :err(''), :exitcode, :out($response), + }, + "$statement: $routine is $response"; + + is_run 'use v6.' ~ $from-rev ~ '; print EVAL("' ~ $statement ~ ' Module_6' ~ $mod-rev ~ $starg ~ '; ' ~ $routine ~ '")', + :@compiler-args, + { + :err(''), :exitcode, :out($response), + }, + "$statement in EVAL: $routine is $response"; } } } diff --git a/S12-subset/type-subset.t b/S12-subset/type-subset.t index 8299c483cd..035513c14a 100644 --- a/S12-subset/type-subset.t +++ b/S12-subset/type-subset.t @@ -1,6 +1,6 @@ -use lib ; use Test; -use Test::Helpers; +use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); +use Test::Util; plan 11; @@ -93,60 +93,60 @@ subtest "When used with smartmatch", { subtest "When a subset is created with the name of a stubbed package", { plan 2; - is-run 'class F::B {}; subset F where 5', - :exitcode(0), + is_run 'class F::B {}; subset F where 5', + { :exitcode(0), }, "Can create subset with a name that exists as a stubbed package"; - is-run 'class F::B {}; subset F where 5; die unless F::.keys.grep("B");', - :exitcode(0), + is_run 'class F::B {}; subset F where 5; die unless F::.keys.grep("B");', + { :exitcode(0) }, "The WHO package is stolen from the replaced stubbed package"; } subtest "When a subset is declared within a module", { plan 4; - is-run 'module M { my subset F where 5 }; my M::F $f = 5', - :exitcode(1), :err({ .contains: 'Malformed my' }), + is_run 'module M { my subset F where 5 }; my M::F $f = 5', + { :exitcode(1), :err({ .contains: 'Malformed my' }), }, "'my' scoped subset in a module is unavailable outside the module"; - is-run 'module M { subset F where 5 }; my M::F $f = 5', - :exitcode(0), + is_run 'module M { subset F where 5 }; my M::F $f = 5', + { :exitcode(0), }, "'our' scoped subset in a module is available outside the module"; - is-run 'my module M { subset F where 5 }; my M::F $f = 5', - :exitcode(0), + is_run 'my module M { subset F where 5 }; my M::F $f = 5', + { :exitcode(0), }, "'our' scoped subset in a module is available outside a my-scoped module"; - is-run 'my subset P::F where 5; my P::F $f = 5', - :exitcode(0), + is_run 'my subset P::F where 5; my P::F $f = 5', + { :exitcode(0), }, "Subset with a stubby package in their name resolve correctly"; } subtest "When a subset has no where block", { plan 3; - is-run 'subset MyInt of Int; my MyInt $f = 5', - :exitcode(0), + is_run 'subset MyInt of Int; my MyInt $f = 5', + { :exitcode(0), }, "subset with of but no where succeeds when type constraint met"; #?rakudo todo 'in RakuAST this is a compile time error, not runtime' - is-run 'subset MyInt of Int; my MyInt $f = 5.0', - :exitcode(1), :err({ .contains: 'Cannot assign a literal of type Rat' }), + is_run 'subset MyInt of Int; my MyInt $f = 5.0', + { :exitcode(1), :err({ .contains: 'Cannot assign a literal of type Rat' }), }, "subset with of but no where fails when type constraint not met"; - is-run 'my Str subset MyStr; die unless Str ~~ MyStr', - :exitcode(0), + is_run 'my Str subset MyStr; die unless Str ~~ MyStr', + { :exitcode(0), }, "subset form 'my Str subset MyStr' creates essentially a type alias"; } subtest "When a subset is a subset of a subset", { plan 2; - is-run 'subset F of Int where * %% 2; subset G of F where * %% 3; my G $g = 6', - :exitcode(0), + is_run 'subset F of Int where * %% 2; subset G of F where * %% 3; my G $g = 6', + { :exitcode(0), }, "Subset works as 'of' of a subset (assignment meets criteria)"; - is-run 'subset F of Int where * %% 2; subset G of F where * %% 3; my $n = 9; my G $g = $n', - :exitcode(1), :err({ .contains: 'Type check failed in assignment ' }), + is_run 'subset F of Int where * %% 2; subset G of F where * %% 3; my $n = 9; my G $g = $n', + { :exitcode(1), :err({ .contains: 'Type check failed in assignment ' }), }, "Subset works as 'of' of a subset (assigment fails criteria)"; }