-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce IdlInterfaceMember#toString to improve test names. (#13142)
This deduplicates some code, and improves the output. This ensures that unions and generics don't show up as [object Object], and it makes the output for other arguments more accurate.
- Loading branch information
Showing
2 changed files
with
73 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
resources/test/tests/unit/IdlInterfaceMember/toString.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>IdlInterfaceMember.prototype.toString()</title> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/WebIDLParser.js"></script> | ||
<script src="/resources/idlharness.js"></script> | ||
<script src="../../../idl-helper.js"></script> | ||
<script> | ||
"use strict"; | ||
const tests = [ | ||
["long x", "long"], | ||
["long? x", "long?"], | ||
["Promise<long> x", "Promise<long>"], | ||
["Promise<long?> x", "Promise<long?>"], | ||
["sequence<long> x", "sequence<long>"], | ||
["(long or DOMString) x", "(long or DOMString)"], | ||
["long x, boolean y", "long, boolean"], | ||
["long x, optional boolean y", "long, optional boolean"], | ||
["long... args", "long..."], | ||
["sequence<long>... args", "sequence<long>..."], | ||
["(long or DOMString)... args", "(long or DOMString)..."], | ||
]; | ||
for (const [input, output] of tests) { | ||
test(function() { | ||
var m = memberFrom(`void foo(${input})`); | ||
assert_equals(m.toString(), `foo(${output})`); | ||
}, `toString for ${input}`); | ||
} | ||
</script> | ||
</body> | ||
</html> |