]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Test for entity-field-pointer function parameters
authorWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 1 Nov 2012 17:21:53 +0000 (18:21 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 1 Nov 2012 17:21:53 +0000 (18:21 +0100)
testsuite/Makefile
testsuite/field-parameters/expected [new file with mode: 0644]
testsuite/field-parameters/main.qc [new file with mode: 0644]

index d238455ceba57af9bcfa197b79f1d3c525f3fffe..b132393bada911cac59e2e85c163e1c3aa7aef91 100644 (file)
@@ -15,7 +15,8 @@ TESTLIST = \
        fields1    \
        invalid-types \
        ngraphs    \
-       invalid-assign
+       invalid-assign \
+       field-parameters
 
 .PHONY: clean test
 
@@ -156,6 +157,11 @@ invalid-assign-ok: obj invalid-assign/main.qc
 
 invalid-assign: invalid-assign-ok
 
+$(eval $(call maketest,field-parameters,qcc))
+field-parameters:
+       @$(VM) $< > $@/output
+       @diff $@/output $@/expected
+
 #######################################################################
 obj:
        mkdir obj
diff --git a/testsuite/field-parameters/expected b/testsuite/field-parameters/expected
new file mode 100644 (file)
index 0000000..5716ca5
--- /dev/null
@@ -0,0 +1 @@
+bar
diff --git a/testsuite/field-parameters/main.qc b/testsuite/field-parameters/main.qc
new file mode 100644 (file)
index 0000000..86a31c6
--- /dev/null
@@ -0,0 +1,17 @@
+void(string, string) print = #1;
+entity()             spawn = #3;
+
+.string a;
+.string b;
+
+void(entity e, .string s) callout = {
+       print(e.s, "\n");
+};
+
+void() main = {
+       local entity e;
+       e = spawn();
+       e.a = "foo";
+       e.b = "bar";
+       callout(e, b);
+};