File: 060-array.t

package info (click to toggle)
raku-json-marshal 0.0.25-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: makefile: 4
file content (25 lines) | stat: -rw-r--r-- 465 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!raku

use v6;

use Test;
use JSON::Marshal;
use JSON::Fast;

class TestObject {
    has Str $.string;
}

my @arr = (TestObject.new(string => "one"), TestObject.new(string => "two"));

my $out;

lives-ok { $out = marshal(@arr) }, "marshal an array";

my $test = from-json($out);

is $test[0]<string>, 'one', "got right object in first element";
is $test[1]<string>, 'two', "got right object in second element";

done-testing;
# vim: expandtab shiftwidth=4 ft=raku