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

Unified Diff: tools/generate_stubs/generate_stubs_unittest.py

Issue 403493004: generate_stubs: Add a new option --export-macro. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/generate_stubs/generate_stubs.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/generate_stubs/generate_stubs_unittest.py
diff --git a/tools/generate_stubs/generate_stubs_unittest.py b/tools/generate_stubs/generate_stubs_unittest.py
index 6cea445cf0507c872ff43e496e256181b3482411..85a74c086b7e7da9bb3f308b075563a2521d96da 100755
--- a/tools/generate_stubs/generate_stubs_unittest.py
+++ b/tools/generate_stubs/generate_stubs_unittest.py
@@ -165,7 +165,7 @@ class PosixStubWriterUnittest(unittest.TestCase):
self.module_name = 'my_module-1'
self.signatures = [sig[1] for sig in SIMPLE_SIGNATURES]
self.out_dir = 'out_dir'
- self.writer = gs.PosixStubWriter(self.module_name, self.signatures)
+ self.writer = gs.PosixStubWriter(self.module_name, '', self.signatures)
def testEnumName(self):
self.assertEqual('kModuleMy_module1',
@@ -193,16 +193,24 @@ class PosixStubWriterUnittest(unittest.TestCase):
def testStubFunction(self):
# Test for a signature with a return value and a parameter.
self.assertEqual("""extern int foo(int a) __attribute__((weak));
-int foo(int a) {
+int foo(int a) {
return foo_ptr(a);
}""", gs.PosixStubWriter.StubFunction(SIMPLE_SIGNATURES[0][1]))
# Test for a signature with a void return value and no parameters.
self.assertEqual("""extern void waldo(void) __attribute__((weak));
-void waldo(void) {
+void waldo(void) {
waldo_ptr();
}""", gs.PosixStubWriter.StubFunction(SIMPLE_SIGNATURES[4][1]))
+ # Test export macros.
+ sig = _MakeSignature('int*', 'foo', ['bool b'])
+ sig['export'] = 'TEST_EXPORT'
+ self.assertEqual("""extern int* foo(bool b) __attribute__((weak));
+int* TEST_EXPORT foo(bool b) {
+ return foo_ptr(b);
+}""", gs.PosixStubWriter.StubFunction(sig))
+
def testWriteImplemenationContents(self):
outfile = StringIO.StringIO()
self.writer.WriteImplementationContents('my_namespace', outfile)
« no previous file with comments | « tools/generate_stubs/generate_stubs.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698