Update web-platform-tests to revision 82b73b315ce7ed1554e7a9b7bced66a5831e4ee5

This commit is contained in:
WPT Sync Bot 2019-08-19 10:23:52 +00:00
parent 00a9f30773
commit 76712d7d25
353 changed files with 6528 additions and 1307 deletions

View file

@ -0,0 +1,7 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
// It may be OK to add more allowed characters here.
export const allowedTestNameCharacters = 'a-zA-Z0-9/_ ';
//# sourceMappingURL=allowed_characters.js.map

View file

@ -0,0 +1,48 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
export function attemptGarbageCollection() {
const w = window;
if (w.GCController) {
w.GCController.collect();
return;
}
if (w.opera && w.opera.collect) {
w.opera.collect();
return;
}
try {
w.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).garbageCollect();
return;
} catch (e) {}
if (w.gc) {
w.gc();
return;
}
if (w.CollectGarbage) {
w.CollectGarbage();
return;
}
let i;
function gcRec(n) {
if (n < 1) return;
let temp = {
i: 'ab' + i + i / 100000
};
temp = temp + 'foo';
gcRec(n - 1);
}
for (i = 0; i < 1000; i++) {
gcRec(10);
}
}
//# sourceMappingURL=collect_garbage.js.map

View file

@ -0,0 +1,105 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// A Fixture is a class used to instantiate each test case at run time.
// A new instance of the Fixture is created for every single test case
// (i.e. every time the test function is run).
export class Fixture {
constructor(rec, params) {
_defineProperty(this, "params", void 0);
_defineProperty(this, "rec", void 0);
_defineProperty(this, "numOutstandingAsyncExpectations", 0);
this.rec = rec;
this.params = params;
} // This has to be a member function instead of an async `createFixture` function, because
// we need to be able to ergonomically override it in subclasses.
async init() {}
log(msg) {
this.rec.log(msg);
}
finalize() {
if (this.numOutstandingAsyncExpectations !== 0) {
throw new Error('there were outstanding asynchronous expectations (e.g. shouldReject) at the end of the test');
}
}
warn(msg) {
this.rec.warn(msg);
}
fail(msg) {
this.rec.fail(msg);
}
ok(msg) {
const m = msg ? ': ' + msg : '';
this.log('OK' + m);
}
async asyncExpectation(fn) {
this.numOutstandingAsyncExpectations++;
await fn();
this.numOutstandingAsyncExpectations--;
}
expectErrorValue(expectedName, ex, m) {
if (!(ex instanceof Error)) {
this.fail('THREW NON-ERROR');
return;
}
const actualName = ex.name;
if (actualName !== expectedName) {
this.fail(`THREW ${actualName} INSTEAD OF ${expectedName}${m}`);
} else {
this.ok(`threw ${actualName}${m}`);
}
}
async shouldReject(expectedName, p, msg) {
this.asyncExpectation(async () => {
const m = msg ? ': ' + msg : '';
try {
await p;
this.fail('DID NOT THROW' + m);
} catch (ex) {
this.expectErrorValue(expectedName, ex, m);
}
});
}
shouldThrow(expectedName, fn, msg) {
const m = msg ? ': ' + msg : '';
try {
fn();
this.fail('DID NOT THROW' + m);
} catch (ex) {
this.expectErrorValue(expectedName, ex, m);
}
}
expect(cond, msg) {
if (cond) {
this.ok(msg);
} else {
this.rec.fail(msg);
}
return cond;
}
}
//# sourceMappingURL=fixture.js.map

View file

@ -0,0 +1,19 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
/// <reference types="@webgpu/types" />
let impl = undefined;
export function getGPU() {
if (impl) {
return impl;
}
if (typeof navigator === 'undefined' || navigator.gpu === undefined) {
throw new Error('No WebGPU implementation found');
}
impl = navigator.gpu;
return impl;
}
//# sourceMappingURL=implementation.js.map

View file

@ -0,0 +1,4 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
//# sourceMappingURL=id.js.map

View file

@ -0,0 +1,9 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
export * from './fixture.js';
export * from './params/index.js';
export * from './test_group.js';
export * from './util/index.js';
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1,4 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
//# sourceMappingURL=listing.js.map

View file

