test.pl revision 7c478bd95313f5f23a4c958a745db2134aa03244
# $Id: test.pl,v 1.3 2004/02/20 06:21:26 eagle Exp $
#
# test.pl -- Test suite for the Term::ANSIColor Perl module.
#
# Before "make install" is performed this script should be runnable with "make
# test". After "make install" it should work as "perl test.pl".
############################################################################
# Ensure module can be loaded
############################################################################
BEGIN { $| = 1; print "1..13\n" }
END { print "not ok 1\n" unless $loaded }
delete $ENV{ANSI_COLORS_DISABLED};
$loaded = 1;
print "ok 1\n";
############################################################################
# Test suite
############################################################################
# Test simple color attributes.
print "ok 2\n";
} else {
print "not ok 2\n";
}
# Test colored.
print "ok 3\n";
} else {
print "not ok 3\n";
}
# Test the constants.
print "ok 4\n";
} else {
print "not ok 4\n";
}
# Test AUTORESET.
print "ok 5\n";
} else {
print "not ok 5\n";
}
# Test EACHLINE.
eq "\e[1mtest\e[0m\n\n\e[1mtest\e[0m") {
print "ok 6\n";
} else {
print "not ok 6\n";
}
# Test EACHLINE with multiple trailing delimiters.
eq "\e[1mtest\ntest\r\e[0m\r\n\r\n") {
print "ok 7\n";
} else {
print "not ok 7\n";
}
# Test the array ref form.
eq "\e[1;42mtest\e[0m\n\n\e[1;42mtest\e[0m") {
print "ok 8\n";
} else {
print "not ok 8\n";
}
# Test uncolor.
print "ok 9\n";
} else {
print "not ok 9\n";
}
# Test ANSI_COLORS_DISABLED.
print "ok 10\n";
} else {
print "not ok 10\n";
}
print "ok 11\n";
} else {
print "not ok 11\n";
}
print "ok 12\n";
} else {
print "not ok 12\n";
}
delete $ENV{ANSI_COLORS_DISABLED};
# Make sure DARK is exported. This was omitted in versions prior to 1.07.
print "ok 13\n";
} else {
print "not ok 13\n";
}