Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cargo-insta/tests/functional/nextest_doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ use std::process::Stdio;

use crate::TestFiles;

fn nextest_available() -> bool {
std::process::Command::new("cargo")
.args(["nextest", "--version"])
.output()
.map(|o| o.status.success())
.unwrap_or(false)
}

/// Test that nextest with doctests shows a warning
#[test]
fn test_nextest_doctest_warning() {
if !nextest_available() {
eprintln!("Skipping test: cargo-nextest not installed");
return;
}
let test_project = TestFiles::new()
.add_cargo_toml("test_nextest_doctest_warning")
.add_file(
Expand Down Expand Up @@ -54,6 +66,10 @@ fn test_simple() {
/// Test that nextest with --disable-nextest-doctest flag doesn't show warning
#[test]
fn test_nextest_doctest_flag_no_warning() {
if !nextest_available() {
eprintln!("Skipping test: cargo-nextest not installed");
return;
}
let test_project = TestFiles::new()
.add_cargo_toml("test_nextest_doctest_flag")
.add_file(
Expand Down Expand Up @@ -103,6 +119,10 @@ fn test_simple() {
/// Test that no warning appears when there are no doctests
#[test]
fn test_nextest_no_doctests_no_warning() {
if !nextest_available() {
eprintln!("Skipping test: cargo-nextest not installed");
return;
}
let test_project = TestFiles::new()
.add_cargo_toml("test_nextest_no_doctests")
.add_file(
Expand Down Expand Up @@ -185,6 +205,10 @@ fn test_simple() {
/// Test that nextest with --dnd alias doesn't show warning
#[test]
fn test_nextest_doctest_dnd_alias_no_warning() {
if !nextest_available() {
eprintln!("Skipping test: cargo-nextest not installed");
return;
}
let test_project = TestFiles::new()
.add_cargo_toml("test_nextest_doctest_dnd_alias")
.add_file(
Expand Down
Loading