xref: /llvm-project/llvm/test/tools/llvm-rc/parser.test (revision 64bc44f5ddfb6da4b6a8b51ea9a03f8772b3ae95)
1; RUN: llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-correct-everything.rc | FileCheck %s --check-prefix PGOOD
2
3; PGOOD:  Icon (meh): "hello.bmp"
4; PGOOD-NEXT:  Icon (Icon): "Icon"
5; PGOOD-NEXT:  Language: 5, Sublanguage: 12
6; PGOOD-NEXT:  StringTable:
7; PGOOD-NEXT:    Option: Language: 1, Sublanguage: 1
8; PGOOD-NEXT:    Option: Characteristics: 500
9; PGOOD-NEXT:    Option: Language: 3, Sublanguage: 4
10; PGOOD-NEXT:    Option: Version: 14
11; PGOOD-NEXT:    1 => "hello"
12; PGOOD-NEXT:    2 => "world"
13; PGOOD-NEXT:  StringTable:
14; PGOOD-NEXT:  HTML (500): "index.html"
15; PGOOD-NEXT:  Cursor (Name): "hello.ico"
16; PGOOD-NEXT:  Accelerators (12):
17; PGOOD-NEXT:    Option: Version: 5000
18; PGOOD-NEXT:    Option: Language: 0, Sublanguage: 2
19; PGOOD-NEXT:    Accelerator: "^C" 10
20; PGOOD-NEXT:    Accelerator: 14 11
21; PGOOD-NEXT:    Accelerator: 5 12 VIRTKEY
22; PGOOD-NEXT:    Accelerator: 0 0 ASCII
23; PGOOD-NEXT:    Accelerator: 1 1 VIRTKEY CONTROL
24; PGOOD-NEXT:    Accelerator: 2 2 VIRTKEY CONTROL
25; PGOOD-NEXT:    Accelerator: 3 3 ASCII VIRTKEY NOINVERT ALT SHIFT CONTROL
26; PGOOD-NEXT:  Menu (LLVMTest):
27; PGOOD-NEXT:    Option: Language: 4, Sublanguage: 1
28; PGOOD-NEXT:    Menu list starts
29; PGOOD-NEXT:    Popup ("&OneMenu"):
30; PGOOD-NEXT:    Menu list starts
31; PGOOD-NEXT:    Popup ("Menu&1"):
32; PGOOD-NEXT:    Menu list starts
33; PGOOD-NEXT:    MenuItem ("Item&1"), ID = 301 CHECKED MENUBREAK
34; PGOOD-NEXT:    MenuItem ("Item&2"), ID = 302 CHECKED MENUBARBREAK
35; PGOOD-NEXT:    MenuItem ("Item&3"), ID = 303 HELP INACTIVE MENUBREAK
36; PGOOD-NEXT:    MenuItem ("Item&4"), ID = 304 GRAYED
37; PGOOD-NEXT:    Menu list ends
38; PGOOD-NEXT:    Popup ("Menu&2"):
39; PGOOD-NEXT:    Menu list starts
40; PGOOD-NEXT:    MenuItem ("&A"), ID = 401
41; PGOOD-NEXT:    MenuItem ("&B"), ID = 402
42; PGOOD-NEXT:    Menu list ends
43; PGOOD-NEXT:    Menu list ends
44; PGOOD-NEXT:    Popup ("&Items"):
45; PGOOD-NEXT:    Menu list starts
46; PGOOD-NEXT:    MenuItem ("&Row"), ID = 500
47; PGOOD-NEXT:    MenuItem ("&Column"), ID = 501 CHECKED
48; PGOOD-NEXT:    Menu separator
49; PGOOD-NEXT:    MenuItem ("&Word"), ID = 502
50; PGOOD-NEXT:    Menu list ends
51; PGOOD-NEXT:    Menu list ends
52; PGOOD-NEXT:  DialogEx (14): loc: (50, 60), size: [10, 20], help ID: 500
53; PGOOD-NEXT:    Option: Language: 1, Sublanguage: 2
54; PGOOD-NEXT:    Option: Characteristics: 50
55; PGOOD-NEXT:    Option: Version: 100
56; PGOOD-NEXT:    Option: Font: size = 12, face = "Arial", weight = 500, italic, charset = 13
57; PGOOD-NEXT:    Option: Caption: "RC parser dialog"
58; PGOOD-NEXT:    Option: Style: 332340
59; PGOOD-NEXT:    Control (14): LTEXT, title: "Hello world!", loc: (20, 20), size: [50, 50]
60; PGOOD-NEXT:    Control (50): RTEXT, title: "Heh", loc: (51, 52), size: [53, 54], style: 55, ext. style: 56
61; PGOOD-NEXT:    Control (1): CTEXT, title: "Muuuu", loc: (2, 3), size: [4, 5], style: 6, ext. style: 7, help ID: 8
62; PGOOD-NEXT:    Control (1): PUSHBUTTON, title: "Muuuu", loc: (2, 3), size: [4, 5], style: 6, ext. style: 7, help ID: 8
63; PGOOD-NEXT:    Control (1): DEFPUSHBUTTON, title: "Muuuu", loc: (2, 3), size: [4, 5], style: 6
64; PGOOD-NEXT:    Control (5): EDITTEXT, title: , loc: (1, 2), size: [4, 7], style: 8
65; PGOOD-NEXT:  Dialog (25): loc: (1, 2), size: [3, 4], help ID: 0
66; PGOOD-NEXT:  DialogEx (26): loc: (1, 2), size: [3, 4], help ID: 0
67; PGOOD-NEXT:  VersionInfo (1):
68; PGOOD-NEXT:    Fixed: FILEVERSION: 1 2 3 4
69; PGOOD-NEXT:    Fixed: PRODUCTVERSION: 5 6 7 8
70; PGOOD-NEXT:    Fixed: FILEFLAGSMASK: 50
71; PGOOD-NEXT:    Fixed: FILEFLAGS: 555
72; PGOOD-NEXT:    Fixed: FILEOS: 110
73; PGOOD-NEXT:    Fixed: FILETYPE: 555555
74; PGOOD-NEXT:    Fixed: FILESUBTYPE: 14
75; PGOOD-NEXT:    Start of block (name: )
76; PGOOD-NEXT:    Start of block (name: "StringFileInfo")
77; PGOOD-NEXT:    Start of block (name: "040904E4")
78; PGOOD-NEXT:    "CompanyName" => "a"
79; PGOOD-NEXT:    "FileDescription" => "b" "c" "d", 1 3 7L, "y", "h" "d"
80; PGOOD-NEXT:    "FileVersion" => "c"
81; PGOOD-NEXT:    "InternalName" => "d"
82; PGOOD-NEXT:    "LegalCopyright" => "e"
83; PGOOD-NEXT:    "LegalTrademarks1" => 1 2, 3
84; PGOOD-NEXT:    "LegalTrademarks2" => "g"
85; PGOOD-NEXT:    "OriginalFilename" => L"h"
86; PGOOD-NEXT:    "ProductName" => "ii", 2L, 3
87; PGOOD-NEXT:    "ProductVersion" => 305419896L
88; PGOOD-NEXT:    End of block
89; PGOOD-NEXT:    End of block
90; PGOOD-NEXT:    Start of block (name: "VarFileInfo")
91; PGOOD-NEXT:    "Translation" => 1033, 1252
92; PGOOD-NEXT:    End of block
93; PGOOD-NEXT:    End of block
94; PGOOD-NEXT:  User-defined (type: MYTYPE, name: MYNAME): "filename"
95; PGOOD-NEXT:  User-defined (type: 600, name: 500): "other filename"
96; PGOOD-NEXT:  User-defined (type: INTEGERS, name: HELLO): data = 1 2 3 4
97; PGOOD-NEXT:  User-defined (type: STRINGS, name: HELLO): data = "1" "2" "3" "4"
98; PGOOD-NEXT:  User-defined (type: MIXED, name: 4): data = 1 "2" 3 "4"
99
100
101
102
103; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-stringtable-no-string.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE1
104
105; PSTRINGTABLE1:  llvm-rc: Error parsing file: expected string, got }
106
107
108; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-stringtable-weird-option.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE2
109
110; PSTRINGTABLE2:  llvm-rc: Error parsing file: expected optional statement type, BEGIN or '{', got NONSENSETYPE
111
112
113; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-eof.rc 2>&1 | FileCheck %s --check-prefix PEOF
114
115; PEOF:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got <EOF>
116
117
118; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-no-characteristics-arg.rc 2>&1 | FileCheck %s --check-prefix PCHARACTERISTICS1
119
120; PCHARACTERISTICS1:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got BEGIN
121
122
123; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-token.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE1
124
125; PNONSENSE1:  llvm-rc: Error parsing file: expected int or identifier, got &
126
127
128; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-type.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE2
129
130; PNONSENSE2:  llvm-rc: Error parsing file: expected filename, '{' or BEGIN, got <EOF>
131
132
133; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-type-eof.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE3
134
135; PNONSENSE3:  llvm-rc: Error parsing file: expected int or identifier, got <EOF>
136
137
138; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-language-no-comma.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE1
139
140; PLANGUAGE1:  llvm-rc: Error parsing file: expected ',', got 7
141
142
143; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-language-too-many-commas.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE2
144
145; PLANGUAGE2:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got ,
146
147
148; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-html-extra-comma.rc 2>&1 | FileCheck %s --check-prefix PHTML2
149
150; PHTML2:  llvm-rc: Error parsing file: expected string, got ,
151
152
153; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS1
154
155; PACCELERATORS1:  llvm-rc: Error parsing file: expected ASCII/VIRTKEY/NOINVERT/ALT/SHIFT/CONTROL, got HELLO
156
157
158; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-bad-int-or-string.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS2
159
160; PACCELERATORS2:  llvm-rc: Error parsing file: expected int or string, got NotIntOrString
161
162
163; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-no-comma.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS3
164
165; PACCELERATORS3:  llvm-rc: Error parsing file: expected int or string, got CONTROL
166
167
168; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-no-comma-2.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS4
169
170; PACCELERATORS4:  llvm-rc: Error parsing file: expected ',', got 10
171
172
173; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-bad-id.rc 2>&1 | FileCheck %s --check-prefix PMENU1
174
175; PMENU1:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got A
176
177
178; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PMENU2
179
180; PMENU2:  llvm-rc: Error parsing file: expected CHECKED/GRAYED/HELP/INACTIVE/MENUBARBREAK/MENUBREAK, got ERRONEOUS
181
182
183; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-missing-block.rc 2>&1 | FileCheck %s --check-prefix PMENU3
184
185; PMENU3:  llvm-rc: Error parsing file: expected '{', got POPUP
186
187
188; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-misspelled-separator.rc 2>&1 | FileCheck %s --check-prefix PMENU4
189
190; PMENU4:  llvm-rc: Error parsing file: expected SEPARATOR or string, got NOTSEPARATOR
191
192
193; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-cant-give-helpid.rc 2>&1 | FileCheck %s --check-prefix PDIALOG1
194
195; PDIALOG1:  llvm-rc: Error parsing file: expected identifier, got ,
196
197
198; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-too-few-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG2
199
200; PDIALOG2:  llvm-rc: Error parsing file: expected ',', got }
201
202
203; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-too-many-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG3
204
205; PDIALOG3:  llvm-rc: Error parsing file: expected identifier, got ,
206
207
208; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-unknown-type.rc 2>&1 | FileCheck %s --check-prefix PDIALOG4
209
210; PDIALOG4:  llvm-rc: Error parsing file: expected control type, END or '}', got UNKNOWN
211
212
213; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-unnecessary-string.rc 2>&1 | FileCheck %s --check-prefix PDIALOG5
214
215; PDIALOG5:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got "This shouldn't be here"
216
217
218; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-simple-font.rc 2>&1 | FileCheck %s --check-prefix PDIALOG6
219
220; PDIALOG6:  llvm-rc: Error parsing file: expected identifier, got ,
221
222
223; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-wrong-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO1
224
225; PVERSIONINFO1:  llvm-rc: Error parsing file: expected fixed VERSIONINFO statement type, got WEIRDFIXED
226
227
228; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-named-main-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO2
229
230; PVERSIONINFO2:  llvm-rc: Error parsing file: expected fixed VERSIONINFO statement type, got BLOCK
231
232
233; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-inner-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO3
234
235; PVERSIONINFO3:  llvm-rc: Error parsing file: expected string, got {
236
237
238; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-value.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO4
239
240; PVERSIONINFO4:  llvm-rc: Error parsing file: expected string, got END
241
242
243; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-bad-type.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO5
244
245; PVERSIONINFO5:  llvm-rc: Error parsing file: expected BLOCK or VALUE, got INCORRECT
246
247
248; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-repeated-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO6
249
250; PVERSIONINFO6:  llvm-rc: Error parsing file: expected yet unread fixed VERSIONINFO statement type, got FILEVERSION
251
252
253; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-user-invalid-contents.rc 2>&1 | FileCheck %s --check-prefix PUSER1
254
255; PUSER1:  llvm-rc: Error parsing file: expected int or string, got InvalidToken
256