Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: build/check_gn_headers_unittest.py

Issue 2844623002: Revert of Optimize check_gn_headers.py for speed (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/check_gn_headers.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2017 The Chromium Authors. All rights reserved. 2 # Copyright 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import logging 6 import logging
7 import json 7 import json
8 import os 8 import os
9 import unittest 9 import unittest
10 import check_gn_headers 10 import check_gn_headers
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 a/b/c/white-end.c # comment 51 a/b/c/white-end.c # comment
52 dir/white-both.c #more comment 52 dir/white-both.c #more comment
53 53
54 # empty line above 54 # empty line above
55 a/b/c 55 a/b/c
56 ''' 56 '''
57 57
58 58
59 class CheckGnHeadersTest(unittest.TestCase): 59 class CheckGnHeadersTest(unittest.TestCase):
60 def testNinja(self): 60 def testNinja(self):
61 headers = check_gn_headers.ParseNinjaDepsOutput(ninja_input.split('\n')) 61 headers = check_gn_headers.ParseNinjaDepsOutput(ninja_input)
62 expected = set([ 62 expected = set([
63 'dir/path/b.h', 63 'dir/path/b.h',
64 'c.hh', 64 'c.hh',
65 'dir3/path/b.h', 65 'dir3/path/b.h',
66 'c3.hh', 66 'c3.hh',
67 ]) 67 ])
68 self.assertEquals(headers, expected) 68 self.assertEquals(headers, expected)
69 69
70 def testNinjaWin(self): 70 def testNinjaWin(self):
71 old_sep = os.sep 71 old_sep = os.sep
72 os.sep = '\\' 72 os.sep = '\\'
73 73
74 headers = check_gn_headers.ParseNinjaDepsOutput( 74 headers = check_gn_headers.ParseNinjaDepsOutput(ninja_input_win)
75 ninja_input_win.split('\n'))
76 expected = set([ 75 expected = set([
77 'dir\\path\\b.h', 76 'dir\\path\\b.h',
78 'c.hh', 77 'c.hh',
79 'dir3\\path\\b.h', 78 'dir3\\path\\b.h',
80 'c3.hh', 79 'c3.hh',
81 ]) 80 ])
82 self.assertEquals(headers, expected) 81 self.assertEquals(headers, expected)
83 82
84 os.sep = old_sep 83 os.sep = old_sep
85 84
(...skipping 12 matching lines...) Expand all
98 'a/b/c/white-end.c', 97 'a/b/c/white-end.c',
99 'dir/white-both.c', 98 'dir/white-both.c',
100 'a/b/c', 99 'a/b/c',
101 ]) 100 ])
102 self.assertEquals(output, expected) 101 self.assertEquals(output, expected)
103 102
104 103
105 if __name__ == '__main__': 104 if __name__ == '__main__':
106 logging.getLogger().setLevel(logging.DEBUG) 105 logging.getLogger().setLevel(logging.DEBUG)
107 unittest.main(verbosity=2) 106 unittest.main(verbosity=2)
OLDNEW
« no previous file with comments | « build/check_gn_headers.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698