From 5d60ee7f1280d8000b918e7fb9e11e3ddca779e7 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 15 Mar 2022 18:15:56 -0400 Subject: chore(test_util): use pretty_assertions::assert_eq when not pattern matching (#13965) --- test_util/Cargo.toml | 1 + test_util/src/lib.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'test_util') diff --git a/test_util/Cargo.toml b/test_util/Cargo.toml index bb9b61fca..db42c0856 100644 --- a/test_util/Cargo.toml +++ b/test_util/Cargo.toml @@ -20,6 +20,7 @@ futures = "0.3.21" hyper = { version = "0.14.12", features = ["server", "http1", "http2", "runtime"] } lazy_static = "1.4.0" os_pipe = "1.0.1" +pretty_assertions = "=1.2.0" regex = "1.5.5" rustls-pemfile = "0.2.1" serde = { version = "1.0.126", features = ["derive"] } diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 664469cf8..75a8840e3 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -15,6 +15,7 @@ use hyper::Response; use hyper::StatusCode; use lazy_static::lazy_static; use os_pipe::pipe; +use pretty_assertions::assert_eq; use regex::Regex; use rustls::Certificate; use rustls::PrivateKey; @@ -1801,7 +1802,9 @@ impl CheckOutputIntegrationTest { std::fs::read_to_string(output_path).expect("cannot read output") }; - if !wildcard_match(&expected, &actual) { + if !expected.contains("[WILDCARD]") { + assert_eq!(actual, expected) + } else if !wildcard_match(&expected, &actual) { println!("OUTPUT\n{}\nOUTPUT", actual); println!("EXPECTED\n{}\nEXPECTED", expected); panic!("pattern match failed"); @@ -2090,6 +2093,7 @@ pub fn parse_max_mem(output: &str) -> Option { #[cfg(test)] mod tests { use super::*; + use pretty_assertions::assert_eq; #[test] fn parse_wrk_output_1() { -- cgit v1.2.3