proxygen
cpp.gmock_class_test.GenerateMocksTest Class Reference
Inheritance diagram for cpp.gmock_class_test.GenerateMocksTest:
cpp.gmock_class_test.TestCase cpp.gmock_class_test.TestCase cpp.gmock_class_test.TestCase

Public Member Functions

def GenerateMocks (self, cpp_source)
 
def testNamespaces (self)
 
def testClassWithStorageSpecifierMacro (self)
 
def testTemplatedForwardDeclaration (self)
 
def testTemplatedClass (self)
 
def testTemplateInATemplateTypedef (self)
 
def testTemplateInATemplateTypedefWithComma (self)
 
def GenerateMocks (self, cpp_source)
 
def testNamespaces (self)
 
def testClassWithStorageSpecifierMacro (self)
 
def testTemplatedForwardDeclaration (self)
 
def testTemplatedClass (self)
 
def testTemplateInATemplateTypedef (self)
 
def testTemplateInATemplateTypedefWithComma (self)
 
def GenerateMocks (self, cpp_source)
 
def testNamespaces (self)
 
def testClassWithStorageSpecifierMacro (self)
 
def testTemplatedForwardDeclaration (self)
 
def testTemplatedClass (self)
 
def testTemplateInATemplateTypedef (self)
 
def testTemplateInATemplateTypedefWithComma (self)
 
- Public Member Functions inherited from cpp.gmock_class_test.TestCase
def StripLeadingWhitespace (self, lines)
 
def assertEqualIgnoreLeadingWhitespace (self, expected_lines, lines)
 
def StripLeadingWhitespace (self, lines)
 
def assertEqualIgnoreLeadingWhitespace (self, expected_lines, lines)
 
def StripLeadingWhitespace (self, lines)
 
def assertEqualIgnoreLeadingWhitespace (self, expected_lines, lines)
 

Detailed Description

Definition at line 315 of file gmock_class_test.py.

Member Function Documentation

def cpp.gmock_class_test.GenerateMocksTest.GenerateMocks (   self,
  cpp_source 
)
Convert C++ source to complete Google Mock output source.

Definition at line 317 of file gmock_class_test.py.

References join, and bm.list.

Referenced by cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), cpp.gmock_class_test.GenerateMocksTest.testClassWithStorageSpecifierMacro(), cpp.gmock_class_test.GenerateMocksTest.testNamespaces(), cpp.gmock_class_test.GenerateMocksTest.testTemplatedClass(), cpp.gmock_class_test.GenerateMocksTest.testTemplatedForwardDeclaration(), cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedef(), and cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedefWithComma().

317  def GenerateMocks(self, cpp_source):
318  """Convert C++ source to complete Google Mock output source."""
319  # <test> is a pseudo-filename, it is not read or written.
320  filename = '<test>'
321  builder = ast.BuilderFromSource(cpp_source, filename)
322  ast_list = list(builder.Generate())
323  lines = gmock_class._GenerateMocks(filename, cpp_source, ast_list, None)
324  return '\n'.join(lines)
325 
Encoder::MutableCompressedList list
#define join
def cpp.gmock_class_test.GenerateMocksTest.GenerateMocks (   self,
  cpp_source 
)
Convert C++ source to complete Google Mock output source.

Definition at line 317 of file gmock_class_test.py.

References cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), join, and bm.list.

317  def GenerateMocks(self, cpp_source):
318  """Convert C++ source to complete Google Mock output source."""
319  # <test> is a pseudo-filename, it is not read or written.
320  filename = '<test>'
321  builder = ast.BuilderFromSource(cpp_source, filename)
322  ast_list = list(builder.Generate())
323  lines = gmock_class._GenerateMocks(filename, cpp_source, ast_list, None)
324  return '\n'.join(lines)
325 
Encoder::MutableCompressedList list
#define join
def cpp.gmock_class_test.GenerateMocksTest.GenerateMocks (   self,
  cpp_source 
)
Convert C++ source to complete Google Mock output source.

Definition at line 317 of file gmock_class_test.py.

References cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), join, and bm.list.

317  def GenerateMocks(self, cpp_source):
318  """Convert C++ source to complete Google Mock output source."""
319  # <test> is a pseudo-filename, it is not read or written.
320  filename = '<test>'
321  builder = ast.BuilderFromSource(cpp_source, filename)
322  ast_list = list(builder.Generate())
323  lines = gmock_class._GenerateMocks(filename, cpp_source, ast_list, None)
324  return '\n'.join(lines)
325 
Encoder::MutableCompressedList list
#define join
def cpp.gmock_class_test.GenerateMocksTest.testClassWithStorageSpecifierMacro (   self)

Definition at line 356 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testClassWithStorageSpecifierMacro().

