| OLD | NEW |
| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 self.assertEquals(self._SingleTokenForInput("|"), | 136 self.assertEquals(self._SingleTokenForInput("|"), |
| 137 _MakeLexToken("OR", "|")) | 137 _MakeLexToken("OR", "|")) |
| 138 self.assertEquals(self._SingleTokenForInput("~"), | 138 self.assertEquals(self._SingleTokenForInput("~"), |
| 139 _MakeLexToken("NOT", "~")) | 139 _MakeLexToken("NOT", "~")) |
| 140 self.assertEquals(self._SingleTokenForInput("^"), | 140 self.assertEquals(self._SingleTokenForInput("^"), |
| 141 _MakeLexToken("XOR", "^")) | 141 _MakeLexToken("XOR", "^")) |
| 142 self.assertEquals(self._SingleTokenForInput("<<"), | 142 self.assertEquals(self._SingleTokenForInput("<<"), |
| 143 _MakeLexToken("LSHIFT", "<<")) | 143 _MakeLexToken("LSHIFT", "<<")) |
| 144 self.assertEquals(self._SingleTokenForInput(">>"), | 144 self.assertEquals(self._SingleTokenForInput(">>"), |
| 145 _MakeLexToken("RSHIFT", ">>")) | 145 _MakeLexToken("RSHIFT", ">>")) |
| 146 self.assertEquals(self._SingleTokenForInput("&"), |
| 147 _MakeLexToken("AMP", "&")) |
| 146 self.assertEquals(self._SingleTokenForInput("="), | 148 self.assertEquals(self._SingleTokenForInput("="), |
| 147 _MakeLexToken("EQUALS", "=")) | 149 _MakeLexToken("EQUALS", "=")) |
| 148 self.assertEquals(self._SingleTokenForInput("=>"), | 150 self.assertEquals(self._SingleTokenForInput("=>"), |
| 149 _MakeLexToken("RESPONSE", "=>")) | 151 _MakeLexToken("RESPONSE", "=>")) |
| 150 self.assertEquals(self._SingleTokenForInput("("), | 152 self.assertEquals(self._SingleTokenForInput("("), |
| 151 _MakeLexToken("LPAREN", "(")) | 153 _MakeLexToken("LPAREN", "(")) |
| 152 self.assertEquals(self._SingleTokenForInput(")"), | 154 self.assertEquals(self._SingleTokenForInput(")"), |
| 153 _MakeLexToken("RPAREN", ")")) | 155 _MakeLexToken("RPAREN", ")")) |
| 154 self.assertEquals(self._SingleTokenForInput("["), | 156 self.assertEquals(self._SingleTokenForInput("["), |
| 155 _MakeLexToken("LBRACKET", "[")) | 157 _MakeLexToken("LBRACKET", "[")) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 184 def _SingleTokenForInput(self, input_string): | 186 def _SingleTokenForInput(self, input_string): |
| 185 """Gets the single token for the given input string. (Raises an exception if | 187 """Gets the single token for the given input string. (Raises an exception if |
| 186 the input string does not result in exactly one token.)""" | 188 the input string does not result in exactly one token.)""" |
| 187 toks = self._TokensForInput(input_string) | 189 toks = self._TokensForInput(input_string) |
| 188 assert len(toks) == 1 | 190 assert len(toks) == 1 |
| 189 return toks[0] | 191 return toks[0] |
| 190 | 192 |
| 191 | 193 |
| 192 if __name__ == "__main__": | 194 if __name__ == "__main__": |
| 193 unittest.main() | 195 unittest.main() |
| OLD | NEW |