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

Side by Side Diff: build/check_gn_headers_unittest.py

Issue 2905863002: Revert of Add helpful error messages to check_gn_headers.py (Closed)
Patch Set: Created 3 years, 7 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 26 matching lines...) Expand all
37 "targets": { 37 "targets": {
38 "//:All": { 38 "//:All": {
39 }, 39 },
40 "//:base": { 40 "//:base": {
41 "public": [ "//base/p.h" ], 41 "public": [ "//base/p.h" ],
42 "sources": [ "//base/a.cc", "//base/a.h", "//base/b.hh" ], 42 "sources": [ "//base/a.cc", "//base/a.h", "//base/b.hh" ],
43 "visibility": [ "*" ] 43 "visibility": [ "*" ]
44 }, 44 },
45 "//:star_public": { 45 "//:star_public": {
46 "public": "*", 46 "public": "*",
47 "sources": [ "//base/c.h", "//tmp/gen/a.h" ], 47 "sources": [ "//base/c.h" ],
48 "visibility": [ "*" ] 48 "visibility": [ "*" ]
49 } 49 }
50 } 50 }
51 } 51 }
52 ''') 52 ''')
53 53
54 54
55 whitelist = r''' 55 whitelist = r'''
56 white-front.c 56 white-front.c
57 a/b/c/white-end.c # comment 57 a/b/c/white-end.c # comment
(...skipping 25 matching lines...) Expand all
83 'dir\\path\\b.h', 83 'dir\\path\\b.h',
84 'c.hh', 84 'c.hh',
85 'dir3\\path\\b.h', 85 'dir3\\path\\b.h',
86 'c3.hh', 86 'c3.hh',
87 ]) 87 ])
88 self.assertEquals(headers, expected) 88 self.assertEquals(headers, expected)
89 89
90 os.sep = old_sep 90 os.sep = old_sep
91 91
92 def testGn(self): 92 def testGn(self):
93 headers = check_gn_headers.ParseGNProjectJSON(gn_input, 93 headers = check_gn_headers.ParseGNProjectJSON(gn_input)
94 'out/Release', 'tmp')
95 expected = set([ 94 expected = set([
96 'base/a.h', 95 'base/a.h',
97 'base/b.hh', 96 'base/b.hh',
98 'base/c.h', 97 'base/c.h',
99 'base/p.h', 98 'base/p.h',
100 'out/Release/gen/a.h',
101 ]) 99 ])
102 self.assertEquals(headers, expected) 100 self.assertEquals(headers, expected)
103 101
104 def testWhitelist(self): 102 def testWhitelist(self):
105 output = check_gn_headers.ParseWhiteList(whitelist) 103 output = check_gn_headers.ParseWhiteList(whitelist)
106 expected = set([ 104 expected = set([
107 'white-front.c', 105 'white-front.c',
108 'a/b/c/white-end.c', 106 'a/b/c/white-end.c',
109 'dir/white-both.c', 107 'dir/white-both.c',
110 'a/b/c', 108 'a/b/c',
111 ]) 109 ])
112 self.assertEquals(output, expected) 110 self.assertEquals(output, expected)
113 111
114 112
115 if __name__ == '__main__': 113 if __name__ == '__main__':
116 logging.getLogger().setLevel(logging.DEBUG) 114 logging.getLogger().setLevel(logging.DEBUG)
117 unittest.main(verbosity=2) 115 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