1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-01 01:04:00 +00:00

docs(preset): Plaintext status added (#4775)

* Plaintext status added

* One test case
This commit is contained in:
John Slowik 2022-12-31 05:35:28 -06:00 committed by GitHub
parent e0590f1669
commit 8a8e09dd50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -180,6 +180,9 @@ symbol = "scala "
[spack] [spack]
symbol = "spack " symbol = "spack "
[status]
symbol = "[x](bold red) "
[sudo] [sudo]
symbol = "sudo " symbol = "sudo "

View File

@ -337,6 +337,27 @@ mod tests {
} }
} }
#[test]
fn failure_plaintext_status() {
let exit_values = [1, 2, 130];
for status in &exit_values {
let expected = Some(format!(
"{} ",
Color::Red.bold().paint(format!("x {status}"))
));
let actual = ModuleRenderer::new("status")
.config(toml::toml! {
[status]
symbol = "[x](bold red) "
disabled = false
})
.status(*status)
.collect();
assert_eq!(expected, actual);
}
}
#[test] #[test]
fn failure_hex_status() { fn failure_hex_status() {
let exit_values = [1, 2, 130, -2_147_467_260, 2_147_500_036]; let exit_values = [1, 2, 130, -2_147_467_260, 2_147_500_036];