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

Side by Side Diff: tools/binary_size/libsupersize/match_util_test.py

Issue 2813963002: //tools/binary_size: Consolidate most tools into "supersize" command (Closed)
Patch Set: Fix readme formatting. Make archive's --outoput-file a positional arg 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 | « tools/binary_size/libsupersize/match_util.py ('k') | tools/binary_size/libsupersize/models.py » ('j') | 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 re
6 import unittest 7 import unittest
7 8
8 import match_util 9 import match_util
9 import re
10 10
11 11
12 class MatchHelperTest(unittest.TestCase): 12 class MatchHelperTest(unittest.TestCase):
13 13
14 def testExpandRegexIdentifierPlaceholder(self): 14 def testExpandRegexIdentifierPlaceholder(self):
15 def matches(pattern, target): 15 def matches(pattern, target):
16 regex = re.compile(match_util.ExpandRegexIdentifierPlaceholder(pattern)) 16 regex = re.compile(match_util.ExpandRegexIdentifierPlaceholder(pattern))
17 return bool(regex.search(target) and regex.search(' %s ' % target)) 17 return bool(regex.search(target) and regex.search(' %s ' % target))
18 18
19 self.assertTrue(matches(r'{{hello_world}}', 'helloWorld')) 19 self.assertTrue(matches(r'{{hello_world}}', 'helloWorld'))
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 self.assertTrue(matches(r'{{_hello_world_}}', 'FOO_HELLO_WORLD')) 60 self.assertTrue(matches(r'{{_hello_world_}}', 'FOO_HELLO_WORLD'))
61 self.assertTrue(matches(r'{{_hello_world_}}', 'HELLO_WORLD_BAR')) 61 self.assertTrue(matches(r'{{_hello_world_}}', 'HELLO_WORLD_BAR'))
62 self.assertTrue(matches(r'{{_hello_world_}}', 'FooHelloWorld')) 62 self.assertTrue(matches(r'{{_hello_world_}}', 'FooHelloWorld'))
63 self.assertTrue(matches(r'{{_hello_world_}}', 'HelloWorldBar')) 63 self.assertTrue(matches(r'{{_hello_world_}}', 'HelloWorldBar'))
64 self.assertFalse(matches(r'{{_hello_world_}}', 'foohello/world')) 64 self.assertFalse(matches(r'{{_hello_world_}}', 'foohello/world'))
65 self.assertFalse(matches(r'{{_hello_world_}}', '1HELLO_WORLD')) 65 self.assertFalse(matches(r'{{_hello_world_}}', '1HELLO_WORLD'))
66 66
67 67
68 if __name__ == '__main__': 68 if __name__ == '__main__':
69 unittest.main() 69 unittest.main()
OLDNEW
« no previous file with comments | « tools/binary_size/libsupersize/match_util.py ('k') | tools/binary_size/libsupersize/models.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698