Requested Changes

- Removed explicit type annotation.
- Changed panic to assert_eq
This commit is contained in:
simon-curtis
2024-10-23 21:40:29 +01:00
committed by Simon Curtis
parent 82c2ae1cfd
commit 7efbfe020c
3 changed files with 7 additions and 7 deletions

View File

@ -163,14 +163,14 @@ pub fn check_example_evaluates_to_expected_output(
let expected = DebuggableValue(expected); let expected = DebuggableValue(expected);
let result = DebuggableValue(&result); let result = DebuggableValue(&result);
if result != expected { if result != expected {
panic!( assert_eq!(
"\x1b[31mError:\x1b[0m The result of example \x1b[34m'{}'\x1b[0m for the command \x1b[34m'{}'\x1b[0m differs from the expected value.\n\n\ result,
Expected: {:?}\n\ expected,
Actual: {:?}\n", "\x1b[31mError:\x1b[0m The result of example \x1b[34m'{}'\x1b[0m for the command \x1b[34m'{}'\x1b[0m differs from the expected value.\n\nExpected: {:?}\nActual: {:?}\n",
example.description, example.description,
cmd_name, cmd_name,
expected, expected,
result result,
); );
} }
} }

View File

@ -104,7 +104,7 @@ impl Command for BytesAt {
}, },
Example { Example {
description: "Slice out `0x[10 01 13]` from `0x[33 44 55 10 01 13]`", description: "Slice out `0x[10 01 13]` from `0x[33 44 55 10 01 13]`",
example: "0x[33 44 55 10 01 13 10] | bytes at 3..6", example: "0x[33 44 55 10 01 13] | bytes at 3..6",
result: Some(Value::test_binary(vec![0x10, 0x01, 0x13, 0x10])), result: Some(Value::test_binary(vec![0x10, 0x01, 0x13, 0x10])),
}, },
Example { Example {

View File

@ -25,7 +25,7 @@ pub fn run_test(input: &str, expected: &str) -> TestResult {
let mut file = NamedTempFile::new()?; let mut file = NamedTempFile::new()?;
let name = file.path(); let name = file.path();
let mut cmd: Command = Command::cargo_bin("nu")?; let mut cmd = Command::cargo_bin("nu")?;
cmd.arg("--no-std-lib"); cmd.arg("--no-std-lib");
cmd.arg("--no-config-file"); cmd.arg("--no-config-file");
cmd.arg(name); cmd.arg(name);