Skip to content

Commit f731c41

Browse files
authored
Fix placeholder name for addition comparison test (#985)
1 parent 7233d4b commit f731c41

File tree

13 files changed

+97
-49
lines changed

13 files changed

+97
-49
lines changed

unicodetools/src/main/java/org/unicode/text/UCA/MakeNamesChart.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,19 @@ public static void main(String[] args) throws Exception {
6969
isWhiteSpace = new UnicodeSet(up.getSet("whitespace=Yes"));
7070

7171
Utility.copyTextFile(
72-
Settings.SRC_UCA_DIR + "nameslist_index.html",
72+
MakeNamesChart.class.getResource("nameslist_index.html").getPath(),
7373
Utility.UTF8,
7474
NAMESLIST_DIR + "index.html");
7575
Utility.copyTextFile(
76-
Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, NAMESLIST_DIR + "charts.css");
76+
MakeNamesChart.class.getResource("charts.css").getPath(),
77+
Utility.LATIN1,
78+
NAMESLIST_DIR + "charts.css");
7779
Utility.copyTextFile(
78-
Settings.SRC_UCA_DIR + "nameslist_help.html",
80+
MakeNamesChart.class.getResource("nameslist_help.html").getPath(),
7981
Utility.UTF8,
8082
NAMESLIST_DIR + "help.html");
8183
Utility.copyTextFile(
82-
Settings.SRC_UCA_DIR + "nameslist.css",
84+
MakeNamesChart.class.getResource("nameslist.css").getPath(),
8385
Utility.LATIN1,
8486
NAMESLIST_DIR + "nameslist.css");
8587

unicodetools/src/main/java/org/unicode/text/UCA/WriteCharts.java

+56-20
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,27 @@ public static void collationChart(UCA uca) throws IOException {
107107
final String folder = GEN_CHARTS_DIR + "collation/";
108108

109109
Utility.copyTextFile(
110-
Settings.SRC_UCA_DIR + "index.html",
110+
WriteCharts.class.getResource("index.html").getPath(),
111111
Utility.UTF8,
112112
folder + "index.html",
113113
replacement);
114114
Utility.copyTextFile(
115-
Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css", null);
115+
WriteCharts.class.getResource("charts.css").getPath(),
116+
Utility.LATIN1,
117+
folder + "charts.css",
118+
null);
116119
Utility.copyTextFile(
117-
Settings.SRC_UCA_DIR + "help.html", Utility.UTF8, folder + "help.html", null);
120+
WriteCharts.class.getResource("help.html").getPath(),
121+
Utility.UTF8,
122+
folder + "help.html",
123+
null);
118124

119125
indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS);
120126
Utility.appendFile(
121-
Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement);
127+
WriteCharts.class.getResource("index_header.html").getPath(),
128+
Utility.UTF8,
129+
indexFile,
130+
replacement);
122131

