Skip to content

Commit 087f9e1

Browse files
committed
more detailed tests
1 parent bf98cb8 commit 087f9e1

File tree

1 file changed

+87
-40
lines changed

1 file changed

+87
-40
lines changed

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

Lines changed: 87 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ public void arguments() throws Exception {
6464
*/
6565
@Test
6666
@Alerts({"TypeError", "TypeError", "TypeError", "TypeError"})
67-
@HtmlUnitNYI(CHROME = {"0", "0", "1", "TypeError"},
68-
EDGE = {"0", "0", "1", "TypeError"},
69-
FF = {"0", "0", "1", "TypeError"},
70-
FF_ESR = {"0", "0", "1", "TypeError"})
7167
public void argumentsStrictScript() throws Exception {
7268
final String html = DOCTYPE_HTML
7369
+ "<html>\n"
@@ -390,10 +386,10 @@ public void argumentsShouldBeNullOutsideFunction() throws Exception {
390386
*/
391387
@Test
392388
@Alerts({"TypeError", "[object Arguments]", "TypeError", "TypeError"})
393-
@HtmlUnitNYI(CHROME = {"null", "[object Arguments]", "[object Arguments]", "null"},
394-
EDGE = {"null", "[object Arguments]", "[object Arguments]", "null"},
395-
FF = {"null", "[object Arguments]", "[object Arguments]", "null"},
396-
FF_ESR = {"null", "[object Arguments]", "[object Arguments]", "null"})
389+
@HtmlUnitNYI(CHROME = {"null", "[object Arguments]", "null", "null"},
390+
EDGE = {"null", "[object Arguments]", "null", "null"},
391+
FF = {"null", "[object Arguments]", "null", "null"},
392+
FF_ESR = {"null", "[object Arguments]", "null", "null"})
397393
public void argumentsShouldBeNullOutsideFunctionStrict() throws Exception {
398394
final String html = DOCTYPE_HTML
399395
+ "<html>\n"
@@ -503,10 +499,10 @@ public void passedCountDifferentFromDeclared() throws Exception {
503499
*/
504500
@Test
505501
@Alerts({"2", "TypeError"})
506-
@HtmlUnitNYI(CHROME = {"2", "[object Arguments]"},
507-
EDGE = {"2", "[object Arguments]"},
508-
FF = {"2", "[object Arguments]"},
509-
FF_ESR = {"2", "[object Arguments]"})
502+
@HtmlUnitNYI(CHROME = {"2", "null"},
503+
EDGE = {"2", "null"},
504+
FF = {"2", "null"},
505+
FF_ESR = {"2", "null"})
510506
public void passedCountDifferentFromDeclaredStrict() throws Exception {
511507
final String html = DOCTYPE_HTML
512508
+ "<html>\n"
@@ -1774,7 +1770,7 @@ public void argumentsToStringStrict() throws Exception {
17741770
* @throws Exception if the test fails
17751771
*/
17761772
@Test
1777-
@Alerts({"undefined", "false", "undefined", "false", "test"})
1773+
@Alerts({"undefined", "false", "false", "undefined", "false", "false", "test"})
17781774
public void argumentsCaller() throws Exception {
17791775
final String html = DOCTYPE_HTML
17801776
+ "<html>\n"
@@ -1789,6 +1785,8 @@ public void argumentsCaller() throws Exception {
17891785
+ " logEx(e);\n"
17901786
+ " }\n"
17911787
+ " log(Object.keys(arguments).includes('caller'));\n"
1788+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
1789+
17921790
+ " test1('hi');\n"
17931791
+ " }\n"
17941792

@@ -1799,6 +1797,7 @@ public void argumentsCaller() throws Exception {
17991797
+ " logEx(e);\n"
18001798
+ " }\n"
18011799
+ " log(Object.keys(arguments).includes('caller'));\n"
1800+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
18021801

18031802
+ " try {\n"
18041803
+ " log(arguments.callee.caller.name);\n"
@@ -1818,7 +1817,7 @@ public void argumentsCaller() throws Exception {
18181817
* @throws Exception if the test fails
18191818
*/
18201819
@Test
1821-
@Alerts({"undefined", "false", "undefined", "false", "TypeError"})
1820+
@Alerts({"undefined", "false", "false", "undefined", "false", "false", "TypeError"})
18221821
public void argumentsCallerStrictScript() throws Exception {
18231822
final String html = DOCTYPE_HTML
18241823
+ "<html>\n"
@@ -1834,6 +1833,8 @@ public void argumentsCallerStrictScript() throws Exception {
18341833
+ " logEx(e);\n"
18351834
+ " }\n"
18361835
+ " log(Object.keys(arguments).includes('caller'));\n"
1836+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
1837+
18371838
+ " test1('hi');\n"
18381839
+ " }\n"
18391840

@@ -1844,6 +1845,7 @@ public void argumentsCallerStrictScript() throws Exception {
18441845
+ " logEx(e);\n"
18451846
+ " }\n"
18461847
+ " log(Object.keys(arguments).includes('caller'));\n"
1848+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
18471849

18481850
+ " try {\n"
18491851
+ " log(arguments.callee.caller.name);\n"
@@ -1863,11 +1865,12 @@ public void argumentsCallerStrictScript() throws Exception {
18631865
* @throws Exception if the test fails
18641866
*/
18651867
@Test
1866-
@Alerts({"undefined", "false", "undefined", "false", "null"})
1867-
@HtmlUnitNYI(CHROME = {"undefined", "false", "undefined", "false", "undefined"},
1868-
EDGE = {"undefined", "false", "undefined", "false", "undefined"},
1869-
FF = {"undefined", "false", "undefined", "false", "undefined"},
1870-
FF_ESR = {"undefined", "false", "undefined", "false", "undefined"})
1868+
@Alerts({"undefined", "false", "false", "undefined", "false", "false", "null"})
1869+
@HtmlUnitNYI(
1870+
CHROME = {"undefined", "false", "false", "undefined", "false", "false", "undefined"},
1871+
EDGE = {"undefined", "false", "false", "undefined", "false", "false", "undefined"},
1872+
FF = {"undefined", "false", "false", "undefined", "false", "false", "undefined"},
1873+
FF_ESR = {"undefined", "false", "false", "undefined", "false", "false", "undefined"})
18711874
public void argumentsCallerStrictParentFoo() throws Exception {
18721875
final String html = DOCTYPE_HTML
18731876
+ "<html>\n"
@@ -1883,6 +1886,8 @@ public void argumentsCallerStrictParentFoo() throws Exception {
18831886
+ " logEx(e);\n"
18841887
+ " }\n"
18851888
+ " log(Object.keys(arguments).includes('caller'));\n"
1889+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
1890+
18861891
+ " test1('hi');\n"
18871892
+ " }\n"
18881893

@@ -1893,6 +1898,7 @@ public void argumentsCallerStrictParentFoo() throws Exception {
18931898
+ " logEx(e);\n"
18941899
+ " }\n"
18951900
+ " log(Object.keys(arguments).includes('caller'));\n"
1901+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
18961902

18971903
+ " try {\n"
18981904
+ " log(arguments.callee.caller);\n"
@@ -1912,7 +1918,7 @@ public void argumentsCallerStrictParentFoo() throws Exception {
19121918
* @throws Exception if the test fails
19131919
*/
19141920
@Test
1915-
@Alerts({"undefined", "false", "undefined", "false", "TypeError"})
1921+
@Alerts({"undefined", "false", "false", "undefined", "false", "false", "TypeError"})
19161922
public void argumentsCallerStrictChildFoo() throws Exception {
19171923
final String html = DOCTYPE_HTML
19181924
+ "<html>\n"
@@ -1927,6 +1933,8 @@ public void argumentsCallerStrictChildFoo() throws Exception {
19271933
+ " logEx(e);\n"
19281934
+ " }\n"
19291935
+ " log(Object.keys(arguments).includes('caller'));\n"
1936+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
1937+
19301938
+ " test1('hi');\n"
19311939
+ " }\n"
19321940

@@ -1938,6 +1946,7 @@ public void argumentsCallerStrictChildFoo() throws Exception {
19381946
+ " logEx(e);\n"
19391947
+ " }\n"
19401948
+ " log(Object.keys(arguments).includes('caller'));\n"
1949+
+ " log(Object.prototype.hasOwnProperty.call(arguments, 'caller'));\n"
19411950

19421951
+ " try {\n"
19431952
+ " log(arguments.callee.caller);\n"
@@ -1957,11 +1966,17 @@ public void argumentsCallerStrictChildFoo() throws Exception {
19571966
* @throws Exception if the test fails
19581967
*/
19591968
@Test
1960-
@Alerts({"null", "false", "null", "false", "test", "false", "test", "false"})
1961-
@HtmlUnitNYI(CHROME = {"undefined", "false", "undefined", "false", "test", "false", "test", "false"},
1962-
EDGE = {"undefined", "false", "undefined", "false", "test", "false", "test", "false"},
1963-
FF = {"undefined", "false", "undefined", "false", "test", "false", "test", "false"},
1964-
FF_ESR = {"undefined", "false", "undefined", "false", "test", "false", "test", "false"})
1969+
@Alerts({"null", "false", "false", "null", "false", "false",
1970+
"test", "false", "false", "test", "false", "false"})
1971+
@HtmlUnitNYI(
1972+
CHROME = {"undefined", "false", "false", "undefined", "false", "false",
1973+
"test", "false", "true", "test", "false", "true"},
1974+
EDGE = {"undefined", "false", "false", "undefined", "false", "false",
1975+
"test", "false", "true", "test", "false", "true"},
1976+
FF = {"undefined", "false", "false", "undefined", "false", "false",
1977+
"test", "false", "true", "test", "false", "true"},
1978+
FF_ESR = {"undefined", "false", "false", "undefined", "false", "false",
1979+
"test", "false", "true", "test", "false", "true"})
19651980
public void caller() throws Exception {
19661981
final String html = DOCTYPE_HTML
19671982
+ "<html>\n"
@@ -1976,6 +1991,8 @@ public void caller() throws Exception {
19761991
+ " logEx(e);\n"
19771992
+ " }\n"
19781993
+ " log(Object.keys(test).includes('caller'));\n"
1994+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
1995+
19791996
+ " test1('hi');\n"
19801997
+ " }\n"
19811998

@@ -1986,20 +2003,23 @@ public void caller() throws Exception {
19862003
+ " logEx(e);\n"
19872004
+ " }\n"
19882005
+ " log(Object.keys(test).includes('caller'));\n"
2006+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
19892007

19902008
+ " try {\n"
19912009
+ " log(test1.caller.name);\n"
19922010
+ " } catch(e) {\n"
19932011
+ " logEx(e);\n"
19942012
+ " }\n"
19952013
+ " log(Object.keys(test1).includes('caller'));\n"
2014+
+ " log(Object.prototype.hasOwnProperty.call(test1, 'caller'));\n"
19962015

19972016
+ " try {\n"
19982017
+ " log(arguments.callee.caller.name);\n"
19992018
+ " } catch(e) {\n"
20002019
+ " logEx(e);\n"
20012020
+ " }\n"
20022021
+ " log(Object.keys(arguments.callee).includes('caller'));\n"
2022+
+ " log(Object.prototype.hasOwnProperty.call(arguments.callee, 'caller'));\n"
20032023
+ " }\n"
20042024

20052025
+ " test();\n"
@@ -2013,11 +2033,16 @@ public void caller() throws Exception {
20132033
* @throws Exception if the test fails
20142034
*/
20152035
@Test
2016-
@Alerts({"TypeError", "false", "TypeError", "false", "TypeError", "false", "TypeError"})
2017-
@HtmlUnitNYI(CHROME = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"},
2018-
EDGE = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"},
2019-
FF = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"},
2020-
FF_ESR = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"})
2036+
@Alerts({"TypeError", "false", "false", "TypeError", "false", "false", "TypeError", "false", "false", "TypeError"})
2037+
@HtmlUnitNYI(
2038+
CHROME = {"undefined", "false", "false", "undefined", "false", "false",
2039+
"TypeError", "false", "false", "TypeError"},
2040+
EDGE = {"undefined", "false", "false", "undefined", "false", "false",
2041+
"TypeError", "false", "false", "TypeError"},
2042+
FF = {"undefined", "false", "false", "undefined", "false", "false",
2043+
"TypeError", "false", "false", "TypeError"},
2044+
FF_ESR = {"undefined", "false", "false", "undefined", "false", "false",
2045+
"TypeError", "false", "false", "TypeError"})
20212046
public void callerStrictScript() throws Exception {
20222047
final String html = DOCTYPE_HTML
20232048
+ "<html>\n"
@@ -2033,6 +2058,8 @@ public void callerStrictScript() throws Exception {
20332058
+ " logEx(e);\n"
20342059
+ " }\n"
20352060
+ " log(Object.keys(test).includes('caller'));\n"
2061+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
2062+
20362063
+ " test1('hi');\n"
20372064
+ " }\n"
20382065

@@ -2043,13 +2070,15 @@ public void callerStrictScript() throws Exception {
20432070
+ " logEx(e);\n"
20442071
+ " }\n"
20452072
+ " log(Object.keys(test).includes('caller'));\n"
2073+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
20462074

20472075
+ " try {\n"
20482076
+ " log(test1.caller.name);\n"
20492077
+ " } catch(e) {\n"
20502078
+ " logEx(e);\n"
20512079
+ " }\n"
20522080
+ " log(Object.keys(test1).includes('caller'));\n"
2081+
+ " log(Object.prototype.hasOwnProperty.call(test1, 'caller'));\n"
20532082

20542083
+ " try {\n"
20552084
+ " log(arguments.callee.caller.name);\n"
@@ -2069,11 +2098,16 @@ public void callerStrictScript() throws Exception {
20692098
* @throws Exception if the test fails
20702099
*/
20712100
@Test
2072-
@Alerts({"TypeError", "false", "TypeError", "false", "null", "false", "null"})
2073-
@HtmlUnitNYI(CHROME = {"undefined", "false", "undefined", "false", "undefined", "false", "undefined"},
2074-
EDGE = {"undefined", "false", "undefined", "false", "undefined", "false", "undefined"},
2075-
FF = {"undefined", "false", "undefined", "false", "undefined", "false", "undefined"},
2076-
FF_ESR = {"undefined", "false", "undefined", "false", "undefined", "false", "undefined"})
2101+
@Alerts({"TypeError", "false", "false", "TypeError", "false", "false", "null", "false", "false", "null"})
2102+
@HtmlUnitNYI(
2103+
CHROME = {"undefined", "false", "false", "undefined", "false", "false",
2104+
"undefined", "false", "false", "undefined"},
2105+
EDGE = {"undefined", "false", "false", "undefined", "false", "false",
2106+
"undefined", "false", "false", "undefined"},
2107+
FF = {"undefined", "false", "false", "undefined", "false", "false",
2108+
"undefined", "false", "false", "undefined"},
2109+
FF_ESR = {"undefined", "false", "false", "undefined", "false", "false",
2110+
"undefined", "false", "false", "undefined"})
20772111
public void callerStrictParentFoo() throws Exception {
20782112
final String html = DOCTYPE_HTML
20792113
+ "<html>\n"
@@ -2089,6 +2123,8 @@ public void callerStrictParentFoo() throws Exception {
20892123
+ " logEx(e);\n"
20902124
+ " }\n"
20912125
+ " log(Object.keys(test).includes('caller'));\n"
2126+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
2127+
20922128
+ " test1('hi');\n"
20932129
+ " }\n"
20942130

@@ -2099,13 +2135,15 @@ public void callerStrictParentFoo() throws Exception {
20992135
+ " logEx(e);\n"
21002136
+ " }\n"
21012137
+ " log(Object.keys(test).includes('caller'));\n"
2138+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
21022139

21032140
+ " try {\n"
21042141
+ " log(test1.caller);\n"
21052142
+ " } catch(e) {\n"
21062143
+ " logEx(e);\n"
21072144
+ " }\n"
21082145
+ " log(Object.keys(test1).includes('caller'));\n"
2146+
+ " log(Object.prototype.hasOwnProperty.call(test1, 'caller'));\n"
21092147

21102148
+ " try {\n"
21112149
+ " log(arguments.callee.caller);\n"
@@ -2125,11 +2163,16 @@ public void callerStrictParentFoo() throws Exception {
21252163
* @throws Exception if the test fails
21262164
*/
21272165
@Test
2128-
@Alerts({"null", "false", "null", "false", "TypeError", "false", "TypeError"})
2129-
@HtmlUnitNYI(CHROME = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"},
2130-
EDGE = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"},
2131-
FF = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"},
2132-
FF_ESR = {"undefined", "false", "undefined", "false", "TypeError", "false", "TypeError"})
2166+
@Alerts({"null", "false", "false", "null", "false", "false", "TypeError", "false", "false", "TypeError"})
2167+
@HtmlUnitNYI(
2168+
CHROME = {"undefined", "false", "false", "undefined", "false", "false",
2169+
"TypeError", "false", "false", "TypeError"},
2170+
EDGE = {"undefined", "false", "false", "undefined", "false", "false",
2171+
"TypeError", "false", "false", "TypeError"},
2172+
FF = {"undefined", "false", "false", "undefined", "false", "false",
2173+
"TypeError", "false", "false", "TypeError"},
2174+
FF_ESR = {"undefined", "false", "false", "undefined", "false", "false",
2175+
"TypeError", "false", "false", "TypeError"})
21332176
public void callerStrictChildFoo() throws Exception {
21342177
final String html = DOCTYPE_HTML
21352178
+ "<html>\n"
@@ -2144,6 +2187,8 @@ public void callerStrictChildFoo() throws Exception {
21442187
+ " logEx(e);\n"
21452188
+ " }\n"
21462189
+ " log(Object.keys(test).includes('caller'));\n"
2190+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
2191+
21472192
+ " test1('hi');\n"
21482193
+ " }\n"
21492194

@@ -2155,13 +2200,15 @@ public void callerStrictChildFoo() throws Exception {
21552200
+ " logEx(e);\n"
21562201
+ " }\n"
21572202
+ " log(Object.keys(test).includes('caller'));\n"
2203+
+ " log(Object.prototype.hasOwnProperty.call(test, 'caller'));\n"
21582204

21592205
+ " try {\n"
21602206
+ " log(test1.caller.name);\n"
21612207
+ " } catch(e) {\n"
21622208
+ " logEx(e);\n"
21632209
+ " }\n"
21642210
+ " log(Object.keys(test1).includes('caller'));\n"
2211+
+ " log(Object.prototype.hasOwnProperty.call(test1, 'caller'));\n"
21652212

21662213
+ " try {\n"
21672214
+ " log(arguments.callee.caller);\n"

0 commit comments

Comments
 (0)