Skip to content

Commit ddf5935

Browse files
committed
Test that when boxing bignums the correct thing is in the attribute.
1 parent 73ebe45 commit ddf5935

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

t/nqp/60-bigint.t

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! nqp
22
use nqpmo;
33

4-
plan(87);
4+
plan(89);
55

66
my $knowhow := nqp::knowhow();
77
my $bi_type := $knowhow.new_type(:name('TestBigInt'), :repr('P6bigint'));
@@ -87,6 +87,10 @@ my $box_val_2 := nqp::fromstr_I('38', $bi_boxer);
8787
ok(iseq($box_val_2, 38), 'can get a bigint from a string with boxing type');
8888
ok(iseq(nqp::add_I($box_val_1, $box_val_2, $bi_boxer), 42), 'addition works on boxing type');
8989

90+
my $box_val_3 := nqp::box_i(7, $bi_boxer);
91+
ok(nqp::istype(nqp::getattr($box_val_3, $bi_boxer, '$!value'), $bi_type), "the boxed value is stored in the attribute as a bigint");
92+
ok(nqp::unbox_i(nqp::getattr($box_val_3, $bi_boxer, '$!value')) == 7, "you can extract it and then unbox it");
93+
9094

9195
# Note that the last argument to pow_I should be capable of boxing a num,
9296
# so $bi_type is wrong here. But so far we only test the integer case,

0 commit comments

Comments
 (0)