use v6.d;
use Test;
use RakuDoc::MarkupMeta;
plan 12;
my $actions = RMActions.new;
my $metastr = 'Simple markup string';

my $meta-obj = RakuDoc::MarkupMeta.parse( $metastr, :$actions );
ok $meta-obj, 'sane test';
is $meta-obj.made<type>, 'plain-string', 'simple string';
is $meta-obj.made<value>, $metastr, 'string no quotes';
$metastr = 'one two, "three", four';
$meta-obj = RakuDoc::MarkupMeta.parse( $metastr, :$actions );
is $meta-obj.made<type>, 'plain-string-array', 'array type';
is $meta-obj.made<value>[0][2], 'four', 'got third elem';
$metastr = 'one two, three four; five six seven, eight, nine';
$meta-obj = RakuDoc::MarkupMeta.parse( $metastr, :$actions );
is $meta-obj.made<type>, 'array-of-ps-arrays', 'array of arrays';
is $meta-obj<array-of-ps-arrays><plain-string-array>[1]<plain-string>[1], 'eight', 'got (1,1)';
is $meta-obj.made<value>.[1][1], 'eight', 'got (1,1) from value';
$metastr = q[Syntax,::($c).m;Syntax,A."$m"()];
$meta-obj = RakuDoc::MarkupMeta.parse( $metastr, :$actions );
is $meta-obj.made<type>, 'array-of-ps-arrays', 'array of arrays';
is $meta-obj.made<value>.[1][1], 'A."$m"()', 'got value with quoted chars';
$metastr = q[Other languages,$" (Perl)];
$meta-obj = RakuDoc::MarkupMeta.parse( $metastr, :$actions );
is $meta-obj.made<type>, 'plain-string-array', 'plain array';
is $meta-obj.made<value>.[0][1], '$" (Perl)', 'got value with single quote char';

done-testing;
