0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-07 23:06:50 -05:00

chore(test_util): use pretty_assertions::assert_eq when not pattern matching (#13965)

This commit is contained in:
David Sherret 2022-03-15 18:15:56 -04:00 committed by GitHub
parent 60466de5d5
commit 5d60ee7f12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions

5
Cargo.lock generated
View file

@ -2926,9 +2926,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]] [[package]]
name = "pretty_assertions" name = "pretty_assertions"
version = "0.7.2" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cab0e7c02cf376875e9335e0ba1da535775beb5450d21e1dffca068818ed98b" checksum = "57c038cb5319b9c704bf9c227c261d275bfec0ad438118a2787ce47944fb228b"
dependencies = [ dependencies = [
"ansi_term", "ansi_term",
"ctor", "ctor",
@ -4346,6 +4346,7 @@ dependencies = [
"hyper", "hyper",
"lazy_static", "lazy_static",
"os_pipe", "os_pipe",
"pretty_assertions",
"pty", "pty",
"regex", "regex",
"rustls-pemfile 0.2.1", "rustls-pemfile 0.2.1",

View file

@ -98,7 +98,7 @@ winapi = { version = "=0.3.9", features = ["knownfolders", "mswsock", "objbase",
deno_bench_util = { version = "0.34.0", path = "../bench_util" } deno_bench_util = { version = "0.34.0", path = "../bench_util" }
flaky_test = "=0.1.0" flaky_test = "=0.1.0"
os_pipe = "=1.0.1" os_pipe = "=1.0.1"
pretty_assertions = "=0.7.2" pretty_assertions = "=1.2.0"
test_util = { path = "../test_util" } test_util = { path = "../test_util" }
trust-dns-client = "=0.20.3" trust-dns-client = "=0.20.3"
trust-dns-server = "=0.20.3" trust-dns-server = "=0.20.3"

View file

@ -20,6 +20,7 @@ futures = "0.3.21"
hyper = { version = "0.14.12", features = ["server", "http1", "http2", "runtime"] } hyper = { version = "0.14.12", features = ["server", "http1", "http2", "runtime"] }
lazy_static = "1.4.0" lazy_static = "1.4.0"
os_pipe = "1.0.1" os_pipe = "1.0.1"
pretty_assertions = "=1.2.0"
regex = "1.5.5" regex = "1.5.5"
rustls-pemfile = "0.2.1" rustls-pemfile = "0.2.1"
serde = { version = "1.0.126", features = ["derive"] } serde = { version = "1.0.126", features = ["derive"] }

View file

@ -15,6 +15,7 @@ use hyper::Response;
use hyper::StatusCode; use hyper::StatusCode;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use os_pipe::pipe; use os_pipe::pipe;
use pretty_assertions::assert_eq;
use regex::Regex; use regex::Regex;
use rustls::Certificate; use rustls::Certificate;
use rustls::PrivateKey; use rustls::PrivateKey;
@ -1801,7 +1802,9 @@ impl CheckOutputIntegrationTest {
std::fs::read_to_string(output_path).expect("cannot read output") 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!("OUTPUT\n{}\nOUTPUT", actual);
println!("EXPECTED\n{}\nEXPECTED", expected); println!("EXPECTED\n{}\nEXPECTED", expected);
panic!("pattern match failed"); panic!("pattern match failed");
@ -2090,6 +2093,7 @@ pub fn parse_max_mem(output: &str) -> Option<u64> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn parse_wrk_output_1() { fn parse_wrk_output_1() {