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
12namespace 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
15namespace absl {
16// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: namespace 'absl'
17namespace std {
18int i = 5;
19}
20}
21
22// Things that shouldn't trigger the check
23int i = 5;
24namespace std {}
25

source code of clang-tools-extra/test/clang-tidy/checkers/abseil/no-namespace.cpp