Closed
Description
Debian's environment for packaging Rust crates uses a local crate registry and some other adaptations to ensure the builds are self-contained. This is causing readme_test to fail because it doesn't find the transitive vte_generate_state_changes dependency.
The normal doctests work fine, because those still go through the cargo wrapper that Debian is using.
If/when it's reasonable to raise strip-ansi-escape's minimum Rust version to 1.54 (for the include_str!
macro), the manual rustdoc invocation could be replaced as below which will also address the problem:
diff --git i/src/lib.rs w/src/lib.rs
index 915494e..53acb97 100644
--- i/src/lib.rs
+++ w/src/lib.rs
@@ -151,42 +151,14 @@ where
}
}
+#[doc = include_str!("../README.md")]
+#[cfg(doctest)]
+pub struct ReadmeDoctests;
+
#[cfg(test)]
mod tests {
use super::*;
- use std::env;
- use std::env::consts::EXE_EXTENSION;
- use std::path::Path;
- use std::process::Command;
-
- #[test]
- fn readme_test() {
- let rustdoc = Path::new("rustdoc").with_extension(EXE_EXTENSION);
- let readme = Path::new(file!())
- .parent()
- .unwrap()
- .parent()
- .unwrap()
- .join("README.md");
- let exe = env::current_exe().unwrap();
- let outdir = exe.parent().unwrap();
- let mut cmd = Command::new(rustdoc);
- cmd.args(&["--verbose", "--test", "-L"])
- .arg(&outdir)
- .arg(&readme);
- println!("{:?}", cmd);
- let result = cmd
- .spawn()
- .expect("Failed to spawn process")
- .wait()
- .expect("Failed to run process");
- assert!(
- result.success(),
- "Failed to run rustdoc tests on README.md!"
- );
- }
-
fn assert_parsed(input: &[u8], expected: &[u8]) {
let bytes = strip(input).expect("Failed to strip escapes");
assert_eq!(bytes, expected);
For now, I'm just skipping readme_test in our builds.
Metadata
Metadata
Assignees
Labels
No labels