Add ICU message format support
[chromium-blink-merge.git] / tools / json_comment_eater / json_comment_eater_test.py
blob5a230eb280255647fdeb250cad4bfc34c7ebf1e7
1 #!/usr/bin/env python
2 # Copyright 2013 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.
6 from json_comment_eater import Nom
7 import unittest
9 class JsonCommentEaterTest(unittest.TestCase):
10 def _Load(self, test_name):
11 '''Loads the input and expected output for |test_name| as given by reading
12 in |test_name|.json and |test_name|_expected.json, and returns the string
13 contents as a tuple in that order.
14 '''
15 def read(file_name):
16 with open(file_name, 'r') as f:
17 return f.read()
18 return [read(pattern % test_name)
19 for pattern in ('%s.json', '%s_expected.json')]
21 def testEverything(self):
22 json, expected_json = self._Load('everything')
23 self.assertEqual(expected_json, Nom(json))
25 if __name__ == '__main__':
26 unittest.main()