def test_extra_args_with_sep(self): """ If there are multiple '--' separators, subsequent ones are forwarded verbatim as part of extra arguments. """ argv = ['iwyu_tool.py', '-p', '.', '--', 'arg1', '--', 'another_arg1'] iwyu_tool._bootstrap(argv) self.assertEqual(['arg1', '--', 'another_arg1'], self.main.call_args['extra_args'])
def test_extra_args_with_sep(self): """ If there are multiple '--' separators, subsequent ones are forwarded verbatim as part of extra arguments. """ argv = ['iwyu_tool.py', '-p', '.', '--', 'arg1', '--', 'another_arg1'] iwyu_tool._bootstrap(argv) self.assertEqual(['arg1', '--', 'another_arg1'], self.main.call_args['extra_args'])
def test_argparse_args(self): """ Argparse arguments are forwarded to main. """ argv = ['iwyu_tool.py', '-v', '-o', 'clang', '-j', '12', '-p', '.', 'src1', 'src2'] iwyu_tool._bootstrap(argv) self.assertEqual('.', self.main.call_args['compilation_db_path']) self.assertEqual(['src1', 'src2'], self.main.call_args['source_files']) self.assertEqual(True, self.main.call_args['verbose']) self.assertEqual(iwyu_tool.FORMATTERS['clang'], self.main.call_args['formatter']) self.assertEqual(12, self.main.call_args['jobs']) self.assertEqual([], self.main.call_args['extra_args'])
def test_argparse_args(self): """ Argparse arguments are forwarded to main. """ argv = ['iwyu_tool.py', '-v', '-o', 'clang', '-j', '12', '-p', '.', 'src1', 'src2'] iwyu_tool._bootstrap(argv) self.assertEqual('.', self.main.call_args['compilation_db_path']) self.assertEqual(['src1', 'src2'], self.main.call_args['source_files']) self.assertEqual(True, self.main.call_args['verbose']) self.assertEqual(iwyu_tool.FORMATTERS['clang'], self.main.call_args['formatter']) self.assertEqual(12, self.main.call_args['jobs']) self.assertEqual([], self.main.call_args['extra_args'])
def test_extra_iwyu_args(self): """ Extra arguments with '-Xiwyu' prefix are forwarded verbatim. """ argv = ['iwyu_tool.py', '-p', '.', '--', '-Xiwyu', '--arg'] iwyu_tool._bootstrap(argv) self.assertEqual(['-Xiwyu', '--arg'], self.main.call_args['extra_args'])
def test_extra_args(self): """ Extra arguments after '--' are forwarded to main. """ argv = ['iwyu_tool.py', '-p', '.', '--', '-extra1', '-extra2'] iwyu_tool._bootstrap(argv) self.assertEqual(['-extra1', '-extra2'], self.main.call_args['extra_args'])
def test_extra_iwyu_args(self): """ Extra arguments with '-Xiwyu' prefix are forwarded verbatim. """ argv = ['iwyu_tool.py', '-p', '.', '--', '-Xiwyu', '--arg'] iwyu_tool._bootstrap(argv) self.assertEqual(['-Xiwyu', '--arg'], self.main.call_args['extra_args'])
def test_extra_args(self): """ Extra arguments after '--' are forwarded to main. """ argv = ['iwyu_tool.py', '-p', '.', '--', '-extra1', '-extra2'] iwyu_tool._bootstrap(argv) self.assertEqual(['-extra1', '-extra2'], self.main.call_args['extra_args'])