t: only run opustags.t in UTF-8 environments

This commit is contained in:
Frédéric Mangano-Tarumi 2018-12-19 20:32:55 -05:00
parent 191796a3d2
commit d09d7bd634
2 changed files with 7 additions and 5 deletions

View File

@ -17,6 +17,6 @@ configure_file(gobble.opus . COPYONLY)
add_custom_target(
check
COMMAND prove "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND prove "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS opustags gobble.opus system.t opus.t ogg.t cli.t
)

View File

@ -1,9 +1,5 @@
#!/usr/bin/env perl
# This test assumes the following system environment:
# - The current locale is UTF-8.
# - Locale fr_FR.ISO-8859-1 is available.
use strict;
use warnings;
use utf8;
@ -19,6 +15,12 @@ use Symbol 'gensym';
my $opustags = '../opustags';
BAIL_OUT("$opustags does not exist or is not executable") if (! -x $opustags);
my $is_utf8;
open(my $ctype, 'locale -k LC_CTYPE |');
while (<$ctype>) { $is_utf8 = 1 if (/^charmap="UTF-?8"$/i) }
close($ctype);
BAIL_OUT("this test must be run from an UTF-8 environment") unless $is_utf8;
sub opustags {
my %opt;
%opt = %{pop @_} if ref $_[-1];