added tests for == and $
This commit is contained in:
parent
45c9975e9c
commit
7fc9dfcb24
1 changed files with 20 additions and 0 deletions
20
tests/run/tobject.nim
Normal file
20
tests/run/tobject.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
type Obj = object
|
||||||
|
foo: int
|
||||||
|
|
||||||
|
proc makeObj(x: int): ref Obj =
|
||||||
|
new(result)
|
||||||
|
result.foo = x
|
||||||
|
|
||||||
|
proc initObject(x: int): Obj =
|
||||||
|
result.foo = x
|
||||||
|
|
||||||
|
suite "object basic methods":
|
||||||
|
test "it should convert an objcet to a string":
|
||||||
|
var obj = makeObj(1)
|
||||||
|
discard $obj
|
||||||
|
test "it should test equality based on fields":
|
||||||
|
check(initObj(1) == initObj(1))
|
||||||
|
test "it should test equality based on fields for refs too":
|
||||||
|
check(makeObj(1) == makeObj(1))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue