1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-27 03:53:30 +00:00

test(hostname): fix trim_at test with unicode hostname (#3295)

This commit is contained in:
David Knaack 2021-12-09 22:15:25 +01:00 committed by GitHub
parent b626a98b37
commit b4a14e3a80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]