Merged tests to produce a single binary (#12826)

This PR should close #7147 

# Description
Merged src/tests into /tests to produce a single binary.

![image](https://github.com/nushell/nushell/assets/94604837/84726469-d447-4619-b6d1-2d1415d0f42e)

# User-Facing Changes
No user facing changes

# Tests + Formatting
Moved tests. Tollkit check pr pass.

# After Submitting

---------

Co-authored-by: Ian Manske <ian.manske@pm.me>
This commit is contained in:
francesco-gaglione 2024-05-13 15:37:53 +02:00 committed by GitHub
parent c70c43aae9
commit c4dca5fe03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 53 additions and 59 deletions

View File

@ -55,7 +55,6 @@ It is good practice to cover your changes with a test. Also, try to think about
Tests can be found in different places:
* `/tests`
* `src/tests`
* command examples
* crate-specific tests

View File

@ -7,8 +7,6 @@ mod signals;
#[cfg(unix)]
mod terminal;
mod test_bins;
#[cfg(test)]
mod tests;
#[cfg(feature = "mimalloc")]
#[global_allocator]

View File

@ -11,5 +11,6 @@ mod path;
mod plugin_persistence;
#[cfg(feature = "plugin")]
mod plugins;
mod repl;
mod scope;
mod shell;

27
tests/repl/mod.rs Normal file
View File

@ -0,0 +1,27 @@
mod test_bits;
mod test_cell_path;
mod test_commandline;
mod test_conditionals;
mod test_config;
mod test_config_path;
mod test_converters;
mod test_custom_commands;
mod test_engine;
mod test_env;
mod test_help;
mod test_hiding;
mod test_ide;
mod test_iteration;
mod test_known_external;
mod test_math;
mod test_modules;
mod test_parser;
mod test_ranges;
mod test_regex;
mod test_signatures;
mod test_spread;
mod test_stdlib;
mod test_strings;
mod test_table_operations;
mod test_type_check;
mod tests;

View File

@ -1,4 +1,4 @@
use crate::tests::{run_test, TestResult};
use crate::repl::tests::{run_test, TestResult};
#[test]
fn bits_and() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
// Tests for null / null / Value::Nothing
#[test]

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn commandline_test_get_empty() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{run_test, TestResult};
use crate::repl::tests::{run_test, TestResult};
#[test]
fn if_test1() -> TestResult {

View File

@ -1,5 +1,4 @@
use super::{fail_test, run_test, run_test_std};
use crate::tests::TestResult;
use crate::repl::tests::{fail_test, run_test, run_test_std, TestResult};
#[test]
fn mutate_nu_config() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{run_test, TestResult};
use crate::repl::tests::{run_test, TestResult};
#[test]
fn from_json_1() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, run_test_contains, TestResult};
use crate::repl::tests::{fail_test, run_test, run_test_contains, TestResult};
use nu_test_support::nu;
use pretty_assertions::assert_eq;

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
use rstest::rstest;
#[test]

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
use nu_test_support::nu;
#[test]

View File

@ -1,4 +1,4 @@
use crate::tests::{run_test, TestResult};
use crate::repl::tests::{run_test, TestResult};
use rstest::rstest;
#[rstest]

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
// TODO: Test the use/hide tests also as separate lines in REPL (i.e., with merging the delta in between)
#[test]

View File

@ -1,4 +1,4 @@
use crate::tests::{test_ide_contains, TestResult};
use crate::repl::tests::{test_ide_contains, TestResult};
#[test]
fn parser_recovers() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{run_test, TestResult};
use crate::repl::tests::{run_test, TestResult};
#[test]
fn better_block_types() -> TestResult {

View File

@ -1,7 +1,6 @@
use crate::repl::tests::{fail_test, run_test, run_test_contains, TestResult};
use std::process::Command;
use crate::tests::{fail_test, run_test, run_test_contains, TestResult};
// cargo version prints a string of the form:
// cargo 1.60.0 (d1fd9fe2c 2022-03-01)

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn add_simple() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn module_def_imports_1() -> TestResult {

View File

@ -1,9 +1,7 @@
use crate::tests::{fail_test, run_test, run_test_with_env, TestResult};
use crate::repl::tests::{fail_test, run_test, run_test_contains, run_test_with_env, TestResult};
use nu_test_support::{nu, nu_repl_code};
use std::collections::HashMap;
use super::run_test_contains;
#[test]
fn env_shorthand() -> TestResult {
run_test("FOO=BAR if false { 3 } else { 4 }", "4")

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn int_in_inc_range() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn contains() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn list_annotations() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
use nu_test_support::nu;
#[test]

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test_std, TestResult};
use crate::repl::tests::{fail_test, run_test_std, TestResult};
#[test]
fn library_loaded() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn cjk_in_substrings() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn illegal_column_duplication() -> TestResult {

View File

@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn chained_operator_typecheck() -> TestResult {

View File

@ -1,30 +1,3 @@
mod test_bits;
mod test_cell_path;
mod test_commandline;
mod test_conditionals;
mod test_config;
mod test_config_path;
mod test_converters;
mod test_custom_commands;
mod test_engine;
mod test_env;
mod test_help;
mod test_hiding;
mod test_ide;
mod test_iteration;
mod test_known_external;
mod test_math;
mod test_modules;
mod test_parser;
mod test_ranges;
mod test_regex;
mod test_signatures;
mod test_spread;
mod test_stdlib;
mod test_strings;
mod test_table_operations;
mod test_type_check;
use assert_cmd::prelude::*;
use pretty_assertions::assert_eq;
use std::collections::HashMap;