diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-03-08 21:08:21 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-03-08 21:08:21 -0600 |
commit | b9841300cb47cee9d6cda24b3477c763530b947f (patch) | |
tree | aeb3dfebc87c767c57e5583fdf4bdd664f2cdfc8 /t | |
parent | 0a0a01d1d8b1d48d68e6b8e37fc38dd4ca553b97 (diff) | |
download | carp-always-color-b9841300cb47cee9d6cda24b3477c763530b947f.tar.gz carp-always-color-b9841300cb47cee9d6cda24b3477c763530b947f.zip |
fix test suite for carp dot stuff
Diffstat (limited to 't')
-rw-r--r-- | t/detect.t | 12 | ||||
-rw-r--r-- | t/eval.t | 12 | ||||
-rw-r--r-- | t/html.t | 20 | ||||
-rw-r--r-- | t/term.t | 24 |
4 files changed, 34 insertions, 34 deletions
@@ -8,22 +8,22 @@ BEGIN { plan tests => 2; } -sub output_is { +sub output_like { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($script, $expected, $desc) = @_; my $pty = IO::Pty::Easy->new; $pty->spawn("$^X", "-e", $script); - is($pty->read, $expected, $desc); + like($pty->read, $expected, $desc); } -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color; warn "foo"; EOF - "\e[33mfoo\e[m at -e line 2\n", + qr/\e\[33mfoo\e\[m at -e line 2\b/, "detection works for terminal output"); -output_is(<<EOF, +output_like(<<EOF, my \$stderr; BEGIN { close(STDERR); @@ -33,5 +33,5 @@ output_is(<<EOF, warn "foo"; print \$stderr; EOF - "<span style=\"color:#880\">foo</span> at -e line 7\n", + qr+<span style=\"color:#880\">foo</span> at -e line 7\b+, "detection works for terminal output"); @@ -8,25 +8,25 @@ BEGIN { plan tests => 2; } -sub output_is { +sub output_like { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($script, $expected, $desc) = @_; my $pty = IO::Pty::Easy->new; $pty->spawn("$^X", "-e", $script); - is($pty->read, $expected, $desc); + like($pty->read, $expected, $desc); } -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color; eval { die "foo" }; if (\$@) { die \$@; } EOF - "\e[31m\e[31mfoo\e[m\e[m at -e line 2\n\teval {...} called at -e line 4\n", + qr/\e\[31m\e\[31mfoo\e\[m\e\[m at -e line 2\.?\n\teval {\.\.\.} called at -e line 4\b/, "rethrowing works"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color; sub foo { eval { die "foo" }; @@ -36,5 +36,5 @@ output_is(<<EOF, } foo(); EOF - "\e[31m\e[31mfoo\e[m\e[m at -e line 3\n\teval {...} called at -e line 3\n\tmain::foo() called at -e line 5\n\tmain::foo() called at -e line 8\n", + qr/\e\[31m\e\[31mfoo\e\[m\e\[m at -e line 3\.?\n\teval {\.\.\.} called at -e line 3\n\tmain::foo\(\) called at -e line 5\.?\n\tmain::foo\(\) called at -e line 8\n/, "rethrowing works inside functions"); @@ -8,44 +8,44 @@ BEGIN { plan tests => 4; } -sub output_is { +sub output_like { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($script, $expected, $desc) = @_; my $pty = IO::Pty::Easy->new; $pty->spawn("$^X", "-e", $script); - is($pty->read, $expected, $desc); + like($pty->read, $expected, $desc); } -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::HTML; warn "foo"; EOF - "<span style=\"color:#880\">foo</span> at -e line 2\n", + qr+<span style=\"color:#880\">foo</span> at -e line 2\b+, "simple warns work"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::HTML; sub foo { warn "foo"; } foo(); EOF - "<span style=\"color:#880\">foo</span> at -e line 3\n\tmain::foo() called at -e line 5\n", + qr+<span style=\"color:#880\">foo</span> at -e line 3\.?\n\tmain::foo\(\) called at -e line 5\n+, "warns with a stacktrace work"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::HTML; die "foo"; EOF - "<span style=\"color:#800\">foo</span> at -e line 2\n", + qr+<span style=\"color:#800\">foo</span> at -e line 2\b+, "simple dies work"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::HTML; sub foo { die "foo"; } foo(); EOF - "<span style=\"color:#800\">foo</span> at -e line 3\n\tmain::foo() called at -e line 5\n", + qr+<span style=\"color:#800\">foo</span> at -e line 3\.?\n\tmain::foo\(\) called at -e line 5\n+, "dies with a stacktrace work"); @@ -8,51 +8,51 @@ BEGIN { plan tests => 5; } -sub output_is { +sub output_like { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($script, $expected, $desc) = @_; my $pty = IO::Pty::Easy->new; $pty->spawn("$^X", "-e", $script); - is($pty->read, $expected, $desc); + like($pty->read, $expected, $desc); } -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::Term; warn "foo"; EOF - "\e[33mfoo\e[m at -e line 2\n", + qr/\e\[33mfoo\e\[m at -e line 2\b/, "simple warns work"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::Term; sub foo { warn "foo"; } foo(); EOF - "\e[33mfoo\e[m at -e line 3\n\tmain::foo() called at -e line 5\n", + qr/\e\[33mfoo\e\[m at -e line 3\.?\n\tmain::foo\(\) called at -e line 5\n/, "warns with a stacktrace work"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::Term; die "foo"; EOF - "\e[31mfoo\e[m at -e line 2\n", + qr/\e\[31mfoo\e\[m at -e line 2\b/, "simple dies work"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::Term; sub foo { die "foo"; } foo(); EOF - "\e[31mfoo\e[m at -e line 3\n\tmain::foo() called at -e line 5\n", + qr/\e\[31mfoo\e\[m at -e line 3\.?\n\tmain::foo\(\) called at -e line 5\n/, "dies with a stacktrace work"); -output_is(<<EOF, +output_like(<<EOF, use Carp::Always::Color::Term; die "foo at bar line 23"; EOF - "\e[31mfoo at bar line 23\e[m at -e line 2\n", + qr/\e\[31mfoo at bar line 23\e\[m at -e line 2\b/, "weird messages work"); |