summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-rc
diff options
context:
space:
mode:
authorMarek Sokolowski <mnbvmar@gmail.com>2017-09-29 00:14:18 +0000
committerMarek Sokolowski <mnbvmar@gmail.com>2017-09-29 00:14:18 +0000
commitb5f39a05a329534979572781b10326c60b0bdc9e (patch)
tree2aa8ae30a9e0fd36c1c4bcf0fa044298abeefd8a /llvm/test/tools/llvm-rc
parent7e89ee7fdc428900dd362703e80d4644b28058f7 (diff)
downloadbcm5719-llvm-b5f39a05a329534979572781b10326c60b0bdc9e.tar.gz
bcm5719-llvm-b5f39a05a329534979572781b10326c60b0bdc9e.zip
[llvm-rc] Add user-defined resources parsing ability. [8/8]
This allows llvm-rc to parse user-defined resources (ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx). These statements either import files, or put the specified raw data in the resulting resource file. Thanks to Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D37033 llvm-svn: 314478
Diffstat (limited to 'llvm/test/tools/llvm-rc')
-rw-r--r--llvm/test/tools/llvm-rc/Inputs/parser-correct-everything.rc10
-rw-r--r--llvm/test/tools/llvm-rc/Inputs/parser-user-invalid-contents.rc4
-rw-r--r--llvm/test/tools/llvm-rc/parser.test13
3 files changed, 26 insertions, 1 deletions
diff --git a/llvm/test/tools/llvm-rc/Inputs/parser-correct-everything.rc b/llvm/test/tools/llvm-rc/Inputs/parser-correct-everything.rc
index ec5286c0393..5f15bcc0944 100644
--- a/llvm/test/tools/llvm-rc/Inputs/parser-correct-everything.rc
+++ b/llvm/test/tools/llvm-rc/Inputs/parser-correct-everything.rc
@@ -111,3 +111,13 @@ BEGIN
END
END
+
+MYNAME MYTYPE "filename"
+
+500 600 "other filename"
+
+HELLO INTEGERS {1, 2, 3, 4}
+
+HELLO STRINGS {"1", "2", "3", "4"}
+
+4 MIXED {1, "2", 3, "4"}
diff --git a/llvm/test/tools/llvm-rc/Inputs/parser-user-invalid-contents.rc b/llvm/test/tools/llvm-rc/Inputs/parser-user-invalid-contents.rc
new file mode 100644
index 00000000000..bf8f71486e3
--- /dev/null
+++ b/llvm/test/tools/llvm-rc/Inputs/parser-user-invalid-contents.rc
@@ -0,0 +1,4 @@
+MYNAME MYTYPE
+BEGIN
+ 1, 2, InvalidToken
+END
diff --git a/llvm/test/tools/llvm-rc/parser.test b/llvm/test/tools/llvm-rc/parser.test
index e1477a822a3..a9395dc5cba 100644
--- a/llvm/test/tools/llvm-rc/parser.test
+++ b/llvm/test/tools/llvm-rc/parser.test
@@ -91,6 +91,12 @@
; 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"
+
@@ -121,7 +127,7 @@
; RUN: not llvm-rc /V %p/Inputs/parser-nonsense-type.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE2
-; PNONSENSE2: llvm-rc: Error parsing file: expected resource type, got WORLD
+; PNONSENSE2: llvm-rc: Error parsing file: expected filename, '{' or BEGIN, got <EOF>
; RUN: not llvm-rc /V %p/Inputs/parser-nonsense-type-eof.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE3
@@ -242,3 +248,8 @@
; RUN: not llvm-rc /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 /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
OpenPOWER on IntegriCloud