]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
functions-as-parameters testcase 0.1-rc1
authorWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 1 Nov 2012 17:24:48 +0000 (18:24 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 1 Nov 2012 17:24:48 +0000 (18:24 +0100)
testsuite/Makefile
testsuite/functions-as-parameters/expected [new file with mode: 0644]
testsuite/functions-as-parameters/main.qc [new file with mode: 0644]

index b132393bada911cac59e2e85c163e1c3aa7aef91..e902e55612af9bcf84edc96b597d56cdf33abc68 100644 (file)
@@ -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 (file)
index 0000000..818e321
--- /dev/null
@@ -0,0 +1 @@
+correct
diff --git a/testsuite/functions-as-parameters/main.qc b/testsuite/functions-as-parameters/main.qc
new file mode 100644 (file)
index 0000000..7790e64
--- /dev/null
@@ -0,0 +1,13 @@
+void(string, string) print = #1;
+
+string() getter = {
+    return "correct";
+};
+
+void(string() f) printer = {
+    print(f(), "\n");
+};
+
+void() main = {
+    printer(getter);
+};