33 lines · cpp
1// RUN: %check_clang_tidy %s google-readability-namespace-comments %t -std=c++20 \2// RUN: '-config={CheckOptions: { \3// RUN: google-readability-namespace-comments.AllowOmittingNamespaceComments: true, \4// RUN: google-readability-namespace-comments.ShortNamespaceLines: 0, \5// RUN: }}'6 7// accept if namespace comments are fully omitted8namespace n1::n2 {9namespace /*comment1*/n3/*comment2*/::/*comment3*/inline/*comment4*/n4/*comment5*/ {10void f();11}}12 13namespace n5::inline n6 {14void f();15}16 17namespace n7::inline n8 {18void f();19}20 21// accept if namespace comments are partly omitted (e.g. only for nested namespace)22namespace n1::n2 {23namespace n3::n4 {24void f();25}26} // namespace n1::n227 28// fail if namespace comment is different than expected29namespace n9::inline n10 {30void f();31} // namespace n9::n1032// CHECK-MESSAGES: :[[@LINE-1]]:2: warning: namespace 'n9::inline n10' ends with a comment that refers to a wrong namespace 'n9::n10' [google-readability-namespace-comments]33