use v6.e.PREVIEW; use Test; plan 4; my $ast; my $deparsed; my $raku; sub ast(RakuAST::Node:D $node --> Nil) { $ast := $node; $deparsed := $node.DEPARSE; $raku := 'use experimental :rakuast; ' ~ $node.raku; diag $deparsed.chomp; } subtest 'simple bold markup' => { # B ast RakuAST::Doc::Markup.new( letter => 'B', atoms => ("this is bold",) ); for 'Str', $deparsed, 'Raku', $raku.EVAL.DEPARSE -> $type, $it { is-deeply $it, 'B', "$type: deparse"; } } subtest 'simple bold with italics markup' => { # B bold> ast RakuAST::Doc::Markup.new( letter => 'B', atoms => ( "this ", RakuAST::Doc::Markup.new( letter => "I", atoms => ("is",) ), " bold", ) ); for 'Str', $deparsed, 'Raku', $raku.EVAL.DEPARSE -> $type, $it { is-deeply $it, 'B bold>', "$type: deparse"; } } subtest 'link with code markup' => { # L Programming Language|https://raku.org> ast RakuAST::Doc::Markup.new( letter => 'L', atoms => ( "The ", RakuAST::Doc::Markup.new( letter => "C", atoms => ("Raku",) ), " Programming Language", ), meta => ("https://raku.org",) ); for 'Str', $deparsed, 'Raku', $raku.EVAL.DEPARSE -> $type, $it { is-deeply $it, 'L Programming Language|https://raku.org>', "$type: deparse"; } } subtest 'index entry with multiple lemmas' => { for -> $letter { # $letter ast RakuAST::Doc::Markup.new( letter => $letter, atoms => ("hash",), meta => ( "hashes, definition of; associative arrays", ), ); for 'Str', $deparsed, 'Raku', $raku.EVAL.DEPARSE -> $type, $it { is-deeply $it, $letter ~ '', "$type: deparse"; } } } # vim: expandtab shiftwidth=4