Skip to content

Commit

Permalink
precompiled module's constants get updated on change
Browse files Browse the repository at this point in the history
RT#129266
  • Loading branch information
zoffixznet committed Sep 13, 2016
1 parent 34985d2 commit 1f616b0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
24 changes: 23 additions & 1 deletion S10-packages/precompilation.t
Expand Up @@ -3,7 +3,7 @@ use lib 't/spec/packages';
use Test;
use Test::Util;

plan 50;
plan 51;

my @*MODULES; # needed for calling CompUnit::Repository::need directly
my $precomp-ext := $*VM.precomp-ext;
Expand Down Expand Up @@ -279,3 +279,25 @@ is-deeply @keys2, [<C D E F H K N P R S>], 'Twisty maze of dependencies, all dif
"roles in precompiled modules recognize type names (run $_)";
}
}
# RT #129266
subtest 'precompiled module constants get updated on change' => {
plan 2;
constant $foo = 't/spec/packages/RT129266/Foo.pm6'.IO;
constant $bar = 't/spec/packages/RT129266/Bar.pm6'.IO;
constant $foo-content = $foo.slurp;
LEAVE { $foo.spurt: $foo-content }
is_run use RT129266::Bar; say var() eq '«VALUE»' ?? 'pass' !! 'fail',
:compiler-args['-I', 't/spec/packages'],
{:out("pass\n"), :err('')},
"original content has correct value";
$foo.spurt: $foo-content.subst: '«VALUE»', '«NEW»';
is_run use RT129266::Bar; say var() eq '«NEW»' ?? 'pass' !! 'fail',
:compiler-args['-I', 't/spec/packages'],
{:out("pass\n"), :err('')},
"modified content has updated";
}
2 changes: 2 additions & 0 deletions packages/RT129266/Bar.pm6
@@ -0,0 +1,2 @@
use RT129266::Foo;
sub var is export { $bar }
1 change: 1 addition & 0 deletions packages/RT129266/Foo.pm6
@@ -0,0 +1 @@
constant $bar is export = "«VALUE»";

0 comments on commit 1f616b0

Please sign in to comment.