### ----------------------------------------------------
### -- Rakuast::RakuDoc::Render
### -- Licenses: Artistic-2.0
### -- Authors: Richard Hainsworth
### -- File: xt/160-formulae.rakutest
### ----------------------------------------------------
use v6.d;
use Test;

use RakuDoc::Render;

plan 3;

my $ast;
my $rv;
my RakuDoc::Processor $rdp .= new(:test);
$ast = Q:to/QAST/.AST;
    =begin rakudoc
    We will use the identity: F<\sum \frac{1}{n^{2}} = \frac{\pi^{2}}{6}>
    ... where the value of pi can be inferred from Euler’s Identity:
    =formula e^{i\pi}+1=0
    =end rakudoc
    QAST
$rv = $rdp.render( $ast, :pre-finalised );
like $rv.body.Str, /
    '<para>' .+ 'content' .+
    'We will use the identity: '
    '<markup-F>' .+ 'content' .+
    '\sum \frac{1}{n^{2}} = \frac{\pi^{2}}{6}' .+
    'formula:' .+
    '\sum \frac{1}{n^{2}} = \frac{\pi^{2}}{6}' .+
    '</markup-F>'
    /, 'F markup without display text as expected';
like $rv.body.Str, /
    '... where the value of pi can be inferred from Euler’s Identity:'
    .+ '/para' .+
    '<formula>' .+
    'alt' .+ 'Formula cannot' .+
    'formula' .+ 'e^{i\pi}+1=0' .+
    '</formula>'
    /, 'Formula block OK';
$ast = Q:to/QAST/.AST;
    =begin rakudoc
    We will use the identity: F<alt text|\sum \frac{1}{n^{2}} = \frac{\pi^{2}}{6}>
    =end rakudoc
    QAST
$rv = $rdp.render( $ast, :pre-finalised );
like $rv.body.Str, /
    '<para>' .+ 'content' .+
    'We will use the identity: '
    '<markup-F>' .+ 'content' .+
    'alt text' .+
    'formula:' .+
    '\sum \frac{1}{n^{2}} = \frac{\pi^{2}}{6}' .+
    '</markup-F>'
    /, 'F markup with display text as expected';

done-testing;


