proxygen
gtest_list_tests_unittest.GTestListTestsUnitTest Class Reference
Inheritance diagram for gtest_list_tests_unittest.GTestListTestsUnitTest:

Public Member Functions

def RunAndVerify (self, flag_value, expected_output_re, other_flag)
 
def testDefaultBehavior (self)
 
def testFlag (self)
 
def testOverrideNonFilterFlags (self)
 
def testWithFilterFlags (self)
 
def RunAndVerify (self, flag_value, expected_output_re, other_flag)
 
def testDefaultBehavior (self)
 
def testFlag (self)
 
def testOverrideNonFilterFlags (self)
 
def testWithFilterFlags (self)
 
def RunAndVerify (self, flag_value, expected_output_re, other_flag)
 
def testDefaultBehavior (self)
 
def testFlag (self)
 
def testOverrideNonFilterFlags (self)
 
def testWithFilterFlags (self)
 

Detailed Description

Tests using the --gtest_list_tests flag to list all tests.

Definition at line 126 of file gtest_list_tests_unittest.py.

Member Function Documentation

def gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify (   self,
  flag_value,
  expected_output_re,
  other_flag 
)
Runs gtest_list_tests_unittest_ and verifies that it prints
the correct tests.

Args:
  flag_value:         value of the --gtest_list_tests flag;
                  None if the flag should not be present.
  expected_output_re: regular expression that matches the expected
                  output after running command;
  other_flag:         a different flag to be passed to command
                  along with gtest_list_tests;
                  None if the flag should not be present.

Definition at line 129 of file gtest_list_tests_unittest.py.

References join, and gtest_list_tests_unittest.Run().

