Home | History | Annotate | Download | only in DummySubDir
      1 #!/usr/bin/env python
      2 
      3 import sys
      4 
      5 if len(sys.argv) != 2:
      6     raise ValueError("unexpected number of args")
      7 
      8 if sys.argv[1] == "--gtest_list_tests":
      9     print("""\
     10 Running main() from gtest_main.cc
     11 FirstTest.
     12   subTestA
     13   subTestB
     14 ParameterizedTest/0.
     15   subTest
     16 ParameterizedTest/1.
     17   subTest""")
     18     sys.exit(0)
     19 elif not sys.argv[1].startswith("--gtest_filter="):
     20     raise ValueError("unexpected argument: %r" % (sys.argv[1]))
     21 
     22 test_name = sys.argv[1].split('=',1)[1]
     23 print('Running main() from gtest_main.cc')
     24 if test_name == 'FirstTest.subTestA':
     25     print('I am subTest A, I PASS')
     26     print('[  PASSED  ] 1 test.')
     27     sys.exit(0)
     28 elif test_name == 'FirstTest.subTestB':
     29     print('I am subTest B, I FAIL')
     30     print('And I have two lines of output')
     31     sys.exit(1)
     32 elif test_name in ('ParameterizedTest/0.subTest',
     33                    'ParameterizedTest/1.subTest'):
     34     print('I am a parameterized test, I also PASS')
     35     print('[  PASSED  ] 1 test.')
     36     sys.exit(0)
     37 else:
     38     raise SystemExit("error: invalid test name: %r" % (test_name,))
     39