@ -0,0 +1,52 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { loadFilter } from './test_filter/index.js';
function* concat(lists) {
for (const specs of lists) {
yield* specs;
}
}
class DefaultTestFileLoader {
async listing(suite) {
return (await import(`../suites/${suite}/index.js`)).listing;
}
import(path) {
return import('../suites/' + path);
}
}
export class TestLoader {
constructor(fileLoader = new DefaultTestFileLoader()) {
_defineProperty(this, "fileLoader", void 0);
this.fileLoader = fileLoader;
} // TODO: Test
async loadTestsFromQuery(query) {
return this.loadTests(new URLSearchParams(query).getAll('q'));
} // TODO: Test
// TODO: Probably should actually not exist at all, just use queries on cmd line too.
async loadTestsFromCmdLine(filters) {
// In actual URL queries (?q=...), + represents a space. But decodeURIComponent doesn't do this,
// so do it manually. (+ is used over %20 for readability.) (See also encodeSelectively.)
return this.loadTests(filters.map(f => decodeURIComponent(f.replace(/\+/g, '%20'))));
}
async loadTests(filters) {
const loads = filters.map(f => loadFilter(this.fileLoader, f));
return concat((await Promise.all(loads)));
}
}
//# sourceMappingURL=loader.js.map

View file

@ -0,0 +1,121 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { makeQueryString } from './url_query.js';
import { getStackTrace, now } from './util/index.js';
import { version } from './version.js';
export class Logger {
constructor() {
_defineProperty(this, "results", []);
}
record(spec) {
const result = {
spec: makeQueryString(spec),
cases: []
};
this.results.push(result);
return [new TestSpecRecorder(result), result];
}
asJSON(space) {
return JSON.stringify({
version,
results: this.results
}, undefined, space);
}
}
export class TestSpecRecorder {
constructor(result) {
_defineProperty(this, "result", void 0);
this.result = result;
}
record(test, params) {
const result = {
test,
params,
status: 'running',
timems: -1
};
this.result.cases.push(result);
return [new TestCaseRecorder(result), result];
}
}
export class TestCaseRecorder {
constructor(result) {
_defineProperty(this, "result", void 0);
_defineProperty(this, "failed", false);
_defineProperty(this, "warned", false);
_defineProperty(this, "startTime", -1);
_defineProperty(this, "logs", []);
this.result = result;
}
start() {
this.startTime = now();
this.logs = [];
this.failed = false;
this.warned = false;
}
finish() {
if (this.startTime < 0) {
throw new Error('finish() before start()');
}
const endTime = now(); // Round to next microsecond to avoid storing useless .xxxx00000000000002 in results.
this.result.timems = Math.ceil((endTime - this.startTime) * 1000) / 1000;
this.result.status = this.failed ? 'fail' : this.warned ? 'warn' : 'pass';
this.result.logs = this.logs;
}
log(msg) {
this.logs.push(msg);
}
warn(msg) {
this.warned = true;
let m = 'WARN';
if (msg) {
m += ': ' + msg;
}
m += ' ' + getStackTrace(new Error());
this.log(m);
}
fail(msg) {
this.failed = true;
let m = 'FAIL';
if (msg) {
m += ': ' + msg;
}
m += ' ' + getStackTrace(new Error());
this.log(m);
}
threw(e) {
this.failed = true;
let m = 'EXCEPTION';
m += ' ' + getStackTrace(e);
this.log(m);
}
}
//# sourceMappingURL=logger.js.map

View file

@ -0,0 +1,58 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
let _Symbol$iterator;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
export function pcombine(params) {
return new PCombine(params);
}
function merge(a, b) {
for (const key of Object.keys(a)) {
if (b.hasOwnProperty(key)) {
throw new Error('Duplicate key: ' + key);
}
}
return { ...a,
...b
};
}
function* cartesian(iters) {
if (iters.length === 0) {
return;
}
if (iters.length === 1) {
yield* iters[0];
return;
}
const [as, ...rest] = iters;
for (const a of as) {
for (const b of cartesian(rest)) {
yield merge(a, b);
}
}
}
_Symbol$iterator = Symbol.iterator;
class PCombine {
constructor(params) {
_defineProperty(this, "params", void 0);
this.params = params;
}
[_Symbol$iterator]() {
return cartesian(this.params);
}
}
//# sourceMappingURL=combine.js.map

