[HtmlUnit] SVN: [15514] trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/ javascript/JavaScriptEngine2Test.java

rbri--- via HtmlUnit-develop <[email protected]> Fri, 10 Aug 2018 16:51:53 +0000
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID <[email protected]>
Revision: 15514
          http://sourceforge.net/p/htmlunit/code/15514
Author:   rbri
Date:     2018-08-10 16:51:51 +0000 (Fri, 10 Aug 2018)
Log Message:
-----------
switch to the latest core-js made the related tests passing

Modified Paths:
--------------
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java	2018-08-10 06:12:02 UTC (rev 15513)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java	2018-08-10 16:51:51 UTC (rev 15514)
@@ -328,7 +328,8 @@
     @Test
     @BuggyWebDriver
     public void function_object_method() throws Exception {
-        final String html = "<html><head><title>foo</title><script>\n"
+        final String html = "<html><head>\n"
+                + "<script>\n"
                 + "  try {\n"
                 + "    alert('1');\n"
                 + "    function document.onclick() {\n"
@@ -335,10 +336,10 @@
                 + "      alert('hi');\n"
                 + "    }\n"
                 + "    alert('2');\n"
-                + "  } catch(e) {alert(e)}\n"
-                + "</script></head>\n"
+                + "  } catch(e) { alert(e); }\n"
+                + "</script>\n"
+                + "</head>\n"
                 + "<body>\n"
-                + "  <div id='myDiv'>Hello there</div>\n"
                 + "</body></html>";
 
         try {
@@ -721,14 +722,13 @@
      * @throws Exception if the test fails
      */
     @Test
-    @Alerts({"outer abc = 1", "inner abc = function abc() { alert('inner abc = ' + abc); }"})
-    @NotYetImplemented
+    @Alerts({"outer abc = 1", "inner abc = function"})
     public void functionHasNameOfVarStrictMode() throws Exception {
         final String html = "<html><head>\n"
                 + "<script>\n"
                 + "  'use strict';\n"
                 + "  var abc = 1;\n"
-                + "  var foo = function abc() { alert('inner abc = ' + abc); }\n"
+                + "  var foo = function abc() { alert('inner abc = ' + typeof abc); }\n"
                 + "  alert('outer abc = ' + abc);\n"
                 + "  foo()\n"
                 + "</script>\n"
@@ -744,7 +744,6 @@
      */
     @Test
     @Alerts({"a", "b"})
-    @NotYetImplemented
     public void innerFunctionWithSameName() throws Exception {
         final String html = "<html><head>\n"
                 + "<script>\n"
@@ -773,7 +772,6 @@
      */
     @Test
     @Alerts("a")
-    @NotYetImplemented
     public void innerFunctionWithSameNameAsOutsideStrict() throws Exception {
         final String html = "<html><head>\n"
                 + "<script>\n"
@@ -798,15 +796,16 @@
      * @throws Exception if the test fails
      */
     @Test
-    @Alerts({"function func() { alert(func); }", "outer"})
-    @NotYetImplemented
+    @Alerts({"functionfunc(){alert(norm(func));}", "outer"})
     public void secondFunctionWithSameNameStrict() throws Exception {
         final String html = "<html><head>\n"
                 + "<script>\n"
                 + "  'use strict';\n"
+                + "  function norm(foo) { return ('' + foo).replace(/(\\s)/gm,'') }\n"
+
                 + "  function func () { alert('outer'); }\n"
 
-                + "  var x = function func() { alert(func); }\n"
+                + "  var x = function func() { alert(norm(func)); }\n"
 
                 + "  x();\n"
                 + "  func();\n"


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot