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")
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'!")
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()
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.*")
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.*")
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.*")
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.*")