View file

@ -0,0 +1,34 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
let _Symbol$iterator;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { paramsEquals } from './index.js';
export function pexclude(params, exclude) {
return new PExclude(params, exclude);
}
_Symbol$iterator = Symbol.iterator;
class PExclude {
constructor(cases, exclude) {
_defineProperty(this, "cases", void 0);
_defineProperty(this, "exclude", void 0);
this.cases = cases;
this.exclude = Array.from(exclude);
}
*[_Symbol$iterator]() {
for (const p of this.cases) {
if (this.exclude.every(e => !paramsEquals(p, e))) {
yield p;
}
}
}
}
//# sourceMappingURL=exclude.js.map

View file

@ -0,0 +1,33 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
let _Symbol$iterator;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
export function pfilter(cases, pred) {
return new PFilter(cases, pred);
}
_Symbol$iterator = Symbol.iterator;
class PFilter {
constructor(cases, pred) {
_defineProperty(this, "cases", void 0);
_defineProperty(this, "pred", void 0);
this.cases = cases;
this.pred = pred;
}
*[_Symbol$iterator]() {
for (const p of this.cases) {
if (this.pred(p)) {
yield p;
}
}
}
}
//# sourceMappingURL=filter.js.map

View file

@ -0,0 +1,54 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
export * from './combine.js';
export * from './filter.js';
export * from './options.js';
export * from './exclude.js';
export function paramsEquals(x, y) {
if (x === y) {
return true;
}
if (x === null || y === null) {
return false;
}
for (const xk of Object.keys(x)) {
if (!y.hasOwnProperty(xk)) {
return false;
}
if (x[xk] !== y[xk]) {
return false;
}
}
for (const yk of Object.keys(y)) {
if (!x.hasOwnProperty(yk)) {
return false;
}
}
return true;
}
export function paramsSupersets(sup, sub) {
if (sub === null) {
return true;
}
if (sup === null) {
// && sub !== undefined
return false;
}
for (const k of Object.keys(sub)) {
if (!sup.hasOwnProperty(k) || sup[k] !== sub[k]) {
return false;
}
}
return true;
}
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1,36 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
let _Symbol$iterator;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
export function poptions(name, values) {
return new POptions(name, values);
}
export function pbool(name) {
return new POptions(name, [false, true]);
}
_Symbol$iterator = Symbol.iterator;
class POptions {
constructor(name, values) {
_defineProperty(this, "name", void 0);
_defineProperty(this, "values", void 0);
this.name = name;
this.values = values;
}
*[_Symbol$iterator]() {
for (const value of this.values) {
yield {
[this.name]: value
};
}
}
}
//# sourceMappingURL=options.js.map

View file

@ -0,0 +1,49 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
export class FilterByGroup {
constructor(suite, groupPrefix) {
_defineProperty(this, "suite", void 0);
_defineProperty(this, "groupPrefix", void 0);
this.suite = suite;
this.groupPrefix = groupPrefix;
}
matches(spec, testcase) {
throw new Error('unimplemented');
}
async iterate(loader) {
const specs = await loader.listing(this.suite);
const entries = [];
const suite = this.suite;
for (const {
path,
description
} of specs) {
if (path.startsWith(this.groupPrefix)) {
const isReadme = path === '' || path.endsWith('/');
const spec = isReadme ? {
description
} : await loader.import(`${suite}/${path}.spec.js`);
entries.push({
id: {
suite,
path
},
spec
});
}
}
return entries;
}
}
//# sourceMappingURL=filter_by_group.js.map

View file

@ -0,0 +1,102 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { paramsEquals, paramsSupersets } from '../params/index.js';
class FilterOneFile {
constructor(specId) {
_defineProperty(this, "specId", void 0);
this.specId = specId;
}
async iterate(loader) {
const spec = await loader.import(`${this.specId.suite}/${this.specId.path}.spec.js`);
return [{
id: this.specId,
spec: {
description: spec.description,
g: this.getCases(spec)
}
}];
}
}
function filterTestGroup(group, filter) {
return {
*iterate(log) {
for (const rc of group.iterate(log)) {
if (filter(rc.id)) {
yield rc;
}
}
}
};
}
export class FilterByTestMatch extends FilterOneFile {
constructor(specId, testPrefix) {
super(specId);
_defineProperty(this, "testPrefix", void 0);
this.testPrefix = testPrefix;
}
getCases(spec) {
return filterTestGroup(spec.g, testcase => testcase.test.startsWith(this.testPrefix));
}
matches(spec, testcase) {
throw new Error('unimplemented');
}
}
export class FilterByParamsMatch extends FilterOneFile {
constructor(specId, test, params) {
super(specId);
_defineProperty(this, "test", void 0);
_defineProperty(this, "params", void 0);
this.test = test;
this.params = params;
}
getCases(spec) {
return filterTestGroup(spec.g, testcase => testcase.test === this.test && paramsSupersets(testcase.params, this.params));
}
matches(spec, testcase) {
throw new Error('unimplemented');
}
}
export class FilterByParamsExact extends FilterOneFile {
constructor(specId, test, params) {
super(specId);
_defineProperty(this, "test", void 0);
_defineProperty(this, "params", void 0);
this.test = test;
this.params = params;
}
getCases(spec) {
return filterTestGroup(spec.g, testcase => testcase.test === this.test && paramsEquals(testcase.params, this.params));
}
matches(spec, testcase) {
throw new Error('unimplemented');
}
}
//# sourceMappingURL=filter_one_file.js.map

View file

@ -0,0 +1,6 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
export { loadFilter } from './load_filter.js'; // Result of iterating a test filter. Contains a loaded spec (.spec.ts) file and its id.
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1,4 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
//# sourceMappingURL=internal.js.map

View file

@ -0,0 +1,71 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
import { allowedTestNameCharacters } from '../allowed_characters.js';
import { FilterByGroup } from './filter_by_group.js';
import { FilterByParamsExact, FilterByParamsMatch, FilterByTestMatch } from './filter_one_file.js';
// Each filter is of one of the forms below (urlencoded).
export async function loadFilter(loader, filter) {
const i1 = filter.indexOf(':');
if (i1 === -1) {
throw new Error('Test queries must fully specify their suite name (e.g. "cts:")');
}
const suite = filter.substring(0, i1);
const i2 = filter.indexOf(':', i1 + 1);
if (i2 === -1) {
// - cts:
// - cts:buf
// - cts:buffers/
// - cts:buffers/map
const groupPrefix = filter.substring(i1 + 1);
return new FilterByGroup(suite, groupPrefix).iterate(loader);
}
const path = filter.substring(i1 + 1, i2);
const endOfTestName = new RegExp('[^' + allowedTestNameCharacters + ']');
const i3sub = filter.substring(i2 + 1).search(endOfTestName);
if (i3sub === -1) {
// - cts:buffers/mapWriteAsync:
// - cts:buffers/mapWriteAsync:b
const testPrefix = filter.substring(i2 + 1);
return new FilterByTestMatch({
suite,
path
}, testPrefix).iterate(loader);
}
const i3 = i2 + 1 + i3sub;
const test = filter.substring(i2 + 1, i3);
const token = filter.charAt(i3);
let params = null;
if (i3 + 1 < filter.length) {
params = JSON.parse(filter.substring(i3 + 1));
}
if (token === '~') {
// - cts:buffers/mapWriteAsync:basic~
// - cts:buffers/mapWriteAsync:basic~{}
// - cts:buffers/mapWriteAsync:basic~{filter:"params"}
return new FilterByParamsMatch({
suite,
path
}, test, params).iterate(loader);
} else if (token === '=') {
// - cts:buffers/mapWriteAsync:basic=
// - cts:buffers/mapWriteAsync:basic={}
// - cts:buffers/mapWriteAsync:basic={exact:"params"}
return new FilterByParamsExact({
suite,
path
}, test, params).iterate(loader);
} else {
throw new Error("invalid character after test name; must be '~' or '='");
}
}
//# sourceMappingURL=load_filter.js.map

View file

