1N/A# $Id: test.pl,v 1.3 2004/02/20 06:21:26 eagle Exp $ 1N/A# test.pl -- Test suite for the Term::ANSIColor Perl module. 1N/A# Before "make install" is performed this script should be runnable with "make 1N/A# test". After "make install" it should work as "perl test.pl". 1N/A############################################################################ 1N/A# Ensure module can be loaded 1N/A############################################################################ 1N/ABEGIN { $| =
1;
print "1..13\n" }
1N/A############################################################################ 1N/A############################################################################ 1N/A# Test simple color attributes. 1N/Aif (
color (
'blue on_green',
'bold')
eq "\e[34;42;1m") {
1N/Aif (
colored (
"testing",
'blue',
'bold')
eq "\e[34;1mtesting\e[0m") {
1N/A# Test the constants. 1N/Aif (
BLUE BOLD "testing" eq "\e[34m\e[1mtesting\e[0m\e[0m") {
1N/A eq "\e[1mtest\e[0m\n\n\e[1mtest\e[0m") {
1N/A# Test EACHLINE with multiple trailing delimiters. 1N/A eq "\e[1mtest\ntest\r\e[0m\r\n\r\n") {
1N/A# Test the array ref form. 1N/Aif (
colored ([
'bold',
'on_green'],
"test\n",
"\n",
"test")
1N/A eq "\e[1;42mtest\e[0m\n\n\e[1;42mtest\e[0m") {
1N/A print colored ([
'bold',
'on_green'],
"test\n",
"\n",
"test");
1N/Aif (
join (
'|', @
names)
eq 'bold|on_green|clear') {
1N/A# Test ANSI_COLORS_DISABLED. 1N/A print "not ok 10\n";
1N/Aif (
colored (
'testing',
'blue',
'on_red') ==
'testing') {
1N/A print "not ok 11\n";
1N/A print "not ok 12\n";
1N/A# Make sure DARK is exported. This was omitted in versions prior to 1.07. 1N/Aif (
DARK "testing" eq "\e[2mtesting\e[0m") {
1N/A print "not ok 13\n";