Referenced by gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_throw_on_failure_test.ThrowOnFailureTest.testDefaultBehavior(), gtest_list_tests_unittest.GTestListTestsUnitTest.testDefaultBehavior(), gtest_list_tests_unittest.GTestListTestsUnitTest.testFlag(), gtest_list_tests_unittest.GTestListTestsUnitTest.testOverrideNonFilterFlags(), gtest_throw_on_failure_test.ThrowOnFailureTest.testThrowOnFailureEnvVar(), gtest_throw_on_failure_test.ThrowOnFailureTest.testThrowOnFailureFlag(), gtest_throw_on_failure_test.ThrowOnFailureTest.testThrowOnFailureFlagOverridesEnvVar(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testWithFilterFlags().

129  def RunAndVerify(self, flag_value, expected_output_re, other_flag):
130  """Runs gtest_list_tests_unittest_ and verifies that it prints
131  the correct tests.
132 
133  Args:
134  flag_value: value of the --gtest_list_tests flag;
135  None if the flag should not be present.
136  expected_output_re: regular expression that matches the expected
137  output after running command;
138  other_flag: a different flag to be passed to command
139  along with gtest_list_tests;
140  None if the flag should not be present.
141  """
142 
143  if flag_value is None:
144  flag = ''
145  flag_expression = 'not set'
146  elif flag_value == '0':
147  flag = '--%s=0' % LIST_TESTS_FLAG
148  flag_expression = '0'
149  else:
150  flag = '--%s' % LIST_TESTS_FLAG
151  flag_expression = '1'
152 
153  args = [flag]
154 
155  if other_flag is not None:
156  args += [other_flag]
157 
158  output = Run(args)
159 
160  if expected_output_re:
161  self.assert_(
162  expected_output_re.match(output),
163  ('when %s is %s, the output of "%s" is "%s",\n'
164  'which does not match regex "%s"' %
165  (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output,
166  expected_output_re.pattern)))
167  else:
168  self.assert_(
169  not EXPECTED_OUTPUT_NO_FILTER_RE.match(output),
170  ('when %s is %s, the output of "%s" is "%s"'%
171  (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output)))
172 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
#define join
def gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify (   self,
  flag_value,
  expected_output_re,
  other_flag 
)
Runs gtest_list_tests_unittest_ and verifies that it prints
the correct tests.

Args:
  flag_value:         value of the --gtest_list_tests flag;
                  None if the flag should not be present.
  expected_output_re: regular expression that matches the expected
                  output after running command;
  other_flag:         a different flag to be passed to command
                  along with gtest_list_tests;
                  None if the flag should not be present.

Definition at line 129 of file gtest_list_tests_unittest.py.

References join, gtest_list_tests_unittest.Run(), and gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify().

129  def RunAndVerify(self, flag_value, expected_output_re, other_flag):
130  """Runs gtest_list_tests_unittest_ and verifies that it prints
131  the correct tests.
132 
133  Args:
134  flag_value: value of the --gtest_list_tests flag;
135  None if the flag should not be present.
136  expected_output_re: regular expression that matches the expected
137  output after running command;
138  other_flag: a different flag to be passed to command
139  along with gtest_list_tests;
140  None if the flag should not be present.
141  """
142 
143  if flag_value is None:
144  flag = ''
145  flag_expression = 'not set'
146  elif flag_value == '0':
147  flag = '--%s=0' % LIST_TESTS_FLAG
148  flag_expression = '0'
149  else:
150  flag = '--%s' % LIST_TESTS_FLAG
151  flag_expression = '1'
152 
153  args = [flag]
154 
155  if other_flag is not None:
156  args += [other_flag]
157 
158  output = Run(args)
159 
160  if expected_output_re:
161  self.assert_(
162  expected_output_re.match(output),
163  ('when %s is %s, the output of "%s" is "%s",\n'
164  'which does not match regex "%s"' %
165  (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output,
166  expected_output_re.pattern)))
167  else:
168  self.assert_(
169  not EXPECTED_OUTPUT_NO_FILTER_RE.match(output),
170  ('when %s is %s, the output of "%s" is "%s"'%
171  (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output)))
172 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
#define join
def gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify (   self,
  flag_value,
  expected_output_re,
  other_flag 
)
Runs gtest_list_tests_unittest_ and verifies that it prints
the correct tests.

Args:
  flag_value:         value of the --gtest_list_tests flag;
                  None if the flag should not be present.
  expected_output_re: regular expression that matches the expected
                  output after running command;
  other_flag:         a different flag to be passed to command
                  along with gtest_list_tests;
                  None if the flag should not be present.

Definition at line 129 of file gtest_list_tests_unittest.py.

References join, gtest_list_tests_unittest.Run(), and gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify().

129  def RunAndVerify(self, flag_value, expected_output_re, other_flag):
130  """Runs gtest_list_tests_unittest_ and verifies that it prints
131  the correct tests.
132 
133  Args:
134  flag_value: value of the --gtest_list_tests flag;
135  None if the flag should not be present.
136  expected_output_re: regular expression that matches the expected
137  output after running command;
138  other_flag: a different flag to be passed to command
139  along with gtest_list_tests;
140  None if the flag should not be present.
141  """
142 
143  if flag_value is None:
144  flag = ''
145  flag_expression = 'not set'
146  elif flag_value == '0':
147  flag = '--%s=0' % LIST_TESTS_FLAG
148  flag_expression = '0'
149  else:
150  flag = '--%s' % LIST_TESTS_FLAG
151  flag_expression = '1'
152 
153  args = [flag]
154 
155  if other_flag is not None:
156  args += [other_flag]
157 
158  output = Run(args)
159 
160  if expected_output_re:
161  self.assert_(
162  expected_output_re.match(output),
163  ('when %s is %s, the output of "%s" is "%s",\n'
164  'which does not match regex "%s"' %
165  (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output,
166  expected_output_re.pattern)))
167  else:
168  self.assert_(
169  not EXPECTED_OUTPUT_NO_FILTER_RE.match(output),
170  ('when %s is %s, the output of "%s" is "%s"'%
171  (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output)))
172 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
#define join
def gtest_list_tests_unittest.GTestListTestsUnitTest.testDefaultBehavior (   self)
Tests the behavior of the default mode.

Definition at line 173 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), and gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify().

Referenced by gtest_list_tests_unittest.GTestListTestsUnitTest.testDefaultBehavior().

174  """Tests the behavior of the default mode."""
175 
176  self.RunAndVerify(flag_value=None,
177  expected_output_re=None,
178  other_flag=None)
179 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testDefaultBehavior (   self)
Tests the behavior of the default mode.

Definition at line 173 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testDefaultBehavior().

174  """Tests the behavior of the default mode."""
175 
176  self.RunAndVerify(flag_value=None,
177  expected_output_re=None,
178  other_flag=None)
179 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testDefaultBehavior (   self)
Tests the behavior of the default mode.

Definition at line 173 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testDefaultBehavior().

174  """Tests the behavior of the default mode."""
175 
176  self.RunAndVerify(flag_value=None,
177  expected_output_re=None,
178  other_flag=None)
179 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testFlag (   self)
Tests using the --gtest_list_tests flag.

Definition at line 180 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testFlag().

