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

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

Issue 291173010: Mojo: Mojom: Remove support for octal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 _MakeLexToken("INT_CONST_DEC", "10")) 108 _MakeLexToken("INT_CONST_DEC", "10"))
109 109
110 def testValidTokens(self): 110 def testValidTokens(self):
111 """Tests valid tokens (which aren't tested elsewhere).""" 111 """Tests valid tokens (which aren't tested elsewhere)."""
112 # Keywords tested in |testValidKeywords|. 112 # Keywords tested in |testValidKeywords|.
113 # NAME tested in |testValidIdentifiers|. 113 # NAME tested in |testValidIdentifiers|.
114 self.assertEquals(self._SingleTokenForInput("@123"), 114 self.assertEquals(self._SingleTokenForInput("@123"),
115 _MakeLexToken("ORDINAL", "@123")) 115 _MakeLexToken("ORDINAL", "@123"))
116 self.assertEquals(self._SingleTokenForInput("456"), 116 self.assertEquals(self._SingleTokenForInput("456"),
117 _MakeLexToken("INT_CONST_DEC", "456")) 117 _MakeLexToken("INT_CONST_DEC", "456"))
118 self.assertEquals(self._SingleTokenForInput("0765"),
119 _MakeLexToken("INT_CONST_OCT", "0765"))
120 self.assertEquals(self._SingleTokenForInput("0x01aB2eF3"), 118 self.assertEquals(self._SingleTokenForInput("0x01aB2eF3"),
121 _MakeLexToken("INT_CONST_HEX", "0x01aB2eF3")) 119 _MakeLexToken("INT_CONST_HEX", "0x01aB2eF3"))
122 self.assertEquals(self._SingleTokenForInput("123.456"), 120 self.assertEquals(self._SingleTokenForInput("123.456"),
123 _MakeLexToken("FLOAT_CONST", "123.456")) 121 _MakeLexToken("FLOAT_CONST", "123.456"))
124 self.assertEquals(self._SingleTokenForInput("'x'"), 122 self.assertEquals(self._SingleTokenForInput("'x'"),
125 _MakeLexToken("CHAR_CONST", "'x'")) 123 _MakeLexToken("CHAR_CONST", "'x'"))
126 self.assertEquals(self._SingleTokenForInput("\"hello\""), 124 self.assertEquals(self._SingleTokenForInput("\"hello\""),
127 _MakeLexToken("STRING_LITERAL", "\"hello\"")) 125 _MakeLexToken("STRING_LITERAL", "\"hello\""))
128 self.assertEquals(self._SingleTokenForInput("+"), 126 self.assertEquals(self._SingleTokenForInput("+"),
129 _MakeLexToken("PLUS", "+")) 127 _MakeLexToken("PLUS", "+"))
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 def _SingleTokenForInput(self, input_string): 184 def _SingleTokenForInput(self, input_string):
187 """Gets the single token for the given input string. (Raises an exception if 185 """Gets the single token for the given input string. (Raises an exception if
188 the input string does not result in exactly one token.)""" 186 the input string does not result in exactly one token.)"""
189 toks = self._TokensForInput(input_string) 187 toks = self._TokensForInput(input_string)
190 assert len(toks) == 1 188 assert len(toks) == 1
191 return toks[0] 189 return toks[0]
192 190
193 191
194 if __name__ == "__main__": 192 if __name__ == "__main__":
195 unittest.main() 193 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698