aboutsummaryrefslogtreecommitdiffstats
path: root/t/conf
diff options
context:
space:
mode:
Diffstat (limited to 't/conf')
-rwxr-xr-xt/conf/endings.t36
-rwxr-xr-xt/conf/parse/fail.t3
2 files changed, 38 insertions, 1 deletions
diff --git a/t/conf/endings.t b/t/conf/endings.t
new file mode 100755
index 0000000..35abe20
--- /dev/null
+++ b/t/conf/endings.t
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(lib);
+
+use Colorize::Common qw(:defaults $write_to_tmpfile);
+use File::Temp qw(tmpnam);
+use Test::More;
+
+my $tests = 1;
+
+my $conf = <<'EOT';
+attr=reverse
+color=red
+EOT
+
+plan tests => $tests;
+
+SKIP: {
+ my $program = tmpnam();
+ my $conf_file = tmpnam();
+
+ skip 'compiling failed (endings)', $tests unless system(qq($compiler -DTEST -DCONF_FILE_TEST=\"$conf_file\" -o $program $source)) == 0;
+
+ my $infile = $write_to_tmpfile->('foo');
+
+ open(my $fh, '>', $conf_file) or die "Cannot open `$conf_file' for writing: $!\n";
+ print {$fh} join "\015\012", split /\n/, $conf;
+ close($fh);
+
+ is(qx($program $infile), "\e[7;31mfoo\e[0m", 'CRLF line endings');
+
+ unlink $program;
+ unlink $conf_file;
+}
diff --git a/t/conf/parse/fail.t b/t/conf/parse/fail.t
index ea267f8..d2988e4 100755
--- a/t/conf/parse/fail.t
+++ b/t/conf/parse/fail.t
@@ -12,7 +12,7 @@ use IPC::Open3 qw(open3);
use Symbol qw(gensym);
use Test::More;
-my $tests = 8;
+my $tests = 9;
my $run_program_fail = sub
{
@@ -47,6 +47,7 @@ SKIP: {
[ 'exclude-random1=black', 'option \'exclude-random1\' not recognized' ],
[ 'omit-color-empty1=yes', 'option \'omit-color-empty1\' not recognized' ],
[ 'attr', 'option \'attr\' not followed by =' ],
+ [ 'attr#', 'option \'attr\' not followed by =' ],
[ 'attr bold', 'option \'attr\' not followed by =' ],
[ "color=$chars_exceed", 'line 1 exceeds maximum of' ],
);