diff options
Diffstat (limited to 'js/src/jit-test/tests/modules/requested-modules.js')
-rw-r--r-- | js/src/jit-test/tests/modules/requested-modules.js | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/js/src/jit-test/tests/modules/requested-modules.js b/js/src/jit-test/tests/modules/requested-modules.js index ebbf8ce6c1..e0a7fb66b8 100644 --- a/js/src/jit-test/tests/modules/requested-modules.js +++ b/js/src/jit-test/tests/modules/requested-modules.js @@ -1,4 +1,4 @@ -// |jit-test| --enable-import-assertions +// |jit-test| --enable-import-attributes // Test requestedModules property @@ -8,15 +8,16 @@ function testRequestedModules(source, expected) { assertEq(actual.length, expected.length); for (var i = 0; i < actual.length; i++) { assertEq(actual[i].moduleRequest.specifier, expected[i].specifier); - if(expected[i].assertions === null) { - assertEq(actual[i].moduleRequest.assertions, null); + if(expected[i].attributes === null) { + assertEq(actual[i].moduleRequest.attributes, null); } else { - var expectedAssertions = expected[i].assertions; - var actualAssertions = actual[i].moduleRequest.assertions; - assertEq(actualAssertions.length, expectedAssertions.length); - for (var j = 0; j < expectedAssertions.length; j++) { - assertEq(expectedAssertions[j].type, actualAssertions[j].type); + var expectedAttributes = expected[i].attributes; + var actualAttributes = actual[i].moduleRequest.attributes; + assertEq(actualAttributes.length, expectedAttributes.length); + for (var j = 0; j < expectedAttributes.length; j++) { + assertEq(expectedAttributes[j]['key'], actualAttributes[j]['key']); + assertEq(expectedAttributes[j]['value'], actualAttributes[j]['value']); } } } @@ -25,71 +26,71 @@ function testRequestedModules(source, expected) { testRequestedModules("", []); testRequestedModules("import a from 'foo'", [ - { specifier: 'foo', assertions: null } + { specifier: 'foo', attributes: null } ]); testRequestedModules("import a from 'foo'; import b from 'bar'", [ - { specifier: 'foo', assertions: null }, - { specifier: 'bar', assertions: null } + { specifier: 'foo', attributes: null }, + { specifier: 'bar', attributes: null } ]); testRequestedModules("import a from 'foo'; import b from 'bar'; import c from 'foo'", [ - { specifier: 'foo', assertions: null }, - { specifier: 'bar', assertions: null } + { specifier: 'foo', attributes: null }, + { specifier: 'bar', attributes: null } ]); testRequestedModules("export {} from 'foo'", [ - { specifier: 'foo', assertions: null } + { specifier: 'foo', attributes: null } ]); testRequestedModules("export * from 'bar'",[ - { specifier: 'bar', assertions: null } + { specifier: 'bar', attributes: null } ]); testRequestedModules("import a from 'foo'; export {} from 'bar'; export * from 'baz'", [ - { specifier: 'foo', assertions: null }, - { specifier: 'bar', assertions: null }, - { specifier: 'baz', assertions: null } + { specifier: 'foo', attributes: null }, + { specifier: 'bar', attributes: null }, + { specifier: 'baz', attributes: null } ]); if (getRealmConfiguration("importAttributes")) { - testRequestedModules("import a from 'foo' assert {}", [ - { specifier: 'foo', assertions: null }, + testRequestedModules("import a from 'foo' with {}", [ + { specifier: 'foo', attributes: null }, ]); - testRequestedModules("import a from 'foo' assert { type: 'js'}", [ - { specifier: 'foo', assertions: [ { type: 'js' } ] }, + testRequestedModules("import a from 'foo' with { type: 'js'}", [ + { specifier: 'foo', attributes: [ { key: 'type', value: 'js'} ] }, ]); - testRequestedModules("import a from 'foo' assert { unsupported: 'test'}", [ - { specifier: 'foo', assertions: null }, + testRequestedModules("import a from 'foo' with { unsupported: 'test'}", [ + { specifier: 'foo', attributes: [ { key: 'unsupported', value: 'test'} ] }, ]); - testRequestedModules("import a from 'foo' assert { unsupported: 'test', type: 'js', foo: 'bar' }", [ - { specifier: 'foo', assertions: [ { type: 'js' } ] }, + testRequestedModules("import a from 'foo' with { unsupported: 'test', type: 'js', foo: 'bar' }", [ + { specifier: 'foo', attributes: [ { key: 'unsupported', value: 'test'}, { key: 'type', value: 'js'}, { key: 'foo', value: 'bar'} ] }, ]); - testRequestedModules("import a from 'foo' assert { type: 'js1'}; export {} from 'bar' assert { type: 'js2'}; export * from 'baz' assert { type: 'js3'}", [ - { specifier: 'foo', assertions: [ { type: 'js1' } ] }, - { specifier: 'bar', assertions: [ { type: 'js2' } ] }, - { specifier: 'baz', assertions: [ { type: 'js3' } ] } + testRequestedModules("import a from 'foo' with { type: 'js1'}; export {} from 'bar' with { type: 'js2'}; export * from 'baz' with { type: 'js3'}", [ + { specifier: 'foo', attributes: [ { key: 'type', value: 'js1'} ] }, + { specifier: 'bar', attributes: [ { key: 'type', value: 'js2'} ] }, + { specifier: 'baz', attributes: [ { key: 'type', value: 'js3'} ] } ]); - testRequestedModules("export {} from 'foo' assert { type: 'js'}", [ - { specifier: 'foo', assertions: [ { type: 'js' } ] } + testRequestedModules("export {} from 'foo' with { type: 'js'}", [ + { specifier: 'foo', attributes: [ { key: 'type', value: 'js'} ] } ]); - testRequestedModules("export * from 'bar' assert { type: 'json'}",[ - { specifier: 'bar', assertions: [ { type: 'json' } ] } + testRequestedModules("export * from 'bar' with { type: 'json'}",[ + { specifier: 'bar', attributes: [ { key: 'type', value: 'json'} ] } ]); - testRequestedModules("import a from 'foo'; import b from 'bar' assert { type: 'json' };", [ - { specifier: 'foo', assertions: null }, - { specifier: 'bar', assertions: [ { type: 'json' } ] }, + testRequestedModules("import a from 'foo'; import b from 'bar' with { type: 'json' };", [ + { specifier: 'foo', attributes: null }, + { specifier: 'bar', attributes: [ { key: 'type', value: 'json'} ] }, ]); - testRequestedModules("import b from 'bar' assert { type: 'json' }; import a from 'foo';", [ - { specifier: 'bar', assertions: [ { type: 'json' } ] }, - { specifier: 'foo', assertions: null }, + testRequestedModules("import b from 'bar' with { type: 'json' }; import a from 'foo';", [ + { specifier: 'bar', attributes: [ { key: 'type', value: 'json'} ] }, + { specifier: 'foo', attributes: null }, ]); } |