History

a test for the #pragma push/pop_macro

seyko committed 11 years ago

Commit 9cbab361 parent 72e8ff13 files · +37 −1Browse files

Unified · Split

3 files
  1. tests/tests2/77_push_pop_macro.c +30 −0
  2. tests/tests2/77_push_pop_macro.expect +5 −0
  3. tests/tests2/Makefile +2 −1
tests/tests2/77_push_pop_macro.c+30−0
@@ -0,0 +1,30 @@
1+#include <stdio.h>
2+
3+int main()
4+{
5+ /* must not affect how #pragma ppop_macro works */
6+ #define pop_macro foobar1
7+
8+ /* must not affect how #pragma push_macro works */
9+ #define push_macro foobar2
10+
11+ #undef abort
12+ #define abort "111"
13+ printf("abort = %s\n", abort);
14+
15+ #pragma push_macro("abort")
16+ #undef abort
17+ #define abort "222"
18+ printf("abort = %s\n", abort);
19+
20+ #pragma push_macro("abort")
21+ #undef abort
22+ #define abort "333"
23+ printf("abort = %s\n", abort);
24+
25+ #pragma pop_macro("abort")
26+ printf("abort = %s\n", abort);
27+
28+ #pragma pop_macro("abort")
29+ printf("abort = %s\n", abort);
30+}
tests/tests2/77_push_pop_macro.expect+5−0
@@ -0,0 +1,5 @@
1+abort = 111
2+abort = 222
3+abort = 333
4+abort = 222
5+abort = 111
tests/tests2/Makefile+2−1
@@ -95,7 +95,8 @@ TESTS = \ · 94 unmodified lines
9595 73_arm64.test \
9696 74_nocode_wanted.test \
9797 75_array_in_struct_init.test \
98− 76_dollars_in_identifiers.test
98+ 76_dollars_in_identifiers.test \
99+ 77_push_pop_macro.test
99100
100101 # 34_array_assignment.test -- array assignment is not in C standard
101102

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t