From 3bd45c005beaa0e006bea0b5e8975b421a6f7342 Mon Sep 17 00:00:00 2001 From: 132ikl <132@ikl.sh> Date: Wed, 4 Dec 2024 20:26:48 -0500 Subject: [PATCH] Change tests which may invoke externals to use non-conflicting names (#14516) # Description Fixes #14515 Also tweaks the fix from #11261 _just in case_ someone has a `foo` executable # User-Facing Changes N/A # Tests + Formatting # After Submitting --- crates/nu-command/tests/commands/use_.rs | 6 +++--- tests/overlays/mod.rs | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/nu-command/tests/commands/use_.rs b/crates/nu-command/tests/commands/use_.rs index 2822be83c7..cb5f262e72 100644 --- a/crates/nu-command/tests/commands/use_.rs +++ b/crates/nu-command/tests/commands/use_.rs @@ -284,9 +284,9 @@ fn use_main_def_known_external() { #[test] fn use_main_not_exported() { let inp = &[ - r#"module spam { def main [] { "spam" } }"#, - r#"use spam"#, - r#"spam"#, + r#"module my-super-cool-and-unique-module-name { def main [] { "hi" } }"#, + r#"use my-super-cool-and-unique-module-name"#, + r#"my-super-cool-and-unique-module-name"#, ]; let actual = nu!(&inp.join("; ")); diff --git a/tests/overlays/mod.rs b/tests/overlays/mod.rs index 15697f467d..a04f44641b 100644 --- a/tests/overlays/mod.rs +++ b/tests/overlays/mod.rs @@ -807,10 +807,10 @@ fn overlay_can_add_renamed_overlay() { #[test] fn overlay_hide_renamed_overlay() { let inp = &[ - r#"module spam { export def foo [] { "foo" } }"#, + r#"module spam { export def foo-command-which-does-not-conflict [] { "foo" } }"#, "overlay use spam as eggs", "overlay hide eggs", - "foo", + "foo-command-which-does-not-conflict", ]; let actual = nu!(&inp.join("; ")); @@ -1243,9 +1243,9 @@ fn overlay_use_main_def_known_external() { #[test] fn overlay_use_main_not_exported() { let inp = &[ - r#"module foo { def main [] { "foo" } }"#, - "overlay use foo", - "foo", + r#"module my-super-cool-and-unique-module-name { def main [] { "hi" } }"#, + "overlay use my-super-cool-and-unique-module-name", + "my-super-cool-and-unique-module-name", ]; let actual = nu!(&inp.join("; ")); @@ -1257,11 +1257,11 @@ fn overlay_use_main_not_exported() { fn alias_overlay_hide() { let inp = &[ "overlay new spam", - "def foo [] { 'foo' }", + "def my-epic-command-name [] { 'foo' }", "overlay new eggs", "alias oh = overlay hide", "oh spam", - "foo", + "my-epic-command-name", ]; let actual = nu!(&inp.join("; "));