]> git.refcnt.org Git - colorize.git/blob - t/conf/endings.t
parse_conf(): minor tweaks
[colorize.git] / t / conf / endings.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use lib qw(lib);
6
7 use Colorize::Common qw(:defaults $write_to_tmpfile);
8 use File::Temp qw(tmpnam);
9 use Test::More;
10
11 my $tests = 1;
12
13 my $conf = <<'EOT';
14 attr=reverse
15 color=red
16 EOT
17
18 plan tests => $tests;
19
20 SKIP: {
21 my $program = tmpnam();
22 my $conf_file = tmpnam();
23
24 skip 'compiling failed (endings)', $tests unless system(qq($compiler -DTEST -DCONF_FILE_TEST=\"$conf_file\" -o $program $source)) == 0;
25
26 my $infile = $write_to_tmpfile->('foo');
27
28 open(my $fh, '>', $conf_file) or die "Cannot open `$conf_file' for writing: $!\n";
29 print {$fh} join "\015\012", split /\n/, $conf;
30 close($fh);
31
32 is(qx($program $infile), "\e[7;31mfoo\e[0m", 'CRLF line endings');
33
34 unlink $program;
35 unlink $conf_file;
36 }