llvm-project/llvm/test/tools/llvm-rc/parser.test

256 lines
12 KiB
Plaintext

; RUN: llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-correct-everything.rc | FileCheck %s --check-prefix PGOOD
; PGOOD: Icon (meh): "hello.bmp"
; PGOOD-NEXT: Icon (Icon): "Icon"
; PGOOD-NEXT: Language: 5, Sublanguage: 12
; PGOOD-NEXT: StringTable:
; PGOOD-NEXT: Option: Language: 1, Sublanguage: 1
; PGOOD-NEXT: Option: Characteristics: 500
; PGOOD-NEXT: Option: Language: 3, Sublanguage: 4
; PGOOD-NEXT: Option: Version: 14
; PGOOD-NEXT: 1 => "hello"
; PGOOD-NEXT: 2 => "world"
; PGOOD-NEXT: StringTable:
; PGOOD-NEXT: HTML (500): "index.html"
; PGOOD-NEXT: Cursor (Name): "hello.ico"
; PGOOD-NEXT: Accelerators (12):
; PGOOD-NEXT: Option: Version: 5000
; PGOOD-NEXT: Option: Language: 0, Sublanguage: 2
; PGOOD-NEXT: Accelerator: "^C" 10
; PGOOD-NEXT: Accelerator: 14 11
; PGOOD-NEXT: Accelerator: 5 12 VIRTKEY
; PGOOD-NEXT: Accelerator: 0 0 ASCII
; PGOOD-NEXT: Accelerator: 1 1 VIRTKEY CONTROL
; PGOOD-NEXT: Accelerator: 2 2 VIRTKEY CONTROL
; PGOOD-NEXT: Accelerator: 3 3 ASCII VIRTKEY NOINVERT ALT SHIFT CONTROL
; PGOOD-NEXT: Menu (LLVMTest):
; PGOOD-NEXT: Option: Language: 4, Sublanguage: 1
; PGOOD-NEXT: Menu list starts
; PGOOD-NEXT: Popup ("&OneMenu"):
; PGOOD-NEXT: Menu list starts
; PGOOD-NEXT: Popup ("Menu&1"):
; PGOOD-NEXT: Menu list starts
; PGOOD-NEXT: MenuItem ("Item&1"), ID = 301 CHECKED MENUBREAK
; PGOOD-NEXT: MenuItem ("Item&2"), ID = 302 CHECKED MENUBARBREAK
; PGOOD-NEXT: MenuItem ("Item&3"), ID = 303 HELP INACTIVE MENUBREAK
; PGOOD-NEXT: MenuItem ("Item&4"), ID = 304 GRAYED
; PGOOD-NEXT: Menu list ends
; PGOOD-NEXT: Popup ("Menu&2"):
; PGOOD-NEXT: Menu list starts
; PGOOD-NEXT: MenuItem ("&A"), ID = 401
; PGOOD-NEXT: MenuItem ("&B"), ID = 402
; PGOOD-NEXT: Menu list ends
; PGOOD-NEXT: Menu list ends
; PGOOD-NEXT: Popup ("&Items"):
; PGOOD-NEXT: Menu list starts
; PGOOD-NEXT: MenuItem ("&Row"), ID = 500
; PGOOD-NEXT: MenuItem ("&Column"), ID = 501 CHECKED
; PGOOD-NEXT: Menu separator
; PGOOD-NEXT: MenuItem ("&Word"), ID = 502
; PGOOD-NEXT: Menu list ends
; PGOOD-NEXT: Menu list ends
; PGOOD-NEXT: DialogEx (14): loc: (50, 60), size: [10, 20], help ID: 500
; PGOOD-NEXT: Option: Language: 1, Sublanguage: 2
; PGOOD-NEXT: Option: Characteristics: 50
; PGOOD-NEXT: Option: Version: 100
; PGOOD-NEXT: Option: Font: size = 12, face = "Arial", weight = 500, italic, charset = 13
; PGOOD-NEXT: Option: Caption: "RC parser dialog"
; PGOOD-NEXT: Option: Style: 332340
; PGOOD-NEXT: Control (14): LTEXT, title: "Hello world!", loc: (20, 20), size: [50, 50]
; PGOOD-NEXT: Control (50): RTEXT, title: "Heh", loc: (51, 52), size: [53, 54], style: 55, ext. style: 56
; PGOOD-NEXT: Control (1): CTEXT, title: "Muuuu", loc: (2, 3), size: [4, 5], style: 6, ext. style: 7, help ID: 8
; PGOOD-NEXT: Control (1): PUSHBUTTON, title: "Muuuu", loc: (2, 3), size: [4, 5], style: 6, ext. style: 7, help ID: 8
; PGOOD-NEXT: Control (1): DEFPUSHBUTTON, title: "Muuuu", loc: (2, 3), size: [4, 5], style: 6
; PGOOD-NEXT: Control (5): EDITTEXT, title: , loc: (1, 2), size: [4, 7], style: 8
; PGOOD-NEXT: Dialog (25): loc: (1, 2), size: [3, 4], help ID: 0
; PGOOD-NEXT: DialogEx (26): loc: (1, 2), size: [3, 4], help ID: 0
; PGOOD-NEXT: VersionInfo (1):
; PGOOD-NEXT: Fixed: FILEVERSION: 1 2 3 4
; PGOOD-NEXT: Fixed: PRODUCTVERSION: 5 6 7 8
; PGOOD-NEXT: Fixed: FILEFLAGSMASK: 50
; PGOOD-NEXT: Fixed: FILEFLAGS: 555
; PGOOD-NEXT: Fixed: FILEOS: 110
; PGOOD-NEXT: Fixed: FILETYPE: 555555
; PGOOD-NEXT: Fixed: FILESUBTYPE: 14
; PGOOD-NEXT: Start of block (name: )
; PGOOD-NEXT: Start of block (name: "StringFileInfo")
; PGOOD-NEXT: Start of block (name: "040904E4")
; PGOOD-NEXT: "CompanyName" => "a"
; PGOOD-NEXT: "FileDescription" => "b" "c" "d", 1 3 7L, "y", "h" "d"
; PGOOD-NEXT: "FileVersion" => "c"
; PGOOD-NEXT: "InternalName" => "d"
; PGOOD-NEXT: "LegalCopyright" => "e"
; PGOOD-NEXT: "LegalTrademarks1" => 1 2, 3
; PGOOD-NEXT: "LegalTrademarks2" => "g"
; PGOOD-NEXT: "OriginalFilename" => L"h"
; PGOOD-NEXT: "ProductName" => "ii", 2L, 3
; PGOOD-NEXT: "ProductVersion" => 305419896L
; PGOOD-NEXT: End of block
; PGOOD-NEXT: End of block
; PGOOD-NEXT: Start of block (name: "VarFileInfo")
; PGOOD-NEXT: "Translation" => 1033, 1252
; PGOOD-NEXT: End of block
; PGOOD-NEXT: End of block
; PGOOD-NEXT: User-defined (type: MYTYPE, name: MYNAME): "filename"
; PGOOD-NEXT: User-defined (type: 600, name: 500): "other filename"
; PGOOD-NEXT: User-defined (type: INTEGERS, name: HELLO): data = 1 2 3 4
; PGOOD-NEXT: User-defined (type: STRINGS, name: HELLO): data = "1" "2" "3" "4"
; PGOOD-NEXT: User-defined (type: MIXED, name: 4): data = 1 "2" 3 "4"
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-stringtable-no-string.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE1
; PSTRINGTABLE1: llvm-rc: Error parsing file: expected string, got }
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-stringtable-weird-option.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE2
; PSTRINGTABLE2: llvm-rc: Error parsing file: expected optional statement type, BEGIN or '{', got NONSENSETYPE
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-eof.rc 2>&1 | FileCheck %s --check-prefix PEOF
; PEOF: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got <EOF>
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-no-characteristics-arg.rc 2>&1 | FileCheck %s --check-prefix PCHARACTERISTICS1
; PCHARACTERISTICS1: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got BEGIN
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-token.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE1
; PNONSENSE1: llvm-rc: Error parsing file: expected int or identifier, got &
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-type.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE2
; PNONSENSE2: llvm-rc: Error parsing file: expected filename, '{' or BEGIN, got <EOF>
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-type-eof.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE3
; PNONSENSE3: llvm-rc: Error parsing file: expected int or identifier, got <EOF>
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-language-no-comma.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE1
; PLANGUAGE1: llvm-rc: Error parsing file: expected ',', got 7
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-language-too-many-commas.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE2
; PLANGUAGE2: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got ,
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-html-extra-comma.rc 2>&1 | FileCheck %s --check-prefix PHTML2
; PHTML2: llvm-rc: Error parsing file: expected string, got ,
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS1
; PACCELERATORS1: llvm-rc: Error parsing file: expected ASCII/VIRTKEY/NOINVERT/ALT/SHIFT/CONTROL, got HELLO
; 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
; PACCELERATORS2: llvm-rc: Error parsing file: expected int or string, got NotIntOrString
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-no-comma.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS3
; PACCELERATORS3: llvm-rc: Error parsing file: expected int or string, got CONTROL
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-no-comma-2.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS4
; PACCELERATORS4: llvm-rc: Error parsing file: expected ',', got 10
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-bad-id.rc 2>&1 | FileCheck %s --check-prefix PMENU1
; PMENU1: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got A
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PMENU2
; PMENU2: llvm-rc: Error parsing file: expected CHECKED/GRAYED/HELP/INACTIVE/MENUBARBREAK/MENUBREAK, got ERRONEOUS
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-missing-block.rc 2>&1 | FileCheck %s --check-prefix PMENU3
; PMENU3: llvm-rc: Error parsing file: expected '{', got POPUP
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-misspelled-separator.rc 2>&1 | FileCheck %s --check-prefix PMENU4
; PMENU4: llvm-rc: Error parsing file: expected SEPARATOR or string, got NOTSEPARATOR
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-cant-give-helpid.rc 2>&1 | FileCheck %s --check-prefix PDIALOG1
; PDIALOG1: llvm-rc: Error parsing file: expected identifier, got ,
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-too-few-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG2
; PDIALOG2: llvm-rc: Error parsing file: expected ',', got }
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-too-many-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG3
; PDIALOG3: llvm-rc: Error parsing file: expected identifier, got ,
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-unknown-type.rc 2>&1 | FileCheck %s --check-prefix PDIALOG4
; PDIALOG4: llvm-rc: Error parsing file: expected control type, END or '}', got UNKNOWN
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-unnecessary-string.rc 2>&1 | FileCheck %s --check-prefix PDIALOG5
; PDIALOG5: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got "This shouldn't be here"
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-simple-font.rc 2>&1 | FileCheck %s --check-prefix PDIALOG6
; PDIALOG6: llvm-rc: Error parsing file: expected identifier, got ,
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-wrong-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO1
; PVERSIONINFO1: llvm-rc: Error parsing file: expected fixed VERSIONINFO statement type, got WEIRDFIXED
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-named-main-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO2
; PVERSIONINFO2: llvm-rc: Error parsing file: expected fixed VERSIONINFO statement type, got BLOCK
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-inner-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO3
; PVERSIONINFO3: llvm-rc: Error parsing file: expected string, got {
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-value.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO4
; PVERSIONINFO4: llvm-rc: Error parsing file: expected string, got END
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-bad-type.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO5
; PVERSIONINFO5: llvm-rc: Error parsing file: expected BLOCK or VALUE, got INCORRECT
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-repeated-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO6
; PVERSIONINFO6: llvm-rc: Error parsing file: expected yet unread fixed VERSIONINFO statement type, got FILEVERSION
; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-user-invalid-contents.rc 2>&1 | FileCheck %s --check-prefix PUSER1
; PUSER1: llvm-rc: Error parsing file: expected int or string, got InvalidToken