@@ -36,23 +36,6 @@ public void intl() throws Exception {
3636 test ("Intl" );
3737 }
3838
39- private void test (final String string ) throws Exception {
40- final String html = DOCTYPE_HTML
41- + "<html><head>\n "
42- + "<script>\n "
43- + LOG_TITLE_FUNCTION
44- + " function test() {\n "
45- + " try {\n "
46- + " log(" + string + ");\n "
47- + " } catch(e) { logEx(e) }\n "
48- + " }\n "
49- + "</script>\n "
50- + "</head><body onload='test()'>\n "
51- + "</body></html>" ;
52-
53- loadPageVerifyTitle2 (html );
54- }
55-
5639 /**
5740 * @throws Exception if the test fails
5841 */
@@ -62,6 +45,17 @@ public void collator() throws Exception {
6245 test ("Intl.Collator" );
6346 }
6447
48+ /**
49+ * @throws Exception if the test fails
50+ */
51+ @ Test
52+ @ Alerts ({"[object Intl.Collator]" ,
53+ "function Collator() { [native code] }" ,
54+ "[object Intl.Collator]" })
55+ public void collatorCtor () throws Exception {
56+ testCtor ("new Intl.Collator('de')" );
57+ }
58+
6559 /**
6660 * @throws Exception if the test fails
6761 */
@@ -71,13 +65,16 @@ public void dateTimeFormat() throws Exception {
7165 test ("Intl.DateTimeFormat" );
7266 }
7367
68+
7469 /**
7570 * @throws Exception if the test fails
7671 */
7772 @ Test
78- @ Alerts ("function NumberFormat() { [native code] }" )
79- public void numberFormat () throws Exception {
80- test ("Intl.NumberFormat" );
73+ @ Alerts ({"[object Intl.DateTimeFormat]" ,
74+ "function DateTimeFormat() { [native code] }" ,
75+ "[object Intl.DateTimeFormat]" })
76+ public void dateTimeFormatCtor () throws Exception {
77+ testCtor ("new Intl.DateTimeFormat('en-US')" );
8178 }
8279
8380 /**
@@ -89,6 +86,37 @@ public void locale() throws Exception {
8986 test ("Intl.Locale" );
9087 }
9188
89+ /**
90+ * @throws Exception if the test fails
91+ */
92+ @ Test
93+ @ Alerts ({"de" ,
94+ "function Locale() { [native code] }" ,
95+ "TypeError" })
96+ public void localeCtor () throws Exception {
97+ testCtor ("new Intl.Locale('de')" );
98+ }
99+
100+ /**
101+ * @throws Exception if the test fails
102+ */
103+ @ Test
104+ @ Alerts ("function NumberFormat() { [native code] }" )
105+ public void numberFormat () throws Exception {
106+ test ("Intl.NumberFormat" );
107+ }
108+
109+ /**
110+ * @throws Exception if the test fails
111+ */
112+ @ Test
113+ @ Alerts ({"[object Intl.NumberFormat]" ,
114+ "function NumberFormat() { [native code] }" ,
115+ "[object Intl.NumberFormat]" })
116+ public void numberFormatCtor () throws Exception {
117+ testCtor ("new Intl.NumberFormat('de-DE')" );
118+ }
119+
92120 /**
93121 * @throws Exception if the test fails
94122 */
@@ -99,6 +127,53 @@ public void locale() throws Exception {
99127 public void v8BreakIterator () throws Exception {
100128 test ("Intl.v8BreakIterator" );
101129 }
130+ /**
131+ * @throws Exception if the test fails
132+ */
133+ @ Test
134+ @ Alerts (DEFAULT = "TypeError" ,
135+ CHROME = "[object Object]" ,
136+ EDGE = "[object Object]" )
137+ public void v8BreakIteratorCtor () throws Exception {
138+ test ("new Intl.v8BreakIterator('de-DE')" );
139+ }
140+
141+ private void test (final String string ) throws Exception {
142+ final String html = DOCTYPE_HTML
143+ + "<html><head>\n "
144+ + "<script>\n "
145+ + LOG_TITLE_FUNCTION
146+ + " function test() {\n "
147+ + " try {\n "
148+ + " log(" + string + ");\n "
149+ + " } catch(e) { logEx(e) }\n "
150+ + " }\n "
151+ + "</script>\n "
152+ + "</head><body onload='test()'>\n "
153+ + "</body></html>" ;
154+
155+ loadPageVerifyTitle2 (html );
156+ }
157+
158+ private void testCtor (final String string ) throws Exception {
159+ final String html = DOCTYPE_HTML
160+ + "<html><head>\n "
161+ + "<script>\n "
162+ + LOG_TITLE_FUNCTION
163+ + " function test() {\n "
164+ + " try {\n "
165+ + " let ctor = " + string + ";\n "
166+ + " log(ctor);\n "
167+ + " log(ctor.constructor);\n "
168+ + " log(ctor.constructor.prototype);\n "
169+ + " } catch(e) { logEx(e) }\n "
170+ + " }\n "
171+ + "</script>\n "
172+ + "</head><body onload='test()'>\n "
173+ + "</body></html>" ;
174+
175+ loadPageVerifyTitle2 (html );
176+ }
102177
103178 /**
104179 * @throws Exception if the test fails
0 commit comments