mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-05 12:57:50 +00:00
7718450311
* feat: add nix-shell icon Fixes #1048 * style: make nix-shell bold blue by default It better matches the whole theme around Nix and snowflakes.
59 lines
1.5 KiB
Rust
59 lines
1.5 KiB
Rust
use ansi_term::Color;
|
|
use std::io;
|
|
|
|
use crate::common;
|
|
|
|
#[test]
|
|
fn no_env_variables() -> io::Result<()> {
|
|
let output = common::render_module("nix_shell").output()?;
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
assert_eq!("", actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
fn invalid_env_variables() -> io::Result<()> {
|
|
let output = common::render_module("nix_shell")
|
|
.env("IN_NIX_SHELL", "something_wrong")
|
|
.output()?;
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
assert_eq!("", actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
fn pure_shell() -> io::Result<()> {
|
|
let output = common::render_module("nix_shell")
|
|
.env("IN_NIX_SHELL", "pure")
|
|
.output()?;
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
let expected = format!("via {} ", Color::Blue.bold().paint("❄️ pure"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
fn impure_shell() -> io::Result<()> {
|
|
let output = common::render_module("nix_shell")
|
|
.env("IN_NIX_SHELL", "impure")
|
|
.output()?;
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
let expected = format!("via {} ", Color::Blue.bold().paint("❄️ impure"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
fn lorri_shell() -> io::Result<()> {
|
|
let output = common::render_module("nix_shell")
|
|
.env("IN_NIX_SHELL", "1")
|
|
.output()?;
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
let expected = format!("via {} ", Color::Blue.bold().paint("❄️ impure"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|