From c0c2ae0bf1e88ec807ad9868c8a3f07388a25511 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 3 Sep 2014 23:29:48 -0500 Subject: perl wants "use utf8" when UTF-8 is in the source When there are literal UTF-8 characters in the source, "use utf8" will tell Perl to set the utf8 flag on strings. --- runtests.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'runtests.pl') diff --git a/runtests.pl b/runtests.pl index 5facbe6..ce72931 100644 --- a/runtests.pl +++ b/runtests.pl @@ -1,6 +1,7 @@ #!/usr/bin/env perl use warnings; use strict; +use utf8; use Term::ANSIColor; use IO::Handle; use IPC::Open2; -- cgit v1.2.3 From d67a01b8619e59785ac3825c46c2ce8ce2e31b11 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 3 Sep 2014 23:31:55 -0500 Subject: require at least Perl 5.6 The core modules and pragmas being used require at least Perl 5.6 in order to work. Explicitly saying "use 5.006" will make the error more clear. --- runtests.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'runtests.pl') diff --git a/runtests.pl b/runtests.pl index ce72931..7bffe81 100644 --- a/runtests.pl +++ b/runtests.pl @@ -1,4 +1,5 @@ #!/usr/bin/env perl +use 5.006; use warnings; use strict; use utf8; -- cgit v1.2.3 From 23fee89e91244d720c5321ab3ab2ad0293ae5014 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 3 Sep 2014 23:33:29 -0500 Subject: do not buffer STDOUT This ensures that the status line printed to STDERR at the very end of the script will appear after all other script output. --- runtests.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'runtests.pl') diff --git a/runtests.pl b/runtests.pl index 7bffe81..370b43c 100644 --- a/runtests.pl +++ b/runtests.pl @@ -6,6 +6,7 @@ use utf8; use Term::ANSIColor; use IO::Handle; use IPC::Open2; +$|++; my $usage="runtests.pl PROGRAM SPEC\nSet ANSI_COLORS_DISABLED=1 if you redirect to a file.\nSet PATT='...' to restrict tests to sections matching a regex.\n"; -- cgit v1.2.3 From 883f117643e91d213451f5aebde765e67d2706aa Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 3 Sep 2014 23:47:28 -0500 Subject: runtests.pl: switch the order of arguments Putting the spec file first lets us consume all the other arguments as the program to run. This makes it easier to use complex commands to run the tests. --- runtests.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtests.pl') diff --git a/runtests.pl b/runtests.pl index 5facbe6..2e2b795 100644 --- a/runtests.pl +++ b/runtests.pl @@ -5,13 +5,13 @@ use Term::ANSIColor; use IO::Handle; use IPC::Open2; -my $usage="runtests.pl PROGRAM SPEC\nSet ANSI_COLORS_DISABLED=1 if you redirect to a file.\nSet PATT='...' to restrict tests to sections matching a regex.\n"; +my $usage="runtests.pl SPEC PROGRAM\nSet ANSI_COLORS_DISABLED=1 if you redirect to a file.\nSet PATT='...' to restrict tests to sections matching a regex.\n"; -my $PROG=$ARGV[0]; -my $SPEC=$ARGV[1]; +my $SPEC = shift @ARGV; +my @PROG = @ARGV; my $PATT=$ENV{'PATT'}; -if (!(defined $PROG && defined $SPEC)) { +if (!(@PROG && defined $SPEC)) { print STDERR $usage; exit 1; } @@ -69,7 +69,7 @@ sub dotest # We use → to indicate tab and ␣ space in the spec $markdown =~ s/→/\t/g;s/␣/ /g; $html =~ s/→/\t/g;s/␣/ /g; - open2(my $out, my $in, $PROG); + open2(my $out, my $in, @PROG); print $in $markdown; close $in; flush $out; -- cgit v1.2.3 From 364f9440ccc3bf54ae1db3455fbb9b6a6e9e1b2c Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Thu, 4 Sep 2014 00:12:05 -0500 Subject: only use colors when attached to a terminal If STDOUT is not hooked up to a terminal, automatically disable the colors by setting the appropriate environment variable. --- runtests.pl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtests.pl') diff --git a/runtests.pl b/runtests.pl index 5facbe6..adcc373 100644 --- a/runtests.pl +++ b/runtests.pl @@ -16,6 +16,9 @@ if (!(defined $PROG && defined $SPEC)) { exit 1; } +# Disable ANSI colors if we're not hooked up to a terminal +$ENV{ANSI_COLORS_DISABLED} ||= !-t *STDOUT; + my $passed = 0; my $failed = 0; my $skipped = 0; -- cgit v1.2.3 From 3e7594489336d43092e328db06ef0e239c9ddfda Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 4 Sep 2014 09:52:50 -0700 Subject: Revert "only use colors when attached to a terminal" --- runtests.pl | 3 --- 1 file changed, 3 deletions(-) (limited to 'runtests.pl') diff --git a/runtests.pl b/runtests.pl index 2d80f14..2e2b795 100644 --- a/runtests.pl +++ b/runtests.pl @@ -16,9 +16,6 @@ if (!(@PROG && defined $SPEC)) { exit 1; } -# Disable ANSI colors if we're not hooked up to a terminal -$ENV{ANSI_COLORS_DISABLED} ||= !-t *STDOUT; - my $passed = 0; my $failed = 0; my $skipped = 0; -- cgit v1.2.3 From 5b639ace36130bd722413b66833478126d27ccca Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 4 Sep 2014 09:59:17 -0700 Subject: Revert "Perl changes" --- runtests.pl | 3 --- 1 file changed, 3 deletions(-) (limited to 'runtests.pl') diff --git a/runtests.pl b/runtests.pl index 1dfdcf6..2e2b795 100644 --- a/runtests.pl +++ b/runtests.pl @@ -1,12 +1,9 @@ #!/usr/bin/env perl -use 5.006; use warnings; use strict; -use utf8; use Term::ANSIColor; use IO::Handle; use IPC::Open2; -$|++; my $usage="runtests.pl SPEC PROGRAM\nSet ANSI_COLORS_DISABLED=1 if you redirect to a file.\nSet PATT='...' to restrict tests to sections matching a regex.\n"; -- cgit v1.2.3