@@ -1006,6 +1006,22 @@ def testCleanseLine(self):
1006
1006
cpplint .CleanseComments ('f(a, /**/b/**/, c);' ))
1007
1007
1008
1008
def testRawStrings (self ):
1009
+ self .TestMultiLineLint (
1010
+ """
1011
+ int main() {
1012
+ struct A {
1013
+ A(std::string s, A&& a);
1014
+ };
1015
+ }""" ,
1016
+ 'RValue references are an unapproved C++ feature. [build/c++11] [3]' )
1017
+
1018
+ self .TestMultiLineLint (
1019
+ """
1020
+ template <class T, class D = default_delete<T>> class unique_ptr {
1021
+ public:
1022
+ unique_ptr(unique_ptr&& u) noexcept;
1023
+ };""" ,
1024
+ 'RValue references are an unapproved C++ feature. [build/c++11] [3]' )
1009
1025
self .TestMultiLineLint (
1010
1026
"""
1011
1027
void Func() {
@@ -2577,6 +2593,9 @@ def testRvalueReference(self):
2577
2593
self .TestLint ('const a&& b = c;' , rvalue_error )
2578
2594
self .TestLint ('struct a&& b = c;' , rvalue_error )
2579
2595
self .TestLint ('decltype(a)&& b = c;' , rvalue_error )
2596
+ self .TestLint ('A(int s, A&& a);' , rvalue_error )
2597
+ self .TestLint ('A(std::string s, A&& a);' , rvalue_error )
2598
+ self .TestLint ('unique_ptr(unique_ptr&& u) noexcept;' , rvalue_error )
2580
2599
2581
2600
# Cast expressions
2582
2601
self .TestLint ('a = const_cast<b&&>(c);' , rvalue_error )
@@ -5440,6 +5459,12 @@ def testTemplate(self):
5440
5459
self .assertTrue (isinstance (self .nesting_state .stack [0 ], cpplint ._ClassInfo ))
5441
5460
self .assertEquals (self .nesting_state .stack [0 ].name , 'K' )
5442
5461
5462
+ def testTemplateDefaultArg (self ):
5463
+ self .UpdateWithLines ([
5464
+ 'template <class T, class D = default_delete<T>> class unique_ptr {' ,])
5465
+ self .assertEquals (len (self .nesting_state .stack ), 1 )
5466
+ self .assertTrue (self .nesting_state .stack [0 ], isinstance (self .nesting_state .stack [0 ], cpplint ._ClassInfo ))
5467
+
5443
5468
def testTemplateInnerClass (self ):
5444
5469
self .UpdateWithLines (['class A {' ,
5445
5470
' public:' ])
0 commit comments