Export `mjsunit.formatFailureText` which is needed by `test-async.js`

Without this the call to `formatFailureText` in `test-async.js`
fails but goes unnoticed since the promise change is rejects
which is not handled.  And d8 silently ignores the the unhandled
rejections.

Once `formatFailureText` was added it reveals a but where several
tests were expecting `.equal` to be a deepEquals.  Specifically:

test/mjsunit/es6/promise-all.js
test/mjsunit/harmony/async-generators-resume-return.js
test/mjsunit/harmony/async-generators-return.js
test/mjsunit/harmony/async-generators-yield.js

Making equals call `deepEquals` fixed that issue.

Change-Id: I350c7d916147eaa7cf873bdaf273aebbaaa833c5
Reviewed-on: https://chromium-review.googlesource.com/1236852
Commit-Queue: Sam Clegg <sbc@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56107}
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js
index a458e0c..59923a4 100644
--- a/test/mjsunit/mjsunit.js
+++ b/test/mjsunit/mjsunit.js
@@ -64,6 +64,9 @@
 // and the properties of non-Array objects).
 var assertEquals;
 
+// Deep equality predicate used by assertEquals.
+var deepEquals;
+
 // Expected and found values are not identical primitive values or functions
 // or similarly structured objects (checking internal properties
 // of, e.g., Number and Date objects, the elements of arrays
@@ -183,6 +186,9 @@
 // Monkey-patchable all-purpose failure handler.
 var failWithMessage;
 
+// Returns the formatted failure text.  Used by test-async.js.
+var formatFailureText;
+
 // Returns a pretty-printed string representation of the passed value.
 var prettyPrinted;
 
@@ -297,7 +303,7 @@
     throw new MjsUnitAssertionError(message);
   }
 
-  function formatFailureText(expectedText, found, name_opt) {
+  formatFailureText = function(expectedText, found, name_opt) {
     var message = "Fail" + "ure";
     if (name_opt) {
       // Fix this when we ditch the old test runner.
@@ -335,7 +341,7 @@
   }
 
 
-  function deepEquals(a, b) {
+  deepEquals = function deepEquals(a, b) {
     if (a === b) {
       // Check for -0.
       if (a === 0) return (1 / a) === (1 / b);
diff --git a/test/mjsunit/test-async.js b/test/mjsunit/test-async.js
index f8a11c5..d4fee9b 100644
--- a/test/mjsunit/test-async.js
+++ b/test/mjsunit/test-async.js
@@ -53,7 +53,7 @@
 
     equals(expected, found, name_opt) {
       this.actualAsserts_++;
-      if (expected !== found) {
+      if (!deepEquals(expected, found)) {
         this.fail(prettyPrinted(expected), found, name_opt);
       }
     }