From d09d7bd6346124ad0574084f6dde8dcbfa75750a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano-Tarumi?= Date: Wed, 19 Dec 2018 20:32:55 -0500 Subject: [PATCH] t: only run opustags.t in UTF-8 environments --- t/CMakeLists.txt | 2 +- t/opustags.t | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/t/CMakeLists.txt b/t/CMakeLists.txt index 2ceef8b..87a3a51 100644 --- a/t/CMakeLists.txt +++ b/t/CMakeLists.txt @@ -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 ) diff --git a/t/opustags.t b/t/opustags.t index ed5c7e5..f0fcb01 100755 --- a/t/opustags.t +++ b/t/opustags.t @@ -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];