|
43 | 43 | exit 1
|
44 | 44 | fi
|
45 | 45 |
|
46 |
| -if ! grep -Fq "struct PrettyStruct pretty_function(struct PrettyStruct" singlefile.out.demangled.c; |
47 |
| -then |
48 |
| - echo "Error: demangled file singlefile.out.demangled.c did not contain expected demangled struct and function name." |
49 |
| - exit 1 |
50 |
| -fi |
51 |
| - |
52 |
| -if ! grep -Fq "monomorphize::<usize>(" singlefile.out.demangled.c; |
53 |
| -then |
54 |
| - echo "Error: demangled file singlefile.out.demangled.c did not contain monomorphized function name." |
55 |
| - exit 1 |
56 |
| -fi |
57 |
| - |
58 |
| -if ! grep -Fq "struct ()" singlefile.out.demangled.c; |
59 |
| -then |
60 |
| - echo "Error: demangled file singlefile.out.demangled.c did not contain pretty-printed unit struct." |
61 |
| - exit 1 |
62 |
| -fi |
63 |
| - |
64 |
| -if ! grep -Fq "init_array_repeat<[bool; 2]>" singlefile.out.demangled.c; |
65 |
| -then |
66 |
| - echo "Error: demangled file singlefile.out.demangled.c did not contain pretty-printed array initializer." |
67 |
| - exit 1 |
68 |
| -fi |
69 |
| - |
70 |
| -if ! grep -Fq "struct &str" singlefile.out.demangled.c; |
71 |
| -then |
72 |
| - echo "Error: demangled file singlefile.out.demangled.c did not contain pretty-printed reference type." |
73 |
| - exit 1 |
74 |
| -fi |
| 46 | +echo "Checking that demangling works as expected..." |
| 47 | + |
| 48 | +declare -a PATTERNS=( |
| 49 | + 'struct PrettyStruct pretty_function(struct PrettyStruct' # expected demangled struct and function name |
| 50 | + 'monomorphize::<usize>(' # monomorphized function name |
| 51 | + 'struct ()' # pretty-printed unit struct |
| 52 | + 'init_array_repeat<[bool; 2]>' # pretty-printed array initializer |
| 53 | + 'struct &str' # pretty-printed reference type |
| 54 | + 'TestEnum::Variant1' # pretty-printed variant |
| 55 | +) |
75 | 56 |
|
76 |
| -if ! grep -Fq "TestEnum::Variant1" singlefile.out.demangled.c; |
77 |
| -then |
78 |
| - echo "Error: demangled file singlefile.out.demangled.c did not contain pretty-printed variant." |
79 |
| - exit 1 |
80 |
| -fi |
| 57 | +for val in "${PATTERNS[@]}"; do |
| 58 | + if ! grep -Fq "$val" singlefile.out.demangled.c; |
| 59 | + then |
| 60 | + echo "Error: demangled file singlefile.out.demangled.c did not contain expected pattern '$val'." |
| 61 | + exit 1 |
| 62 | + fi |
| 63 | +done |
81 | 64 |
|
82 | 65 | echo "Finished single-file check successfully..."
|
83 | 66 | echo
|
|
0 commit comments