Skip to content

Commit 0eedbca

Browse files
committed
test for hacked const handling
1 parent e1937ec commit 0eedbca

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,33 @@ public void constInOfLoop() throws Exception {
11231123
loadPageVerifyTitle2(html);
11241124
}
11251125

1126+
/**
1127+
* @throws Exception if the test fails
1128+
*/
1129+
@Test
1130+
@Alerts("seven")
1131+
public void constInIfElse() throws Exception {
1132+
final String html = "<html><head>\n"
1133+
+ "<script>\n"
1134+
+ LOG_TITLE_FUNCTION
1135+
+ "function test() {\n"
1136+
+ " let abcd = '1234';"
1137+
+ " if('abcd' === abcd) {\n"
1138+
+ " const constant = 7;\n"
1139+
+ " log(constant);\n"
1140+
+ " } else {\n"
1141+
+ " const constant = 'seven';\n"
1142+
+ " log(constant);\n"
1143+
+ " }\n"
1144+
+ "}\n"
1145+
+ "</script>\n"
1146+
+ "</head>\n"
1147+
+ "<body onload='test()'>\n"
1148+
+ "</body></html>";
1149+
1150+
loadPageVerifyTitle2(html);
1151+
}
1152+
11261153
/**
11271154
* @throws Exception if the test fails
11281155
*/

0 commit comments

Comments
 (0)