357  source = """
358 class STORAGE_SPECIFIER Test {
359  public:
360  virtual void Foo();
361 };
362 """
363  expected = """\
364 class MockTest : public Test {
365 public:
366 MOCK_METHOD0(Foo,
367 void());
368 };
369 """
371  expected, self.GenerateMocks(source))
372 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testClassWithStorageSpecifierMacro (   self)

Definition at line 356 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testClassWithStorageSpecifierMacro().

357  source = """
358 class STORAGE_SPECIFIER Test {
359  public:
360  virtual void Foo();
361 };
362 """
363  expected = """\
364 class MockTest : public Test {
365 public:
366 MOCK_METHOD0(Foo,
367 void());
368 };
369 """
371  expected, self.GenerateMocks(source))
372 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testClassWithStorageSpecifierMacro (   self)

Definition at line 356 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), and cpp.gmock_class_test.GenerateMocksTest.GenerateMocks().

Referenced by cpp.gmock_class_test.GenerateMocksTest.testClassWithStorageSpecifierMacro().

357  source = """
358 class STORAGE_SPECIFIER Test {
359  public:
360  virtual void Foo();
361 };
362 """
363  expected = """\
364 class MockTest : public Test {
365 public:
366 MOCK_METHOD0(Foo,
367 void());
368 };
369 """
371  expected, self.GenerateMocks(source))
372 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testNamespaces (   self)

Definition at line 326 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), and cpp.gmock_class_test.GenerateMocksTest.GenerateMocks().

Referenced by cpp.gmock_class_test.GenerateMocksTest.testNamespaces().

326  def testNamespaces(self):
327  source = """
328 namespace Foo {
329 namespace Bar { class Forward; }
330 namespace Baz {
331 
332 class Test {
333  public:
334  virtual void Foo();
335 };
336 
337 } // namespace Baz
338 } // namespace Foo
339 """
340  expected = """\
341 namespace Foo {
342 namespace Baz {
343 
344 class MockTest : public Test {
345 public:
346 MOCK_METHOD0(Foo,
347 void());
348 };
349 
350 } // namespace Baz
351 } // namespace Foo
352 """
354  expected, self.GenerateMocks(source))
355 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testNamespaces (   self)

Definition at line 326 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testNamespaces().

326  def testNamespaces(self):
327  source = """
328 namespace Foo {
329 namespace Bar { class Forward; }
330 namespace Baz {
331 
332 class Test {
333  public:
334  virtual void Foo();
335 };
336 
337 } // namespace Baz
338 } // namespace Foo
339 """
340  expected = """\
341 namespace Foo {
342 namespace Baz {
343 
344 class MockTest : public Test {
345 public:
346 MOCK_METHOD0(Foo,
347 void());
348 };
349 
350 } // namespace Baz
351 } // namespace Foo
352 """
354  expected, self.GenerateMocks(source))
355 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testNamespaces (   self)

Definition at line 326 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testNamespaces().

326  def testNamespaces(self):
327  source = """
328 namespace Foo {
329 namespace Bar { class Forward; }
330 namespace Baz {
331 
332 class Test {
333  public:
334  virtual void Foo();
335 };
336 
337 } // namespace Baz
338 } // namespace Foo
339 """
340  expected = """\
341 namespace Foo {
342 namespace Baz {
343 
344 class MockTest : public Test {
345 public:
346 MOCK_METHOD0(Foo,
347 void());
348 };
349 
350 } // namespace Baz
351 } // namespace Foo
352 """
354  expected, self.GenerateMocks(source))
355 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplatedClass (   self)

Definition at line 391 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplatedClass().

392  source = """
393 template <typename S, typename T>
394 class Test {
395  public:
396  virtual void Foo();
397 };
398 """
399  expected = """\
400 template <typename T0, typename T1>
401 class MockTest : public Test<T0, T1> {
402 public:
403 MOCK_METHOD0_T(Foo,
404 void());
405 };
406 """
408  expected, self.GenerateMocks(source))
409 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplatedClass (   self)

Definition at line 391 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), and cpp.gmock_class_test.GenerateMocksTest.GenerateMocks().

Referenced by cpp.gmock_class_test.GenerateMocksTest.testTemplatedClass().

392  source = """
393 template <typename S, typename T>
394 class Test {
395  public:
396  virtual void Foo();
397 };
398 """
399  expected = """\
400 template <typename T0, typename T1>
401 class MockTest : public Test<T0, T1> {
402 public:
403 MOCK_METHOD0_T(Foo,
404 void());
405 };
406 """
408  expected, self.GenerateMocks(source))
409 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplatedClass (   self)

Definition at line 391 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplatedClass().

392  source = """
393 template <typename S, typename T>
394 class Test {
395  public:
396  virtual void Foo();
397 };
398 """
399  expected = """\
400 template <typename T0, typename T1>
401 class MockTest : public Test<T0, T1> {
402 public:
403 MOCK_METHOD0_T(Foo,
404 void());
405 };
406 """
408  expected, self.GenerateMocks(source))
409 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplatedForwardDeclaration (   self)

