### ----------------------------------------------------
### -- JSON::Unmarshal
### -- Licenses: Artistic-2.0
### -- Authors: Tadeusz Sośnierz, Raku Community
### -- File: t/030-null.rakutest
### ----------------------------------------------------
use Test;

use JSON::Unmarshal;

plan 4;

my Str $json = '{ "attr" : null }';

my @tests = %( "class" => class  { has Int $.attr; }, description => "Int attribute" ),
            %( "class" => class  { has Num $.attr; }, description => "Num attribute" ),
            %( "class" => class  { has Rat $.attr; }, description => "Rat attribute" ),
            %( "class" => class  { has Str $.attr; }, description => "Str attribute" ),;

for @tests -> $test {
    my $obj;
    lives-ok { $obj = unmarshal($json, $test<class> ) }, $test<description>;
}

# vim: expandtab shiftwidth=4 ft=raku


