1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-01 16:10:51 +00:00
starship/tests/python.rs

80 lines
1.8 KiB
Rust

use ansi_term::Color;
use starship::segment::Segment;
use std::fs::File;
use std::io;
use tempfile::TempDir;
mod common;
#[test]
#[ignore]
fn folder_with_python_version() -> io::Result<()> {
let dir = TempDir::new()?;
File::create(dir.path().join(".python-version"))?;
let expected = format!(
"via {} ",
Segment::new("python")
.set_value("🐍 v3.6.8")
.set_style(Color::Yellow.bold())
);
let actual = common::render_module("python", &dir.path());
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
fn folder_with_requirements_txt() -> io::Result<()> {
let dir = TempDir::new()?;
File::create(dir.path().join("requirements.txt"))?;
let expected = format!(
"via {} ",
Segment::new("python")
.set_value("🐍 v3.6.8")
.set_style(Color::Yellow.bold())
);
let actual = common::render_module("python", &dir.path());
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
fn folder_with_pyproject_toml() -> io::Result<()> {
let dir = TempDir::new()?;
File::create(dir.path().join("pyproject.toml"))?;
let expected = format!(
"via {} ",
Segment::new("python")
.set_value("🐍 v3.6.8")
.set_style(Color::Yellow.bold())
);
let actual = common::render_module("python", &dir.path());
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
fn folder_with_py_file() -> io::Result<()> {
let dir = TempDir::new()?;
File::create(dir.path().join("main.py"))?;
let expected = format!(
"via {} ",
Segment::new("python")
.set_value("🐍 v3.6.8")
.set_style(Color::Yellow.bold())
);
let actual = common::render_module("python", &dir.path());
assert_eq!(expected, actual);
Ok(())
}