Skip to main content

TestProject

Trait TestProject 

Source
pub trait TestProject {
    // Required method
    fn root(&self) -> &Path;

    // Provided methods
    fn add_file(
        &self,
        relative_path: &str,
        content: &str,
    ) -> Result<PathBuf, TestProjectError> { ... }
    fn file_uri(&self, relative_path: &str) -> Uri { ... }
    fn file_path_str(&self, relative_path: &str) -> String { ... }
}
Expand description

Scaffolds temporary projects for integration testing against real language servers.

Enable with the testing feature flag:

aether-lspd = { version = "...", features = ["testing"] }

§TestProject trait

All test projects implement TestProject, which provides:

§Implementations

  • CargoProject::new(name) – Creates a temporary Cargo project with Cargo.toml and src/main.rs.
  • NodeProject::new(name) – Creates a temporary Node.js/TypeScript project with package.json, tsconfig.json, src/index.ts, and runs npm install typescript.

Both are backed by TempDir and are automatically cleaned up when dropped.

§Example

use aether_lspd::testing::{CargoProject, TestProject};

let project = CargoProject::new("my-test").unwrap();
project.add_file("src/lib.rs", "pub fn hello() -> &'static str { \"hi\" }").unwrap();
let uri = project.file_uri("src/lib.rs");

Required Methods§

Source

fn root(&self) -> &Path

Provided Methods§

Source

fn add_file( &self, relative_path: &str, content: &str, ) -> Result<PathBuf, TestProjectError>

Source

fn file_uri(&self, relative_path: &str) -> Uri

Source

fn file_path_str(&self, relative_path: &str) -> String

Implementors§