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

Unified Diff: tools/lexer_generator/term_test.py

Issue 152513004: Experimental parser: some tuple removal (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/lexer_generator/rule_parser.py ('k') | tools/lexer_generator/test_suite.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/term_test.py
diff --git a/tools/lexer_generator/code_generator_test.py b/tools/lexer_generator/term_test.py
similarity index 67%
copy from tools/lexer_generator/code_generator_test.py
copy to tools/lexer_generator/term_test.py
index d09ac0d170bd089aafc070d731217df2d956ba0e..8e60e1eec4c4e92003e50f2939ae894ae051de25 100644
--- a/tools/lexer_generator/code_generator_test.py
+++ b/tools/lexer_generator/term_test.py
@@ -1,4 +1,4 @@
-# Copyright 2013 the V8 project authors. All rights reserved.
+# Copyright 2014 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
@@ -26,18 +26,26 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import unittest
-from code_generator import CodeGenerator
-from rule_parser import RuleProcessor
+from automaton import Term
-class CodeGeneratorTestCase(unittest.TestCase):
+class TermTestCase(unittest.TestCase):
- def test_simple(self):
- rules = '''
- <<default>>
- "(" <|LBRACE|>
- ")" <|RBRACE|>
+ def test_basic(self):
- "foo" <|FOO|>
- eos <terminate>
- default_action <DEFAULT>'''
- CodeGenerator(RuleProcessor.parse(rules, 'latin1'))
+ t = Term('a')
+ self.assertEqual('a', t.name())
+ self.assertEqual((), t.args())
+ self.assertEqual("(a)", str(t))
+ self.assertEqual(Term('a'), t)
+
+ t = Term('a', 'b', 'c')
+ self.assertEqual('a', t.name())
+ self.assertEqual(('b', 'c'), t.args())
+ self.assertEqual("(a,b,c)", str(t))
+ self.assertEqual(Term('a', 'b', 'c'), t)
+
+ t = Term('a', Term('b', 'c'))
+ self.assertEqual('a', t.name())
+ self.assertEqual((Term('b', 'c'), ), t.args())
+ self.assertEqual("(a,(b,c))", str(t))
+ self.assertEqual(Term('a', Term('b', 'c')), t)
« no previous file with comments | « tools/lexer_generator/rule_parser.py ('k') | tools/lexer_generator/test_suite.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698