summaryrefslogtreecommitdiffstats
path: root/tests/preprocessor/define-function-like.slang
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-06-12 14:33:31 -0700
committerGitHub <noreply@github.com>2017-06-12 14:33:31 -0700
commitce90fec1c795eaafbd91d7b8a83501a57eeb1946 (patch)
tree2e939a9ef7b972944b71ea3f7d11a17af844c3fe /tests/preprocessor/define-function-like.slang
parentd1f11a29f8a48eecd47ac64c8635ed062cba982d (diff)
parent5b49974bd6ddd248b5ee1b1e29c0acfc3c422a3a (diff)
Merge pull request #3 from tfoleyNV/rename-tests
Rename tests from `*.spire` to `*.slang`
Diffstat (limited to 'tests/preprocessor/define-function-like.slang')
-rw-r--r--tests/preprocessor/define-function-like.slang19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/preprocessor/define-function-like.slang b/tests/preprocessor/define-function-like.slang
new file mode 100644
index 000000000..f1dd9caa4
--- /dev/null
+++ b/tests/preprocessor/define-function-like.slang
@@ -0,0 +1,19 @@
+//TEST:SIMPLE:
+// support for function-like macros
+
+#define FOO(x) 1.0 + x
+
+float foo(float y) { return FOO(y) * 2.0; }
+
+// simple token pasting
+
+#define PASTE(a,b) a##b
+
+PASTE(flo,at) bar() { return 0.0; }
+
+// no space before parens? not a function-like macro
+
+#define M (x) - (x)
+
+// Error: undefined identifier `x`
+float bar(float a) { return M(a); }