X-Git-Url: http://git.refcnt.org/?a=blobdiff_plain;f=test.pl;h=40c3cb52187b272f90183c8e96e6a5bf5bfc47d1;hb=166b606b2504297f425943b855301ae97f689d7c;hp=729884fe0bf57dfc400031c4f6d20118c74636c8;hpb=0ffd3036fe3f53cf5e6d25f128c075163b305f68;p=colorize.git diff --git a/test.pl b/test.pl index 729884f..40c3cb5 100755 --- a/test.pl +++ b/test.pl @@ -18,6 +18,7 @@ my %BUF_SIZE = ( short => 10, ); my $source = 'colorize.c'; +my $compiler = 'gcc'; my $compiler_flags = '-ansi -pedantic -Wall -Wextra -Wformat -Wswitch-default -Wuninitialized -Wunused -Wno-unused-function -Wno-unused-parameter'; my $write_to_tmpfile = sub @@ -42,11 +43,11 @@ SKIP: { skip "$source does not exist", $tests unless -e $source; my $binary = tmpnam(); - skip 'compiling failed', $tests unless system("gcc $compiler_flags -o $binary $source") == 0; + skip 'compiling failed', $tests unless system("$compiler $compiler_flags -o $binary $source") == 0; unlink $binary; my $program = tmpnam(); - skip 'compiling failed (normal)', $tests unless system("gcc -DTEST -DBUF_SIZE=$BUF_SIZE{normal} -o $program $source") == 0; + skip 'compiling failed (normal)', $tests unless system("$compiler -DTEST -DBUF_SIZE=$BUF_SIZE{normal} -o $program $source") == 0; is(system("$program --help >/dev/null 2>&1"), 0, 'exit value for help screen'); is(system("$program --version >/dev/null 2>&1"), 0, 'exit value for version data'); @@ -128,8 +129,8 @@ SKIP: { my $switch = "--$type"; - is(qx(printf %s "\e[35mhello\e[0m \e[36mworld\e[0m" | $program $switch), 'hello world', "$type colored words"); - is(qx(printf %s "hello world" | $program Magenta | $program $switch), 'hello world', "$type colored line"); + is(qx(printf %s "\e[35mhello\e[0m \e[36mworld\e[0m" | $program $switch), 'hello world', "$type colored words"); + is(qx(printf %s "hello world" | $program Magenta | $program $switch), 'hello world', "$type colored line"); is_deeply([split /\n/, qx($program cyan $infile1 | $program $switch)], [split /\n/, $text], "$type colored text"); ok(qx(printf %s "\e[\e[33m" | $program $switch) eq "\e[", "$type with invalid sequence"); @@ -152,7 +153,7 @@ SKIP: { SKIP: { my $program_buf = tmpnam(); - skip 'compiling failed (short buffer)', 2 unless system("gcc -DTEST -DBUF_SIZE=$BUF_SIZE{short} -o $program_buf $source") == 0; + skip 'compiling failed (short buffer)', 2 unless system("$compiler -DTEST -DBUF_SIZE=$BUF_SIZE{short} -o $program_buf $source") == 0; $check_clean_buf->($program_buf, $_) foreach qw(clean clean-all); unlink $program_buf; } @@ -180,7 +181,7 @@ SKIP: { { my $debug = tmpnam(); - is(system("gcc -DDEBUG -o $debug $source"), 0, 'debugging build'); + is(system("$compiler -DDEBUG -o $debug $source"), 0, 'debugging build'); unlink $debug if -e $debug; }