Skip to content
Permalink
Browse files

Use a dynamic variable $*CORE-SETTING-REV instead of a routine.

  • Loading branch information...
vrurg committed May 30, 2019
1 parent ad60fc9 commit 003625412b20c972eccefe884fa8f2ce08347985
@@ -555,6 +555,8 @@ class Perl6::World is HLL::World {
}
}

# NOTE: Revision .c has special meaning because it doesn't have own dedicated CORE setting and serves as the base
# for all other revisions.
method load-lang-ver($ver-match, $comp) {
$*MAIN := 'MAIN';
$*STRICT := 1 if $*begin_compunit;
@@ -1,5 +1,6 @@
use nqp;

sub CORE-SETTING-REV {'d'}
# This dynamic is purely for testing support.
PROCESS::<$CORE-SETTING-REV> := 'd';

# vim: ft=perl6 expandtab sw=4
@@ -1,5 +1,6 @@
use nqp;

sub CORE-SETTING-REV {'e'}
# This dynamic is purely for testing support.
PROCESS::<$CORE-SETTING-REV> := 'e';

# vim: ft=perl6 expandtab sw=4
@@ -66,6 +66,7 @@ PROCESS::<$SCHEDULER> = JavaScriptScheduler.new();
BEGIN {nqp::p6setassociativetype(Associative);}
#?endif

sub CORE-SETTING-REV {'c'}
# This dynamic is purely for testing support.
PROCESS::<$CORE-SETTING-REV> := 'c';

# vim: ft=perl6 expandtab sw=4
@@ -6,19 +6,19 @@ plan 2;

subtest "CORE.setting Revision", {
plan 3;
is-run q[use v6.c; print CORE-SETTING-REV], "CORE.setting", :out<c>;
is-run q[use v6.d; print CORE-SETTING-REV], "CORE.d.setting", :out<d>;
is-run q[use v6.e.PREVIEW; print CORE-SETTING-REV], "CORE.e.setting", :out<e>;
is-run q[use v6.c; print $*CORE-SETTING-REV], "CORE.setting", :out<c>;
is-run q[use v6.d; print $*CORE-SETTING-REV], "CORE.d.setting", :out<d>;
is-run q[use v6.e.PREVIEW; print $*CORE-SETTING-REV], "CORE.e.setting", :out<e>;
};

subtest "Modifiers", {
plan 4;
# This test must be edited to match currently planned revision.
my $planned_rev = 'e';
is-run qq[use v6.$planned_rev; print CORE-SETTING-REV], "6.$planned_rev without PREVIEW dies", :exitcode(1), :err(rx:s/Perl v6'.'$planned_rev requires modifier PREVIEW/);
is-run q[use v6.d.TEST; print CORE-SETTING-REV], "v6.d.TEST loads CORE.d.setting", :out<d>;
is-run q[use v6.d.TESTDEPR; print CORE-SETTING-REV], "Deprecated modifier generates a warning", :out<d>, :err(rx:s/TESTDEPR modifier is deprecated for Perl 6'.'d/);
is-run q[use v6.d.NOMOD; print CORE-SETTING-REV], "Deprecated modifier generates a warning", :exitcode(1), :err(rx:s/No compiler available for Perl v6'.'d'.'NOMOD/);
is-run qq[use v6.$planned_rev; print \$*CORE-SETTING-REV], "6.$planned_rev without PREVIEW dies", :exitcode(1), :err(rx:s/Perl v6'.'$planned_rev requires modifier PREVIEW/);
is-run q[use v6.d.TEST; print $*CORE-SETTING-REV], "v6.d.TEST loads CORE.d.setting", :out<d>;
is-run q[use v6.d.TESTDEPR; print $*CORE-SETTING-REV], "Deprecated modifier generates a warning", :out<d>, :err(rx:s/TESTDEPR modifier is deprecated for Perl 6'.'d/);
is-run q[use v6.d.NOMOD; print $*CORE-SETTING-REV], "Deprecated modifier generates a warning", :exitcode(1), :err(rx:s/No compiler available for Perl v6'.'d'.'NOMOD/);
}
done-testing;
@@ -5,6 +5,7 @@ plan 1;
my %allowed = (
Q{$AWAITER},
Q{$CWD},
Q{$CORE-SETTING-REV},
Q{$ERR},
Q{$IN},
Q{$OUT},

0 comments on commit 0036254

Please sign in to comment.
You can’t perform that action at this time.