Skip to content

Commit

Permalink
Added tests for colored() and colored_text().
Browse files Browse the repository at this point in the history
  • Loading branch information
xxfelixxx committed Feb 14, 2018
1 parent c863ddc commit 1db3004
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions t/colormap.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ BEGIN {
color2rgb
color_table
colorbar
colored
colored_text
colormap
colormap_names
print_colored
Expand Down Expand Up @@ -244,6 +246,20 @@ my $expected_lavender = '|[|4|8|;|5|;|9|3|m|T|e|x|t| |o|n| |L|a|v|e|n|d|e|r||[
ok( $normalized_lavender eq $expected_lavender,
"print_colored( 93, 'Text on Lavender' ) => $colored_output");

# colored_text tests
my $peach = colored_text( 208, "Peach Colored Text" );
my $expected_peach = "\x1b[38;5;208mPeach Colored Text\x1b[0m";
ok($peach eq $expected_peach,
"colored_text( 208, 'Peach Colored Text' ) => $peach")
or diag("Got '$peach' instead of '$expected_peach'");

# colored tests
my $lavender = colored( 93, "Text on Lavender" );
my $exp_lavender = "\x1b[48;5;93mText on Lavender\x1b[0m";
ok($lavender eq $exp_lavender,
"colored_text( 93, 'Text on Lavender' ) => $lavender")
or diag("Got '$lavender' instead of '$exp_lavender'");

done_testing();
exit 0;

Expand Down

0 comments on commit 1db3004

Please sign in to comment.