6
6
== Vilolation ==
7
7
8
8
/testdir/test_1.cpp <== Violation. - is used.
9
- /testdir1/_test1.cpp <== Violation. _ is used
9
+ /testdir1/_test1.cxx <== Violation. _ is used
10
+ /testdir/test_1.cc <== Violation. - is used.
11
+ /testdir1/_test1.mm <== Violation. _ is used
10
12
11
13
== Good ==
12
14
13
- testdir/test.cpp
15
+ testdir/test.cpp
16
+ testdir/test.cxx
17
+ testdir/test.cc
18
+ testdir/test.mm
14
19
testdir1/test_1.c <== Don't care. it's c file.
15
20
"""
16
21
19
24
from nsiqcppstyle_rulemanager import *
20
25
21
26
def RunRule (lexer , filename , dirname ) :
22
- if Search ("[_]" , filename ) and filename [filename .rfind ("." ):] in (".cpp" , ".cxx" , "cc" , "mm" ) :
23
- nsiqcppstyle_reporter .Error (DummyToken (lexer .filename , "" , 0 ,0 ), __name__ ,
27
+ if Search ("[_]" , filename ) and filename [filename .rfind ("." ):] in (".cpp" , ".cxx" , ". cc" , ". mm" ) :
28
+ nsiqcppstyle_reporter .Error (DummyToken (lexer .filename , "" , 0 ,0 ), __name__ ,
24
29
"Do not use underbar for cpp file name (%s)." % filename )
25
30
26
31
ruleManager .AddFileStartRule (RunRule )
@@ -40,15 +45,33 @@ def RunRule(lexer, filename, dirname) :
40
45
class testRule (nct ):
41
46
def setUpRule (self ):
42
47
ruleManager .AddFileStartRule (RunRule )
43
-
48
+
44
49
def test1 (self ):
45
- self .Analyze ("test/this_file.cpp" , "" )
46
- assert CheckErrorContent (__name__ )
47
- def test2 (self ):
48
50
self .Analyze ("test/thisfile.cpp" , "" )
49
51
assert not CheckErrorContent (__name__ )
50
-
51
- def test3 (self ):
52
+ def test2 (self ):
52
53
self .Analyze ("test/this_file.c" , "" )
53
54
assert not CheckErrorContent (__name__ )
54
-
55
+ def test3 (self ):
56
+ self .Analyze ("test/thisfile.cxx" , "" )
57
+ assert not CheckErrorContent (__name__ )
58
+ def test4 (self ):
59
+ self .Analyze ("test/thisfile.cc" , "" )
60
+ assert not CheckErrorContent (__name__ )
61
+ def test5 (self ):
62
+ self .Analyze ("test/thisfile.mm" , "" )
63
+ assert not CheckErrorContent (__name__ )
64
+
65
+ def test6 (self ):
66
+ self .Analyze ("test/this_file.cxx" , "" )
67
+ assert CheckErrorContent (__name__ )
68
+ def test7 (self ):
69
+ self .Analyze ("test/this_file.cpp" , "" )
70
+ assert CheckErrorContent (__name__ )
71
+ def test8 (self ):
72
+ self .Analyze ("test/this_file.cc" , "" )
73
+ assert CheckErrorContent (__name__ )
74
+ def test9 (self ):
75
+ self .Analyze ("test/this_file.mm" , "" )
76
+ assert CheckErrorContent (__name__ )
77
+
0 commit comments