Index: PRESUBMIT_test.py |
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py |
index 183ec6e54c839f71ad98827228ce195faa71819e..bcacad9004fa6286a6539461e3443639630e2c0a 100755 |
--- a/PRESUBMIT_test.py |
+++ b/PRESUBMIT_test.py |
@@ -99,7 +99,7 @@ class IncludeOrderTest(unittest.TestCase): |
'#include "a/header.h"'] |
mock_file = MockFile('some/path/foo.cc', contents) |
warnings = PRESUBMIT._CheckIncludeOrderInFile( |
- mock_input_api, mock_file, True, range(1, len(contents) + 1)) |
+ mock_input_api, mock_file, range(1, len(contents) + 1)) |
self.assertEqual(0, len(warnings)) |
def testSpecialFirstInclude2(self): |
@@ -108,7 +108,7 @@ class IncludeOrderTest(unittest.TestCase): |
'#include "a/header.h"'] |
mock_file = MockFile('some/path/foo.cc', contents) |
warnings = PRESUBMIT._CheckIncludeOrderInFile( |
- mock_input_api, mock_file, True, range(1, len(contents) + 1)) |
+ mock_input_api, mock_file, range(1, len(contents) + 1)) |
self.assertEqual(0, len(warnings)) |
def testSpecialFirstInclude3(self): |
@@ -117,7 +117,7 @@ class IncludeOrderTest(unittest.TestCase): |
'#include "a/header.h"'] |
mock_file = MockFile('some/path/foo_platform.cc', contents) |
warnings = PRESUBMIT._CheckIncludeOrderInFile( |
- mock_input_api, mock_file, True, range(1, len(contents) + 1)) |
+ mock_input_api, mock_file, range(1, len(contents) + 1)) |
self.assertEqual(0, len(warnings)) |
def testSpecialFirstInclude4(self): |
@@ -126,10 +126,19 @@ class IncludeOrderTest(unittest.TestCase): |
'#include "a/header.h"'] |
mock_file = MockFile('some/path/foo_platform.cc', contents) |
warnings = PRESUBMIT._CheckIncludeOrderInFile( |
- mock_input_api, mock_file, True, range(1, len(contents) + 1)) |
+ mock_input_api, mock_file, range(1, len(contents) + 1)) |
self.assertEqual(1, len(warnings)) |
self.assertTrue('2' in warnings[0]) |
+ def testSpecialFirstInclude5(self): |
+ mock_input_api = MockInputApi() |
+ contents = ['#include "some/other/path/foo.h"', |
+ '#include "a/header.h"'] |
+ mock_file = MockFile('some/path/foo-suffix.h', contents) |
+ warnings = PRESUBMIT._CheckIncludeOrderInFile( |
+ mock_input_api, mock_file, range(1, len(contents) + 1)) |
+ self.assertEqual(0, len(warnings)) |
+ |
def testOrderAlreadyWrong(self): |
scope = [(1, '#include "b.h"'), |
(2, '#include "a.h"'), |
@@ -162,6 +171,10 @@ class IncludeOrderTest(unittest.TestCase): |
def testIfElifElseEndif(self): |
mock_input_api = MockInputApi() |
contents = ['#include "e.h"', |
+ '#define foo', |
+ '#include "f.h"', |
+ '#undef foo', |
+ '#include "e.h"', |
'#if foo', |
'#include "d.h"', |
'#elif bar', |
@@ -172,7 +185,7 @@ class IncludeOrderTest(unittest.TestCase): |
'#include "a.h"'] |
mock_file = MockFile('', contents) |
warnings = PRESUBMIT._CheckIncludeOrderInFile( |
- mock_input_api, mock_file, True, range(1, len(contents) + 1)) |
+ mock_input_api, mock_file, range(1, len(contents) + 1)) |
self.assertEqual(0, len(warnings)) |
def testSysIncludes(self): |
@@ -182,7 +195,7 @@ class IncludeOrderTest(unittest.TestCase): |
'#include <sys/a.h>'] |
mock_file = MockFile('', contents) |
warnings = PRESUBMIT._CheckIncludeOrderInFile( |
- mock_input_api, mock_file, True, range(1, len(contents) + 1)) |
+ mock_input_api, mock_file, range(1, len(contents) + 1)) |
self.assertEqual(0, len(warnings)) |