aboutsummaryrefslogtreecommitdiff
path: root/test/Driver/color-diagnostics.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
commit6a0372513edbc473b538d2f724efac50405d6fef (patch)
tree8f7776b7310bebaf415ac5b69e46e9f928c37144 /test/Driver/color-diagnostics.c
parent809500fc2c13c8173a16b052304d983864e4a1e1 (diff)
Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3vendor/clang/clang-release_33-r183502
Notes
Notes: svn path=/vendor/clang/dist/; revision=251609 svn path=/vendor/clang/clang-release_33-r183502/; revision=251610; tag=vendor/clang/clang-release_33-r183502
Diffstat (limited to 'test/Driver/color-diagnostics.c')
-rw-r--r--test/Driver/color-diagnostics.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/Driver/color-diagnostics.c b/test/Driver/color-diagnostics.c
new file mode 100644
index 000000000000..deff5119a0f7
--- /dev/null
+++ b/test/Driver/color-diagnostics.c
@@ -0,0 +1,53 @@
+// RUN: %clang -fcolor-diagnostics -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CD %s
+// CHECK-CD: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fno-color-diagnostics -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=NCD %s
+// CHECK-NCD-NOT: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fdiagnostics-color -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DC %s
+// CHECK-DC: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fno-diagnostics-color -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=NDC %s
+// CHECK-NDC-NOT: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fdiagnostics-color=always -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DCE_A %s
+// CHECK-DCE_A: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fdiagnostics-color=never -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DCE_N %s
+// CHECK-DCE_N-NOT: clang{{.*}}" "-fcolor-diagnostics"
+
+// The test doesn't run in a PTY, so "auto" defaults to off.
+// RUN: %clang -fdiagnostics-color=auto -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DCE_AUTO %s
+// CHECK-DCE_AUTO-NOT: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fdiagnostics-color=foo -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DCE_FOO %s
+// CHECK-DCE_FOO: error: the clang compiler does not support '-fdiagnostics-color=foo'
+
+// Check that the last flag wins.
+// RUN: %clang -fno-color-diagnostics -fdiagnostics-color -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=NCD_DC_S %s
+// CHECK-NCD_DC_S: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fcolor-diagnostics -fno-diagnostics-color -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CD_NDC_S %s
+// CHECK-CD_NDC_S-NOT: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fdiagnostics-color -fno-color-diagnostics -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DC_NCD_S %s
+// CHECK-DC_NCD_S-NOT: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fno-diagnostics-color -fcolor-diagnostics -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=NDC_CD_S %s
+// CHECK-NDC_CD_S: clang{{.*}}" "-fcolor-diagnostics"
+
+// RUN: %clang -fcolor-diagnostics -fdiagnostics-color=auto -### -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CD_DCE_AUTO_S %s
+// CHECK-CD_DCE_AUTO_S-NOT: clang{{.*}}" "-fcolor-diagnostics"