Skip to content

Commit

Permalink
Test that nqp::decode modifies the passed buffer instead of returning…
Browse files Browse the repository at this point in the history
… a fresh one.
  • Loading branch information
pmurias committed Nov 18, 2016
1 parent e1e73a2 commit 4693bb8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion t/nqp/082-decode.t
@@ -1,4 +1,4 @@
plan(5);
plan(6);

class int8 is repr('P6int') {}
class buf8 is repr('VMArray') {}
Expand Down Expand Up @@ -37,3 +37,7 @@ sub buf_dump($buf) {

is(buf_dump($hello), "72,101,108,108,111,32,87,111,114,108,100", "Hello World is encoded to utf8 correctly");
is(nqp::decode($hello, "utf8"), "Hello World", "round-tripping Hello World");

my $hello2 := buf8.new;
nqp::encode('Hello World', 'utf8', $hello2);
is(buf_dump($hello2), "72,101,108,108,111,32,87,111,114,108,100", "the buf passed to nqp::encode is actually changed");

0 comments on commit 4693bb8

Please sign in to comment.