Beispiel #1
0
 def runApplicationWithArgv(self, argv, print_result, os_walk, mock_open):
     def store_result(result, options):
         self.fileInfos = list(result) 
     os_walk.return_value = [('.', [], ['a.cpp'])]
     mock_open.return_value.read.return_value = self.source_code
     print_result.side_effect = store_result
     hfcca_main(argv)
Beispiel #2
0
    def runApplicationWithArgv(self, argv, print_result, os_walk, mock_open):
        def store_result(result, options):
            self.fileInfos = list(result)

        os_walk.return_value = [('.', [], ['a.cpp'])]
        mock_open.return_value.read.return_value = self.source_code
        print_result.side_effect = store_result
        hfcca_main(argv)
Beispiel #3
0
 def testMutipleFilesInArgv(self, print_result, os_walk, mock_open):
     def check_result(result, options):
         fileInfos = list(result) 
         self.assertEqual(1, len(fileInfos))
         self.assertEqual('foo', fileInfos[0][0].name)
     os_walk.return_value = [('.', [], ['a.cpp'])]
     mock_open.return_value.read.return_value = "void foo(){}"
     print_result.side_effect = check_result
     hfcca_main(['hfcca'])
Beispiel #4
0
    def testMutipleFilesInArgv(self, print_result, os_walk, mock_open):
        def check_result(result, options):
            fileInfos = list(result)
            self.assertEqual(1, len(fileInfos))
            self.assertEqual('foo', fileInfos[0][0].name)

        os_walk.return_value = [('.', [], ['a.cpp'])]
        mock_open.return_value.read.return_value = "void foo(){}"
        print_result.side_effect = check_result
        hfcca_main(['hfcca'])
Beispiel #5
0
 def testEmptyResult(self, print_result, os_walk):
     os_walk.return_value = [('.', [], [])]
     print_result.side_effect = self.check_empty_result
     hfcca_main(['hfcca'])
Beispiel #6
0
 def testGetCurrentFolderByDefault(self, print_result, os_walk):
     print_result.side_effect = self.exhaust_result
     hfcca_main(['hfcca'])
     os_walk.assert_called_once_with('.', topdown=False)
Beispiel #7
0
 def testEmptyResult(self, print_result, os_walk):
     os_walk.return_value = [('.', [], [])]
     print_result.side_effect = self.check_empty_result
     hfcca_main(['hfcca'])
Beispiel #8
0
 def testGetCurrentFolderByDefault(self, print_result, os_walk):
     print_result.side_effect = self.exhaust_result
     hfcca_main(['hfcca'])
     os_walk.assert_called_once_with('.', topdown=False)