brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 0ed6d01 Raw
27 lines · cpp
1// This test ensures that the --quiet flag only suppresses the "X warnings generated" 2// message while keeping all diagnostic information including caret indicators (^).3 4// RUN: clang-tidy -checks=-*,readability-magic-numbers,clang-diagnostic-sign-compare %s -- \5// RUN:   -Wsign-compare 2>&1 | FileCheck %s --check-prefix=CHECK-NORMAL6// RUN: clang-tidy -checks=-*,readability-magic-numbers,clang-diagnostic-sign-compare -quiet %s -- \7// RUN:   -Wsign-compare 2>&1 | FileCheck %s --check-prefix=CHECK-QUIET8 9// CHECK-NORMAL: 2 warnings generated10// CHECK-NORMAL-DAG: warning: 42 is a magic number11// CHECK-NORMAL-DAG: {{[ ]*\^}}12// CHECK-NORMAL-DAG: warning: comparison of integers of different signs13// CHECK-NORMAL-DAG: {{[ ]*~ \^ ~}}14 15// CHECK-QUIET-NOT: {{[0-9]+}} warning{{s?}} generated16// CHECK-QUIET-DAG: warning: 42 is a magic number17// CHECK-QUIET-DAG: {{[ ]*\^}}18// CHECK-QUIET-DAG: warning: comparison of integers of different signs19// CHECK-QUIET-DAG: {{[ ]*~ \^ ~}}20 21int main() {22  const int CONST_VAL = 10;23  int x = 42; // trigger 'readability-magic-numbers' with caret: ^24  unsigned int y = CONST_VAL;25  return x < y; // trigger 'clang-diagnostic-sign-compare' with caret: ^26}27