示例#1
0
    def test_launch_window_stack_unknown_error(self):

        stack_ide.stack_ide_start = Mock(side_effect=Exception())
        instance = configure_instance(
            mock_window([cur_dir + '/projects/helloworld']), test_settings)
        self.assertIsInstance(instance, NoStackIDE)
        self.assertRegex(
            instance.reason, "instance init failed -- unknown error")
示例#2
0
    def test_launch_window_stack_not_found(self):

        stack_ide.stack_ide_start = Mock(side_effect=FileNotFoundError())
        instance = configure_instance(
            mock_window([cur_dir + '/projects/helloworld']), test_settings)
        self.assertIsInstance(instance, NoStackIDE)
        self.assertRegex(
            instance.reason, "instance init failed -- stack not found")
        self.assertRegex(sublime.current_error, "Could not find program 'stack'!")
示例#3
0
 def test_launch_window_with_helloworld_project(self):
     instance = configure_instance(
         mock_window([cur_dir + '/projects/helloworld']), test_settings)
     self.assertIsInstance(instance, stack_ide.StackIDE)
     instance.end()
示例#4
0
 def test_launch_window_with_wrong_cabal_file(self):
     instance = configure_instance(
         mock_window([cur_dir + '/projects/cabalfile_wrong_project']), test_settings)
     self.assertIsInstance(instance, NoStackIDE)
     self.assertRegex(
         instance.reason, "cabalfile_wrong_project.cabal not found.*")
示例#5
0
 def test_launch_window_with_cabal_folder(self):
     instance = configure_instance(
         mock_window([cur_dir + '/projects/cabal_project']), test_settings)
     self.assertIsInstance(instance, NoStackIDE)
     self.assertRegex(instance.reason, "No stack.yaml in path.*")
示例#6
0
 def test_launch_window_with_empty_folder(self):
     instance = configure_instance(
         mock_window([cur_dir + '/projects/empty_project']), test_settings)
     self.assertIsInstance(instance, NoStackIDE)
     self.assertRegex(instance.reason, "No cabal file found.*")
示例#7
0
 def test_launch_window_without_folder(self):
     instance = configure_instance(mock_window([]), test_settings)
     self.assertIsInstance(instance, NoStackIDE)
     self.assertRegex(instance.reason, "No folder to monitor.*")