# Defines some Perl functions for the *.t scripts use strict; use warnings; sub P() { no strict 'refs'; return ${(caller(1))[0].'::p'}; } sub bbtest($$;$) { my($src,$bbexpect,$htmlexpect); if(@_ == 3) { ($src,$bbexpect,$htmlexpect) = @_; } else { ($src,$htmlexpect) = @_; $bbexpect = $src; } my $msg = $src; $msg =~ s/\t/\\t/g; $msg =~ s/\n/\\n/g; my $tree = P->parse($src); is($tree->toBBCode, $bbexpect, "$msg (BBCode)"); my $html = $tree->toHTML; $html =~ s/'/'/g; $html =~ s#^