1 | // RUN: %check_clang_tidy %s abseil-no-namespace %t -- -- -I %S/Inputs |
2 | // RUN: clang-tidy -checks='-*, abseil-no-namespace' -header-filter='.*' %s -- -I %S/Inputs 2>&1 | FileCheck %s |
3 | |
4 | /// Warning will not be triggered on internal Abseil code that is included. |
5 | #include "absl/strings/internal-file.h" |
6 | // CHECK-NOT: warning: |
7 | |
8 | /// Warning will be triggered on code that is not internal that is included. |
9 | #include "absl/external-file.h" |
10 | // CHECK: absl/external-file.h:1:11: warning: namespace 'absl' is reserved |
11 | |
12 | namespace absl {} |
13 | // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: namespace 'absl' is reserved for implementation of the Abseil library and should not be opened in user code [abseil-no-namespace] |
14 | |
15 | namespace absl { |
16 | // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: namespace 'absl' |
17 | namespace std { |
18 | int i = 5; |
19 | } |
20 | } |
21 | |
22 | // Things that shouldn't trigger the check |
23 | int i = 5; |
24 | namespace std {} |
25 | |