MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / run_fixture

Function run_fixture

tests/fixture_runner.rs:342–369  ·  view source on GitHub ↗
(path: &Path, content: String)

Source from the content-addressed store, hash-verified

340// ─── Test execution ─────────────────────────────────────────────────────────
341
342fn run_fixture(path: &Path, content: String) -> datatest_stable::Result<()> {
343 let fixture =
344 parse_fixture(&content).map_err(|e| format!("Failed to parse {}: {e}", path.display()))?;
345
346 // Handle ignored fixtures.
347 if let Some(reason) = &fixture.meta.ignore {
348 eprintln!("IGNORED: {reason}");
349 return Ok(());
350 }
351
352 // Use a single-threaded tokio runtime for async LSP calls.
353 let rt = tokio::runtime::Builder::new_current_thread()
354 .enable_all()
355 .build()
356 .map_err(|e| format!("Failed to build tokio runtime: {e}"))?;
357
358 rt.block_on(async {
359 match fixture.meta.feature {
360 Feature::Completion => run_completion(&fixture).await,
361 Feature::Hover => run_hover(&fixture).await,
362 Feature::Definition => run_definition(&fixture).await,
363 Feature::SignatureHelp => run_signature_help(&fixture).await,
364 }
365 })
366 .map_err(|e| format!("{} — {e}", path.display()))?;
367
368 Ok(())
369}
370
371/// Build a URI for a fixture file path.
372fn file_uri(path: &str) -> Url {

Callers

nothing calls this directly

Calls 6

parse_fixtureFunction · 0.85
run_completionFunction · 0.85
run_hoverFunction · 0.85
run_definitionFunction · 0.85
run_signature_helpFunction · 0.85
buildMethod · 0.80

Tested by

no test coverage detected