File: 060-associative.t

package info (click to toggle)
raku-json-class 0.0.21-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 128 kB
  • sloc: makefile: 4
file content (21 lines) | stat: -rw-r--r-- 373 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
#!/usr/bin/env raku

use v6;

use Test;

use JSON::Class;

class C is JSON::Class {
	has Str %.bla{subset :: of Str where any("ble", "blob")}
};

my $res;
lives-ok {
    $res = C.from-json('{"bla": {"ble": "bli"}}');
    is $res.bla<ble>, 'bli', "and get the right value";
}, "from-json with shaped associative works";


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