summaryrefslogtreecommitdiff
path: root/crates/nu-test-support
diff options
context:
space:
mode:
Diffstat (limited to 'crates/nu-test-support')
-rw-r--r--crates/nu-test-support/src/macros.rs4
-rw-r--r--crates/nu-test-support/src/playground/matchers.rs8
-rw-r--r--crates/nu-test-support/src/playground/play.rs8
3 files changed, 10 insertions, 10 deletions
diff --git a/crates/nu-test-support/src/macros.rs b/crates/nu-test-support/src/macros.rs
index fff0fa051..3dc2d1095 100644
--- a/crates/nu-test-support/src/macros.rs
+++ b/crates/nu-test-support/src/macros.rs
@@ -469,9 +469,9 @@ pub fn read_std(std: &[u8]) -> String {
out.replace('\n', "")
}
-use std::{path::PathBuf, process::Command};
+use std::{path::Path, process::Command};
-pub fn run_command(executable_path: &PathBuf, target_cwd: &str) -> Command {
+pub fn run_command(executable_path: &Path, target_cwd: &str) -> Command {
let mut command = Command::new(executable_path);
command
diff --git a/crates/nu-test-support/src/playground/matchers.rs b/crates/nu-test-support/src/playground/matchers.rs
index 3071a9a20..1f8dad1be 100644
--- a/crates/nu-test-support/src/playground/matchers.rs
+++ b/crates/nu-test-support/src/playground/matchers.rs
@@ -30,7 +30,7 @@ pub fn says() -> Play {
trait CheckerMatchers {
fn output(&self, actual: &Outcome) -> MatchResult;
- fn std(&self, actual: &[u8], expected: Option<&String>, description: &str) -> MatchResult;
+ fn std(&self, actual: &[u8], expected: Option<&str>, description: &str) -> MatchResult;
fn stdout(&self, actual: &Outcome) -> MatchResult;
}
@@ -40,10 +40,10 @@ impl CheckerMatchers for Play {
}
fn stdout(&self, actual: &Outcome) -> MatchResult {
- self.std(&actual.out, self.stdout_expectation.as_ref(), "stdout")
+ self.std(&actual.out, self.stdout_expectation.as_deref(), "stdout")
}
- fn std(&self, actual: &[u8], expected: Option<&String>, description: &str) -> MatchResult {
+ fn std(&self, actual: &[u8], expected: Option<&str>, description: &str) -> MatchResult {
let out = match expected {
Some(out) => out,
None => return Ok(()),
@@ -51,7 +51,7 @@ impl CheckerMatchers for Play {
let actual =
str::from_utf8(actual).map_err(|_| format!("{description} was not utf8 encoded"))?;
- if actual != *out {
+ if actual != out {
return Err(format!(
"not equal:\n actual: {actual}\n expected: {out}\n\n"
));
diff --git a/crates/nu-test-support/src/playground/play.rs b/crates/nu-test-support/src/playground/play.rs
index 8ca71a9ef..d81899c5f 100644
--- a/crates/nu-test-support/src/playground/play.rs
+++ b/crates/nu-test-support/src/playground/play.rs
@@ -46,12 +46,12 @@ impl Dirs {
self.fixtures.join("playground/config")
}
- pub fn root(&self) -> &PathBuf {
- &self.root
+ pub fn root(&self) -> &Path {
+ self.root.as_path()
}
- pub fn test(&self) -> &PathBuf {
- &self.test
+ pub fn test(&self) -> &Path {
+ self.test.as_path()
}
}