From: Wolfgang (Blub) Bumiller Date: Thu, 1 Nov 2012 17:24:48 +0000 (+0100) Subject: functions-as-parameters testcase X-Git-Tag: 0.1-rc1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9cf696e0fae66030aa82a7107294c68a93682f07;p=xonotic%2Fgmqcc.git functions-as-parameters testcase --- diff --git a/testsuite/Makefile b/testsuite/Makefile index b132393..e902e55 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -16,7 +16,8 @@ TESTLIST = \ invalid-types \ ngraphs \ invalid-assign \ - field-parameters + field-parameters \ + functions-as-parameters .PHONY: clean test @@ -162,6 +163,11 @@ field-parameters: @$(VM) $< > $@/output @diff $@/output $@/expected +$(eval $(call maketest,functions-as-parameters,qcc)) +functions-as-parameters: + @$(VM) $< > $@/output + @diff $@/output $@/expected + ####################################################################### obj: mkdir obj diff --git a/testsuite/functions-as-parameters/expected b/testsuite/functions-as-parameters/expected new file mode 100644 index 0000000..818e321 --- /dev/null +++ b/testsuite/functions-as-parameters/expected @@ -0,0 +1 @@ +correct diff --git a/testsuite/functions-as-parameters/main.qc b/testsuite/functions-as-parameters/main.qc new file mode 100644 index 0000000..7790e64 --- /dev/null +++ b/testsuite/functions-as-parameters/main.qc @@ -0,0 +1,13 @@ +void(string, string) print = #1; + +string() getter = { + return "correct"; +}; + +void(string() f) printer = { + print(f(), "\n"); +}; + +void() main = { + printer(getter); +};