Skip to content

Commit 2b2a4d9

Browse files
committed
more tests
1 parent 91c774f commit 2b2a4d9

1 file changed

Lines changed: 130 additions & 0 deletions

File tree

src/test/java/org/htmlunit/javascript/ArgumentsTest.java

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,136 @@ public void arguments() throws Exception {
5757
loadPageVerifyTitle2(html);
5858
}
5959

60+
/**
61+
* @throws Exception if the test fails
62+
*/
63+
@Test
64+
@Alerts("true")
65+
public void argumentsPrototype() throws Exception {
66+
final String html = DOCTYPE_HTML
67+
+ "<html>\n"
68+
+ "<body>\n"
69+
+ "<script>\n"
70+
+ LOG_TITLE_FUNCTION
71+
72+
+ " function test() {\n"
73+
+ " log(arguments.prototype === {}.prototype);\n"
74+
+ " }\n"
75+
76+
+ " test();\n"
77+
+ "</script>\n"
78+
+ "</body></html>";
79+
80+
loadPageVerifyTitle2(html);
81+
}
82+
83+
/**
84+
* @throws Exception if the test fails
85+
*/
86+
@Test
87+
@Alerts({"undefined/undefined", "undefined/undefined", "W-true", "C-true", "E-false"})
88+
public void argumentsLengthProperty() throws Exception {
89+
final String html = DOCTYPE_HTML
90+
+ "<html><body>"
91+
+ "<script>\n"
92+
+ LOG_TITLE_FUNCTION
93+
94+
+ "function test() {\n"
95+
+ " let desc = Object.getOwnPropertyDescriptor(arguments, 'length');\n"
96+
+ " log(typeof desc.get + '/' + desc.get);\n"
97+
+ " log(typeof desc.set + '/' + desc.set);\n"
98+
+ " log('W-' + desc.writable);\n"
99+
+ " log('C-' + desc.configurable);\n"
100+
+ " log('E-' + desc.enumerable);\n"
101+
+ "}\n"
102+
103+
+ "test();\n"
104+
+ "</script></body></html>";
105+
106+
loadPageVerifyTitle2(html);
107+
}
108+
109+
/**
110+
* @throws Exception if the test fails
111+
*/
112+
@Test
113+
@Alerts({"undefined/undefined", "undefined/undefined", "W-true", "C-true", "E-false"})
114+
public void argumentsLengthPropertyStrict() throws Exception {
115+
final String html = DOCTYPE_HTML
116+
+ "<html><body>"
117+
+ "<script>\n"
118+
+ "'use strict';\n"
119+
+ LOG_TITLE_FUNCTION
120+
121+
+ "function test() {\n"
122+
+ " let desc = Object.getOwnPropertyDescriptor(arguments, 'length');\n"
123+
+ " log(typeof desc.get + '/' + desc.get);\n"
124+
+ " log(typeof desc.set + '/' + desc.set);\n"
125+
+ " log('W-' + desc.writable);\n"
126+
+ " log('C-' + desc.configurable);\n"
127+
+ " log('E-' + desc.enumerable);\n"
128+
+ "}\n"
129+
130+
+ "test();\n"
131+
+ "</script></body></html>";
132+
133+
loadPageVerifyTitle2(html);
134+
}
135+
136+
/**
137+
* @throws Exception if the test fails
138+
*/
139+
@Test
140+
@Alerts({"undefined/undefined", "undefined/undefined", "W-true", "C-true", "E-false"})
141+
public void argumentsCalleeProperty() throws Exception {
142+
final String html = DOCTYPE_HTML
143+
+ "<html><body>"
144+
+ "<script>\n"
145+
+ LOG_TITLE_FUNCTION
146+
147+
+ "function test() {\n"
148+
+ " let desc = Object.getOwnPropertyDescriptor(arguments, 'callee');\n"
149+
+ " log(typeof desc.get + '/' + desc.get);\n"
150+
+ " log(typeof desc.set + '/' + desc.set);\n"
151+
+ " log('W-' + desc.writable);\n"
152+
+ " log('C-' + desc.configurable);\n"
153+
+ " log('E-' + desc.enumerable);\n"
154+
+ "}\n"
155+
156+
+ "test();\n"
157+
+ "</script></body></html>";
158+
159+
loadPageVerifyTitle2(html);
160+
}
161+
162+
/**
163+
* @throws Exception if the test fails
164+
*/
165+
@Test
166+
@Alerts({"function/function () { [native code] }", "function/function () { [native code] }",
167+
"W-undefined", "C-false", "E-false"})
168+
public void argumentsCalleePropertyStrict() throws Exception {
169+
final String html = DOCTYPE_HTML
170+
+ "<html><body>"
171+
+ "<script>\n"
172+
+ "'use strict';\n"
173+
+ LOG_TITLE_FUNCTION
174+
175+
+ "function test() {\n"
176+
+ " let desc = Object.getOwnPropertyDescriptor(arguments, 'callee');\n"
177+
+ " log(typeof desc.get + '/' + desc.get);\n"
178+
+ " log(typeof desc.set + '/' + desc.set);\n"
179+
+ " log('W-' + desc.writable);\n"
180+
+ " log('C-' + desc.configurable);\n"
181+
+ " log('E-' + desc.enumerable);\n"
182+
+ "}\n"
183+
184+
+ "test();\n"
185+
+ "</script></body></html>";
186+
187+
loadPageVerifyTitle2(html);
188+
}
189+
60190
/**
61191
* @throws Exception if the test fails
62192
*/

0 commit comments

Comments
 (0)