Skip to content

Commit 95c2bd7

Browse files
authored
Merge branch 'unicode-org:main' into main
2 parents c82fe0a + 001f0d4 commit 95c2bd7

6 files changed

Lines changed: 20 additions & 37 deletions

File tree

executors/cpp/datetime_fmt.cpp

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ using std::string;
3535

3636
auto StringToEStyle(string style_string) -> icu::DateFormat::EStyle {
3737
if (style_string == "full") { return icu::DateFormat::kFull;
38-
}
39-
if (style_string == "long") { return icu::DateFormat::kLong;
40-
}
41-
if (style_string == "medium") { return icu::DateFormat::kMedium;
42-
}
43-
if (style_string == "short") { return icu::DateFormat::kShort;
44-
}
38+
} else if (style_string == "long") { return icu::DateFormat::kLong;
39+
} else if (style_string == "medium") { return icu::DateFormat::kMedium;
40+
} else if (style_string == "short") { return icu::DateFormat::kShort;
41+
}
4542
return icu::DateFormat::kNone;
4643
}
4744

@@ -224,7 +221,7 @@ auto TestDatetimeFmt(json_object *json_in) -> string {
224221
// Use ISO string form of the date/time.
225222
json_object *input_string_obj =
226223
json_object_object_get(json_in, "input_string");
227-
// Prefer ISO input as input.
224+
// Use ISO input in milliseconds if available.
228225
json_object *input_millis = json_object_object_get(json_in, "input_millis");
229226

230227
UDate test_date_time;
@@ -233,26 +230,10 @@ auto TestDatetimeFmt(json_object *json_in) -> string {
233230

234231
string input_date_string = json_object_get_string(input_string_obj);
235232

236-
// SimpleDateFormat can't parse options or timezone offset
237-
// First, remove options starting with "["
238-
std::size_t pos = input_date_string.find("[");
239-
if (pos >= 0) {
240-
input_date_string = input_date_string.substr(0, pos);
241-
}
242-
// Now remove the explicit offset
243-
pos = input_date_string.find("+");
244-
if (pos >= 0) {
245-
input_date_string = input_date_string.substr(0, pos);
246-
}
247-
pos = input_date_string.rfind("-");
248-
if (pos >= 10) {
249-
// DOn't clip in the date fields
250-
input_date_string = input_date_string.substr(0, pos);
251-
}
252233
UnicodeString date_ustring(input_date_string.c_str());
253234

254-
// TODO: handles the offset +/-
255-
SimpleDateFormat iso_date_fmt(u"y-M-d'T'h:m:sZ", und_locale, status);
235+
// Input string is in 24 hour time!
236+
SimpleDateFormat iso_date_fmt(u"y-M-d'T'H:m:sZ", und_locale, status);
256237
if (U_FAILURE(status) != 0) {
257238
string error_name = u_errorName(status);
258239
string error_message =

executors/node/datetime_fmt.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ const skeleton_to_options_map = new Map(
4545

4646
['h', {'hourCycle': 'h12', 'hour': 'numeric'} ],
4747
['hh', {'hourCycle': 'h12', 'hour': '2-digit'} ],
48-
['H', {'hourCycle': 'h24', 'hour': 'numeric'} ],
49-
['HH', {'hourCycle': 'h24', 'hour': '2-digit'} ],
48+
['H', {'hourCycle': 'h23', 'hour': 'numeric'} ],
49+
['HH', {'hourCycle': 'h23', 'hour': '2-digit'} ],
5050

5151
['j', {'hour': 'numeric'} ],
5252
['jj', {'hour': '2-digit'} ],
@@ -122,8 +122,10 @@ module.exports = {
122122
}
123123

124124
test_options = fill_options_from_skeleton_parts(split);
125-
if (debug > 0) {
126-
console.log('# TEST_OPTIONS: %s', split, test_options);
125+
126+
// This may be specified explicitly in options.
127+
if ('hourCycle' in input_options) {
128+
test_options['hourCycle'] = input_options['hourCycle'];
127129
}
128130
}
129131

testgen/generators/collation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ def set_patterns(self):
5959
]
6060

6161
# For detecting and converting \x, \u, and \U coded values
62-
self.xcoding = re.compile("\\\\x([0-9A-Fa-f]{2})")
63-
self.escaped_ucoding = re.compile("\\\\u([0-9A-Fa-f]{4})")
64-
self.escaped_bigU_coding = re.compile("\\\\U([0-9A-Fa-f]{8})")
62+
self.xcoding = re.compile(r"\\x([0-9A-Fa-f]{2})")
63+
self.escaped_ucoding = re.compile(r"\\u([0-9A-Fa-f]{4})")
64+
self.escaped_bigU_coding = re.compile(r"\\U([0-9A-Fa-f]{8})")
6565

6666
def process_test_data(self):
6767
# Get each kind of collation tests and create a unified data set

testgen/generators/number_fmt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66
from generators.base import DataGenerator
77

8-
reblankline = re.compile("^\s*$")
8+
reblankline = re.compile(r"^\s*$")
99

1010
# Global constants
1111
# Values to be formatted in number format tests
@@ -166,7 +166,7 @@ def parseNumberFmtTestData(self, rawtestdata):
166166
# Source data: https://github.com/unicode-org/icu/blob/main/icu4c/source/test/testdata/dcfmtest.txt
167167
def generateDcmlFmtTestDataObjects(self, rawtestdata, count=0):
168168
original_count = count
169-
recommentline = re.compile("^\s*#")
169+
recommentline = re.compile(r"^\s*#")
170170
test_list = rawtestdata.splitlines()
171171

172172
all_tests_list = []

testgen/generators/plurals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from generators.base import DataGenerator
1010

11-
reblankline = re.compile("^\s*$")
11+
reblankline = re.compile(r"^\s*$")
1212

1313
class PluralGenerator(DataGenerator):
1414
def plurals_descriptor(self):

verifier/detail_template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<!--Load the AJAX API for visualizing stacked bars-->
2222
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
2323

24-
<title>$test_type with $library_name</title>
24+
<title>$test_type $library_name</title>
2525
<style>
2626
body { font-family: Sans-Serif; }
2727

0 commit comments

Comments
 (0)