Definition at line 373 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplatedForwardDeclaration().

374  source = """
375 template <class T> class Forward; // Forward declaration should be ignored.
376 class Test {
377  public:
378  virtual void Foo();
379 };
380 """
381  expected = """\
382 class MockTest : public Test {
383 public:
384 MOCK_METHOD0(Foo,
385 void());
386 };
387 """
389  expected, self.GenerateMocks(source))
390 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplatedForwardDeclaration (   self)

Definition at line 373 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), and cpp.gmock_class_test.GenerateMocksTest.GenerateMocks().

Referenced by cpp.gmock_class_test.GenerateMocksTest.testTemplatedForwardDeclaration().

374  source = """
375 template <class T> class Forward; // Forward declaration should be ignored.
376 class Test {
377  public:
378  virtual void Foo();
379 };
380 """
381  expected = """\
382 class MockTest : public Test {
383 public:
384 MOCK_METHOD0(Foo,
385 void());
386 };
387 """
389  expected, self.GenerateMocks(source))
390 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplatedForwardDeclaration (   self)

Definition at line 373 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplatedForwardDeclaration().

374  source = """
375 template <class T> class Forward; // Forward declaration should be ignored.
376 class Test {
377  public:
378  virtual void Foo();
379 };
380 """
381  expected = """\
382 class MockTest : public Test {
383 public:
384 MOCK_METHOD0(Foo,
385 void());
386 };
387 """
389  expected, self.GenerateMocks(source))
390 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedef (   self)

Definition at line 410 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedef().

411  source = """
412 class Test {
413  public:
414  typedef std::vector<std::list<int>> FooType;
415  virtual void Bar(const FooType& test_arg);
416 };
417 """
418  expected = """\
419 class MockTest : public Test {
420 public:
421 MOCK_METHOD1(Bar,
422 void(const FooType& test_arg));
423 };
424 """
426  expected, self.GenerateMocks(source))
427 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedef (   self)

Definition at line 410 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), and cpp.gmock_class_test.GenerateMocksTest.GenerateMocks().

Referenced by cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedef().

411  source = """
412 class Test {
413  public:
414  typedef std::vector<std::list<int>> FooType;
415  virtual void Bar(const FooType& test_arg);
416 };
417 """
418  expected = """\
419 class MockTest : public Test {
420 public:
421 MOCK_METHOD1(Bar,
422 void(const FooType& test_arg));
423 };
424 """
426  expected, self.GenerateMocks(source))
427 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedef (   self)

Definition at line 410 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedef().

411  source = """
412 class Test {
413  public:
414  typedef std::vector<std::list<int>> FooType;
415  virtual void Bar(const FooType& test_arg);
416 };
417 """
418  expected = """\
419 class MockTest : public Test {
420 public:
421 MOCK_METHOD1(Bar,
422 void(const FooType& test_arg));
423 };
424 """
426  expected, self.GenerateMocks(source))
427 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedefWithComma (   self)

Definition at line 428 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedefWithComma().

429  source = """
430 class Test {
431  public:
432  typedef std::function<void(
433  const vector<std::list<int>>&, int> FooType;
434  virtual void Bar(const FooType& test_arg);
435 };
436 """
437  expected = """\
438 class MockTest : public Test {
439 public:
440 MOCK_METHOD1(Bar,
441 void(const FooType& test_arg));
442 };
443 """
445  expected, self.GenerateMocks(source))
446 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedefWithComma (   self)

Definition at line 428 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), cpp.gmock_class_test.GenerateMocksTest.GenerateMocks(), and cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedefWithComma().

429  source = """
430 class Test {
431  public:
432  typedef std::function<void(
433  const vector<std::list<int>>&, int> FooType;
434  virtual void Bar(const FooType& test_arg);
435 };
436 """
437  expected = """\
438 class MockTest : public Test {
439 public:
440 MOCK_METHOD1(Bar,
441 void(const FooType& test_arg));
442 };
443 """
445  expected, self.GenerateMocks(source))
446 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)
def cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedefWithComma (   self)

Definition at line 428 of file gmock_class_test.py.

References cpp.gmock_class_test.TestCase.assertEqualIgnoreLeadingWhitespace(), and cpp.gmock_class_test.GenerateMocksTest.GenerateMocks().

Referenced by cpp.gmock_class_test.GenerateMocksTest.testTemplateInATemplateTypedefWithComma().

429  source = """
430 class Test {
431  public:
432  typedef std::function<void(
433  const vector<std::list<int>>&, int> FooType;
434  virtual void Bar(const FooType& test_arg);
435 };
436 """
437  expected = """\
438 class MockTest : public Test {
439 public:
440 MOCK_METHOD1(Bar,
441 void(const FooType& test_arg));
442 };
443 """
445  expected, self.GenerateMocks(source))
446 
def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines)

The documentation for this class was generated from the following file: