mirror of
https://github.com/starship/starship.git
synced 2024-12-23 23:58:51 +01:00
test(hostname): fix trim_at
test with unicode hostname (#3295)
This commit is contained in:
parent
b626a98b37
commit
b4a14e3a80
@ -69,6 +69,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||
mod tests {
|
||||
use crate::test::ModuleRenderer;
|
||||
use ansi_term::{Color, Style};
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
||||
macro_rules! get_hostname {
|
||||
() => {
|
||||
@ -146,7 +147,9 @@ mod tests {
|
||||
#[test]
|
||||
fn trim_at() {
|
||||
let hostname = get_hostname!();
|
||||
let (remainder, trim_at) = hostname.split_at(1);
|
||||
let mut hostname_iter = hostname.graphemes(true);
|
||||
let remainder = hostname_iter.next().unwrap_or_default();
|
||||
let trim_at = hostname_iter.collect::<String>();
|
||||
let actual = ModuleRenderer::new("hostname")
|
||||
.config(toml::toml! {
|
||||
[hostname]
|
||||
|
Loading…
Reference in New Issue
Block a user