summary refs log tree commit diff stats
path: root/tests/objects/tobject.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/objects/tobject.nim')
-rw-r--r--tests/objects/tobject.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/objects/tobject.nim b/tests/objects/tobject.nim
new file mode 100644
index 000000000..5fec84441
--- /dev/null
+++ b/tests/objects/tobject.nim
@@ -0,0 +1,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))