@ -0,0 +1,134 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { allowedTestNameCharacters } from './allowed_characters.js';
import { paramsEquals } from './params/index.js';
const validNames = new RegExp('^[' + allowedTestNameCharacters + ']+$');
export class TestGroup {
constructor(fixture) {
_defineProperty(this, "fixture", void 0);
_defineProperty(this, "seen", new Set());
_defineProperty(this, "tests", []);
this.fixture = fixture;
}
*iterate(log) {
for (const test of this.tests) {
yield* test.iterate(log);
}
}
checkName(name) {
if (!validNames.test(name)) {
throw new Error(`Invalid test name ${name}; must match [${validNames}]+`);
}
if (name !== decodeURIComponent(name)) {
// Shouldn't happen due to the rule above. Just makes sure that treated
// unencoded strings as encoded strings is OK.
throw new Error(`Not decodeURIComponent-idempotent: ${name} !== ${decodeURIComponent(name)}`);
}
if (this.seen.has(name)) {
throw new Error('Duplicate test name');
}
this.seen.add(name);
} // TODO: This could take a fixture, too, to override the one for the group.
test(name, fn) {
this.checkName(name);
const test = new Test(name, this.fixture, fn);
this.tests.push(test);
return test;
}
} // This test is created when it's inserted, but may be parameterized afterward (.params()).
class Test {
constructor(name, fixture, fn) {
_defineProperty(this, "name", void 0);
_defineProperty(this, "fixture", void 0);
_defineProperty(this, "fn", void 0);
_defineProperty(this, "cases", null);
this.name = name;
this.fixture = fixture;
this.fn = fn;
}
params(specs) {
if (this.cases !== null) {
throw new Error('test case is already parameterized');
}
const cases = Array.from(specs);
const seen = []; // This is n^2.
for (const spec of cases) {
if (seen.some(x => paramsEquals(x, spec))) {
throw new Error('Duplicate test case params');
}
seen.push(spec);
}
this.cases = cases;
}
*iterate(rec) {
for (const params of this.cases || [null]) {
yield new RunCaseSpecific(rec, {
test: this.name,
params
}, this.fixture, this.fn);
}
}
}
class RunCaseSpecific {
constructor(recorder, id, fixture, fn) {
_defineProperty(this, "id", void 0);
_defineProperty(this, "recorder", void 0);
_defineProperty(this, "fixture", void 0);
_defineProperty(this, "fn", void 0);
this.recorder = recorder;
this.id = id;
this.fixture = fixture;
this.fn = fn;
}
async run() {
const [rec, res] = this.recorder.record(this.id.test, this.id.params);
rec.start();
try {
const inst = new this.fixture(rec, this.id.params || {});
await inst.init();
await this.fn(inst);
inst.finalize();
} catch (e) {
rec.threw(e);
}
rec.finish();
return res;
}
}
//# sourceMappingURL=test_group.js.map

View file

@ -0,0 +1,32 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
export function encodeSelectively(s) {
let ret = encodeURIComponent(s);
ret = ret.replace(/%20/g, '+'); // Encode space with + (equivalent but more readable)
ret = ret.replace(/%22/g, '"');
ret = ret.replace(/%2C/g, ',');
ret = ret.replace(/%2F/g, '/');
ret = ret.replace(/%3A/g, ':');
ret = ret.replace(/%3D/g, '=');
ret = ret.replace(/%7B/g, '{');
ret = ret.replace(/%7D/g, '}');
return ret;
}
export function makeQueryString(spec, testcase) {
let s = spec.suite + ':';
s += spec.path + ':';
if (testcase !== undefined) {
s += testcase.test + '=';
if (testcase.params) {
s += JSON.stringify(testcase.params);
}
}
return encodeSelectively(s);
}
//# sourceMappingURL=url_query.js.map

View file

@ -0,0 +1,27 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
export * from './stack.js'; // performance.now() is available in all browsers, but not in scope by default in Node.
const perf = typeof performance !== 'undefined' ? performance : require('perf_hooks').performance;
export function now() {
return perf.now();
}
export function objectEquals(x, y) {
if (typeof x !== 'object' || typeof y !== 'object') return x === y;
if (x === null || y === null) return x === y;
if (x.constructor !== y.constructor) return false;
if (x instanceof Function) return x === y;
if (x instanceof RegExp) return x === y;
if (x === y || x.valueOf() === y.valueOf()) return true;
if (Array.isArray(x) && Array.isArray(y) && x.length !== y.length) return false;
if (x instanceof Date) return false;
if (!(x instanceof Object)) return false;
if (!(y instanceof Object)) return false;
const x1 = x;
const y1 = y;
const p = Object.keys(x);
return Object.keys(y).every(i => p.indexOf(i) !== -1) && p.every(i => objectEquals(x1[i], y1[i]));
}
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1,94 @@
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
// Takes a stack trace, and extracts only the first continuous range of lines
// containing '/suites/', which should provide only the useful part of the stack
// to the caller (for logging).
export function getStackTrace(e) {
if (!e.stack) {
return '';
}
const parts = e.stack.split('\n');
const stack = [];
let found = false;
const suitesRegex = /[\/\\]suites[\/\\]/;
for (let i = 0; i < parts.length; ++i) {
const part = parts[i].trim();
const isSuites = suitesRegex.test(part);
if (found && !isSuites) {
break;
}
if (isSuites) {
found = true;
}
stack.push(part);
}
return stack.join('\n');
} // *** Examples ***
//
// Node fail()
// > Error:
// > at CaseRecorder.fail (/Users/kainino/src/cts-experiment/src/framework/logger.ts:99:30)
// > at RunCaseSpecific.exports.g.test.t [as fn] (/Users/kainino/src/cts-experiment/src/suites/unittests/logger.spec.ts:80:7)
// x at RunCaseSpecific.run (/Users/kainino/src/cts-experiment/src/framework/test_group.ts:121:18)
// x at processTicksAndRejections (internal/process/task_queues.js:86:5)
//
// Node throw
// > Error: hello
// > at RunCaseSpecific.g.test.t [as fn] (/Users/kainino/src/cts-experiment/src/suites/unittests/test_group.spec.ts:51:11)
// x at RunCaseSpecific.run (/Users/kainino/src/cts-experiment/src/framework/test_group.ts:121:18)
// x at processTicksAndRejections (internal/process/task_queues.js:86:5)
//
// Firefox fail()
// > fail@http://localhost:8080/out/framework/logger.js:104:30
// > expect@http://localhost:8080/out/framework/default_fixture.js:59:16
// > @http://localhost:8080/out/suites/unittests/util.spec.js:35:5
// x run@http://localhost:8080/out/framework/test_group.js:119:18
//
// Firefox throw
// > @http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11
// x run@http://localhost:8080/out/framework/test_group.js:119:18
//
// Safari fail()
// > fail@http://localhost:8080/out/framework/logger.js:104:39
// > expect@http://localhost:8080/out/framework/default_fixture.js:59:20
// > http://localhost:8080/out/suites/unittests/util.spec.js:35:11
// x http://localhost:8080/out/framework/test_group.js:119:20
// x asyncFunctionResume@[native code]
// x [native code]
// x promiseReactionJob@[native code]
//
// Safari throw
// > http://localhost:8080/out/suites/unittests/test_group.spec.js:48:20
// x http://localhost:8080/out/framework/test_group.js:119:20
// x asyncFunctionResume@[native code]
// x [native code]
// x promiseReactionJob@[native code]
//
// Chrome fail()
// x Error
// x at CaseRecorder.fail (http://localhost:8080/out/framework/logger.js:104:30)
// x at DefaultFixture.expect (http://localhost:8080/out/framework/default_fixture.js:59:16)
// > at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/util.spec.js:35:5)
// x at RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:18)
// x at async runCase (http://localhost:8080/out/runtime/standalone.js:37:17)
// x at async http://localhost:8080/out/runtime/standalone.js:102:7
//
// Chrome throw
// x Error: hello
// > at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11)
// x at RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:18)"
// x at async Promise.all (index 0)
// x at async TestGroupTest.run (http://localhost:8080/out/suites/unittests/test_group_test.js:6:5)
// x at async RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:53:15)
// x at async RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:7)
// x at async runCase (http://localhost:8080/out/runtime/standalone.js:37:17)
// x at async http://localhost:8080/out/runtime/standalone.js:102:7
//# sourceMappingURL=stack.js.map

View file

@ -0,0 +1,3 @@
// AUTO-GENERATED - DO NOT EDIT. See tools/gen_version.
export const version = '84ef21bec576c9272e64e08727dbdf75a2b0e9d8';