File: 020-trait.t

package info (click to toggle)
raku-json-name 0.0.7-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 108 kB
  • sloc: makefile: 4
file content (22 lines) | stat: -rw-r--r-- 468 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
#!raku

use v6;

use Test;

use JSON::Name;
use JSON::OptIn;

class TestName {
    has $.test-attribute is json-name('666weirdname');
}

ok my $attr = TestName.^attributes[0], "get the attribute";

does-ok $attr, JSON::Name::NamedAttribute, "it does the attribute role";
does-ok $attr, JSON::OptIn::OptedInAttribute, "it does the opt-in attribute role as well";
is $attr.json-name, '666weirdname', "got our name";


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