Files
openidea/sdk/rust/openidea-plugin/tests/api15_run_target_validation.rs
T
l0ng-ai 2b80c75317 refactor(plugins): run only programs in plugin run targets (#2490)
Plugin run targets keep running programs, tests and package scripts inside
the target. Language servers and debuggers run on the host again:

- Remove the Language server targets settings page, the project-only
  `languageServerTargets` setting and the PHP / Node.js "Language server:
  run in target" option.
- Remove debugging through plugin targets; Debug on a plugin target is
  refused again. PHP Remote Debug and Python remote configurations with a
  path mapping debug programs in containers.
- Remove LSP / DAP message path mapping, read-only container documents and
  the `ide-core` path-mapping module that only these used.
- Run-target validation (API 1.5, unreleased) no longer has a `debug`
  operation, and debug start no longer takes a request id.
2026-11-10 15:27:31 +08:00

23 lines
974 B
Rust

use openidea_plugin::{mock::MockHost, *};
#[test]
fn validation_receives_mock_project_and_can_refuse_each_launch_kind() {
struct Validator;
impl RunTargetValidation for Validator {
fn validate(&mut self, project: &str, target: &str, launch: &RunTargetLaunch) -> Result<(), String> {
assert!(!project.is_empty());
assert_eq!(launch.program, "composer");
if target == "stopped" { Err("Project runtime is stopped".into()) } else { Ok(()) }
}
}
let mock = MockHost::install();
for operation in [RunTargetOperation::Run, RunTargetOperation::Test] {
let launch = RunTargetLaunch { operation, program: "composer".into(), cwd: "/project".into() };
assert!(mock.validate_run_target(&mut Validator, "running", &launch).is_ok());
assert_eq!(
mock.validate_run_target(&mut Validator, "stopped", &launch),
Err("Project runtime is stopped".into())
);
}
}