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 can be found in different places:
* `/tests` * `/tests`
* `src/tests`
* command examples * command examples
* crate-specific tests * crate-specific tests

View File

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

View File

@ -11,5 +11,6 @@ mod path;
mod plugin_persistence; mod plugin_persistence;
#[cfg(feature = "plugin")] #[cfg(feature = "plugin")]
mod plugins; mod plugins;
mod repl;
mod scope; mod scope;
mod shell; 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] #[test]
fn bits_and() -> TestResult { 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 // Tests for null / null / Value::Nothing
#[test] #[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] #[test]
fn commandline_test_get_empty() -> TestResult { 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] #[test]
fn if_test1() -> TestResult { fn if_test1() -> TestResult {

View File

@ -1,5 +1,4 @@
use super::{fail_test, run_test, run_test_std}; use crate::repl::tests::{fail_test, run_test, run_test_std, TestResult};
use crate::tests::TestResult;
#[test] #[test]
fn mutate_nu_config() -> TestResult { 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] #[test]
fn from_json_1() -> TestResult { 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 nu_test_support::nu;
use pretty_assertions::assert_eq; 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; use rstest::rstest;
#[test] #[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; use nu_test_support::nu;
#[test] #[test]

View File

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

View File

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

View File

@ -1,4 +1,4 @@
use crate::tests::{run_test, TestResult}; use crate::repl::tests::{run_test, TestResult};
#[test] #[test]
fn better_block_types() -> TestResult { 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 std::process::Command;
use crate::tests::{fail_test, run_test, run_test_contains, TestResult};
// cargo version prints a string of the form: // cargo version prints a string of the form:
// cargo 1.60.0 (d1fd9fe2c 2022-03-01) // 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] #[test]
fn add_simple() -> TestResult { 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] #[test]
fn module_def_imports_1() -> TestResult { 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 nu_test_support::{nu, nu_repl_code};
use std::collections::HashMap; use std::collections::HashMap;
use super::run_test_contains;
#[test] #[test]
fn env_shorthand() -> TestResult { fn env_shorthand() -> TestResult {
run_test("FOO=BAR if false { 3 } else { 4 }", "4") 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] #[test]
fn int_in_inc_range() -> TestResult { 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] #[test]
fn contains() -> TestResult { 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] #[test]
fn list_annotations() -> TestResult { 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; use nu_test_support::nu;
#[test] #[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] #[test]
fn library_loaded() -> TestResult { 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] #[test]
fn cjk_in_substrings() -> TestResult { 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] #[test]
fn illegal_column_duplication() -> TestResult { 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] #[test]
fn chained_operator_typecheck() -> TestResult { 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 assert_cmd::prelude::*;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use std::collections::HashMap; use std::collections::HashMap;