コード例 #1
0
ファイル: test_gcc.py プロジェクト: walexzzy/universal
class TestGcc(unittest.TestCase):
    def setUp(self):
        self.filename_c = 'foobar.c'
        self.compiler = Gcc(self.filename_c)

    @patch('universal.compiler.language.gcc.perform_system_command')
    def test_compile(self, mock_sys_cmd):
        self.compiler.compile()
        mock_sys_cmd.assert_called_once_with(AnyStringContaining('gcc'))

    @patch('os.path.exists')
    @patch('universal.compiler.language.gcc.perform_system_command')
    def test_run_output_when_no_input_file_available(self, mock_sys_cmd,
                                                     mock_path_exists):
        mock_path_exists.return_value = False

        self.compiler.run()

        mock_sys_cmd.assert_called_once_with(AnyStringContaining('foobar.out'))

    @patch('os.path.exists')
    @patch('universal.compiler.language.gcc.perform_system_command')
    def test_run_output_when_input_file_available(self, mock_sys_cmd,
                                                  mock_path_exists):
        mock_path_exists.return_value = True

        self.compiler.run()

        mock_sys_cmd.assert_called_once_with(
            AnyStringContaining('foobar.input'))
コード例 #2
0
ファイル: test_gcc.py プロジェクト: gitter-badger/universal-1
class TestGcc(unittest.TestCase):
    def setUp(self):
        self.filename_c = 'foobar.c'
        self.compiler = Gcc(self.filename_c)

    @patch('universal.compiler.language.gcc.perform_system_command')
    def test_compile(self, mock_sys_cmd):
        self.compiler.compile()
        mock_sys_cmd.assert_called_once_with(AnyStringContaining('gcc'))


    @patch('os.path.exists')
    @patch('universal.compiler.language.gcc.perform_system_command')
    def test_run_output_when_no_input_file_available(self, mock_sys_cmd, mock_path_exists):
        mock_path_exists.return_value = False

        self.compiler.run()

        mock_sys_cmd.assert_called_once_with(AnyStringContaining('foobar.out'))

    @patch('os.path.exists')
    @patch('universal.compiler.language.gcc.perform_system_command')
    def test_run_output_when_input_file_available(self, mock_sys_cmd, mock_path_exists):
        mock_path_exists.return_value = True

        self.compiler.run()

        mock_sys_cmd.assert_called_once_with(AnyStringContaining('foobar.input'))
コード例 #3
0
ファイル: test_gcc.py プロジェクト: walexzzy/universal
 def setUp(self):
     self.filename_c = 'foobar.c'
     self.compiler = Gcc(self.filename_c)
コード例 #4
0
ファイル: test_gcc.py プロジェクト: gitter-badger/universal-1
 def setUp(self):
     self.filename_c = 'foobar.c'
     self.compiler = Gcc(self.filename_c)