| 1 |
// RUN: env NO_COLOR=1 %clang -### %s 2>&1 | FileCheck --check-prefix=NO-COLOR %s |
| 2 |
// RUN: env NO_COLOR=1 %clang -fcolor-diagnostics -### %s 2>&1 | FileCheck --check-prefix=COLOR %s |
| 3 |
// RUN: env NO_COLOR=1 %clang -fdiagnostics-color=auto -### %s 2>&1 | FileCheck --check-prefix=NO-COLOR %s |
| 4 |
// RUN: env NO_COLOR=1 %clang -fdiagnostics-color=always -### %s 2>&1 | FileCheck --check-prefix=COLOR %s |
| 5 |
// RUN: env NO_COLOR=1 %clang -fdiagnostics-color=never -### %s 2>&1 | FileCheck --check-prefix=NO-COLOR %s |
| 6 |
|
| 7 |
// Note, the value of the environment variable does not matter, only that it is defined and not empty. |
| 8 |
// RUN: env NO_COLOR=0 %clang -### %s 2>&1 | FileCheck --check-prefix=NO-COLOR %s |
| 9 |
// Note, an empty value means we automatically decide whether to enable colors or not, and lit tests |
| 10 |
// are not run in a PTY, so colors are disabled by default. There is no easy way for us to test this |
| 11 |
// configuration where auto enables colors. |
| 12 |
// RUN: env NO_COLOR= %clang -### %s 2>&1 | FileCheck --check-prefix=NO-COLOR %s |
| 13 |
|
| 14 |
int main(void) {} |
| 15 |
|
| 16 |
// COLOR: -fcolor-diagnostics |
| 17 |
// NO-COLOR-NOT: -fcolor-diagnostics |