Bug 1729029 - Ensure test fails when feature is off; r=lth

Differential Revision: https://phabricator.services.mozilla.com/D124601
This commit is contained in:
Ms2ger 2021-09-06 09:32:59 +00:00
Родитель 4784b305e2
Коммит fdf6c917ae
2 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -11,12 +11,15 @@
[fail with non-string parameters & results]
expected:
if release_or_beta: FAIL
[fail with non-existant parameter and result type]
[fail with non-existent parameter and result type]
expected:
if release_or_beta: FAIL
[fail with non-function object]
expected:
if release_or_beta: FAIL
[fail to construct with non-callable object]
expected:
if release_or_beta: FAIL
[constructor.tentative.any.html]
[construct with JS function]
expected:
@ -30,12 +33,15 @@
[fail with non-string parameters & results]
expected:
if release_or_beta: FAIL
[fail with non-existant parameter and result type]
[fail with non-existent parameter and result type]
expected:
if release_or_beta: FAIL
[fail with non-function object]
expected:
if release_or_beta: FAIL
[fail to construct with non-callable object]
expected:
if release_or_beta: FAIL
[constructor.tentative.any.js]
[construct with JS function]
expected:
@ -49,9 +55,12 @@
[fail with non-string parameters & results]
expected:
if release_or_beta: FAIL
[fail with non-existant parameter and result type]
[fail with non-existent parameter and result type]
expected:
if release_or_beta: FAIL
[fail with non-function object]
expected:
if release_or_beta: FAIL
[fail to construct with non-callable object]
expected:
if release_or_beta: FAIL

Просмотреть файл

@ -6,30 +6,37 @@ function addxy(x, y) {
}
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
assert_true(fun instanceof WebAssembly.Function)
}, "construct with JS function")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: []}, addxy))
}, "fail with missing results")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({results: []}, addxy))
}, "fail with missing parameters")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: [1], results: [true]}, addxy))
}, "fail with non-string parameters & results")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: ["invalid"], results: ["invalid"]}, addxy))
}, "fail with non-existent parameter and result type")
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: [], results: []}, 72))
}, "fail with non-function object")
test(() => {
test(() => {
assert_implements(WebAssembly.Function, "WebAssembly.Function is not implemented");
assert_throws_js(TypeError, () => new WebAssembly.Function({parameters: [], results: []}, {}))
}, "fail to construct with non-callable object")