From 5d124351d32713f59df3b532e40a79ea51715ee3 Mon Sep 17 00:00:00 2001 From: Doonv <58695417+doonv@users.noreply.github.com> Date: Wed, 3 Jan 2024 16:54:34 +0200 Subject: [PATCH] Remove test for removed internal behavior --- src/builtin_parser/runner.rs | 2 +- src/builtin_parser/runner/unique_rc.rs | 11 ----------- src/ui.rs | 10 +++++++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/builtin_parser/runner.rs b/src/builtin_parser/runner.rs index b261ac8..5d4e28e 100644 --- a/src/builtin_parser/runner.rs +++ b/src/builtin_parser/runner.rs @@ -92,7 +92,7 @@ pub fn run(ast: Ast, world: &mut World) { match value { Ok(Value::None) => {} Ok(value) => match value.try_format(span, world, ®istrations) { - Ok(value) => info!(name: COMMAND_RESULT_NAME, "> {value}"), + Ok(value) => info!(name: COMMAND_RESULT_NAME, "{value}"), Err(err) => error!("{err:?}"), }, Err(err) => { diff --git a/src/builtin_parser/runner/unique_rc.rs b/src/builtin_parser/runner/unique_rc.rs index e20a6c9..f0cc020 100644 --- a/src/builtin_parser/runner/unique_rc.rs +++ b/src/builtin_parser/runner/unique_rc.rs @@ -114,17 +114,6 @@ impl StrongRef { mod tests { use super::*; - #[test] - fn weak_ref_upgrade_once() { - let rc = UniqueRc::new(0); - - let weak = rc.borrow(); - - assert!(weak.upgrade().is_some()); - assert!(weak.upgrade().is_none()); - assert!(weak.upgrade().is_none()); - } - #[test] #[should_panic] fn strong_ref_panic() { diff --git a/src/ui.rs b/src/ui.rs index e3dac1c..4bd4167 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -17,7 +17,9 @@ use crate::{ prelude::ConsoleConfig, }; +/// The prefix for commands const COMMAND_MESSAGE_PREFIX: &str = "$ "; +const COMMAND_RESULT_PREFIX: &str = "> "; /// Identifier for log messages that show a previous command. pub const COMMAND_MESSAGE_NAME: &str = "console_command"; /// Identifier for log messages that show the result of a history @@ -217,7 +219,7 @@ fn format_line( *command_index += 1; - // TODO: Handle more than just he first element + // TODO: Handle more than just the first element if let Some(hint) = hints.first() { const PREFIX_LEN: usize = COMMAND_MESSAGE_PREFIX.len(); @@ -241,10 +243,12 @@ fn format_line( ); return text; } + text.append(message.as_str(), 0.0, config.theme.format_text()); + return text; + } else { // COMMAND_RESULT_NAME + text.append(COMMAND_RESULT_PREFIX, 0.0, config.theme.format_dark()) } - text.append(message.as_str(), 0.0, config.theme.format_text()); - return text; } text.append(level.as_str(), 0.0, config.theme.format_level(*level)); text.append(&format!(" {message}"), 0.0, config.theme.format_text());