Skip to content

Commit

Permalink
Test caching of type objects
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Apr 5, 2017
1 parent 0fd6d1a commit 7abb070
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion t/nqp/105-multicache.t
@@ -1,4 +1,4 @@
plan(8);
plan(13);

my $cache := nqp::null();

Expand Down Expand Up @@ -71,3 +71,25 @@ find_in_cache(2, "finding in cache Bar wrapped in cont, after adding it wrapped"

find_in_cache(1, "finding in cache Foo raw, after adding it wrapped")($cont1);
find_in_cache(2, "finding in cache Bar raw, after adding it wrapped")($cont2);

reset_cache();

{
my $instance1 := Foo.new;
my $instance2 := Foo.new;

my $cont1 := nqp::create(Cont);
nqp::assign($cont1, Foo);

my $cont2 := nqp::create(Cont);
nqp::assign($cont2, Foo.new);

add_to_cache(1)(Foo);
add_to_cache(2)($instance1);

find_in_cache(1, "type object is cached separately")(Foo);
find_in_cache(2, "instance is cached seprately from the type object")($instance1);
find_in_cache(2, "instances share cache")($instance2);
find_in_cache(1, "a type object wrapped in a container is cached")($cont1);
find_in_cache(2, "a instance wrapped in a container is cached properly")($cont2);
}

0 comments on commit 7abb070

Please sign in to comment.