mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
Use dprint for internal formatting (#6682)
This commit is contained in:
parent
9eca71caa1
commit
cde4dbb351
378 changed files with 3116 additions and 3121 deletions
|
@ -22,7 +22,7 @@ Deno.test({
|
|||
},
|
||||
RangeError,
|
||||
"Invalid typed array length: -1",
|
||||
"should throw on negative numbers"
|
||||
"should throw on negative numbers",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -41,7 +41,7 @@ Deno.test({
|
|||
},
|
||||
TypeError,
|
||||
`The "size" argument must be of type number. Received type ${typeof size}`,
|
||||
"should throw on non-number size"
|
||||
"should throw on non-number size",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ Deno.test({
|
|||
},
|
||||
TypeError,
|
||||
`The argument "value" is invalid. Received ${value.constructor.name} []`,
|
||||
"should throw for empty Buffer/Uint8Array"
|
||||
"should throw for empty Buffer/Uint8Array",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -132,7 +132,7 @@ Deno.test({
|
|||
fn() {
|
||||
assertEquals(
|
||||
Buffer.alloc(11, "aGVsbG8gd29ybGQ=", "base64"),
|
||||
new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])
|
||||
new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -142,7 +142,7 @@ Deno.test({
|
|||
fn() {
|
||||
assertEquals(
|
||||
Buffer.alloc(4, "64656e6f", "hex"),
|
||||
new Uint8Array([100, 101, 110, 111])
|
||||
new Uint8Array([100, 101, 110, 111]),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -152,7 +152,7 @@ Deno.test({
|
|||
fn() {
|
||||
assertEquals(
|
||||
Buffer.alloc(13, "64656e6f", "hex").toString(),
|
||||
"denodenodenod"
|
||||
"denodenodenod",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -162,11 +162,11 @@ Deno.test({
|
|||
fn() {
|
||||
assertEquals(
|
||||
Buffer.alloc(7, new Uint8Array([100, 101])),
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101, 100])
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101, 100]),
|
||||
);
|
||||
assertEquals(
|
||||
Buffer.alloc(6, new Uint8Array([100, 101])),
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101])
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101]),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -176,7 +176,7 @@ Deno.test({
|
|||
fn() {
|
||||
assertEquals(
|
||||
Buffer.alloc(1, new Uint8Array([100, 101])),
|
||||
new Uint8Array([100])
|
||||
new Uint8Array([100]),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -186,11 +186,11 @@ Deno.test({
|
|||
fn() {
|
||||
assertEquals(
|
||||
Buffer.alloc(6, new Buffer([100, 101])),
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101])
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101]),
|
||||
);
|
||||
assertEquals(
|
||||
Buffer.alloc(7, new Buffer([100, 101])),
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101, 100])
|
||||
new Uint8Array([100, 101, 100, 101, 100, 101, 100]),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -224,7 +224,7 @@ Deno.test({
|
|||
assertEquals(Buffer.byteLength("aGkk", "base64"), 3);
|
||||
assertEquals(
|
||||
Buffer.byteLength("bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==", "base64"),
|
||||
25
|
||||
25,
|
||||
);
|
||||
// special padding
|
||||
assertEquals(Buffer.byteLength("aaa=", "base64"), 2);
|
||||
|
@ -253,7 +253,7 @@ Deno.test({
|
|||
assertEquals(
|
||||
Buffer.byteLength(Buffer.alloc(0)),
|
||||
Buffer.alloc(0).byteLength,
|
||||
"Byte lenght differs on buffers"
|
||||
"Byte lenght differs on buffers",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -306,7 +306,7 @@ Deno.test({
|
|||
},
|
||||
RangeError,
|
||||
"offset is out of bounds",
|
||||
"should throw on negative numbers"
|
||||
"should throw on negative numbers",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -319,7 +319,7 @@ Deno.test({
|
|||
assertEquals(
|
||||
buffer.toString(),
|
||||
"test",
|
||||
"Buffer to string should recover the string"
|
||||
"Buffer to string should recover the string",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -330,13 +330,13 @@ Deno.test({
|
|||
for (const encoding of ["hex", "HEX"]) {
|
||||
const buffer: Buffer = Buffer.from(
|
||||
"7468697320697320612074c3a97374",
|
||||
encoding
|
||||
encoding,
|
||||
);
|
||||
assertEquals(buffer.length, 15, "Buffer length should be 15");
|
||||
assertEquals(
|
||||
buffer.toString(),
|
||||
"this is a tést",
|
||||
"Buffer to string should recover the string"
|
||||
"Buffer to string should recover the string",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -351,7 +351,7 @@ Deno.test({
|
|||
assertEquals(
|
||||
buffer.toString(),
|
||||
"this is a tést",
|
||||
"Buffer to string should recover the string"
|
||||
"Buffer to string should recover the string",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -365,7 +365,7 @@ Deno.test({
|
|||
assertEquals(
|
||||
buffer.toString(encoding),
|
||||
"ZGVubyBsYW5k",
|
||||
"Buffer to string should recover the string in base64"
|
||||
"Buffer to string should recover the string in base64",
|
||||
);
|
||||
}
|
||||
const b64 = "dGhpcyBpcyBhIHTDqXN0";
|
||||
|
@ -381,7 +381,7 @@ Deno.test({
|
|||
assertEquals(
|
||||
buffer.toString(encoding),
|
||||
"64656e6f206c616e64",
|
||||
"Buffer to string should recover the string"
|
||||
"Buffer to string should recover the string",
|
||||
);
|
||||
}
|
||||
const hex = "64656e6f206c616e64";
|
||||
|
@ -404,7 +404,7 @@ Deno.test({
|
|||
},
|
||||
TypeError,
|
||||
`Unkown encoding: ${encoding}`,
|
||||
"Should throw on invalid encoding"
|
||||
"Should throw on invalid encoding",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -430,7 +430,7 @@ Deno.test({
|
|||
Buffer.from("yes", encoding);
|
||||
},
|
||||
TypeError,
|
||||
`Unkown encoding: ${encoding}`
|
||||
`Unkown encoding: ${encoding}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -451,7 +451,7 @@ Deno.test({
|
|||
},
|
||||
Error,
|
||||
`"${encoding}" encoding`,
|
||||
"Should throw on invalid encoding"
|
||||
"Should throw on invalid encoding",
|
||||
);
|
||||
|
||||
assertThrows(
|
||||
|
@ -462,7 +462,7 @@ Deno.test({
|
|||
},
|
||||
Error,
|
||||
`"${encoding}" encoding`,
|
||||
"Should throw on invalid encoding"
|
||||
"Should throw on invalid encoding",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -476,7 +476,7 @@ Deno.test({
|
|||
assertEquals(
|
||||
buffer.toString(),
|
||||
"test",
|
||||
"Buffer to string should recover the string"
|
||||
"Buffer to string should recover the string",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -501,7 +501,7 @@ Deno.test({
|
|||
fn() {
|
||||
assertEquals(
|
||||
JSON.stringify(Buffer.from("deno")),
|
||||
'{"type":"Buffer","data":[100,101,110,111]}'
|
||||
'{"type":"Buffer","data":[100,101,110,111]}',
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -578,7 +578,7 @@ Deno.test({
|
|||
assertEquals(d.equals(d), true);
|
||||
assertEquals(
|
||||
d.equals(new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65])),
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
assertEquals(c.equals(d), false);
|
||||
|
@ -589,7 +589,7 @@ Deno.test({
|
|||
// @ts-ignore
|
||||
() => Buffer.alloc(1).equals("abc"),
|
||||
TypeError,
|
||||
`The "otherBuffer" argument must be an instance of Buffer or Uint8Array. Received type string`
|
||||
`The "otherBuffer" argument must be an instance of Buffer or Uint8Array. Received type string`,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue