1 /* 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2023 Aaron Lindros 5 * All rights reserved. 6 */ 7 #include "test.h" 8 9 #ifdef HAVE_LOCALE_H 10 #include <locale.h> 11 #endif 12 13 /* Test I arg - file name encoding */ 14 DEFINE_TEST(test_I) 15 { 16 const char *reffile = "test_I.zip"; 17 #if !defined(_WIN32) || defined(__CYGWIN__) 18 const char *envstr = "env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 " 19 "LC_CTYPE=en_US.UTF-8"; 20 #else 21 const char *envstr = ""; 22 #endif 23 int r; 24 25 #if HAVE_SETLOCALE 26 if (NULL == setlocale(LC_ALL, "en_US.UTF-8")) { 27 skipping("en_US.UTF-8 locale not available on this system."); 28 return; 29 } 30 #else 31 skipping("setlocale() not available on this system."); 32 #endif 33 34 extract_reference_file(reffile); 35 r = systemf("%s %s -I UTF-8 %s >test.out 2>test.err", envstr, testprog, 36 reffile); 37 assertEqualInt(0, r); 38 assertNonEmptyFile("test.out"); 39 assertEmptyFile("test.err"); 40 41 assertTextFileContents("Hello, World!\n", "Γειά σου Κόσμε.txt"); 42 } 43