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

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

Issue 317073005: Mojom: Add 'default' keyword for initializing structs to non-null value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 self.assertEquals(self._SingleTokenForInput("import"), 70 self.assertEquals(self._SingleTokenForInput("import"),
71 _MakeLexTokenForKeyword("import")) 71 _MakeLexTokenForKeyword("import"))
72 self.assertEquals(self._SingleTokenForInput("module"), 72 self.assertEquals(self._SingleTokenForInput("module"),
73 _MakeLexTokenForKeyword("module")) 73 _MakeLexTokenForKeyword("module"))
74 self.assertEquals(self._SingleTokenForInput("struct"), 74 self.assertEquals(self._SingleTokenForInput("struct"),
75 _MakeLexTokenForKeyword("struct")) 75 _MakeLexTokenForKeyword("struct"))
76 self.assertEquals(self._SingleTokenForInput("interface"), 76 self.assertEquals(self._SingleTokenForInput("interface"),
77 _MakeLexTokenForKeyword("interface")) 77 _MakeLexTokenForKeyword("interface"))
78 self.assertEquals(self._SingleTokenForInput("enum"), 78 self.assertEquals(self._SingleTokenForInput("enum"),
79 _MakeLexTokenForKeyword("enum")) 79 _MakeLexTokenForKeyword("enum"))
80 self.assertEquals(self._SingleTokenForInput("const"),
81 _MakeLexTokenForKeyword("const"))
82 self.assertEquals(self._SingleTokenForInput("true"),
83 _MakeLexTokenForKeyword("true"))
84 self.assertEquals(self._SingleTokenForInput("false"),
85 _MakeLexTokenForKeyword("false"))
86 self.assertEquals(self._SingleTokenForInput("default"),
87 _MakeLexTokenForKeyword("default"))
80 88
81 def testValidIdentifiers(self): 89 def testValidIdentifiers(self):
82 """Tests identifiers.""" 90 """Tests identifiers."""
83 self.assertEquals(self._SingleTokenForInput("abcd"), 91 self.assertEquals(self._SingleTokenForInput("abcd"),
84 _MakeLexToken("NAME", "abcd")) 92 _MakeLexToken("NAME", "abcd"))
85 self.assertEquals(self._SingleTokenForInput("AbC_d012_"), 93 self.assertEquals(self._SingleTokenForInput("AbC_d012_"),
86 _MakeLexToken("NAME", "AbC_d012_")) 94 _MakeLexToken("NAME", "AbC_d012_"))
87 self.assertEquals(self._SingleTokenForInput("_0123"), 95 self.assertEquals(self._SingleTokenForInput("_0123"),
88 _MakeLexToken("NAME", "_0123")) 96 _MakeLexToken("NAME", "_0123"))
89 97
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 def _SingleTokenForInput(self, input_string): 178 def _SingleTokenForInput(self, input_string):
171 """Gets the single token for the given input string. (Raises an exception if 179 """Gets the single token for the given input string. (Raises an exception if
172 the input string does not result in exactly one token.)""" 180 the input string does not result in exactly one token.)"""
173 toks = self._TokensForInput(input_string) 181 toks = self._TokensForInput(input_string)
174 assert len(toks) == 1 182 assert len(toks) == 1
175 return toks[0] 183 return toks[0]
176 184
177 185
178 if __name__ == "__main__": 186 if __name__ == "__main__":
179 unittest.main() 187 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698