MCPcopy Create free account
hub / github.com/cpplint/cpplint / testSemiColonAfterBraces

Method testSemiColonAfterBraces

cpplint_unittest.py:3050–3096  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3048 self.TestLint("MoveOnly(int i1, int i2) : ip1{new int{i1}}, ip2{new int{i2}} {}", "")
3049
3050 def testSemiColonAfterBraces(self):
3051 self.TestLintContains(
3052 "if (cond) { func(); };", "You don't need a ; after a } [readability/braces] [4]"
3053 )
3054 self.TestLint("void Func() {};", "You don't need a ; after a } [readability/braces] [4]")
3055 self.TestLint(
3056 "void Func() const {};", "You don't need a ; after a } [readability/braces] [4]"
3057 )
3058 self.TestLint("class X {};", "")
3059 for keyword in ["struct", "union"]:
3060 for align in ["", " alignas(16)"]:
3061 for typename in ["", " X"]:
3062 for identifier in ["", " x"]:
3063 self.TestLint(keyword + align + typename + " {}" + identifier + ";", "")
3064
3065 self.TestLint("class X : public Y {};", "")
3066 self.TestLint("class X : public MACRO() {};", "")
3067 self.TestLint("class X : public decltype(expr) {};", "")
3068 self.TestLint("DEFINE_FACADE(PCQueue::Watcher, PCQueue) {};", "")
3069 self.TestLint("VCLASS(XfaTest, XfaContextTest) {};", "")
3070 self.TestLint("class STUBBY_CLASS(H, E) {};", "")
3071 self.TestLint("class STUBBY2_CLASS(H, E) {};", "")
3072 self.TestLint(
3073 "TEST(TestCase, TestName) {};", "You don't need a ; after a } [readability/braces] [4]"
3074 )
3075 self.TestLint(
3076 "TEST_F(TestCase, TestName) {};",
3077 "You don't need a ; after a } [readability/braces] [4]",
3078 )
3079
3080 self.TestLint("file_tocs_[i] = (FileToc) {a, b, c};", "")
3081 self.TestMultiLineLint("class X : public Y,\npublic Z {};", "")
3082 self.TestMultiLineLint(
3083 "template<typename T>\nconcept Addable = requires(T x) { x + x; };", ""
3084 )
3085 self.TestMultiLineLint(
3086 "template <typename T>\nconcept C = requires(T a, T b) {\n requires a == b;\n};", ""
3087 )
3088 self.TestMultiLineLint(
3089 "template <typename T, typename U>\n"
3090 "concept C = (std::integral<T> || std::floating_point<T>) &&\n"
3091 " (std::integral<U> || std::floating_point<U>) &&\n"
3092 " requires(T t, U u) {\n"
3093 " std::min(static_cast<float>(t), static_cast<float>(u));\n"
3094 "};",
3095 "",
3096 )
3097
3098 def testSpacingBeforeBrackets(self):
3099 self.TestLint(

Callers

nothing calls this directly

Calls 3

TestLintContainsMethod · 0.80
TestLintMethod · 0.80
TestMultiLineLintMethod · 0.80

Tested by

no test coverage detected