| 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 omitted |
| 8 | namespace n1::n2 { |
| 9 | namespace /*comment1*/n3/*comment2*/::/*comment3*/inline/*comment4*/n4/*comment5*/ { |
| 10 | void f(); |
| 11 | }} |
| 12 | |
| 13 | namespace n5::inline n6 { |
| 14 | void f(); |
| 15 | } |
| 16 | |
| 17 | namespace n7::inline n8 { |
| 18 | void f(); |
| 19 | } |
| 20 | |
| 21 | // accept if namespace comments are partly omitted (e.g. only for nested namespace) |
| 22 | namespace n1::n2 { |
| 23 | namespace n3::n4 { |
| 24 | void f(); |
| 25 | } |
| 26 | } // namespace n1::n2 |
| 27 | |
| 28 | // fail if namespace comment is different than expected |
| 29 | namespace n9::inline n10 { |
| 30 | void f(); |
| 31 | } // namespace n9::n10 |
| 32 | // 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 | |