diff options
author | Shevek <[email protected]> | 2014-12-30 20:25:28 -0800 |
---|---|---|
committer | Shevek <[email protected]> | 2014-12-30 20:25:28 -0800 |
commit | c7b8f222102b6b8882ebe8c0d2b0255bf32817f7 (patch) | |
tree | 3987a44b8254ef3711b5d9aa674fd474cf44c528 /src/test | |
parent | 95b8b68bb3be229b7c3f52e7f53a232e1d7eb281 (diff) |
Fix #23: Allow empty anonymous variadic arguments.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/anarres/cpp/PreprocessorTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/java/org/anarres/cpp/PreprocessorTest.java b/src/test/java/org/anarres/cpp/PreprocessorTest.java index 80d0cba..13bd944 100644 --- a/src/test/java/org/anarres/cpp/PreprocessorTest.java +++ b/src/test/java/org/anarres/cpp/PreprocessorTest.java @@ -132,6 +132,14 @@ public class PreprocessorTest { I("__VA_ARGS__"), WHITESPACE, // __VA_ARGS__ is not expanded in this case. I("b") ); + /* Missing arguments are fine. */ + testInput("var()\n", NL, + I("a"), WHITESPACE, + /* No expansion for 'x'. */ WHITESPACE, + I("__VA_ARGS__"), WHITESPACE, + I("b") + ); + /* Variadic macros with anonymous args. */ testInput("#define var2(x, ...) a x __VA_ARGS__ e\n", NL); testInput("var2(b, c, d)\n", NL, @@ -141,6 +149,14 @@ public class PreprocessorTest { I("d"), WHITESPACE, I("e") ); + /* Missing arguments are fine. */ + testInput("var2(b)\n", NL, + I("a"), WHITESPACE, + I("b"), WHITESPACE, + /* No expansion for '__VA_ARGS__'. */ WHITESPACE, + I("e") + ); + testInput("#define var3(...) a __VA_ARGS__ d\n", NL); testInput("var3(b, c)\n", NL, I("a"), WHITESPACE, @@ -148,6 +164,11 @@ public class PreprocessorTest { I("c"), WHITESPACE, I("d") ); + testInput("var3()\n", NL, + I("a"), WHITESPACE, + /* No expansion for '__VA_ARGS__'. */ WHITESPACE, + I("d") + ); testInput("#define _Widen(x) L ## x\n", NL); testInput("#define Widen(x) _Widen(x)\n", NL); |