From: Wolfgang (Blub) Bumiller Date: Thu, 1 Nov 2012 17:21:53 +0000 (+0100) Subject: Test for entity-field-pointer function parameters X-Git-Tag: 0.1-rc1~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=70f9be0f59bdb7853ca1e9a6b6224c8c68105bf2;p=xonotic%2Fgmqcc.git Test for entity-field-pointer function parameters --- diff --git a/testsuite/Makefile b/testsuite/Makefile index d238455..b132393 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -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 index 0000000..5716ca5 --- /dev/null +++ b/testsuite/field-parameters/expected @@ -0,0 +1 @@ +bar diff --git a/testsuite/field-parameters/main.qc b/testsuite/field-parameters/main.qc new file mode 100644 index 0000000..86a31c6 --- /dev/null +++ b/testsuite/field-parameters/main.qc @@ -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); +};