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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom_tests/parse/parser_unittest.py

Issue 394263003: Mojo: Mojom: Add missing assertEquals in test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import imp 5 import imp
6 import os.path 6 import os.path
7 import sys 7 import sys
8 import unittest 8 import unittest
9 9
10 # Disable lint check for finding modules: 10 # Disable lint check for finding modules:
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 source3 = """\ 942 source3 = """\
943 import "somedir/my1.mojom" 943 import "somedir/my1.mojom"
944 import "somedir/my2.mojom" 944 import "somedir/my2.mojom"
945 module my_module {} 945 module my_module {}
946 """ 946 """
947 expected3 = ast.Mojom( 947 expected3 = ast.Mojom(
948 ast.Module(('IDENTIFIER', 'my_module'), None), 948 ast.Module(('IDENTIFIER', 'my_module'), None),
949 ast.ImportList([ast.Import("somedir/my1.mojom"), 949 ast.ImportList([ast.Import("somedir/my1.mojom"),
950 ast.Import("somedir/my2.mojom")]), 950 ast.Import("somedir/my2.mojom")]),
951 []) 951 [])
952 self.assertEquals(parser.Parse(source3, "my_file.mojom"), expected3)
952 953
953 def testInvalidImports(self): 954 def testInvalidImports(self):
954 """Tests that invalid import statements are correctly detected.""" 955 """Tests that invalid import statements are correctly detected."""
955 956
956 source1 = """\ 957 source1 = """\
957 // Make the error occur on line 2. 958 // Make the error occur on line 2.
958 import invalid 959 import invalid
959 """ 960 """
960 with self.assertRaisesRegexp( 961 with self.assertRaisesRegexp(
961 parser.ParseError, 962 parser.ParseError,
962 r"^my_file\.mojom:2: Error: Unexpected 'invalid':\n" 963 r"^my_file\.mojom:2: Error: Unexpected 'invalid':\n"
963 r" *import invalid$"): 964 r" *import invalid$"):
964 parser.Parse(source1, "my_file.mojom") 965 parser.Parse(source1, "my_file.mojom")
965 966
966 source2 = """\ 967 source2 = """\
967 import // Missing string. 968 import // Missing string.
968 module {} 969 module {}
969 """ 970 """
970 with self.assertRaisesRegexp( 971 with self.assertRaisesRegexp(
971 parser.ParseError, 972 parser.ParseError,
972 r"^my_file\.mojom:2: Error: Unexpected 'module':\n" 973 r"^my_file\.mojom:2: Error: Unexpected 'module':\n"
973 r" *module {}$"): 974 r" *module {}$"):
974 parser.Parse(source2, "my_file.mojom") 975 parser.Parse(source2, "my_file.mojom")
975 976
976 977
977 if __name__ == "__main__": 978 if __name__ == "__main__":
978 unittest.main() 979 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698