Thomas Preud'homme | e17a0d3 | 2019-05-08 21:47:36 +0000 | [diff] [blame] | 1 | ; Test incorrect syntax for -D option is correctly diagnosed. |
| 2 | |
| 3 | ; Missing equal sign. |
| 4 | RUN: not FileCheck -DVALUE10 --input-file %s %s 2>&1 \ |
| 5 | RUN: | FileCheck %s --check-prefix ERRCLIEQ1 |
| 6 | |
| 7 | ERRCLIEQ1: Missing equal sign in command-line definition '-DVALUE10' |
| 8 | |
| 9 | ; Missing definition expression (variable name, equal sign and value). |
| 10 | RUN: not FileCheck -D --input-file %s %s 2>&1 \ |
| 11 | RUN: | FileCheck %s --check-prefix ERRCLIEQ2 |
| 12 | |
| 13 | ERRCLIEQ2: {{F|f}}ile{{C|c}}heck{{[^:]*}}: for the -D option: requires a value! |
| 14 | |
| 15 | ; Missing variable name. |
| 16 | RUN: not FileCheck -D=10 --input-file %s %s 2>&1 \ |
| 17 | RUN: | FileCheck %s --check-prefix ERRCLIVAR1 |
| 18 | |
Thomas Preud'homme | 1a944d2 | 2019-05-23 00:10:14 +0000 | [diff] [blame] | 19 | ERRCLIVAR1: Missing variable name in command-line definition '-D=10' |
Thomas Preud'homme | e17a0d3 | 2019-05-08 21:47:36 +0000 | [diff] [blame] | 20 | |
| 21 | ; Missing variable name. |
| 22 | RUN: not FileCheck -D= --input-file %s %s 2>&1 \ |
| 23 | RUN: | FileCheck %s --check-prefix ERRCLIVAR2 |
| 24 | |
Thomas Preud'homme | 1a944d2 | 2019-05-23 00:10:14 +0000 | [diff] [blame] | 25 | ERRCLIVAR2: Missing variable name in command-line definition '-D=' |
Thomas Preud'homme | e17a0d3 | 2019-05-08 21:47:36 +0000 | [diff] [blame] | 26 | |
| 27 | ; Invalid variable name: starts with a digit. |
| 28 | RUN: not FileCheck -D10VALUE=10 --input-file %s %s 2>&1 \ |
Thomas Preud'homme | a83dfd9 | 2019-07-24 12:38:29 +0000 | [diff] [blame] | 29 | RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix ERRCLIFMT |
Thomas Preud'homme | e17a0d3 | 2019-05-08 21:47:36 +0000 | [diff] [blame] | 30 | |
Thomas Preud'homme | a83dfd9 | 2019-07-24 12:38:29 +0000 | [diff] [blame] | 31 | ERRCLIFMT:Global defines:1:19: error: invalid variable name |
| 32 | ERRCLIFMT-NEXT:Global define #1: 10VALUE=10 |
| 33 | ERRCLIFMT-NEXT: ^ |
Thomas Preud'homme | e17a0d3 | 2019-05-08 21:47:36 +0000 | [diff] [blame] | 34 | |
| 35 | ; Invalid definition of pseudo variable. |
| 36 | RUN: not FileCheck -D@VALUE=10 --input-file %s %s 2>&1 \ |
Thomas Preud'homme | a83dfd9 | 2019-07-24 12:38:29 +0000 | [diff] [blame] | 37 | RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix ERRCLIPSEUDO |
Thomas Preud'homme | e17a0d3 | 2019-05-08 21:47:36 +0000 | [diff] [blame] | 38 | |
Thomas Preud'homme | a83dfd9 | 2019-07-24 12:38:29 +0000 | [diff] [blame] | 39 | ERRCLIPSEUDO:Global defines:1:19: error: invalid name in string variable definition '@VALUE' |
| 40 | ERRCLIPSEUDO-NEXT:Global define #1: @VALUE=10 |
| 41 | ERRCLIPSEUDO-NEXT: ^ |
Thomas Preud'homme | e17a0d3 | 2019-05-08 21:47:36 +0000 | [diff] [blame] | 42 | |
| 43 | ; Invalid definition of an expression. |
| 44 | RUN: not FileCheck -D'VALUE + 2=10' --input-file %s %s 2>&1 \ |
| 45 | RUN: | FileCheck %s --strict-whitespace --check-prefix ERRCLITRAIL |
| 46 | |
Thomas Preud'homme | a83dfd9 | 2019-07-24 12:38:29 +0000 | [diff] [blame] | 47 | ERRCLITRAIL:Global defines:1:19: error: invalid name in string variable definition 'VALUE + 2' |
| 48 | ERRCLITRAIL-NEXT:Global define #1: VALUE + 2=10 |
| 49 | ERRCLITRAIL-NEXT: ^ |