aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-05-13 17:44:50 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-05-13 17:44:50 -0700
commitca4120afec54fc20295a4a7d3ce6f8c29eccd84c (patch)
tree6619890c616bde65b3798b28fb99018b1eac71e3 /src/test
parent2eb09c1fec3a11067066602e2d6613e817a06630 (diff)
downloadbun-ca4120afec54fc20295a4a7d3ce6f8c29eccd84c.tar.gz
bun-ca4120afec54fc20295a4a7d3ce6f8c29eccd84c.tar.zst
bun-ca4120afec54fc20295a4a7d3ce6f8c29eccd84c.zip
bug fixes galore
Former-commit-id: 72439452918caa05a32d4e3607910901fa2f4f85
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fixtures/function-args-parse-bug.js20
-rw-r--r--src/test/fixtures/img-bug.js61
-rw-r--r--src/test/fixtures/regexp-validation.js1
-rw-r--r--src/test/fixtures/require-detector.js1
4 files changed, 83 insertions, 0 deletions
diff --git a/src/test/fixtures/function-args-parse-bug.js b/src/test/fixtures/function-args-parse-bug.js
new file mode 100644
index 000000000..79dc5d6e5
--- /dev/null
+++ b/src/test/fixtures/function-args-parse-bug.js
@@ -0,0 +1,20 @@
+"use strict";
+exports.__esModule = true;
+exports.defaultHead = defaultHead;
+exports.default = void 0;
+var _react = _interopRequireWildcard(require("react"));
+var _sideEffect = _interopRequireDefault(require("./side-effect"));
+var _ampContext = require("./amp-context");
+var _headManagerContext = require("./head-manager-context");
+var _amp = require("./amp");
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : { default: obj };
+}
+function _getRequireWildcardCache() {
+ if (typeof WeakMap !== "function") return null;
+ var cache = new WeakMap();
+ _getRequireWildcardCache = function () {
+ return cache;
+ };
+ return cache;
+}
diff --git a/src/test/fixtures/img-bug.js b/src/test/fixtures/img-bug.js
new file mode 100644
index 000000000..207f59a09
--- /dev/null
+++ b/src/test/fixtures/img-bug.js
@@ -0,0 +1,61 @@
+function get() {
+ if (true) {
+ if (true) {
+ if (true) {
+ console.log("HI");
+ if (true) {
+ return { hi: () => true };
+ }
+ }
+ }
+
+ if (true) {
+ if (true) {
+ if (true) {
+ return { hi: () => true };
+ }
+ }
+ }
+ }
+}
+// function getWidths(width, layout, sizes) {
+// if (sizes && (layout === "fill" || layout === "responsive")) {
+// // Find all the "vw" percent sizes used in the sizes prop
+// const percentSizes = [...sizes.matchAll(/(^|\s)(1?\d?\d)vw/g)].map((m) =>
+// parseInt(m[2])
+// );
+// if (percentSizes.length) {
+
+// // const smallestRatio = Math.min(...percentSizes) * 0.01;
+// // return {
+// // widths: allSizes.filter(
+// // (s) => s >= configDeviceSizes[0] * smallestRatio
+// // ),
+// // kind: "w",
+// // };
+// }
+// return { widths: allSizes, kind: "w" };
+// }
+// if (
+// typeof width !== "number" ||
+// layout === "fill" ||
+// layout === "responsive"
+// ) {
+// return { widths: configDeviceSizes, kind: "w" };
+// }
+// // const widths = [
+// // ...new Set( // > This means that most OLED screens that say they are 3x resolution,
+// // // > are actually 3x in the green color, but only 1.5x in the red and
+// // // > blue colors. Showing a 3x resolution image in the app vs a 2x
+// // // > resolution image will be visually the same, though the 3x image
+// // // > takes significantly more data. Even true 3x resolution screens are
+// // // > wasteful as the human eye cannot see that level of detail without
+// // // > something like a magnifying glass.
+// // // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html
+// // [width, width * 2 /*, width * 3*/].map(
+// // (w) => allSizes.find((p) => p >= w) || allSizes[allSizes.length - 1]
+// // )
+// // ),
+// // ];
+// // return { widths, kind: "x" };
+// }
diff --git a/src/test/fixtures/regexp-validation.js b/src/test/fixtures/regexp-validation.js
new file mode 100644
index 000000000..579109c72
--- /dev/null
+++ b/src/test/fixtures/regexp-validation.js
@@ -0,0 +1 @@
+/(^|\s)(1?\d?\d)vw/g.test("hi");
diff --git a/src/test/fixtures/require-detector.js b/src/test/fixtures/require-detector.js
new file mode 100644
index 000000000..c203d8019
--- /dev/null
+++ b/src/test/fixtures/require-detector.js
@@ -0,0 +1 @@
+const foo = require("react");