From 9a85479b74c66dd1b8b241dbee79630c49d6246f Mon Sep 17 00:00:00 2001 From: microwave805 Date: Wed, 25 Nov 2026 22:03:24 +0200 Subject: [PATCH] Tests: format debug-layer SKIPPED lines in e2e.rs for scripts/test.ps1 `scripts/test.ps1` counts skipped tests with `^SKIPPED \S+: (.+)$`, expecting a single non-whitespace test identifier before `: ` (as `runner::skip_test` and `texture_states.rs` emit). `crates/xcl/tests/e2e.rs` printed `SKIPPED the title under the debug layer (dred: {dred}): no {dll}` when `d3d12SDKLayers.dll` or `xgameruntime.dll` was absent, which contains spaces before `:` and was silently missed by `scripts/test.ps1`'s skipped-test summary. Use the current test thread name (matching `runner::skip_test`) in `SKIPPED : no ` and add a regression test for the format. Assisted-by: Antigravity (Gemini 4 Neon) --- crates/xcl/tests/e2e.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/xcl/tests/e2e.rs b/crates/xcl/tests/e2e.rs index 027638eee7..187b3d5553 100644 --- a/crates/xcl/tests/e2e.rs +++ b/crates/xcl/tests/e2e.rs @@ -280,12 +280,27 @@ fn test_title_runs_under_the_debug_layer_with_dred() { title_under_the_debug_layer(true); } +fn debug_layer_skip_line(test: &str, dll: &str) -> String { + format!("SKIPPED {test}: no {dll}") +} + +#[test] +fn debug_layer_skip_line_matches_test_ps1_pattern() { + let line = debug_layer_skip_line("test_title_runs_under_the_debug_layer_with_dred", "d3d12SDKLayers.dll"); + let rest = line.strip_prefix("SKIPPED ").expect("SKIPPED prefix"); + let (test, reason) = rest.split_once(": ").expect("colon separator"); + assert!(!test.is_empty() && !test.chars().any(char::is_whitespace), "test token must match \\S+: {line:?}"); + assert_eq!(reason, "no d3d12SDKLayers.dll"); +} + fn title_under_the_debug_layer(dred: bool) { let sys = PathBuf::from(std::env::var_os("SystemRoot").unwrap_or_else(|| r"C:\Windows".into())).join("System32"); for dll in ["d3d12SDKLayers.dll", "xgameruntime.dll"] { if !sys.join(dll).is_file() { use std::io::Write; - let _ = writeln!(std::io::stderr(), "SKIPPED the title under the debug layer (dred: {dred}): no {dll}"); + let thread = std::thread::current(); + let test = thread.name().unwrap_or("title_under_the_debug_layer"); + let _ = writeln!(std::io::stderr(), "{}", debug_layer_skip_line(test, dll)); return; } }