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

Unified Diff: tools/lexer_generator/lexer_test.py

Issue 71313002: Experimental parser: action refactor (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/lexer_generator/dfa.py ('k') | tools/lexer_generator/nfa.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/lexer_test.py
diff --git a/tools/lexer_generator/lexer_test.py b/tools/lexer_generator/lexer_test.py
index f2c4159e0b5f948b614e27611393d85b76edec4f..587acbbeaed3932951353a8212b7eed2714bdcce 100644
--- a/tools/lexer_generator/lexer_test.py
+++ b/tools/lexer_generator/lexer_test.py
@@ -26,16 +26,18 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import unittest
+from automaton import Action
from rule_parser import RuleProcessor
class LexerTestCase(unittest.TestCase):
- def __verify_action_stream(self, rules, string, expected_stream):
- expected_stream.append(('terminate', '\0'))
+ def __verify_action_stream(self, rules, string, expected):
+ expected = map(lambda (action, s) : (Action('code', action), s), expected)
+ expected.append((Action('terminate'), '\0'))
rule_processor = RuleProcessor.parse(rules)
for i, (action, start, stop) in enumerate(rule_processor.lex(string)):
- self.assertEquals(expected_stream[i][0], action)
- self.assertEquals(expected_stream[i][1], string[start : stop])
+ self.assertEquals(expected[i][0], action)
+ self.assertEquals(expected[i][1], string[start : stop])
def test_simple(self):
rules = '''
« no previous file with comments | « tools/lexer_generator/dfa.py ('k') | tools/lexer_generator/nfa.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698