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

Unified Diff: tools/lexer_generator/code_generator_test.py

Issue 71273003: Experimental lexer generator: add a test for the code generator. (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/code_generator.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/code_generator_test.py
diff --git a/WATCHLISTS b/tools/lexer_generator/code_generator_test.py
similarity index 77%
copy from WATCHLISTS
copy to tools/lexer_generator/code_generator_test.py
index 9c2bce9c5589c22649b4a2c94837f00c8d669be1..92ed6f971228b37e3baf0dd5842807c800f0d9ac 100644
--- a/WATCHLISTS
+++ b/tools/lexer_generator/code_generator_test.py
@@ -25,22 +25,20 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Watchlist Rules
-# Refer: http://dev.chromium.org/developers/contributing-code/watchlists
+import unittest
+from code_generator import CodeGenerator
+from rule_parser import RuleProcessor
-# IMPORTANT: The regular expression filepath is tested against each path using
-# re.search, so it is not usually necessary to add .*.
+class CodeGeneratorTestCase(unittest.TestCase):
-{
- 'WATCHLIST_DEFINITIONS': {
- 'public_api': {
- 'filepath': 'include/',
- },
- },
+ def test_simple(self):
+ rules = '''
+ <default>
+ "(" { LBRACE }
+ ")" { RBRACE }
- 'WATCHLISTS': {
- 'public_api': [
- 'phajdan.jr@chromium.org',
- ],
- },
-}
+ "foo" { FOO }
+ eof <<terminate>>'''
+ rule_processor = RuleProcessor.parse(rules)
+ (nfa, dfa) = rule_processor.default_automata()
+ CodeGenerator.dfa_to_code(dfa)
« no previous file with comments | « tools/lexer_generator/code_generator.py ('k') | tools/lexer_generator/test_suite.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698