(self)
| 2868 | assert error_collector.Results() == "" |
| 2869 | |
| 2870 | def testBraceAtBeginOfLine(self): |
| 2871 | self.TestLint( |
| 2872 | "{", |
| 2873 | "{ should almost always be at the end of the previous line [whitespace/braces] [4]", |
| 2874 | ) |
| 2875 | |
| 2876 | error_collector = ErrorCollector(self.assertTrue) |
| 2877 | cpplint.ProcessFileData( |
| 2878 | "foo.cc", |
| 2879 | "cc", |
| 2880 | [ |
| 2881 | "int function()", |
| 2882 | "{", # warning here |
| 2883 | " MutexLock l(&mu);", |
| 2884 | "}", |
| 2885 | "int variable;{", # no warning |
| 2886 | " MutexLock l(&mu);", |
| 2887 | "}", |
| 2888 | "MyType m = {", |
| 2889 | " {value1, value2},", |
| 2890 | " {", # no warning |
| 2891 | " loooong_value1, looooong_value2", |
| 2892 | " }", |
| 2893 | "};", |
| 2894 | "#if PREPROCESSOR", |
| 2895 | "{", # no warning |
| 2896 | " MutexLock l(&mu);", |
| 2897 | "}", |
| 2898 | "#endif", |
| 2899 | ], |
| 2900 | error_collector, |
| 2901 | ) |
| 2902 | assert ( |
| 2903 | error_collector.Results().count( |
| 2904 | "{ should almost always be at the end of the previous line [whitespace/braces] [4]" |
| 2905 | ) |
| 2906 | == 1 |
| 2907 | ) |
| 2908 | |
| 2909 | self.TestMultiLineLint( |
| 2910 | """ |
| 2911 | foo( |
| 2912 | { |
| 2913 | loooooooooooooooong_value, |
| 2914 | });""", |
| 2915 | "", |
| 2916 | ) |
| 2917 | |
| 2918 | def testMismatchingSpacesInParens(self): |
| 2919 | self.TestLint("if (foo ) {", "Mismatching spaces inside () in if [whitespace/parens] [5]") |
nothing calls this directly
no test coverage detected