mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +00:00
add more test types
This commit is contained in:
@@ -2292,7 +2292,7 @@ JSC_DEFINE_HOST_FUNCTION(constructJSBuffer, (JSC::JSGlobalObject * lexicalGlobal
|
||||
return {};
|
||||
}
|
||||
return JSBuffer__bufferFromLength(lexicalGlobalObject, length);
|
||||
} else if (distinguishingArg.isUndefinedOrNull()) {
|
||||
} else if (distinguishingArg.isUndefinedOrNull() || distinguishingArg.isBoolean()) {
|
||||
auto arg_string = distinguishingArg.toWTFString(globalObject);
|
||||
auto message = makeString("The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received "_s, arg_string);
|
||||
throwTypeError(lexicalGlobalObject, throwScope, message);
|
||||
|
||||
@@ -2758,7 +2758,7 @@ it("new Buffer.from()", () => {
|
||||
|
||||
describe("fuzzing constructors with new", () => {
|
||||
const zeroArray = new Uint32Array(10).fill(0);
|
||||
const sizes = [1e20, 0, 0.1, -1, "a", undefined, null, NaN, 5n, Symbol("xyz")];
|
||||
const sizes = [1e20, 0, 0.1, -1, "a", undefined, null, NaN, 5n, Symbol("xyz"), true, () => {}, {}];
|
||||
const allocators = [Buffer, SlowBuffer, Buffer.alloc, Buffer.allocUnsafe, Buffer.allocUnsafeSlow];
|
||||
for (const allocator of allocators) {
|
||||
for (const size of sizes) {
|
||||
@@ -2776,7 +2776,7 @@ describe("fuzzing constructors with new", () => {
|
||||
|
||||
describe("fuzzing constructors with call", () => {
|
||||
const zeroArray = new Uint32Array(10).fill(0);
|
||||
const sizes = [1e20, 0, 0.1, -1, "a", undefined, null, NaN, 5n, Symbol("xyz")];
|
||||
const sizes = [1e20, 0, 0.1, -1, "a", undefined, null, NaN, 5n, Symbol("xyz"), true, () => {}, {}];
|
||||
const allocators = [Buffer, SlowBuffer, Buffer.alloc, Buffer.allocUnsafe, Buffer.allocUnsafeSlow];
|
||||
for (const allocator of allocators) {
|
||||
for (const size of sizes) {
|
||||
|
||||
Reference in New Issue
Block a user