Example #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)
Example #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)
Example #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'])
Example #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'])
Example #5
0
 def testEmptyResult(self, print_result, os_walk):
     os_walk.return_value = [('.', [], [])]
     print_result.side_effect = self.check_empty_result
     hfcca_main(['hfcca'])
Example #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)
Example #7
0
 def testEmptyResult(self, print_result, os_walk):
     os_walk.return_value = [('.', [], [])]
     print_result.side_effect = self.check_empty_result
     hfcca_main(['hfcca'])
Example #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)