1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-28 15:56:28 +00:00

fix: Do not depend on user's config in conda tests (#1098)

The user's config is automatically loaded
in context.new_module. This change explicitly
sets the empty config to avoid depending on
the environment.

Without this fix, the tests do not pass
for users who have a custom symbol defined
for conda. This prevents installing/upgrading
from Arch Linux AUR.
This commit is contained in:
Stanisław Barzowski 2020-04-13 21:23:49 +02:00 committed by GitHub
parent 05e323da75
commit 7c45f74d11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,12 +2,14 @@ use ansi_term::Color;
use std::io; use std::io;
use crate::common; use crate::common;
use crate::common::TestCommand;
#[test] #[test]
fn not_in_env() -> io::Result<()> { fn not_in_env() -> io::Result<()> {
let output = common::render_module("conda") let output = common::render_module("conda")
.env_clear() .env_clear()
.env("PATH", env!("PATH")) .env("PATH", env!("PATH"))
.use_config("".parse().unwrap())
.output()?; .output()?;
let expected = ""; let expected = "";
@ -22,6 +24,7 @@ fn env_set() -> io::Result<()> {
let output = common::render_module("conda") let output = common::render_module("conda")
.env_clear() .env_clear()
.env("CONDA_DEFAULT_ENV", "astronauts") .env("CONDA_DEFAULT_ENV", "astronauts")
.use_config("".parse().unwrap())
.output()?; .output()?;
let expected = format!("via {} ", Color::Green.bold().paint("C astronauts")); let expected = format!("via {} ", Color::Green.bold().paint("C astronauts"));
@ -33,7 +36,11 @@ fn env_set() -> io::Result<()> {
#[test] #[test]
fn truncate() -> io::Result<()> { fn truncate() -> io::Result<()> {
let output = common::render_module("conda").env_clear().env("CONDA_DEFAULT_ENV", "/some/really/long/and/really/annoying/path/that/shouldnt/be/displayed/fully/conda/my_env").output()?; let output = common::render_module("conda")
.env_clear()
.use_config("".parse().unwrap())
.env("CONDA_DEFAULT_ENV", "/some/really/long/and/really/annoying/path/that/shouldnt/be/displayed/fully/conda/my_env")
.output()?;
let expected = format!("via {} ", Color::Green.bold().paint("C my_env")); let expected = format!("via {} ", Color::Green.bold().paint("C my_env"));
let actual = String::from_utf8(output.stdout).unwrap(); let actual = String::from_utf8(output.stdout).unwrap();