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:
Maria José Solano 2023-04-08 11:52:37 -07:00 committed by GitHub
parent d128c0e02b
commit 5afbfb5c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 26 additions and 9 deletions

View File

@ -1,4 +1,5 @@
use nu_test_support::nu;
use pretty_assertions::assert_eq;
use std::fs;
use std::path::Path;

View File

@ -1,5 +1,6 @@
use crate::tests::{fail_test, run_test, run_test_contains, TestResult};
use nu_test_support::nu;
use pretty_assertions::assert_eq;
#[test]
fn no_scope_leak1() -> TestResult {

View File

@ -1,4 +1,5 @@
use nu_test_support::{nu, pipeline};
use pretty_assertions::assert_eq;
#[test]
fn const_bool() {

View File

@ -1,4 +1,5 @@
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 {
let mut list = String::new();

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
use pretty_assertions::assert_eq;
#[test]
fn module_private_import_decl() {

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code, pipeline};
use pretty_assertions::assert_eq;
#[test]
fn add_overlay() {

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
use pretty_assertions::assert_eq;
#[test]
fn source_file_relative_to_file() {

View 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::playground::Playground;
use nu_path::canonicalize_with;
use pretty_assertions::assert_eq;
use std::path::Path;
#[test]
fn canonicalize_path() {

View File

@ -1,8 +1,7 @@
use std::path::PathBuf;
use nu_test_support::playground::Playground;
use nu_path::expand_path_with;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
use std::path::PathBuf;
#[cfg(not(windows))]
#[test]

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn chooses_highest_increment_if_given_more_than_one() {

View File

@ -1,4 +1,5 @@
use nu_test_support::nu_with_plugins;
use pretty_assertions::assert_eq;
#[test]
fn can_get_custom_value_from_plugin_and_instantly_collapse_it() {

View File

@ -1,4 +1,5 @@
use nu_test_support::nu_with_plugins;
use pretty_assertions::assert_eq;
const TEST_CWD: &str = "tests/fixtures/formats";

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn infers_types() {

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
const TEST_CWD: &str = "tests/fixtures/formats";

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn infers_types() {

View File

@ -1,4 +1,5 @@
use nu_test_support::nu;
use pretty_assertions::assert_eq;
#[ignore = "TODO: This shows old-style aliases. New aliases are under commands"]
#[test]

View File

@ -4,7 +4,7 @@ use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use nu_test_support::{nu_repl_code, pipeline};
use pretty_assertions::assert_eq;
use serial_test::serial;
#[test]

View File

@ -3,6 +3,7 @@ use super::support::Trusted;
use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
use pretty_assertions::assert_eq;
use serial_test::serial;

View File

@ -1,6 +1,7 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code, pipeline};
use pretty_assertions::assert_eq;
#[cfg(feature = "which-support")]
mod environment;

View File

@ -1,4 +1,5 @@
use nu_test_support::nu;
use pretty_assertions::assert_eq;
#[cfg(feature = "which-support")]
#[test]

View File

@ -2,6 +2,7 @@ use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::pipeline;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {

View File

@ -1,6 +1,7 @@
mod commands;
use nu_test_support::nu;
use pretty_assertions::assert_eq;
#[test]
fn doesnt_break_on_utf8() {