View Javadoc
1   package io.jawk.gawk;
2   
3   /*-
4    * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
5    * Jawk
6    * ჻჻჻჻჻჻
7    * Copyright (C) 2006 - 2026 MetricsHub
8    * ჻჻჻჻჻჻
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
23   */
24  
25  import io.jawk.AwkTestSupport;
26  import org.junit.Test;
27  
28  /**
29   * Locale- and charset-sensitive gawk compatibility cases mirrored from the
30   * vendored GNU Awk locale test groups.
31   * Upstream source: {@code git://git.savannah.gnu.org/gawk.git}
32   */
33  public class GawkLocaleIT extends AbstractGawkSuite {
34  
35  	@Test
36  	public void test_asort() throws Exception {
37  		AwkTestSupport
38  				.cliTest("GAWK asort")
39  				.argument("-f", gawkFile("asort.awk"))
40  				.expectLines(gawkPath("asort.ok"))
41  				.expectExit(0)
42  				.runAndAssert();
43  	}
44  
45  	@Test
46  	public void test_asorti() throws Exception {
47  		AwkTestSupport
48  				.cliTest("GAWK asorti")
49  				.argument("-f", gawkFile("asorti.awk"))
50  				.expectLines(gawkPath("asorti.ok"))
51  				.expectExit(0)
52  				.runAndAssert();
53  	}
54  
55  	@Test
56  	public void test_backbigs1() throws Exception {
57  		skip(NON_UTF8_STDIN_REASON);
58  	}
59  
60  	@Test
61  	public void test_backsmalls1() throws Exception {
62  		AwkTestSupport
63  				.cliTest("GAWK backsmalls1")
64  				.argument("--locale", "en-US")
65  				.argument("-f", gawkFile("backsmalls1.awk"))
66  				.stdin(gawkText("backsmalls1.in"))
67  				.expectLines(gawkPath("backsmalls1.ok"))
68  				.expectExit(0)
69  				.runAndAssert();
70  	}
71  
72  	@Test
73  	public void test_backsmalls2() throws Exception {
74  		AwkTestSupport
75  				.cliTest("GAWK backsmalls2")
76  				.argument("--locale", "en-US")
77  				.argument("-f", gawkFile("backsmalls2.awk"))
78  				.expectLines(gawkPath("backsmalls2.ok"))
79  				.expectExit(0)
80  				.runAndAssert();
81  	}
82  
83  	@Test
84  	public void test_fmttest() throws Exception {
85  		AwkTestSupport
86  				.cliTest("GAWK fmttest")
87  				.argument("-f", gawkFile("fmttest.awk"))
88  				.expectLines(gawkPath("fmttest.ok"))
89  				.expectExit(0)
90  				.runAndAssert();
91  	}
92  
93  	@Test
94  	public void test_fnarydel() throws Exception {
95  		AwkTestSupport
96  				.cliTest("GAWK fnarydel")
97  				.argument("-f", gawkFile("fnarydel.awk"))
98  				.expectLines(gawkPath("fnarydel.ok"))
99  				.expectExit(0)
100 				.runAndAssert();
101 	}
102 
103 	@Test
104 	public void test_fnparydl() throws Exception {
105 		AwkTestSupport
106 				.cliTest("GAWK fnparydl")
107 				.argument("-f", gawkFile("fnparydl.awk"))
108 				.expectLines(gawkPath("fnparydl.ok"))
109 				.expectExit(0)
110 				.runAndAssert();
111 	}
112 
113 	@Test
114 	public void test_lc_num1() throws Exception {
115 		AwkTestSupport
116 				.cliTest("GAWK lc_num1")
117 				.argument("--locale", "en-US")
118 				.argument("-f", gawkFile("lc_num1.awk"))
119 				.expectLines(gawkPath("lc_num1.ok"))
120 				.expectExit(0)
121 				.runAndAssert();
122 	}
123 
124 	@Test
125 	public void test_mbfw1() throws Exception {
126 		AwkTestSupport
127 				.cliTest("GAWK mbfw1")
128 				.argument("--locale", "en-US")
129 				.argument("-f", gawkFile("mbfw1.awk"))
130 				.stdin(gawkText("mbfw1.in"))
131 				.expectLines(gawkPath("mbfw1.ok"))
132 				.expectExit(0)
133 				.runAndAssert();
134 	}
135 
136 	@Test
137 	public void test_mbprintf1() throws Exception {
138 		AwkTestSupport
139 				.cliTest("GAWK mbprintf1")
140 				.argument("--locale", "en-US")
141 				.argument("-f", gawkFile("mbprintf1.awk"))
142 				.stdin(gawkText("mbprintf1.in"))
143 				.expectLines(gawkPath("mbprintf1.ok"))
144 				.expectExit(0)
145 				.runAndAssert();
146 	}
147 
148 	@Test
149 	public void test_mbprintf2() throws Exception {
150 		AwkTestSupport
151 				.cliTest("GAWK mbprintf2")
152 				.argument("--locale", "ja-JP")
153 				.argument("-f", gawkFile("mbprintf2.awk"))
154 				.expectLines(gawkPath("mbprintf2.ok"))
155 				.expectExit(0)
156 				.runAndAssert();
157 	}
158 
159 	@Test
160 	public void test_mbprintf3() throws Exception {
161 		skip(NON_UTF8_EXPECTED_REASON);
162 	}
163 
164 	@Test
165 	public void test_mbprintf4() throws Exception {
166 		AwkTestSupport
167 				.cliTest("GAWK mbprintf4")
168 				.argument("--locale", "en-US")
169 				.argument("-f", gawkFile("mbprintf4.awk"))
170 				.stdin(gawkText("mbprintf4.in"))
171 				.expectLines(gawkPath("mbprintf4.ok"))
172 				.expectExit(0)
173 				.runAndAssert();
174 	}
175 
176 	@Test
177 	public void test_mtchi18n() throws Exception {
178 		AwkTestSupport
179 				.cliTest("GAWK mtchi18n")
180 				.argument("--locale", "ru-RU")
181 				.argument("-f", gawkFile("mtchi18n.awk"))
182 				.stdin(gawkText("mtchi18n.in"))
183 				.expectLines(gawkPath("mtchi18n.ok"))
184 				.expectExit(0)
185 				.runAndAssert();
186 	}
187 
188 	@Test
189 	public void test_rebt8b2() throws Exception {
190 		AwkTestSupport
191 				.cliTest("GAWK rebt8b2")
192 				.argument("-f", gawkFile("rebt8b2.awk"))
193 				.expectLines(gawkPath("rebt8b2.ok"))
194 				.expectExit(0)
195 				.runAndAssert();
196 	}
197 
198 	@Test
199 	public void test_sort1() throws Exception {
200 		AwkTestSupport
201 				.cliTest("GAWK sort1")
202 				.argument("-f", gawkFile("sort1.awk"))
203 				.expectLines(gawkPath("sort1.ok"))
204 				.expectExit(0)
205 				.runAndAssert();
206 	}
207 
208 	@Test
209 	public void test_sprintfc() throws Exception {
210 		AwkTestSupport
211 				.cliTest("GAWK sprintfc")
212 				.argument("-f", gawkFile("sprintfc.awk"))
213 				.stdin(gawkText("sprintfc.in"))
214 				.expectLines(gawkPath("sprintfc.ok"))
215 				.expectExit(0)
216 				.runAndAssert();
217 	}
218 
219 	@Test
220 	public void test_rtlenmb() throws Exception {
221 		skip(MANUAL_SKIP_REASON);
222 	}
223 
224 	@Test
225 	public void test_mbprintf5() throws Exception {
226 		skip(MANUAL_SKIP_REASON);
227 	}
228 
229 	@Test
230 	public void test_jarebug() throws Exception {
231 		skip(MANUAL_SKIP_REASON);
232 	}
233 
234 	@Test
235 	public void test_nlstringtest() throws Exception {
236 		skip(MANUAL_SKIP_REASON);
237 	}
238 
239 	@Test
240 	public void test_spacere() throws Exception {
241 		AwkTestSupport
242 				.cliTest("GAWK spacere")
243 				.argument("-f", gawkFile("spacere.awk"))
244 				.expectLines(gawkPath("spacere.ok"))
245 				.expectExit(0)
246 				.runAndAssert();
247 	}
248 
249 }