diff options
| author | James Wright <james@jamesswright.co.uk> | 2019-10-30 00:23:54 +0000 |
|---|---|---|
| committer | Ry Dahl <ry@tinyclouds.org> | 2019-10-29 20:23:54 -0400 |
| commit | 64957d92efdfbb8008e51c9d501b0d6754a777b7 (patch) | |
| tree | adac23650b74a4f07e0def6be36b5ad4f98b9fe5 /std/testing/asserts_test.ts | |
| parent | 8f571ef166d31f44378c1b6de5f4092fcccef732 (diff) | |
Support for deep `Map` equality with `asserts#equal` (#3236)
Diffstat (limited to 'std/testing/asserts_test.ts')
| -rw-r--r-- | std/testing/asserts_test.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts index b480fe7c9..062fac8cc 100644 --- a/std/testing/asserts_test.ts +++ b/std/testing/asserts_test.ts @@ -47,6 +47,42 @@ test(function testingEqual(): void { assert(!equal(new Set([1, 2]), new Set([3, 2, 1]))); assert(!equal(new Set([1, 2, 3]), new Set([4, 5, 6]))); assert(equal(new Set("denosaurus"), new Set("denosaurussss"))); + assert(equal(new Map(), new Map())); + assert( + equal( + new Map([["foo", "bar"], ["baz", "baz"]]), + new Map([["foo", "bar"], ["baz", "baz"]]) + ) + ); + assert( + equal( + new Map([["foo", new Map([["bar", "baz"]])]]), + new Map([["foo", new Map([["bar", "baz"]])]]) + ) + ); + assert( + equal( + new Map([["foo", { bar: "baz" }]]), + new Map([["foo", { bar: "baz" }]]) + ) + ); + assert( + equal( + new Map([["foo", "bar"], ["baz", "qux"]]), + new Map([["baz", "qux"], ["foo", "bar"]]) + ) + ); + assert(equal(new Map([["foo", ["bar"]]]), new Map([["foo", ["bar"]]]))); + assert(!equal(new Map([["foo", "bar"]]), new Map([["bar", "baz"]]))); + assert( + !equal(new Map([["foo", "bar"]]), new Map([["foo", "bar"], ["bar", "baz"]])) + ); + assert( + !equal( + new Map([["foo", new Map([["bar", "baz"]])]]), + new Map([["foo", new Map([["bar", "qux"]])]]) + ) + ); }); test(function testingNotEquals(): void { |
