summary refs log tree commit diff stats
path: root/tests/objects/tobject.nim
blob: 5fec8444174eda5727b25be0ff9eb85d8b13473d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import unittest

type Obj = object
  foo: int

proc makeObj(x: int): Obj = 
  result.foo = x

suite "object basic methods":
  test "it should convert an object to a string":
    var obj = makeObj(1)
    # Should be "obj: (foo: 1)" or similar.
    check($obj == "(foo: 1)")
  test "it should test equality based on fields":
    check(makeObj(1) == makeObj(1))