summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/harness/assert_spec.lua
blob: df15a8a05d0c158b35187d8388ae2a235742fb05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local assert = require('test.assert')

describe('test.assert', function()
  it('ignores aliasing differences', function()
    local shared = {}

    assert.eq({ 1, shared, 1, shared }, { 1, {}, 1, {} })
    assert.eq({ 1, {}, 1, {} }, { 1, shared, 1, shared })
  end)

  it('handles cyclic tables', function()
    local expected = {}
    local actual = {}

    expected[1] = expected
    actual[1] = actual

    assert.eq(expected, actual)
  end)

  it('still rejects different structures', function()
    local expected = {}

    expected[1] = expected

    assert.neq(expected, { {} })
  end)
end)