1b9128a37SMartin Matuska /* 2b9128a37SMartin Matuska * Copyright (c) 2023 Aaron Lindros 3b9128a37SMartin Matuska * All rights reserved. 4b9128a37SMartin Matuska * 5b9128a37SMartin Matuska * Redistribution and use in source and binary forms, with or without 6b9128a37SMartin Matuska * modification, are permitted provided that the following conditions 7b9128a37SMartin Matuska * are met: 8b9128a37SMartin Matuska * 1. Redistributions of source code must retain the above copyright 9b9128a37SMartin Matuska * notice, this list of conditions and the following disclaimer 10b9128a37SMartin Matuska * in this position and unchanged. 11b9128a37SMartin Matuska * 2. Redistributions in binary form must reproduce the above copyright 12b9128a37SMartin Matuska * notice, this list of conditions and the following disclaimer in the 13b9128a37SMartin Matuska * documentation and/or other materials provided with the distribution. 14b9128a37SMartin Matuska * 15b9128a37SMartin Matuska * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16b9128a37SMartin Matuska * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17b9128a37SMartin Matuska * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18b9128a37SMartin Matuska * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19b9128a37SMartin Matuska * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20b9128a37SMartin Matuska * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21b9128a37SMartin Matuska * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22b9128a37SMartin Matuska * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23b9128a37SMartin Matuska * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24b9128a37SMartin Matuska * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25b9128a37SMartin Matuska */ 26b9128a37SMartin Matuska #include "test.h" 27b9128a37SMartin Matuska 28*13d826ffSMartin Matuska #ifdef HAVE_LOCALE_H 29*13d826ffSMartin Matuska #include <locale.h> 30*13d826ffSMartin Matuska #endif 31*13d826ffSMartin Matuska 32b9128a37SMartin Matuska /* Test I arg - file name encoding */ 33b9128a37SMartin Matuska DEFINE_TEST(test_I) 34b9128a37SMartin Matuska { 35b9128a37SMartin Matuska const char *reffile = "test_I.zip"; 36b9128a37SMartin Matuska int r; 37b9128a37SMartin Matuska 38*13d826ffSMartin Matuska #if HAVE_SETLOCALE 39*13d826ffSMartin Matuska if (NULL == setlocale(LC_ALL, "en_US.UTF-8")) { 40*13d826ffSMartin Matuska skipping("en_US.UTF-8 locale not available on this system."); 41*13d826ffSMartin Matuska return; 42*13d826ffSMartin Matuska } 43*13d826ffSMartin Matuska #else 44*13d826ffSMartin Matuska skipping("setlocale() not available on this system."); 45*13d826ffSMartin Matuska #endif 46*13d826ffSMartin Matuska 47b9128a37SMartin Matuska extract_reference_file(reffile); 48b9128a37SMartin Matuska r = systemf("%s -I UTF-8 %s >test.out 2>test.err", testprog, reffile); 49b9128a37SMartin Matuska assertEqualInt(0, r); 50b9128a37SMartin Matuska assertNonEmptyFile("test.out"); 51b9128a37SMartin Matuska assertEmptyFile("test.err"); 52b9128a37SMartin Matuska 53b9128a37SMartin Matuska assertTextFileContents("Hello, World!\n", "Γειά σου Κόσμε.txt"); 54b9128a37SMartin Matuska } 55