Skip to content
Browse files

Add nqp::split tests; donaldh++.

  • Loading branch information...
1 parent cf72dc1 commit c9bc4a25ba2ca57e3642dbe870da31fd1b661322 @jnthn jnthn committed
Showing with 10 additions and 1 deletion.
  1. +10 −1 t/nqp/59-nqpop.t
View
11 t/nqp/59-nqpop.t
@@ -2,7 +2,7 @@
# Test nqp::op pseudo-functions.
-plan(116);
+plan(121);
ok( nqp::add_i(5,2) == 7, 'nqp::add_i');
@@ -25,6 +25,15 @@ ok( nqp::ord('xyz') eq 120, 'nqp::ord');
ok( nqp::lc('Hello World') eq 'hello world', 'nqp::downcase');
ok( nqp::uc("Don't Panic") eq "DON'T PANIC", 'nqp::upcase');
+my @items := nqp::split(' ', 'a little lamb');
+ok( nqp::elems(@items) == 3 && @items[0] eq 'a' && @items[1] eq 'little' && @items[2] eq 'lamb', 'nqp::split');
+ok( nqp::elems(nqp::split(' ', '')) == 0, 'nqp::split zero length string');
+ok( nqp::elems(nqp::split('\\s', 'Mary had a little lamb')) == 1, 'nqp::split no match');
+@items := nqp::split('', 'a man a plan');
+ok( nqp::elems(@items) == 12, 'nqp::split zero length delimiter');
+@items := nqp::split('a', 'a man a plan a canal panama');
+ok( nqp::elems(@items) == 11 && @items[0] eq '' && @items[10] eq '', 'nqp::split delimiter at ends');
+
ok( nqp::iseq_i(2, 2) == 1, 'nqp::iseq_i');
ok( nqp::cmp_i(2, 0) == 1, 'nqp::cmp_i');

0 comments on commit c9bc4a2

Please sign in to comment.
Something went wrong with that request. Please try again.