Пример #1
0
 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\".*')
Пример #2
0
 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\".*')
Пример #3
0
 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.*')
Пример #4
0
 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.*')
Пример #5
0
 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")*')
Пример #6
0
 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.*')
Пример #7
0
 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)
Пример #8
0
 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..*')
Пример #9
0
 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 \]')
Пример #10
0
 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.*')
Пример #11
0
 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 \]')
Пример #12
0
 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.*')
Пример #13
0
 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.*')
Пример #14
0
 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")*'
     )
Пример #15
0
 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..*'
     )