devloop guard test: skip its own module

This commit is contained in:
CRTkafa 2026-09-30 22:21:41 +07:00
parent 8da1f1b20e
commit b3d1d42f6e

View file

@ -30,6 +30,7 @@
//! feature flags, as validated data and the scripts that hand them to site tabs. //! feature flags, as validated data and the scripts that hand them to site tabs.
//! - [`modes`]: the onboarding mode the owner started from (the presets are the app's feature table). //! - [`modes`]: the onboarding mode the owner started from (the presets are the app's feature table).
//! - [`zoom`]: page zoom per tab (a clamped factor the shell sets, remembered in `zoom.json`). //! - [`zoom`]: page zoom per tab (a clamped factor the shell sets, remembered in `zoom.json`).
//! - [`find`]: find in page (the request the shell sends, the fallback script; the query is kept nowhere).
//! - [`alerts`]: local keyword alerts (keywords, snippets, per-item/per-keyword rate limits). //! - [`alerts`]: local keyword alerts (keywords, snippets, per-item/per-keyword rate limits).
//! - [`media`]: gallery folders (path containment) and the opt-in clipboard history (private copies skipped). //! - [`media`]: gallery folders (path containment) and the opt-in clipboard history (private copies skipped).
//! - [`gfonts`]: self-hosted Google Fonts: CSS parsing, URL/woff2 checks, the cache format, the page script; //! - [`gfonts`]: self-hosted Google Fonts: CSS parsing, URL/woff2 checks, the cache format, the page script;
@ -52,6 +53,7 @@ pub mod backup;
pub mod bridge; pub mod bridge;
pub mod commands; pub mod commands;
pub mod devmode; pub mod devmode;
pub mod find;
#[cfg(feature = "net")] #[cfg(feature = "net")]
pub mod fonts; pub mod fonts;
pub mod gfonts; pub mod gfonts;
@ -109,7 +111,8 @@ mod release_guard {
#[test] #[test]
fn every_devloop_mention_is_debug_only() { fn every_devloop_mention_is_debug_only() {
for (file, source) in [("lib.rs", include_str!("lib.rs")), ("app.rs", include_str!("app.rs"))] { for (file, source) in [("lib.rs", include_str!("lib.rs")), ("app.rs", include_str!("app.rs"))] {
let lines: Vec<&str> = source.lines().collect(); // This test module itself talks about the dev loop; only the code before it counts.
let lines: Vec<&str> = source.split("mod release_guard").next().unwrap_or(source).lines().collect();
for (index, line) in lines.iter().enumerate() { for (index, line) in lines.iter().enumerate() {
let code = line.trim_start(); let code = line.trim_start();
if code.starts_with("//") || !(code.contains("devloop::") || code.starts_with("pub mod devloop")) || code.contains("$crate::devloop") { if code.starts_with("//") || !(code.contains("devloop::") || code.starts_with("pub mod devloop")) || code.contains("$crate::devloop") {