From d0f6f3d07e7357cf915109193f2b76ebd4482d90 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 16 Dec 2019 22:09:20 -0600 Subject: [PATCH] tests/refactor ~ change output test macros to 'actual = expected' format - rust usually uses `assert_eq!(ACTUAL, EXPECTED)` - ref: https://users.rust-lang.org/t/assert-eq-expected-and-actual/20304/3 @@ https://archive.is/xPp9R --- tests/common/util.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 756107d44..d5c9c4c27 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -73,7 +73,7 @@ impl CmdResult { /// 1. you can not know exactly what stdout will be /// or 2. you know that stdout will also be empty pub fn no_stderr(&self) -> Box<&CmdResult> { - assert_eq!("", self.stderr); + assert_eq!(self.stderr, ""); Box::new(self) } @@ -84,7 +84,7 @@ impl CmdResult { /// 1. you can not know exactly what stderr will be /// or 2. you know that stderr will also be empty pub fn no_stdout(&self) -> Box<&CmdResult> { - assert_eq!("", self.stdout); + assert_eq!(self.stdout, ""); Box::new(self) } @@ -93,8 +93,8 @@ impl CmdResult { /// stdout_only is a better choice unless stderr may or will be non-empty pub fn stdout_is>(&self, msg: T) -> Box<&CmdResult> { assert_eq!( - String::from(msg.as_ref()), - self.stdout + self.stdout, + String::from(msg.as_ref()) ); Box::new(self) } @@ -110,8 +110,8 @@ impl CmdResult { /// stderr_only is a better choice unless stdout may or will be non-empty pub fn stderr_is>(&self, msg: T) -> Box<&CmdResult> { assert_eq!( - String::from(msg.as_ref()).trim_end(), - self.stderr.trim_end() + self.stderr.trim_end(), + String::from(msg.as_ref()).trim_end() ); Box::new(self) } @@ -152,7 +152,7 @@ impl CmdResult { pub fn fails_silently(&self) -> Box<&CmdResult> { assert!(!self.success); - assert_eq!("", self.stderr); + assert_eq!(self.stderr, ""); Box::new(self) } }