tobject.nim 414 B

1234567891011121314151617181920
  1. discard """
  2. output: "[Suite] object basic methods"
  3. """
  4. import unittest
  5. type Obj = object
  6. foo: int
  7. proc makeObj(x: int): Obj =
  8. result.foo = x
  9. suite "object basic methods":
  10. test "it should convert an object to a string":
  11. var obj = makeObj(1)
  12. # Should be "obj: (foo: 1)" or similar.
  13. check($obj == "(foo: 1)")
  14. test "it should test equality based on fields":
  15. check(makeObj(1) == makeObj(1))