mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
### What does this PR do? - fixes both functions returning false for double-encoded values (even if the numeric value is a valid int32/uint32) - fixes IsUint32() returning false for values that don't fit in int32 - fixes the test from #22462 not testing anything (the native functions were being passed a callback to run garbage collection as the first argument, so it was only ever testing what the type check APIs returned for that function) - extends the test to cover the first edge case above ### How did you verify your code works? The new tests fail without these fixes. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
21 lines
589 B
JavaScript
21 lines
589 B
JavaScript
"use strict";
|
|
// usage: bun/node main.js <name of test function to run> [JSON array of arguments] [JSON `this` value] [debug]
|
|
|
|
const buildMode = process.argv[5];
|
|
|
|
const tests = require("./module")(buildMode === "debug");
|
|
|
|
const testName = process.argv[2];
|
|
const args = eval(process.argv[3] ?? "[]");
|
|
const thisValue = JSON.parse(process.argv[4] ?? "null");
|
|
|
|
const fn = tests[testName];
|
|
if (typeof fn !== "function") {
|
|
throw new Error("Unknown test:", testName);
|
|
}
|
|
const result = fn.apply(thisValue, [...args]);
|
|
if (result) {
|
|
console.log(result == global);
|
|
throw new Error(result);
|
|
}
|