| 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)
|
|
|