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

Side by Side Diff: grit/format/check_dups_unittest.py

Issue 1056993003: check_dups: Add a script to check for the same resource in multiple pak files. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: . Created 5 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 | « grit/format/check_dups.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 '''Unit tests for grit.format.check_dups'''
7
8 import os
9 import sys
10 if __name__ == '__main__':
11 sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
12
13 import tempfile
14 import unittest
15
16 from grit.format import check_dups
17 from grit.format import data_pack
18
19 class CheckDupsUnittest(unittest.TestCase):
20 def testDuplicateResource(self):
21 first = {1: '', 4: 'this is id 4', 6: 'this is id 6', 10: ''}
22 first_pak = data_pack.WriteDataPackToString(first, data_pack.UTF8)
23 first_file = tempfile.NamedTemporaryFile()
24 first_file.write(first_pak)
25 first_file.flush()
26
27 second = {2: 'resource 2', 3: 'resource 3', 4: 'resource 4'}
28 second_pak = data_pack.WriteDataPackToString(second, data_pack.UTF8)
29 second_file = tempfile.NamedTemporaryFile()
30 second_file.write(second_pak)
31 second_file.flush()
32
33 exception_thrown = False
34 try:
35 check_dups.CheckDupResource([first_file.name, second_file.name])
36 except check_dups.ResourceDuplicateException:
37 exception_thrown = True
38 self.failUnless(exception_thrown)
39
40
41 if __name__ == '__main__':
42 unittest.main()
OLDNEW
« no previous file with comments | « grit/format/check_dups.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698