summaryrefslogtreecommitdiff
path: root/cli/tests/unit/console_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r--cli/tests/unit/console_test.ts65
1 files changed, 65 insertions, 0 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index 39baaf1a3..4601281ff 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -1939,6 +1939,71 @@ Deno.test(function inspectColors() {
assertStringIncludes(Deno.inspect(1, { colors: true }), "\x1b[");
});
+Deno.test(function inspectEmptyArray() {
+ const arr: string[] = [];
+
+ assertEquals(
+ Deno.inspect(arr, {
+ compact: false,
+ trailingComma: true,
+ }),
+ "[\n]",
+ );
+});
+
+Deno.test(function inspectDeepEmptyArray() {
+ const obj = {
+ arr: [],
+ };
+
+ assertEquals(
+ Deno.inspect(obj, {
+ compact: false,
+ trailingComma: true,
+ }),
+ `{
+ arr: [
+ ],
+}`,
+ );
+});
+
+Deno.test(function inspectEmptyMap() {
+ const map = new Map();
+
+ assertEquals(
+ Deno.inspect(map, {
+ compact: false,
+ trailingComma: true,
+ }),
+ "Map {\n}",
+ );
+});
+
+Deno.test(function inspectEmptyMap() {
+ const set = new Set();
+
+ assertEquals(
+ Deno.inspect(set, {
+ compact: false,
+ trailingComma: true,
+ }),
+ "Set {\n}",
+ );
+});
+
+Deno.test(function inspectEmptyMap() {
+ const typedArray = new Uint8Array(0);
+
+ assertEquals(
+ Deno.inspect(typedArray, {
+ compact: false,
+ trailingComma: true,
+ }),
+ "Uint8Array(0) [\n]",
+ );
+});
+
Deno.test(function inspectStringAbbreviation() {
const LONG_STRING =
"This is a really long string which will be abbreviated with ellipsis.";