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

Unified Diff: build/android/gyp/java_cpp_enum_tests.py

Issue 934873002: Improve CLI interface of C++ enums to Java generator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments & rebased Created 5 years, 10 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 | « build/android/gyp/java_cpp_enum.py ('k') | build/android/java_cpp_enum.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/java_cpp_enum_tests.py
diff --git a/build/android/gyp/java_cpp_enum_tests.py b/build/android/gyp/java_cpp_enum_tests.py
index 75e6671ed1616f4601dc07090f9ac7d60609f683..44f9766c82c98d6c6bab67764d89ee4bc6640282 100755
--- a/build/android/gyp/java_cpp_enum_tests.py
+++ b/build/android/gyp/java_cpp_enum_tests.py
@@ -14,6 +14,7 @@ import os
import sys
import unittest
+import java_cpp_enum
from java_cpp_enum import EnumDefinition, GenerateOutput, GetScriptName
from java_cpp_enum import HeaderParser
@@ -151,6 +152,14 @@ public class ClassName {
with self.assertRaises(Exception):
HeaderParser(test_data).ParseDefinitions()
+ def testParseReturnsEmptyListWithoutDirectives(self):
+ test_data = """
+ enum EnumName {
+ VALUE_ONE,
+ };
+ """.split('\n')
+ self.assertEqual([], HeaderParser(test_data).ParseDefinitions())
+
def testParseEnumClass(self):
test_data = """
// GENERATED_JAVA_ENUM_PACKAGE: test.namespace
@@ -403,6 +412,15 @@ public class ClassName {
definition.Finalize()
self.assertEqual(['A', 'B', 'NAME_LAST'], definition.entries.keys())
+ def testGenerateThrowsOnEmptyInput(self):
+ with self.assertRaises(Exception):
+ original_do_parse = java_cpp_enum.DoParseHeaderFile
+ try:
+ java_cpp_enum.DoParseHeaderFile = lambda _: []
+ java_cpp_enum.DoGenerate('dir', ['file'])
+ finally:
+ java_cpp_enum.DoParseHeaderFile = original_do_parse
+
def main(argv):
parser = optparse.OptionParser()
parser.add_option("--stamp", help="File to touch on success.")
« no previous file with comments | « build/android/gyp/java_cpp_enum.py ('k') | build/android/java_cpp_enum.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698