def test_nofused(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt) with self.assertRaises(SystemExit) as cm: iuwandbox.main() self.dump() self.assertEqual(cm.exception.code, 1, self.capture.getvalue()) self.assertRegex(self.capture.getvalue(), '.*please try \"make fused\".*')
def test_nofused(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt) with self.assertRaises(SystemExit) as cm: iuwandbox.main() self.dump() output = self.capture.getvalue() self.assertEqual(cm.exception.code, 1, output) self.assertRegex(output, '.*please try \"make fused\".*')
def test_same_filename(self): sys.argv[1:] = ['src/main.cpp', 'src/A/sample.cpp', 'src/B/sample.cpp'] sys.argv.extend(test_opt_nomain) print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, '.*OK.*')
def test_use_main(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt_nomain) sys.argv.append('--iutest-use-main') with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, '.*OK.*')
def test_nomain(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt_nomain) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 1, output) self.assertRegex(output, '.*hint:.*') self.assertRegex(output, '.*In "iutest" you can omit the definition of the main function, please define IUTEST_USE_MAIN. (--iutest-use-main or -f"-DIUTEST_USE_MAIN")*')
def test_run(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt) print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() self.dump() self.assertEqual(cm.exception.code, 0, self.capture.getvalue()) self.assertRegex(self.capture.getvalue(), '.*OK.*')
def test_run(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt) print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, '\[ \s+OK \]') self.assertFalse('-Wmisleading-indentation' in output)
def test_boosttest_workarround(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt_nomain) sys.argv.extend(['--boost', '1.65.0']) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 1, output) self.assertRegex(output, '.*hint:.*') self.assertRegex(output, '.*If you do not use boost test, please specify the file with the main function first..*')
def test_make_run(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt) sys.argv.extend(['--make']) print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, r'\[ \s+OK \]')
def test_define_wandbox(self): sys.argv[1:] = [test_src] sys.argv.extend(test_opt) sys.argv.extend(test_opt_dryrun) sys.argv.extend(test_opt_verbose) sys.argv.append('-f"-DTEST"') with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, '.*-D__WANDBOX__.*') self.assertRegex(output, '.*-DTEST.*')
def test_make_run(self): if 'SCRUTINIZER' in os.environ: self.skipTest('this test is not run on SCRUTINIZER.') sys.argv[1:] = [test_src] sys.argv.extend(test_opt) sys.argv.extend(['--make']) print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, r'\[ \s+OK \]')
def test_use_main(self): if 'SCRUTINIZER' in os.environ: self.skipTest('this test is not run on SCRUTINIZER.') sys.argv[1:] = [test_src] sys.argv.extend(test_opt_nomain) sys.argv.append('--iutest-use-main') print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, '.*OK.*')
def test_define_wandbox(self): if 'SCRUTINIZER' in os.environ: self.skipTest('this test is not run on SCRUTINIZER.') sys.argv[1:] = [test_src] sys.argv.extend(test_opt) sys.argv.extend(test_opt_dryrun) sys.argv.extend(test_opt_verbose) sys.argv.append('-f"-DTEST"') print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 0, output) self.assertRegex(output, '.*-D__WANDBOX__.*') self.assertRegex(output, '.*-DTEST.*')
def test_nomain(self): if 'SCRUTINIZER' in os.environ: self.skipTest('this test is not run on SCRUTINIZER.') sys.argv[1:] = [test_src] sys.argv.extend(test_opt_nomain) print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 1, output) self.assertRegex(output, '.*hint:.*') self.assertRegex( output, '.*In "iutest" you can omit the definition of the main function, please define IUTEST_USE_MAIN. (--iutest-use-main or -f"-DIUTEST_USE_MAIN")*' )
def test_boosttest_workarround(self): if 'SCRUTINIZER' in os.environ: self.skipTest('this test is not run on SCRUTINIZER.') sys.argv[1:] = [test_src] sys.argv.extend(test_opt_nomain) sys.argv.extend(['--boost', '1.65.0']) print(sys.argv) with self.assertRaises(SystemExit) as cm: iuwandbox.main() output = self.dump() self.assertEqual(cm.exception.code, 1, output) self.assertRegex(output, '.*hint:.*') self.assertRegex( output, '.*If you do not use boost test, please specify the file with the main function first..*' )