Skip to content

Commit bb37a1e

Browse files
committed
Improve test/intl402/Locale/constructor-getter-order.js
* Add a helper for concision * Specify properties in a different order than the one used for reading
1 parent b6fd532 commit bb37a1e

File tree

1 file changed

+28
-82
lines changed

1 file changed

+28
-82
lines changed

test/intl402/Locale/constructor-getter-order.js

Lines changed: 28 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -11,102 +11,48 @@ includes: [compareArray.js]
1111
---*/
1212

1313
const order = [];
14+
function handleGet(name, value) {
15+
order.push("get " + name);
16+
return {
17+
toString() {
18+
order.push("toString " + name);
19+
return value;
20+
}
21+
};
22+
}
1423
new Intl.Locale(
1524
{ toString() { order.push("tag toString"); return "en"; } },
1625
{
17-
get language() {
18-
order.push("get language");
19-
return {
20-
toString() {
21-
order.push("toString language");
22-
return "de";
23-
}
24-
}
25-
},
26-
27-
get script() {
28-
order.push("get script");
29-
return {
30-
toString() {
31-
order.push("toString script");
32-
return "Latn";
33-
}
34-
}
35-
},
36-
37-
get region() {
38-
order.push("get region");
39-
return {
40-
toString() {
41-
order.push("toString region");
42-
return "DE";
43-
}
44-
}
45-
},
46-
47-
get variants() {
48-
order.push("get variants");
49-
return {
50-
toString() {
51-
order.push("toString variants");
52-
return "fonipa-1996";
53-
}
54-
}
55-
},
56-
5726
get calendar() {
58-
order.push("get calendar");
59-
return {
60-
toString() {
61-
order.push("toString calendar");
62-
return "gregory";
63-
}
64-
}
27+
return handleGet("calendar", "gregory");
28+
},
29+
get caseFirst() {
30+
return handleGet("caseFirst", "upper");
6531
},
66-
6732
get collation() {
68-
order.push("get collation");
69-
return {
70-
toString() {
71-
order.push("toString collation");
72-
return "zhuyin";
73-
}
74-
}
33+
return handleGet("collation", "zhuyin");
7534
},
76-
7735
get hourCycle() {
78-
order.push("get hourCycle");
79-
return {
80-
toString() {
81-
order.push("toString hourCycle");
82-
return "h24";
83-
}
84-
}
36+
return handleGet("hourCycle", "h24");
8537
},
86-
87-
get caseFirst() {
88-
order.push("get caseFirst");
89-
return {
90-
toString() {
91-
order.push("toString caseFirst");
92-
return "upper";
93-
}
94-
}
38+
get language() {
39+
return handleGet("language", "de");
40+
},
41+
get numberingSystem() {
42+
return handleGet("numberingSystem", "latn");
9543
},
96-
9744
get numeric() {
9845
order.push("get numeric");
9946
return false;
10047
},
101-
102-
get numberingSystem() {
103-
order.push("get numberingSystem");
104-
return {
105-
toString() {
106-
order.push("toString numberingSystem");
107-
return "latn";
108-
}
109-
}
48+
get region() {
49+
return handleGet("region", "DE");
50+
},
51+
get script() {
52+
return handleGet("script", "Latn");
53+
},
54+
get variants() {
55+
return handleGet("variants", "fonipa-1996");
11056
},
11157
}
11258
);

0 commit comments

Comments
 (0)