Skip to content

Commit

Permalink
Adjust build test for new nightly warning format
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Oct 18, 2023
1 parent e88946c commit 0b842d6
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions cargo-afl/tests/crates_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use predicates::prelude::*;
use std::{env, fs::OpenOptions, io::Write, path::Path};
use tempfile::tempdir;

const BUILD_MSG: &str = "\
warning: You appear to be building `afl` not under `cargo-afl`.
warning: Perhaps you used `cargo build` instead of `cargo afl build`?
";
const BUILD_MSGS: &[&str] = &[
"You appear to be building `afl` not under `cargo-afl`.",
"Perhaps you used `cargo build` instead of `cargo afl build`?",
];

#[ctor::ctor]
fn init() {
Expand All @@ -29,7 +29,11 @@ fn build() {
.env("TESTING_BUILD", "1")
.assert()
.success()
.stderr(predicates::str::contains(BUILD_MSG).not());
.stderr(
predicates::str::contains(BUILD_MSGS[0])
.not()
.and(predicates::str::contains(BUILD_MSGS[1]).not()),
);

let mut file = OpenOptions::new()
.append(true)
Expand All @@ -50,7 +54,9 @@ fn build() {
.env("TESTING_BUILD", "1")
.assert()
.success()
.stderr(predicates::str::contains(BUILD_MSG));
.stderr(
predicates::str::contains(BUILD_MSGS[0]).and(predicates::str::contains(BUILD_MSGS[1])),
);

Command::cargo_bin("cargo-afl")
.unwrap()
Expand All @@ -59,7 +65,11 @@ fn build() {
.env("TESTING_BUILD", "1")
.assert()
.success()
.stderr(predicates::str::contains(BUILD_MSG).not());
.stderr(
predicates::str::contains(BUILD_MSGS[0])
.not()
.and(predicates::str::contains(BUILD_MSGS[1]).not()),
);
}

#[test]
Expand Down

0 comments on commit 0b842d6

Please sign in to comment.