Test2:...Parser(3pm)

πŸ’– NAME πŸ’–

Test2::Harness::Collector::TapParser β€” bestie, this one takes a single line of TAP and turns it into EventFacets. Literally its whole job. πŸ‘‘


✨ DESCRIPTION ✨

Okay so real talk: this module is the one reading and processing all that TAP output coming out of your tests. Every line of TAP gets cooked into Test2::Event facet data. That's the vibe. πŸ“

But listen β€” important little disclaimer, no cap: Test2 -> TAP -> Test2 is lossy at the Test2 -> TAP step. So like, some stuff does get left behind in the glow-up. Just so you know. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use Test2::Harness::Collector::TapParser qw/parse_tap_line/;

my $facet_data = parse_tap_line("1..1");
is(
    $facet_data,
    {
        trace => {nested => 0},
        hubs  => [{nested => 0}],
        plan  => {
            details => '',
            count   => 1,
            skip    => 0,
        },
    },
    "Parsed the plan"
);

$facet_data = parse_tap_line("# foo");
is(
    $facet_data,
{
          trace => { nested => 0 },
          hubs => [ { nested => 0 } ],
          info => [
                      {
                        tag => 'NOTE',
                        details => 'foo',
                        debug => 0,
                      },
                    ],
        },

    "Parsed the note"
);

$facet_data = parse_tap_line("ok 1");
is(
    $facet_data,
    {
        trace  => {nested => 0},
        hubs   => [{nested => 0}],
        assert => {
            no_debug => 1,
            pass     => 1,
            number   => '1',
            details  => '',
        },
    },
    "Parsed the assertion"
);

🌈 EXPORTS 🌈

  • $facet_data = parse_tap_line($line) β€” parses a single line of TAP. It assumes the line came from STDOUT, so all the comments get turned into notes. Important tea: using this export will NOT add the usual "from_tap" facet. So it's lowkey better to use one of the other 2 exports instead. πŸ™ˆ
  • $facet_data = parse_stdout_tap($line) β€” parses a line of TAP from stdout. That's it, that's the whole thing. ✨
  • $facet_data = parse_stderr_tap($line) β€” parses a line of TAP from stderr. Heads up though: this one will ONLY parse comment lines (the ones starting with a "#", which, yes, can be indented). Every comment gets treated as a diag, and every other line just gets ignored completely. 🫢

πŸ”₯ SOURCE πŸ”₯

The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/. Go be nosy, bestie, the code's right there. πŸ‘€


πŸ‘‘ MAINTAINERS πŸ‘‘

Chad Granum <exodist@cpan.org>


🌸 AUTHORS 🌸

Chad Granum <exodist@cpan.org>


Copyright 2020 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/


Okay that's the whole page, bestie, you ate that πŸ’…βœ¨ This was served up by perl v5.40.1, dated 2026-05-10 β€” from the User Contributed Perl Documentation corner of the group chat. Byeee, ily, go parse some TAP πŸ¦‹

πŸ“¦ where this page comes from