Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests for nqp::setelems and nqp::ordat.
  • Loading branch information
pmurias committed Feb 7, 2015
1 parent 308cb9f commit 51dde73
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion t/nqp/59-nqpop.t
Expand Up @@ -2,7 +2,7 @@

# Test nqp::op pseudo-functions.

plan(128);
plan(131);

ok( nqp::add_i(5,2) == 7, 'nqp::add_i');
ok( nqp::sub_i(5,2) == 3, 'nqp::sub_i');
Expand Down Expand Up @@ -33,6 +33,7 @@ ok( nqp::index('Hello World', 'l', 4) == 9, 'nqp::index with third argument, thi
ok( nqp::chr(120) eq 'x', 'nqp::chr');
ok( nqp::ord('xyz') eq 120, 'nqp::ord');
ok( nqp::ord('xyz',2) eq 122, '2 argument nqp::ord');
ok( nqp::ordat('xyz',2) eq 122, 'nqp::ordat');
ok( nqp::lc('Hello World') eq 'hello world', 'nqp::downcase');
ok( nqp::uc("Don't Panic") eq "DON'T PANIC", 'nqp::upcase');
ok( nqp::flip("foo") eq "oof", "nqp::flip");
Expand Down Expand Up @@ -193,3 +194,10 @@ ok(nqp::eqat("foobar","foobarbaz", 0) == 0, "eqat with needle argument longer th
nqp::splice($b, $source, 1, 2);
ok(nqp::join(",", $b) eq '1,100,200,300,4', "splice");
}

{
my $list := nqp::list("1","2","3","4","5");
my $ret := nqp::setelems($list, 3);
ok(nqp::join(",", $list) eq '1,2,3', 'nqp::setelems reduces list length properly');
ok(nqp::join(",", $ret) eq '1,2,3', 'nqp::setelems return value');
}

0 comments on commit 51dde73

Please sign in to comment.