+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

test: refactor function name #3203

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/rome_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ serde = { version = "1.0.133", features = ["derive"] }
serde_json = { version = "1.0.74" }
tokio = { version = "1.15.0", features = ["io-std", "io-util", "net", "time", "rt", "rt-multi-thread", "macros"] }
anyhow = "1.0.52"
cfg-if = "1.0.0"
dashmap = "5.2.0"

[target.'cfg(unix)'.dependencies]
Expand Down
11 changes: 2 additions & 9 deletions crates/rome_cli/src/termination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,10 @@ pub enum Termination {
}

fn command_name() -> String {
#[allow(unused_assignments)]
let mut command = current_exe()
current_exe()
.ok()
.and_then(|path| Some(path.file_name()?.to_str()?.to_string()))
.unwrap_or_else(|| String::from("rome"));
cfg_if::cfg_if! {
if #[cfg(debug_assertions)] {
command = String::from("rome")
}
}
command
.unwrap_or_else(|| String::from("rome"))
}

// Termination implements Debug by redirecting to Display instead of deriving
Expand Down
12 changes: 11 additions & 1 deletion crates/rome_cli/tests/snap_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use rome_console::{markup, BufferConsole, Markup};
use rome_diagnostics::termcolor::NoColor;
use rome_fs::{FileSystemExt, MemoryFileSystem};
use std::collections::HashMap;
use std::env::current_exe;
use std::fmt::Write as _;
use std::path::PathBuf;

Expand Down Expand Up @@ -76,10 +77,19 @@ impl CliSnapshot {
}

if let Some(termination) = &self.termination {
let mut message = format!("{:?}", termination);
let exe = current_exe()
.ok()
.and_then(|path| Some(path.file_name()?.to_str()?.to_string()));
if let Some(exe) = exe {
if message.contains(&exe) {
message = message.replace(&exe, "rome");
}
}
content.push_str("# Termination Message\n\n");
content.push_str("```block");
content.push('\n');
let _ = write!(content, "{:?}", termination);
let _ = write!(content, "{}", message);
content.push('\n');
content.push_str("```");
content.push_str("\n\n");
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载