(self)
| 2933 | ) |
| 2934 | |
| 2935 | def testSpacingForFncall(self): |
| 2936 | self.TestLint("if (foo) {", "") |
| 2937 | self.TestLint("for (foo; bar; baz) {", "") |
| 2938 | self.TestLint("for (;;) {", "") |
| 2939 | # Space should be allowed in placement new operators. |
| 2940 | self.TestLint("Something* p = new (place) Something();", "") |
| 2941 | # Test that there is no warning when increment statement is empty. |
| 2942 | self.TestLint("for (foo; baz;) {", "") |
| 2943 | self.TestLint("for (foo;bar;baz) {", "Missing space after ; [whitespace/semicolon] [3]") |
| 2944 | # we don't warn about this semicolon, at least for now |
| 2945 | self.TestLintNotContains( |
| 2946 | "if (condition) { return &something; }", |
| 2947 | "Missing space after ; [whitespace/semicolon] [3]", |
| 2948 | ) |
| 2949 | # seen in some macros |
| 2950 | self.TestLint("DoSth();\\", "") |
| 2951 | # Test that there is no warning about semicolon here. |
| 2952 | self.TestLint( |
| 2953 | "abc;// this is abc", |
| 2954 | "At least two spaces is best between code and comments [whitespace/comments] [2]", |
| 2955 | ) |
| 2956 | self.TestLint("while (foo) {", "") |
| 2957 | self.TestLint("switch (foo) {", "") |
| 2958 | self.TestLint("foo( bar)", "Extra space after ( in function call [whitespace/parens] [4]") |
| 2959 | self.TestLint("foo( // comment", "") |
| 2960 | self.TestLint( |
| 2961 | "foo( // comment", |
| 2962 | "At least two spaces is best between code and comments [whitespace/comments] [2]", |
| 2963 | ) |
| 2964 | self.TestLint("foobar( \\", "") |
| 2965 | self.TestLint("foobar( \\", "") |
| 2966 | self.TestLint("( a + b)", "Extra space after ( [whitespace/parens] [2]") |
| 2967 | self.TestLint("((a+b))", "") |
| 2968 | self.TestLint("foo (foo)", "Extra space before ( in function call [whitespace/parens] [4]") |
| 2969 | # asm volatile () may have a space, as it isn't a function call. |
| 2970 | self.TestLint('asm volatile ("")', "") |
| 2971 | self.TestLint('__asm__ __volatile__ ("")', "") |
| 2972 | self.TestLint("} catch (const Foo& ex) {", "") |
| 2973 | self.TestLint("case (42):", "") |
| 2974 | self.TestLint("typedef foo (*foo)(foo)", "") |
| 2975 | self.TestLint("typedef foo (*foo12bar_)(foo)", "") |
| 2976 | self.TestLint("typedef foo (Foo::*bar)(foo)", "") |
| 2977 | self.TestLint("using foo = type (Foo::*bar)(foo)", "") |
| 2978 | self.TestLint("using foo = type (Foo::*bar)(", "") |
| 2979 | self.TestLint("using foo = type (Foo::*)(", "") |
| 2980 | self.TestLint("foo (Foo::*bar)(", "") |
| 2981 | self.TestLint("foo (x::y::*z)(", "") |
| 2982 | self.TestLint( |
| 2983 | "foo (Foo::bar)(", "Extra space before ( in function call [whitespace/parens] [4]" |
| 2984 | ) |
| 2985 | self.TestLint("foo (*bar)(", "") |
| 2986 | self.TestLint("typedef foo (Foo::*bar)(", "") |
| 2987 | self.TestLint("(foo)(bar)", "") |
| 2988 | self.TestLint("Foo (*foo)(bar)", "") |
| 2989 | self.TestLint("Foo (*foo)(Bar bar,", "") |
| 2990 | self.TestLint("char (*p)[sizeof(foo)] = &foo", "") |
| 2991 | self.TestLint("char (&ref)[sizeof(foo)] = &foo", "") |
| 2992 | self.TestLint("const char32 (*table[])[6];", "") |
nothing calls this directly
no test coverage detected