Changeset 219969 in webkit


Ignore:
Timestamp:
Jul 26, 2017 4:29:25 PM (7 years ago)
Author:
jfbastien@apple.com
Message:

WebAssembly: test throwing out of the start function
https://bugs.webkit.org/show_bug.cgi?id=165714
<rdar://problem/29760251>

Reviewed by Keith Miller.

  • wasm/assert.js:
  • wasm/function-tests/trap-from-start.js: Added.

(StartTraps):

  • wasm/function-tests/trap-from-start-async.js: Added.

(async.StartTrapsAsync):

Location:
trunk/JSTests
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r219727 r219969  
     12017-07-26  JF Bastien  <jfbastien@apple.com>
     2
     3        WebAssembly: test throwing out of the start function
     4        https://bugs.webkit.org/show_bug.cgi?id=165714
     5        <rdar://problem/29760251>
     6
     7        Reviewed by Keith Miller.
     8
     9        * wasm/assert.js:
     10        * wasm/function-tests/trap-from-start.js: Added.
     11        (StartTraps):
     12        * wasm/function-tests/trap-from-start-async.js: Added.
     13        (async.StartTrapsAsync):
     14
    1152017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
    216
  • trunk/JSTests/wasm/assert.js

    r214547 r219969  
    136136};
    137137
     138export async function throwsAsync(promise, type, message) {
     139    try {
     140        await promise;
     141    } catch (e) {
     142        if (e instanceof type) {
     143            if (e.message === message)
     144                return e;
     145            // Ignore source information at the end of the error message if the
     146            // expected message didn't specify that information. Sometimes it
     147            // changes, or it's tricky to get just right.
     148            const evaluatingIndex = e.message.indexOf(" (evaluating '");
     149            if (evaluatingIndex !== -1) {
     150                const cleanMessage = e.message.substring(0, evaluatingIndex);
     151                if (cleanMessage === message)
     152                    return e;
     153            }
     154        }
     155        _fail(`Expected to throw a ${type.name} with message "${message}", got ${e.name} with message "${e.message}"`);
     156    }
     157    _fail(`Expected to throw a ${type.name} with message "${message}"`);
     158}
     159
    138160const _instanceof = (obj, type, msg) => {
    139161    if (!(obj instanceof type))
Note: See TracChangeset for help on using the changeset viewer.