123132
/*
124133
indexFile.println("<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
@@ -319,18 +328,25 @@ public static void normalizationChart() throws IOException {
319328
// System.out.println("File: " + new File(".").getCanonicalPath());
320329

321330
Utility.copyTextFile(
322-
Settings.SRC_UCA_DIR + "index.html",
331+
WriteCharts.class.getResource("index.html").getPath(),
323332
Utility.UTF8,
324333
folder + "index.html",
325334
replacement);
326335
Utility.copyTextFile(
327-
Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css");
336+
WriteCharts.class.getResource("charts.css").getPath(),
337+
Utility.LATIN1,
338+
folder + "charts.css");
328339
Utility.copyTextFile(
329-
Settings.SRC_UCA_DIR + "norm_help.html", Utility.UTF8, folder + "help.html");
340+
WriteCharts.class.getResource("norm_help.html").getPath(),
341+
Utility.UTF8,
342+
folder + "help.html");
330343

331344
indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS);
332345
Utility.appendFile(
333-
Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement);
346+
WriteCharts.class.getResource("index_header.html").getPath(),
347+
Utility.UTF8,
348+
indexFile,
349+
replacement);
334350

335351
/*
336352
indexFile.println("<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
@@ -447,18 +463,27 @@ public static void caseChart() throws IOException {
447463
final String folder = GEN_CHARTS_DIR + "case/";
448464

449465
Utility.copyTextFile(
450-
Settings.SRC_UCA_DIR + "index.html",
466+
WriteCharts.class.getResource("index.html").getPath(),
451467
Utility.UTF8,
452468
folder + "index.html",
453469
replacement);
454470
Utility.copyTextFile(
455-
Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css", null);
471+
WriteCharts.class.getResource("charts.css").getPath(),
472+
Utility.LATIN1,
473+
folder + "charts.css",
474+
null);
456475
Utility.copyTextFile(
457-
Settings.SRC_UCA_DIR + "case_help.html", Utility.UTF8, folder + "help.html", null);
476+
WriteCharts.class.getResource("case_help.html").getPath(),
477+
Utility.UTF8,
478+
folder + "help.html",
479+
null);
458480

459481
indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS);
460482
Utility.appendFile(
461-
Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement);
483+
WriteCharts.class.getResource("index_header.html").getPath(),
484+
Utility.UTF8,
485+
indexFile,
486+
replacement);
462487

463488
/*
464489
indexFile.println("<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
@@ -574,18 +599,22 @@ public static void scriptChart() throws IOException {
574599
final String folder = GEN_CHARTS_DIR + "script/";
575600

576601
Utility.copyTextFile(
577-
Settings.SRC_UCA_DIR + "index.html",
602+
WriteCharts.class.getResource("index.html").getPath(),
578603
Utility.UTF8,
579604
folder + "index.html",
580605
replacement);
581606
Utility.copyTextFile(
582-
Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css");
607+
WriteCharts.class.getResource("charts.css").getPath(),
608+
Utility.LATIN1,
609+
folder + "charts.css");
583610
Utility.copyTextFile(
584-
Settings.SRC_UCA_DIR + "script_help.html", Utility.UTF8, folder + "help.html");
611+
WriteCharts.class.getResource("script_help.html").getPath(),
612+
Utility.UTF8,
613+
folder + "help.html");
585614

586615
indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS);
587616
Utility.appendFile(
588-
Settings.SRC_UCA_DIR + "script_index_header.html",
617+
WriteCharts.class.getResource("script_index_header.html").getPath(),
589618
Utility.UTF8,
590619
indexFile,
591620
replacement);
@@ -724,18 +753,25 @@ public static void indexChart() throws IOException {
724753
final String folder = GEN_CHARTS_DIR + "name/";
725754

726755
Utility.copyTextFile(
727-
Settings.SRC_UCA_DIR + "index.html",
756+
WriteCharts.class.getResource("index.html").getPath(),
728757
Utility.UTF8,
729758
folder + "index.html",
730759
replacement);
731760
Utility.copyTextFile(
732-
Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css");
761+
WriteCharts.class.getResource("charts.css").getPath(),
762+
Utility.LATIN1,
763+
folder + "charts.css");
733764
Utility.copyTextFile(
734-
Settings.SRC_UCA_DIR + "name_help.html", Utility.UTF8, folder + "help.html");
765+
WriteCharts.class.getResource("name_help.html").getPath(),
766+
Utility.UTF8,
767+
folder + "help.html");
735768

736769
indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS);
737770
Utility.appendFile(
738-
Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement);
771+
WriteCharts.class.getResource("index_header.html").getPath(),
772+
Utility.UTF8,
773+
indexFile,
774+
replacement);
739775

740776
int columnCount = 0;
741777
char lastInitial = 0;

unicodetools/src/main/java/org/unicode/text/UCD/GenerateCaseFolding.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,11 @@ static void generateSpecialCasing(boolean normalize) throws IOException {
872872
break;
873873
case 6:
874874
Utility.appendFile(
875-
Settings.SRC_UCD_DIR + "SpecialCasingIota.txt", Utility.UTF8, out);
875+
GenerateCaseFolding.class
876+
.getResource("SpecialCasingIota.txt")
877+
.getPath(),
878+
Utility.UTF8,
879+
out);
876880
break;
877881
case 7:
878882
out.println(
@@ -888,7 +892,10 @@ static void generateSpecialCasing(boolean normalize) throws IOException {
888892
}
889893
out.println(line);
890894
}
891-
Utility.appendFile(Settings.SRC_UCD_DIR + "SpecialCasingFooter.txt", Utility.UTF8, out);
895+
Utility.appendFile(
896+
GenerateCaseFolding.class.getResource("SpecialCasingFooter.txt").getPath(),
897+
Utility.UTF8,
898+
out);
892899
udf.close();
893900
// Utility.renameIdentical(mostRecent, Utility.getOutputName(newFile), batName[0]);
894901
}

unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusables.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ public void writeSourceOrder(
14211421
if (appendFile) {
14221422
final String[] replacements = {"%date%", Default.getDate()};
14231423
Utility.appendFile(
1424-
Settings.SRC_UCD_DIR + "confusablesHeader.txt",
1424+
GenerateConfusables.class.getResource("confusablesHeader.txt").getPath(),
14251425
Utility.UTF8_WINDOWS,
14261426
out,
14271427
replacements);

unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusablesCopy.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,9 @@ public void writeSourceOrder(
21252125
if (appendFile) {
21262126
final String[] replacements = {"%date%", Default.getDate()};
21272127
Utility.appendFile(
2128-
Settings.SRC_UCD_DIR + "confusablesHeader.txt",
2128+
GenerateConfusablesCopy.class
2129+
.getResource("confusablesHeader.txt")
2130+
.getPath(),
21292131
Utility.UTF8_WINDOWS,
21302132
out,
21312133
replacements);

unicodetools/src/main/java/org/unicode/text/UCD/GenerateNamedSequences.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static void generate(String filename2) throws IOException {
160160
};
161161

162162
Utility.appendFile(
163-
Settings.SRC_UCD_DIR + "NamedSequences-Template.html",
163+
GenerateNamedSequences.class.getResource("NamedSequences-Template.html").getPath(),
164164
Utility.UTF8,
165165
out,
166166
replacementList);

unicodetools/src/main/java/org/unicode/text/UCD/GenerateStandardizedVariants.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ public static void generate() throws IOException {
186186
};
187187

188188
Utility.appendFile(
189-
Settings.SRC_UCD_DIR + "StandardizedVariants-Template.html",
189+
GenerateStandardizedVariants.class
190+
.getResource("StandardizedVariants-Template.html")
191+
.getPath(),
190192
Utility.UTF8,
191193
out,
192194
replacementList);

unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,10 @@ private void build() {
370370
try {
371371
br =
372372
Utility.openReadFile(
373-
Settings.SRC_UCD_DIR + "MakeUnicodeFiles.txt", Utility.UTF8);
373+
MakeUnicodeFiles.class
374+
.getResource("MakeUnicodeFiles.txt")
375+
.getPath(),
376+
Utility.UTF8);
374377
String file = null, property = null, value = "", comments = "";
375378
while (true) {
376379
String line = br.readLine();

unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.io.PrintWriter;
77
import org.unicode.cldr.draft.FileUtilities;
88
import org.unicode.cldr.util.TransliteratorUtilities;
9-
import org.unicode.text.utility.Settings;
109

1110
public class UseTransliterator {
1211
public static void main(String[] args) throws IOException {
@@ -15,7 +14,7 @@ public static void main(String[] args) throws IOException {
1514
final File f2 = new File("org/unicode/text/UCD/");
1615
System.out.println(f2.getAbsolutePath());
1716
TransliteratorUtilities.registerTransliteratorFromFile(
18-
Settings.SRC_UCD_DIR, "any-temp");
17+
UseTransliterator.class.getResource(".").getPath(), "any-temp");
1918
final Transliterator t = Transliterator.getInstance("any-temp");
2019
final File f = new File(filename);
2120
final String fileContents =

unicodetools/src/main/java/org/unicode/text/utility/Settings.java

-9
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,4 @@ public static void ensureOutputDir(String dir) {
317317
}
318318
}
319319
}
320-
321-
public static final String SRC_DIR =
322-
Utility.fixFileName(UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text") + "/";
323-
324-
/** Used for data files */
325-
public static final String SRC_UCA_DIR = SRC_DIR + "UCA/";
326-
327-
/** Used for data files */
328-
public static final String SRC_UCD_DIR = SRC_DIR + "UCD/";
329320
}

unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.io.IOException;
55
import java.io.PrintWriter;
66
import org.unicode.text.UCD.Default;
7+
import org.unicode.text.UCD.MakeUnicodeFiles;
78
import org.unicode.text.utility.Utility.RuntimeIOException;
89

910
public class UnicodeDataFile {
@@ -70,7 +71,12 @@ private UnicodeDataFile(String directory, String filename, boolean isHTML) throw
7071
}
7172
try {
7273
Utility.appendFile(
73-
Settings.SRC_UCD_DIR + filename + "Header" + fileType, Utility.UTF8_UNIX, out);
74+
MakeUnicodeFiles.class.getResource(".").getPath()
75+
+ filename
76+
+ "Header"
77+
+ fileType,
78+
Utility.UTF8_UNIX,
79+
out);
7480
} catch (final RuntimeIOException e) {
7581
if (!(e.getCause() instanceof FileNotFoundException)) {
7682
throw e;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# [Template for property comparison tests of character encoding proposals]
2-
# [RMG ISSUE TITLE]
3-
# https://github.com/unicode-org/utc-release-management/issues/[RMG ISSUE NUMBER]
1+
# Tangut: Two Tangut ideographs (18D1D..18D1E)
2+
# https://github.com/unicode-org/utc-release-management/issues/154
43

54
# Names always differ.
65
# Age always differs since these tests are comparing additions to pre-existing characters.

unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public class TestTestUnicodeInvariants {
1818
void testSRC_UCD_DIR() {
1919
assertAll(
2020
"assert that no components of Settings.SRC_UCD_DIR are null",
21-
() -> assertNotNull(Settings.SRC_UCD_DIR, "Settings.SRC_UCD_DIR"),
22-
() -> assertNotNull(Settings.SRC_DIR, "Settings.SRC_DIR"),
2321
() ->
2422
assertNotNull(
2523
Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR,
@@ -42,7 +40,10 @@ void testUnicodeInvariants() throws IOException {
4240

4341
@Test
4442
void testAdditionComparisons() throws IOException {
45-
final var directory = new File(Settings.SRC_DIR + "UCD/AdditionComparisons/");
43+
final var directory = new File(getClass().getResource("AdditionComparisons").getPath());
44+
if (!directory.exists()) {
45+
throw new IOException(directory.getAbsolutePath() + " does not exist");
46+
}
4647
int rc = 0;
4748
for (var file : directory.listFiles()) {
4849
final String filename = file.getName();

0 commit comments

Comments
 (0)