summary refs log tree commit diff stats
path: root/tests/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cpp')
-rw-r--r--tests/cpp/tinitializers.nim31
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/cpp/tinitializers.nim b/tests/cpp/tinitializers.nim
index 868cf825c..0199fb96b 100644
--- a/tests/cpp/tinitializers.nim
+++ b/tests/cpp/tinitializers.nim
@@ -1,5 +1,5 @@
 discard """
-  targets: "cpp"
+  cmd: "nim cpp $file"
 """
 
 {.emit:"""/*TYPESECTION*/
@@ -30,4 +30,31 @@ proc main =
   discard returnCppStruct() #generates result = { 10 } 
   discard initChildStruct() #generates ChildStruct temp ({}) bypassed with makeChildStruct
   (proc (s:CppStruct) = discard)(CppStruct()) #CppStruct temp ({10})
-main()
\ No newline at end of file
+main()
+
+
+#Should handle ObjectCalls
+{.emit:"""/*TYPESECTION*/
+struct Foo {
+};
+struct Boo {
+  Boo(int x, char* y, Foo f): x(x), y(y), foo(f){}
+  int x;
+  char* y;
+  Foo foo;
+};
+""".}
+type
+  Foo {.importcpp, inheritable, bycopy.} = object
+  Boo {.importcpp, inheritable.} = object
+    x: int32
+    y: cstring
+    foo: Foo
+
+proc makeBoo(a:cint = 10, b:cstring = "hello", foo: Foo = Foo()): Boo {.importcpp, constructor.}
+
+proc main2() = 
+  let cppStruct = makeBoo()
+  (proc (s:Boo) = discard)(Boo()) 
+
+main2()
\ No newline at end of file