diff options
author | Steven Schubiger <stsc@refcnt.org> | 2019-09-17 23:14:18 +0200 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2019-09-17 23:14:18 +0200 |
commit | 9082b6aa7b7bd32db92ed1bd8ebe31e836147704 (patch) | |
tree | 1267f3fae5576a73bd969cd77480713e4e1da7ac /t/conf/endings.t | |
parent | 69f07b58527f4a75d67443232a34f944a65ae423 (diff) | |
download | colorize-9082b6aa7b7bd32db92ed1bd8ebe31e836147704.tar.gz colorize-9082b6aa7b7bd32db92ed1bd8ebe31e836147704.tar.bz2 |
parse_conf(): minor tweaks
- Parse lines with CRLF endings
- Separate the '#' sign from the option name
Diffstat (limited to 't/conf/endings.t')
-rwxr-xr-x | t/conf/endings.t | 36 |
1 files changed, 36 insertions, 0 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; +} |