The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

t/examples/pod.t - Compile examples found in POD

SYNOPSIS

    # test all files
    % prove t/examples/pod.t

    # test specific files
    % perl t/examples/pod.t docs/compiler_faq.pod

DESCRIPTION

Tests the syntax for any embedded PIR in POD, for all files in the repository that contain POD. Any invalid examples are reported in the test output.

To test a snippet of parrot code, wrap it in =begin and =end blocks like:

 =begin PASM

   set I0, 0

 =end PASM

PASM and PIR are both valid target languages.

Additionally, you can add the following modifiers (prepending with an underscore).

  • FRAGMENT

    For PIR, wraps the code in a .sub block.

  • TODO

  • INVALID

    Either of these will force the test to be marked TODO.

For example, this PIR fragment uses an old, invalid opcode and needs to be updated:

 =begin PIR_FRAGMENT_INVALID

    find_type $I1, 'Integer'

 =end PIR_FRAGMENT_INVALID

As shown, you can "stack" the modifiers. Take care to make the begin and and end POD targets identical. Always begin with the target language.