def testMarksMostSpecific(self): includes = [ add_header.Include('"cow.h"', 'include', [], None), add_header.Include('"cow_posix.h"', 'include', [], None), ] add_header.MarkPrimaryInclude(includes, 'cow_posix.cc') self.assertEqual(self._extract_primary_name(includes), '"cow_posix.h"')
def testFullPathMatch(self): includes = [ add_header.Include('"zfs/impl/cow.h"', 'include', [], None) ] add_header.MarkPrimaryInclude(includes, 'zfs/impl/cow.cc') self.assertEqual(self._extract_primary_name(includes), '"zfs/impl/cow.h"')
def testSubstantiallySimilarPaths(self): includes = [ add_header.Include('"farm/public/animal/cow.h"', 'include', [], None) ] add_header.MarkPrimaryInclude(includes, 'farm/animal/cow.cc') self.assertEqual(self._extract_primary_name(includes), '"farm/public/animal/cow.h"')
def testNoMatchingSubdirectories(self): includes = [ add_header.Include('"base/zfs/cow.h"', 'include', [], None) ] add_header.MarkPrimaryInclude(includes, 'base/animal/cow.cc') self.assertIsNone(self._extract_primary_name(includes))
def testTopmostDirectoryDoesNotMatch(self): includes = [ add_header.Include('"animal/impl/cow.h"', 'include', [], None) ] add_header.MarkPrimaryInclude(includes, 'zfs/impl/cow.cc') self.assertIsNone(self._extract_primary_name(includes))
def testFuzzyMatchDoesntMatchDifferentSuffixes(self): includes = [add_header.Include('"cow_posix.h"', 'include', [], None)] add_header.MarkPrimaryInclude(includes, 'cow_windows.cc') self.assertIsNone(self._extract_primary_name(includes))
def testFuzzymatchInReverse(self): includes = [add_header.Include('"cow.h"', 'include', [], None)] add_header.MarkPrimaryInclude(includes, 'cow_uitest_aura.cc') self.assertEqual(self._extract_primary_name(includes), '"cow.h"')
def testFuzzyMatch(self): includes = [add_header.Include('"cow.h"', 'include', [], None)] add_header.MarkPrimaryInclude(includes, 'cow_linux_unittest.cc') self.assertEqual(self._extract_primary_name(includes), '"cow.h"')
def testSystemHeaderNotMatched(self): includes = [add_header.Include('<cow.h>', 'include', [], None)] add_header.MarkPrimaryInclude(includes, 'cow.cc') self.assertIsNone(self._extract_primary_name(includes))
def testNoOpOnHeader(self): includes = [add_header.Include('"cow.h"', 'include', [], None)] add_header.MarkPrimaryInclude(includes, 'cow.h') self.assertIsNone(self._extract_primary_name(includes))