Skip to content

Commit 913e273

Browse files
authored
Cleanup output-file tests (rust-lang#1381)
1 parent 46952c8 commit 913e273

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

tests/output-files/check-output.sh

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,41 +43,24 @@ then
4343
exit 1
4444
fi
4545

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+
)
7556

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
8164

8265
echo "Finished single-file check successfully..."
8366
echo

0 commit comments

Comments
 (0)