--- a/t/04.colour.t +++ b/t/04.colour.t @@ -15,6 +15,11 @@ colour_open => "\{", colour_close => "\}", ); +my $is_tty = $m->_is_tty; + +SKIP: { +skip 'Not a tty', 2 unless $is_tty; + is( $m->colour_parse( "Hello {style => 'b', color => 'red'}red everyone! This is {style => 'u', color => 'rgb(255250250)'}embedded{/}{/} text..." ), "Hello \e[38;5;224;1m\e[38;2;255;0;0;1mred everyone! This is \e[38;5;250;4m\e[38;2;255;250;250;4membedded\e[m\e[m\e[m\e[m text...", @@ -26,6 +31,7 @@ "And \e[38;5;224;48;5;255;3;1m\e[38;2;255;0;0;48;2;255;255;255;3;1mlight red on white\e[m\e[m \e[38;5;252;5m\e[38;2;255;255;0;5mand yellow text\e[m\e[m ?", "Inline style: And \e[38;5;224;48;5;255;3;1m\e[38;2;255;0;0;48;2;255;255;255;3;1mlight red on white\e[m\e[m \e[38;5;252;5m\e[38;2;255;255;0;5mand yellow text\e[m\e[m ?", ); +} is( $m->coloured( 'bold white on red', "Bold white text on red background" ), @@ -33,6 +39,9 @@ "Coloured() style: \e[38;5;255;48;5;224;1m\e[38;2;255;255;255;48;2;255;0;0;1mBold white text on red background\e[m\e[m", ); +SKIP: { +skip 'Not a tty', 2 unless $is_tty; + is( $m->colour_parse( "And {bold light white on red}light white\non red multi line{/} {underline green}underlined green text{/}" ), "And \e[38;5;255;48;5;224;1m\e[38;2;255;255;255;48;2;255;0;0;1m\e[38;5;255;48;5;224;1m\e[38;2;255;255;255;48;2;255;0;0;1mlight white\e[m @@ -45,6 +54,7 @@ "Some \e[38;5;224;48;5;255;1m\e[38;2;255;0;0;48;2;255;255;255;1mred on white. And \e[38;5;3;4m\e[38;2;0;0;255;4munderlined\e[m\e[m\e[m\e[m text...", "Inline style with rgb: Some \e[38;5;224;48;5;255;1m\e[38;2;255;0;0;48;2;255;255;255;1mred on white. And \e[38;5;3;4m\e[38;2;0;0;255;4munderlined\e[m\e[m\e[m\e[m text...", ); +} is( $m->coloured( 'bold rgb(255, 0, 0) on white', "Some red on white text." ),