Skip to content

Commit

Permalink
Add simple tests for object, list and map equality
Browse files Browse the repository at this point in the history
  • Loading branch information
rrthomas committed Aug 21, 2024
1 parent bc13342 commit 7724bb0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ursa/basics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ testGroup('Lists', [
['[1, 2].push(3).len()', 3],
['[1, 2, 3].get(1)', 2],
['let l = [1, 2, 3]; l.set(1, 4); l', [1, 4, 3]],
['let x = []; x == x', true],
])

testGroup('Objects', [
['Object {;}', {}],
['let x = {;}; x == x', true],
['ABC {a = 1; b = 2; c=3}', {a: 1, b: 2, c: 3}],
['let o = ABC {a = 1; b = 2}; o.b := 3; o', {a: 1, b: 3}],
])
Expand All @@ -180,6 +182,7 @@ Invalid property`)

testGroup('Maps', [
['{}', new Map<unknown, unknown>()],
['let x = {}; x == x', true],
['{"a": 1, "b": 2 + 0, 3: 4}', new Map<unknown, unknown>([['a', 1], ['b', 2], [3, 4]])],
['let t = {"a": 1, "b": 2 + 0, 3: 4}; t.set("b", 1); t', new Map<unknown, unknown>([['a', 1], ['b', 1], [3, 4]])],
])

0 comments on commit 7724bb0

Please sign in to comment.