The manakai project


A parser for test data in HTML Tree Construction Tests format


  use Test::HTCT::Parser;
  for_each_test $file_name, {
    data => {},
    errors => {is_list => 1},
    document => {is_prefixed => 1},
    'document-fragment' => {is_prefixed => 1},
  }, sub {
    my $test = shift;
    my ($serialized, $errors) = parse_data ($test->{data}->[0]);
    is $serialized, $test->{document}->[0];
    is_deeply $errors, $test->{errors}->[0];


The Test::HTCT::Parser module exports a function to parse test data file encoded in the format for HTML Parsers' Tree Construction Tests. It can also be used to parse test data for other purposes than HTML parsing.

For more information on the usage of the module, see t/test-htct-parser.t test script.


The callback code is invoked for each test, in order in the input test data file. It is invoked with two arguments.

The first argument $_[0] represents the test data.

The second argument $_[1] has additional data. It is a hash reference with a key/value pair: line_number is the line number of the first line of the test data in the input test data file.


WHATWG Wiki, Parser tests, Tree Constructoion Tests <>.

HTML Parser Tree Constructions Tests (from html5lib repository) <>.

sami-test.js, which is a JavaScript implementation of the format <>.


The latest version of the module is available from the GitHub repository: <>.


The module requires Perl 5.8 or later.


Wakaba <>.

The format was originally defined by WHATWG/html5lib contributors.


The parser was originally developed as part of Whatpm::HTML HTML parser module, which is part of the manakai package <>.

The first version, 1.0, as a standalone module with new name Test::HTCT::Parser is released on February 19, 2011.

The second version, 2.0, added support for multiple fields.


Copyright 2007-2017 Wakaba <>.

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