-
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.
This CL imports post-#176 upstream reference implementation's tests into wpt/import-maps/imported/, and executes them under virtual/import-maps-without-builtin-modules/. The pre-#176 existing tests are still left under wpt/import-maps/builtin-support.tentative/imported/, which are excluded by this CL from virtual/import-maps-without-builtin-modules. To match with the expectation of post-#176 tests, this CL modifies ImportMap::ToString() to output strings (not single-element arrays) as right hand side. WICG/import-maps#176 Bug: 990561, 1010751 Change-Id: I652b35969d48e0147d07aa869ca3a97004f2f7a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1842928 Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Cr-Commit-Position: refs/heads/master@{#706637}
- Loading branch information
1 parent
7c94080
commit 551f731
Showing
23 changed files
with
1,534 additions
and
388 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
import-maps/builtin-support.tentative/imported/parsing-addresses.tentative.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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../../resources/jest-test-helper.js"></script> | ||
<script type="module" src="resources/helpers/parsing.js"></script> | ||
|
||
<!-- | ||
Imported from https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/parsing-addresses.js | ||
--> | ||
<script type="module" src="resources/parsing-addresses.js"></script> |
11 changes: 11 additions & 0 deletions
11
import-maps/builtin-support.tentative/imported/parsing-schema.tentative.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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../../resources/jest-test-helper.js"></script> | ||
<script type="module" src="resources/helpers/parsing.js"></script> | ||
|
||
<!-- | ||
Imported from https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/parsing-schema.js | ||
--> | ||
<script type="module" src="resources/parsing-schema.js"></script> |
11 changes: 11 additions & 0 deletions
11
import-maps/builtin-support.tentative/imported/parsing-scope-keys.tentative.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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../../resources/jest-test-helper.js"></script> | ||
<script type="module" src="resources/helpers/parsing.js"></script> | ||
|
||
<!-- | ||
Imported from https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/parsing-scope-keys.js | ||
--> | ||
<script type="module" src="resources/parsing-scope-keys.js"></script> |
11 changes: 11 additions & 0 deletions
11
import-maps/builtin-support.tentative/imported/parsing-specifier-keys.tentative.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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../../resources/jest-test-helper.js"></script> | ||
<script type="module" src="resources/helpers/parsing.js"></script> | ||
|
||
<!-- | ||
Imported from https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/parsing-specifier-keys.js | ||
--> | ||
<script type="module" src="resources/parsing-specifier-keys.js"></script> |
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
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
11 changes: 11 additions & 0 deletions
11
import-maps/builtin-support.tentative/imported/resolving-scopes.tentative.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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../../resources/jest-test-helper.js"></script> | ||
<script type="module" src="resources/helpers/parsing.js"></script> | ||
|
||
<!-- | ||
Imported from https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/resolving-scopes.js | ||
--> | ||
<script type="module" src="resources/resolving-scopes.js"></script> |
11 changes: 11 additions & 0 deletions
11
import-maps/builtin-support.tentative/imported/resolving.tentative.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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../../resources/jest-test-helper.js"></script> | ||
<script type="module" src="resources/helpers/parsing.js"></script> | ||
|
||
<!-- | ||
Imported from https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/resolving.js | ||
--> | ||
<script type="module" src="resources/resolving.js"></script> |
44 changes: 44 additions & 0 deletions
44
import-maps/builtin-support.tentative/imported/resources/helpers/parsing.js
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,44 @@ | ||
'use strict'; | ||
const { parseFromString } = require('../../lib/parser.js'); | ||
|
||
// Local modifications from upstream: | ||
// Currently warnings and scopes are not checked in expectSpecifierMap(). | ||
exports.expectSpecifierMap = (input, baseURL, output, warnings = []) => { | ||
expect(parseFromString(`{ "imports": ${input} }`, baseURL)) | ||
.toEqual({ imports: output, scopes: {} }); | ||
}; | ||
|
||
exports.expectScopes = (inputArray, baseURL, outputArray, warnings = []) => { | ||
const checkWarnings = testWarningHandler(warnings); | ||
|
||
const inputScopesAsStrings = inputArray.map(scopePrefix => `${JSON.stringify(scopePrefix)}: {}`); | ||
const inputString = `{ "scopes": { ${inputScopesAsStrings.join(', ')} } }`; | ||
|
||
const outputScopesObject = {}; | ||
for (const outputScopePrefix of outputArray) { | ||
outputScopesObject[outputScopePrefix] = {}; | ||
} | ||
|
||
expect(parseFromString(inputString, baseURL)).toEqual({ imports: {}, scopes: outputScopesObject }); | ||
|
||
checkWarnings(); | ||
}; | ||
|
||
exports.expectBad = (input, baseURL, warnings = []) => { | ||
const checkWarnings = testWarningHandler(warnings); | ||
expect(() => parseFromString(input, baseURL)).toThrow(TypeError); | ||
checkWarnings(); | ||
}; | ||
|
||
exports.expectWarnings = (input, baseURL, output, warnings = []) => { | ||
const checkWarnings = testWarningHandler(warnings); | ||
expect(parseFromString(input, baseURL)).toEqual(output); | ||
|
||
checkWarnings(); | ||
}; | ||
|
||
function testWarningHandler(expectedWarnings) { | ||
// We don't check warnings on WPT tests, because there are no | ||
// ways to catch console warnings from JavaScript. | ||
return () => {}; | ||
} |
Oops, something went wrong.