diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-09 01:43:09 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-09 02:07:04 +0900 |
| commit | 3c1e4f24910fb2d57d0f1139d496579a2d54d052 (patch) | |
| tree | 53d5b852dd0fd0c79469ca05346724d36c7f236b /tests/macro_operators.sh | |
| parent | c7dfe907d8c9bcf684315c52fa6427447317a768 (diff) | |
| download | ducc-3c1e4f24910fb2d57d0f1139d496579a2d54d052.tar.gz ducc-3c1e4f24910fb2d57d0f1139d496579a2d54d052.tar.zst ducc-3c1e4f24910fb2d57d0f1139d496579a2d54d052.zip | |
feat: implement # operator (stringification)
Diffstat (limited to 'tests/macro_operators.sh')
| -rw-r--r-- | tests/macro_operators.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/macro_operators.sh b/tests/macro_operators.sh index e456d4f..a6d0445 100644 --- a/tests/macro_operators.sh +++ b/tests/macro_operators.sh @@ -87,3 +87,23 @@ int main() { printf("%d\n", F(123)); } EOF + +test_exit_code 0 <<'EOF' +#include <helpers.h> + +int strcmp(const char*, const char*); + +#define FOO 42 + +#define TO_STRING(x) TO_STRING_HELPER(x) +#define TO_STRING_HELPER(x) #x +#define BAR TO_STRING(FOO) + +#define TO_STRING2(x) #x +#define BAZ TO_STRING2(FOO) + +int main() { + ASSERT_EQ(0, strcmp("42", BAR)); + ASSERT_EQ(0, strcmp("FOO", BAZ)); +} +EOF |
