From ead4029d494c770cae97a11c470aee326a5ba33b Mon Sep 17 00:00:00 2001
From: JT <547158+jntrnr@users.noreply.github.com>
Date: Wed, 18 Aug 2021 05:55:34 +1200
Subject: [PATCH] Bump rustyline and add unalias test (#3935)

---
 Cargo.lock                                | 32 ++++++++++++++++-------
 crates/nu-cli/Cargo.toml                  |  2 +-
 crates/nu-command/Cargo.toml              |  2 +-
 tests/shell/pipeline/commands/internal.rs | 13 +++++++++
 4 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index ccaa31a302..5f1fd86f6a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1148,7 +1148,7 @@ version = "3.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "232295399409a8b7ae41276757b5a1cc21032848d42bff2352261f958b3ca29a"
 dependencies = [
- "nix",
+ "nix 0.20.0",
  "winapi 0.3.9",
 ]
 
@@ -1626,10 +1626,11 @@ dependencies = [
 
 [[package]]
 name = "fd-lock"
-version = "2.0.0"
+version = "3.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0010f02effd88c702318c5dde0463206be67495d0b4d906ba7c0a8f166cc7f06"
+checksum = "b8806dd91a06a7a403a8e596f9bfbfb34e469efbc363fc9c9713e79e26472e36"
 dependencies = [
+ "cfg-if 1.0.0",
  "libc",
  "winapi 0.3.9",
 ]
@@ -2681,9 +2682,9 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.2.97"
+version = "0.2.99"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6"
+checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
 
 [[package]]
 name = "libgit2-sys"
@@ -3113,6 +3114,19 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "nix"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7555d6c7164cc913be1ce7f95cbecdabda61eb2ccd89008524af306fb7f5031"
+dependencies = [
+ "bitflags",
+ "cc",
+ "cfg-if 1.0.0",
+ "libc",
+ "memoffset",
+]
+
 [[package]]
 name = "nodrop"
 version = "0.1.14"
@@ -5219,9 +5233,9 @@ checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088"
 
 [[package]]
 name = "rustyline"
-version = "8.2.0"
+version = "9.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbd4eaf7a7738f76c98e4f0395253ae853be3eb018f7b0bb57fe1b6c17e31874"
+checksum = "790487c3881a63489ae77126f57048b42d62d3b2bafbf37453ea19eedb6340d6"
 dependencies = [
  "bitflags",
  "cfg-if 1.0.0",
@@ -5231,7 +5245,7 @@ dependencies = [
  "libc",
  "log",
  "memchr",
- "nix",
+ "nix 0.22.1",
  "radix_trie",
  "scopeguard",
  "smallvec",
@@ -6887,7 +6901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6ffb080b3f2f616242a4eb8e7d325035312127901025b0052bc3154a282d0f19"
 dependencies = [
  "gethostname",
- "nix",
+ "nix 0.20.0",
  "winapi 0.3.9",
  "winapi-wsapoll",
 ]
diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml
index ee1e0fe9b1..e6776f1dc8 100644
--- a/crates/nu-cli/Cargo.toml
+++ b/crates/nu-cli/Cargo.toml
@@ -26,7 +26,7 @@ indexmap ="1.6.1"
 log = "0.4.14"
 pretty_env_logger = "0.4.0"
 strip-ansi-escapes = "0.1.0"
-rustyline = { version="8.1.0", optional=true }
+rustyline = { version="9.0.0", optional=true }
 ctrlc = { version="3.1.7", optional=true }
 shadow-rs = { version="0.6", default-features=false, optional=true }
 serde = { version="1.0.123", features=["derive"] }
diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml
index a339f094e7..beec12721a 100644
--- a/crates/nu-command/Cargo.toml
+++ b/crates/nu-command/Cargo.toml
@@ -74,7 +74,7 @@ rayon = "1.5.0"
 regex = "1.4.3"
 roxmltree = "0.14.0"
 rust-embed = "5.9.0"
-rustyline = { version="8.1.0", optional=true }
+rustyline = { version="9.0.0", optional=true }
 serde = { version="1.0.123", features=["derive"] }
 serde_bytes = "0.11.5"
 serde_ini = "0.2.0"
diff --git a/tests/shell/pipeline/commands/internal.rs b/tests/shell/pipeline/commands/internal.rs
index ec056b0425..1b982f4846 100644
--- a/tests/shell/pipeline/commands/internal.rs
+++ b/tests/shell/pipeline/commands/internal.rs
@@ -1160,6 +1160,19 @@ fn unalias_shadowing() {
     assert_eq!(actual.out, "");
 }
 
+#[test]
+fn unalias_hides_alias() {
+    let actual = nu!(cwd: ".", pipeline(
+        r#"alias ll = ls -l
+        ll
+        unalias ll
+        ll
+        "#)
+    );
+
+    assert!(actual.err.contains("not found"));
+}
+
 mod parse {
     use nu_test_support::nu;