@@ -4280,12 +4280,14 @@ def testBuildHeaderGuardWithRoot(self):
4280
4280
# (note that CPPLINT.cfg root=setting is always made absolute)
4281
4281
this_files_path = os .path .dirname (os .path .abspath (__file__ ))
4282
4282
(styleguide_path , this_files_dir ) = os .path .split (this_files_path )
4283
- (styleguide_parent_path , _ ) = os .path .split (styleguide_path )
4283
+ (styleguide_parent_path , styleguide_dir_name ) = os .path .split (styleguide_path )
4284
4284
# parent dir of styleguide
4285
4285
cpplint ._root = styleguide_parent_path
4286
4286
self .assertIsNotNone (styleguide_parent_path )
4287
+ # do not hardcode the 'styleguide' repository name, it could be anything.
4288
+ expected_prefix = re .sub (r'[^a-zA-Z0-9]' , '_' , styleguide_dir_name ).upper () + '_'
4287
4289
# do not have 'styleguide' repo in '/'
4288
- self .assertEquals ('STYLEGUIDE_CPPLINT_CPPLINT_TEST_HEADER_H_' ,
4290
+ self .assertEquals ('%sCPPLINT_CPPLINT_TEST_HEADER_H_' % ( expected_prefix ) ,
4289
4291
cpplint .GetHeaderGuardCPPVariable (file_path ))
4290
4292
4291
4293
# To run the 'relative path' tests, we must be in the directory of this test file.
@@ -4302,7 +4304,7 @@ def testBuildHeaderGuardWithRoot(self):
4302
4304
styleguide_rel_path = os .path .relpath (styleguide_parent_path ,
4303
4305
this_files_path ) # '../..'
4304
4306
cpplint ._root = styleguide_rel_path
4305
- self .assertEquals ('STYLEGUIDE_CPPLINT_CPPLINT_TEST_HEADER_H_' ,
4307
+ self .assertEquals ('%sCPPLINT_CPPLINT_TEST_HEADER_H_' % ( expected_prefix ) ,
4306
4308
cpplint .GetHeaderGuardCPPVariable (file_path ))
4307
4309
4308
4310
cpplint ._root = None
0 commit comments