summaryrefslogtreecommitdiff
path: root/js/unit_tests.ts
diff options
context:
space:
mode:
authorAaron Power <theaaronepower@gmail.com>2018-08-27 16:46:00 +0100
committerRyan Dahl <ry@tinyclouds.org>2018-08-27 13:45:29 -0400
commit0f1db89aa664fe05efae2136d7456465403df30f (patch)
treeb545c169b97d1d0e456394fbb988b90d785be197 /js/unit_tests.ts
parent224cfc8c74133a6b4fe6c9e96a90925ebaf066aa (diff)
Fixed printing strings in arrays & objects without quotes
Diffstat (limited to 'js/unit_tests.ts')
-rw-r--r--js/unit_tests.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/js/unit_tests.ts b/js/unit_tests.ts
index 6eebf8860..48b7e6bb3 100644
--- a/js/unit_tests.ts
+++ b/js/unit_tests.ts
@@ -5,6 +5,7 @@
import { test, assert, assertEqual } from "./testing/testing.ts";
import { readFileSync } from "deno";
+import { stringify } from "./console.ts";
import * as deno from "deno";
import "./compiler_test.ts";
@@ -25,6 +26,14 @@ test(function tests_console_assert() {
assertEqual(hasThrown, true);
});
+test(function tests_console_stringify_complex_objects() {
+ // tslint:disable:no-any
+ assertEqual("foo", stringify(new Set<any>(), "foo"));
+ assertEqual(`[ "foo", "bar" ]`, stringify(new Set<any>(), ["foo", "bar"]));
+ assertEqual(`{ foo: "bar" }`, stringify(new Set<any>(), { foo: "bar" }));
+ // tslint:enable:no-any
+});
+
test(function tests_console_stringify_circular() {
class Base {
a = 1;