From b35bb04c66040adcefc175e4339e33eafe198eff Mon Sep 17 00:00:00 2001 From: Julien Blanchard Date: Mon, 25 Jul 2016 16:30:42 +0200 Subject: [PATCH] Print rustup version after update --- src/rustup-cli/self_update.rs | 4 +++- tests/cli-self-upd.rs | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index 38d063ef45e..6ffc3b8b5ea 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -55,6 +55,8 @@ pub const NEVER_SELF_UPDATE: bool = true; #[cfg(not(feature = "no-self-update"))] pub const NEVER_SELF_UPDATE: bool = false; +pub const VERSION: &'static str = env!("CARGO_PKG_VERSION"); + // The big installation messages. These are macros because the first // argument of format! needs to be a literal. @@ -1069,7 +1071,7 @@ pub fn update() -> Result<()> { } let setup_path = try!(prepare_update()); if let Some(ref p) = setup_path { - info!("rustup updated successfully"); + info!("rustup updated successfully to {}", VERSION); try!(run_update(p)); } diff --git a/tests/cli-self-upd.rs b/tests/cli-self-upd.rs index 855601fd453..cd715187e1a 100644 --- a/tests/cli-self-upd.rs +++ b/tests/cli-self-upd.rs @@ -456,14 +456,17 @@ fn install_doesnt_modify_path_if_passed_no_modify_path() { #[test] fn update_exact() { - update_setup(&|config, _| { - expect_ok(config, &["rustup-init", "-y"]); - expect_ok_ex(config, &["rustup", "self", "update"], -r"", + let version = env!("CARGO_PKG_VERSION"); + let expected_output = &( r"info: checking for self-updates info: downloading self-update -info: rustup updated successfully +info: rustup updated successfully to ".to_owned() + version + " "); + + update_setup(&|config, _| { + expect_ok(config, &["rustup-init", "-y"]); + expect_ok_ex(config, &["rustup", "self", "update"], + r"", expected_output) }); }