Skip to content

Commit 7abb070

Browse files
committed
Test caching of type objects
1 parent 0fd6d1a commit 7abb070

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

t/nqp/105-multicache.t

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plan(8);
1+
plan(13);
22

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

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

7272
find_in_cache(1, "finding in cache Foo raw, after adding it wrapped")($cont1);
7373
find_in_cache(2, "finding in cache Bar raw, after adding it wrapped")($cont2);
74+
75+
reset_cache();
76+
77+
{
78+
my $instance1 := Foo.new;
79+
my $instance2 := Foo.new;
80+
81+
my $cont1 := nqp::create(Cont);
82+
nqp::assign($cont1, Foo);
83+
84+
my $cont2 := nqp::create(Cont);
85+
nqp::assign($cont2, Foo.new);
86+
87+
add_to_cache(1)(Foo);
88+
add_to_cache(2)($instance1);
89+
90+
find_in_cache(1, "type object is cached separately")(Foo);
91+
find_in_cache(2, "instance is cached seprately from the type object")($instance1);
92+
find_in_cache(2, "instances share cache")($instance2);
93+
find_in_cache(1, "a type object wrapped in a container is cached")($cont1);
94+
find_in_cache(2, "a instance wrapped in a container is cached properly")($cont2);
95+
}

0 commit comments

Comments
 (0)