180  def testFlag(self):
181  """Tests using the --gtest_list_tests flag."""
182 
183  self.RunAndVerify(flag_value='0',
184  expected_output_re=None,
185  other_flag=None)
186  self.RunAndVerify(flag_value='1',
187  expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
188  other_flag=None)
189 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testFlag (   self)
Tests using the --gtest_list_tests flag.

Definition at line 180 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testFlag().

180  def testFlag(self):
181  """Tests using the --gtest_list_tests flag."""
182 
183  self.RunAndVerify(flag_value='0',
184  expected_output_re=None,
185  other_flag=None)
186  self.RunAndVerify(flag_value='1',
187  expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
188  other_flag=None)
189 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testFlag (   self)
Tests using the --gtest_list_tests flag.

Definition at line 180 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), and gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify().

Referenced by gtest_list_tests_unittest.GTestListTestsUnitTest.testFlag().

180  def testFlag(self):
181  """Tests using the --gtest_list_tests flag."""
182 
183  self.RunAndVerify(flag_value='0',
184  expected_output_re=None,
185  other_flag=None)
186  self.RunAndVerify(flag_value='1',
187  expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
188  other_flag=None)
189 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testOverrideNonFilterFlags (   self)
Tests that --gtest_list_tests overrides the non-filter flags.

Definition at line 190 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testOverrideNonFilterFlags().

191  """Tests that --gtest_list_tests overrides the non-filter flags."""
192 
193  self.RunAndVerify(flag_value='1',
194  expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
195  other_flag='--gtest_break_on_failure')
196 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testOverrideNonFilterFlags (   self)
Tests that --gtest_list_tests overrides the non-filter flags.

Definition at line 190 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), and gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify().

Referenced by gtest_list_tests_unittest.GTestListTestsUnitTest.testOverrideNonFilterFlags().

191  """Tests that --gtest_list_tests overrides the non-filter flags."""
192 
193  self.RunAndVerify(flag_value='1',
194  expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
195  other_flag='--gtest_break_on_failure')
196 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testOverrideNonFilterFlags (   self)
Tests that --gtest_list_tests overrides the non-filter flags.

Definition at line 190 of file gtest_list_tests_unittest.py.

References gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testOverrideNonFilterFlags().

191  """Tests that --gtest_list_tests overrides the non-filter flags."""
192 
193  self.RunAndVerify(flag_value='1',
194  expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
195  other_flag='--gtest_break_on_failure')
196 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testWithFilterFlags (   self)
Tests that --gtest_list_tests takes into account the
--gtest_filter flag.

Definition at line 197 of file gtest_list_tests_unittest.py.

References gtest_test_utils.Main(), gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testWithFilterFlags().

198  """Tests that --gtest_list_tests takes into account the
199  --gtest_filter flag."""
200 
201  self.RunAndVerify(flag_value='1',
202  expected_output_re=EXPECTED_OUTPUT_FILTER_FOO_RE,
203  other_flag='--gtest_filter=Foo*')
204 
205 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testWithFilterFlags (   self)
Tests that --gtest_list_tests takes into account the
--gtest_filter flag.

Definition at line 197 of file gtest_list_tests_unittest.py.

References gtest_test_utils.Main(), gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify(), and gtest_list_tests_unittest.GTestListTestsUnitTest.testWithFilterFlags().

198  """Tests that --gtest_list_tests takes into account the
199  --gtest_filter flag."""
200 
201  self.RunAndVerify(flag_value='1',
202  expected_output_re=EXPECTED_OUTPUT_FILTER_FOO_RE,
203  other_flag='--gtest_filter=Foo*')
204 
205 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)
def gtest_list_tests_unittest.GTestListTestsUnitTest.testWithFilterFlags (   self)
Tests that --gtest_list_tests takes into account the
--gtest_filter flag.

Definition at line 197 of file gtest_list_tests_unittest.py.

References gtest_test_utils.Main(), gtest_break_on_failure_unittest.GTestBreakOnFailureUnitTest.RunAndVerify(), gtest_list_tests_unittest.GTestListTestsUnitTest.RunAndVerify(), and gtest_filter_unittest.GTestFilterUnitTest.RunAndVerify().

Referenced by gtest_list_tests_unittest.GTestListTestsUnitTest.testWithFilterFlags().

198  """Tests that --gtest_list_tests takes into account the
199  --gtest_filter flag."""
200 
201  self.RunAndVerify(flag_value='1',
202  expected_output_re=EXPECTED_OUTPUT_FILTER_FOO_RE,
203  other_flag='--gtest_filter=Foo*')
204 
205 
def RunAndVerify(self, flag_value, expected_output_re, other_flag)

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