mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 12:33:47 +08:00
Test resources should act as minimal repro cases: they should be as small and simple as possible, without any unnecessary code that distracts from what’s important. This patch applies that thinking to the existing test resources, with only a few exceptions for 1) descriptive <title>s and 2) the mandatory license headers. This came up during review of [1]. [1]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107525 Change-Id: I1081bb06129d2b6ce98daf1349d20b2bf2fd9401 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116445 Reviewed-by: Changhao Han <changhaohan@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
124 lines
3.1 KiB
HTML
124 lines
3.1 KiB
HTML
<!--
|
|
Copyright 2020 The Chromium Authors. All rights reserved.
|
|
Use of this source code is governed by a BSD-style license that can be
|
|
found in the LICENSE file.
|
|
-->
|
|
<script type="module">
|
|
const regex1 = /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i;
|
|
console.log(regex1);
|
|
|
|
const regex2 = new RegExp("foo\\\\bar\\sbaz", "i");
|
|
console.log(regex2);
|
|
|
|
const error = new Error;
|
|
console.log(error);
|
|
|
|
const errorWithMessage = new Error('My error message');
|
|
console.log(errorWithMessage);
|
|
|
|
const errorWithMultilineMessage = new Error("my multiline\nerror message");
|
|
console.log(errorWithMultilineMessage);
|
|
|
|
const func = function() { return 1; };
|
|
console.log(func);
|
|
|
|
const multilinefunc = function() {
|
|
return 2;
|
|
};
|
|
console.log(multilinefunc);
|
|
|
|
const arrayLikeFunction = function( /**/ foo/**/, /*/**/bar,
|
|
/**/baz) {};
|
|
arrayLikeFunction.splice = function() {};
|
|
console.log(arrayLikeFunction);
|
|
|
|
function generateArguments(foo, bar) {
|
|
return arguments;
|
|
}
|
|
console.log(generateArguments(1, "2"));
|
|
|
|
const tinyTypedArray = new Uint8Array([3]);
|
|
console.log(tinyTypedArray);
|
|
|
|
const smallTypedArray = new Uint8Array(new ArrayBuffer(400));
|
|
smallTypedArray["foo"] = "bar";
|
|
console.log(smallTypedArray);
|
|
|
|
const bigTypedArray = new Uint8Array(new ArrayBuffer(400 * 1000 * 1000));
|
|
bigTypedArray["FAIL"] = "FAIL: Object.getOwnPropertyNames() should not have been run";
|
|
console.log(bigTypedArray);
|
|
|
|
console.log(new Uint16Array([1, 2, 3]));
|
|
|
|
var promise = Promise.reject(-0);
|
|
promise.catch(function() {});
|
|
console.log(promise);
|
|
|
|
const promise2 = Promise.resolve(1);
|
|
console.log(promise2);
|
|
|
|
const promise3 = new Promise(() => {});
|
|
console.log(promise3);
|
|
|
|
const symbol1 = Symbol();
|
|
console.log(symbol1);
|
|
|
|
const symbol2 = Symbol("a");
|
|
console.log(symbol2);
|
|
|
|
const obj = {
|
|
get getter() {}
|
|
};
|
|
obj["a"] = symbol1;
|
|
obj[symbol2] = 2;
|
|
console.log(obj);
|
|
|
|
const map = new Map();
|
|
map.set(obj, {foo: 1});
|
|
console.log(map);
|
|
|
|
const weakMap = new WeakMap();
|
|
weakMap.set(obj, {foo: 1});
|
|
console.log(weakMap);
|
|
|
|
const set = new Set();
|
|
set.add(obj);
|
|
console.log(set);
|
|
|
|
const weakSet = new WeakSet();
|
|
weakSet.add(obj);
|
|
console.log(weakSet);
|
|
|
|
var nestedMap = new Map();
|
|
nestedMap.set(map, weakMap);
|
|
console.log(nestedMap);
|
|
|
|
var nestedMapUniqueValues = new Map();
|
|
nestedMapUniqueValues.set(new Map(), new WeakMap());
|
|
console.log(nestedMapUniqueValues);
|
|
|
|
var nestedSet = new Set();
|
|
nestedSet.add(weakSet);
|
|
console.log(nestedSet);
|
|
|
|
var nestedSetUniqueValues = new Set();
|
|
nestedSetUniqueValues.add(new WeakSet());
|
|
console.log(nestedSetUniqueValues);
|
|
|
|
const bigmap = new Map();
|
|
bigmap.set(" from str ", " to str ");
|
|
bigmap.set(undefined, undefined);
|
|
bigmap.set(null, null);
|
|
bigmap.set(42, 42);
|
|
bigmap.set({foo:"from"}, {foo:"to"});
|
|
bigmap.set(["from"], ["to"]);
|
|
console.log(bigmap);
|
|
|
|
const genFunction = function *() {
|
|
yield 1;
|
|
yield 2;
|
|
}
|
|
const generator = genFunction();
|
|
console.log(generator);
|
|
</script>
|