mirror of
https://github.com/nushell/nushell
synced 2024-12-26 21:13:19 +00:00
Use pretty_assertions
in the root crate (#8818)
# Description This PR is just a minor development improvement. While working on another feature, I noticed that the root crate lists the super useful `pretty_assertions` in the root crate but doesn't use it in most tests. With this change `pretty_assertions::assert_eq!` is used instead of `core::assert_eq!` for better diffs when debugging the tests. I thought of adding the dependency to other crates but I decided not to since I didn't want a huge disruptive PR :)
This commit is contained in:
parent
d128c0e02b
commit
5afbfb5c2c
22 changed files with 26 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::tests::{fail_test, run_test, run_test_contains, TestResult};
|
use crate::tests::{fail_test, run_test, run_test_contains, TestResult};
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_scope_leak1() -> TestResult {
|
fn no_scope_leak1() -> TestResult {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn const_bool() {
|
fn const_bool() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use nu_test_support::{nu, nu_repl_code};
|
use nu_test_support::{nu, nu_repl_code};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
fn env_change_hook_code_list(name: &str, code_list: &[&str]) -> String {
|
fn env_change_hook_code_list(name: &str, code_list: &[&str]) -> String {
|
||||||
let mut list = String::new();
|
let mut list = String::new();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn module_private_import_decl() {
|
fn module_private_import_decl() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu, nu_repl_code, pipeline};
|
use nu_test_support::{nu, nu_repl_code, pipeline};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_overlay() {
|
fn add_overlay() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn source_file_relative_to_file() {
|
fn source_file_relative_to_file() {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use std::path::Path;
|
use nu_path::canonicalize_with;
|
||||||
|
|
||||||
use nu_test_support::fs::Stub::EmptyFile;
|
use nu_test_support::fs::Stub::EmptyFile;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
use nu_path::canonicalize_with;
|
use std::path::Path;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn canonicalize_path() {
|
fn canonicalize_path() {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
|
|
||||||
use nu_path::expand_path_with;
|
use nu_path::expand_path_with;
|
||||||
|
use nu_test_support::playground::Playground;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContent;
|
use nu_test_support::fs::Stub::FileWithContent;
|
||||||
use nu_test_support::nu_with_plugins;
|
use nu_test_support::nu_with_plugins;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn chooses_highest_increment_if_given_more_than_one() {
|
fn chooses_highest_increment_if_given_more_than_one() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use nu_test_support::nu_with_plugins;
|
use nu_test_support::nu_with_plugins;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_get_custom_value_from_plugin_and_instantly_collapse_it() {
|
fn can_get_custom_value_from_plugin_and_instantly_collapse_it() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use nu_test_support::nu_with_plugins;
|
use nu_test_support::nu_with_plugins;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
const TEST_CWD: &str = "tests/fixtures/formats";
|
const TEST_CWD: &str = "tests/fixtures/formats";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::nu_with_plugins;
|
use nu_test_support::nu_with_plugins;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn infers_types() {
|
fn infers_types() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::nu_with_plugins;
|
use nu_test_support::nu_with_plugins;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
const TEST_CWD: &str = "tests/fixtures/formats";
|
const TEST_CWD: &str = "tests/fixtures/formats";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::nu_with_plugins;
|
use nu_test_support::nu_with_plugins;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn infers_types() {
|
fn infers_types() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[ignore = "TODO: This shows old-style aliases. New aliases are under commands"]
|
#[ignore = "TODO: This shows old-style aliases. New aliases are under commands"]
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -4,7 +4,7 @@ use nu_test_support::fs::Stub::FileWithContent;
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu_repl_code, pipeline};
|
use nu_test_support::{nu_repl_code, pipeline};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -3,6 +3,7 @@ use super::support::Trusted;
|
||||||
use nu_test_support::fs::Stub::FileWithContent;
|
use nu_test_support::fs::Stub::FileWithContent;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu, nu_repl_code, pipeline};
|
use nu_test_support::{nu, nu_repl_code, pipeline};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[cfg(feature = "which-support")]
|
#[cfg(feature = "which-support")]
|
||||||
mod environment;
|
mod environment;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[cfg(feature = "which-support")]
|
#[cfg(feature = "which-support")]
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -2,6 +2,7 @@ use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
use nu_test_support::pipeline;
|
use nu_test_support::pipeline;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
|
fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
mod commands;
|
mod commands;
|
||||||
|
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn doesnt_break_on_utf8() {
|
fn doesnt_break_on_utf8() {
|
||||||
|
|
Loading…
Reference in a new issue