1# Bad comment prefixes are diagnosed.
2
3# Check empty comment prefix.
4RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
5RUN:                                      -comment-prefixes= | \
6RUN:   FileCheck -check-prefix=PREFIX-EMPTY %s
7RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
8RUN:                                      -comment-prefixes=,FOO | \
9RUN:   FileCheck -check-prefix=PREFIX-EMPTY %s
10RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
11RUN:                                      -comment-prefixes=FOO, | \
12RUN:   FileCheck -check-prefix=PREFIX-EMPTY %s
13RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
14RUN:                                      -comment-prefixes=FOO,,BAR | \
15RUN:   FileCheck -check-prefix=PREFIX-EMPTY %s
16PREFIX-EMPTY: error: supplied comment prefix must not be the empty string
17
18# Check invalid characters in comment prefix.
19RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
20RUN:                                       -comment-prefixes=. | \
21RUN:   FileCheck -check-prefix=PREFIX-BAD-CHAR1 %s
22RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
23RUN:                                       -comment-prefixes='foo ' | \
24RUN:   FileCheck -check-prefix=PREFIX-BAD-CHAR2 %s
25PREFIX-BAD-CHAR1: error: supplied comment prefix must start with a letter and contain only alphanumeric characters, hyphens, and underscores: '.'
26PREFIX-BAD-CHAR2: error: supplied comment prefix must start with a letter and contain only alphanumeric characters, hyphens, and underscores: 'foo '
27
28# Check duplicate comment prefixes.
29RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
30RUN:                                      -comment-prefixes=FOO,BAR,BAZ,BAR | \
31RUN:   FileCheck -check-prefix=COMMENT-PREFIX-DUP %s
32COMMENT-PREFIX-DUP: error: supplied comment prefix must be unique among check and comment prefixes: 'BAR'
33
34# Check user-supplied check prefix that duplicates a default comment prefix.
35RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
36RUN:                                      -check-prefixes=FOO,COM | \
37RUN:   FileCheck -check-prefix=CHECK-PREFIX-DUP-COM %s
38RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
39RUN:                                      -check-prefixes=RUN,FOO | \
40RUN:   FileCheck -check-prefix=CHECK-PREFIX-DUP-RUN_ %s
41CHECK-PREFIX-DUP-COM: error: supplied check prefix must be unique among check and comment prefixes: 'COM'
42CHECK-PREFIX-DUP-RUN_: error: supplied check prefix must be unique among check and comment prefixes: 'RUN'
43
44# Check user-supplied comment prefix that duplicates default check prefixes.
45RUN: %ProtectFileCheckOutput not FileCheck /dev/null < /dev/null 2>&1 \
46RUN:                                      -comment-prefixes=CHECK | \
47RUN:   FileCheck -check-prefix=COMMENT-PREFIX-DUP-CHECK %s
48COMMENT-PREFIX-DUP-CHECK: error: supplied comment prefix must be unique among check and comment prefixes: 'CHECK'
49