mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 15:56:28 +00:00
test: Add null tests to modules that don't have them (#1104)
Have added some null tests to modules that don't already have them.
This commit is contained in:
parent
d13d508ca2
commit
d91b6b7137
@ -2,9 +2,25 @@ use ansi_term::Color;
|
|||||||
use remove_dir_all::remove_dir_all;
|
use remove_dir_all::remove_dir_all;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use tempfile;
|
||||||
|
|
||||||
use crate::common::{self, TestCommand};
|
use crate::common::{self, TestCommand};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn show_nothing_on_empty_dir() -> io::Result<()> {
|
||||||
|
let repo_dir = tempfile::tempdir()?;
|
||||||
|
|
||||||
|
let output = common::render_module("git_branch")
|
||||||
|
.arg("--path")
|
||||||
|
.arg(repo_dir.path())
|
||||||
|
.output()?;
|
||||||
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
let expected = "";
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
repo_dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_changed_truncation_symbol() -> io::Result<()> {
|
fn test_changed_truncation_symbol() -> io::Result<()> {
|
||||||
test_truncate_length_with_config(
|
test_truncate_length_with_config(
|
||||||
|
@ -5,6 +5,21 @@ use std::{io, str};
|
|||||||
|
|
||||||
use crate::common::{self, TestCommand};
|
use crate::common::{self, TestCommand};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn show_nothing_on_empty_dir() -> io::Result<()> {
|
||||||
|
let repo_dir = tempfile::tempdir()?;
|
||||||
|
|
||||||
|
let output = common::render_module("git_commit")
|
||||||
|
.arg("--path")
|
||||||
|
.arg(repo_dir.path())
|
||||||
|
.output()?;
|
||||||
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
let expected = "";
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
repo_dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_render_commit_hash() -> io::Result<()> {
|
fn test_render_commit_hash() -> io::Result<()> {
|
||||||
let repo_dir = common::create_fixture_repo()?;
|
let repo_dir = common::create_fixture_repo()?;
|
||||||
|
@ -5,6 +5,21 @@ use std::io::{self, Error, ErrorKind, Write};
|
|||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use tempfile;
|
use tempfile;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn show_nothing_on_empty_dir() -> io::Result<()> {
|
||||||
|
let repo_dir = tempfile::tempdir()?;
|
||||||
|
|
||||||
|
let output = common::render_module("git_state")
|
||||||
|
.arg("--path")
|
||||||
|
.arg(repo_dir.path())
|
||||||
|
.output()?;
|
||||||
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
let expected = "";
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
repo_dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn shows_rebasing() -> io::Result<()> {
|
fn shows_rebasing() -> io::Result<()> {
|
||||||
|
@ -4,6 +4,7 @@ use std::fs::{self, File};
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use tempfile;
|
||||||
|
|
||||||
use crate::common::{self, TestCommand};
|
use crate::common::{self, TestCommand};
|
||||||
|
|
||||||
@ -19,6 +20,21 @@ fn barrier() {
|
|||||||
std::thread::sleep(std::time::Duration::from_millis(500));
|
std::thread::sleep(std::time::Duration::from_millis(500));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn show_nothing_on_empty_dir() -> io::Result<()> {
|
||||||
|
let repo_dir = tempfile::tempdir()?;
|
||||||
|
|
||||||
|
let output = common::render_module("git_status")
|
||||||
|
.arg("--path")
|
||||||
|
.arg(repo_dir.path())
|
||||||
|
.output()?;
|
||||||
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
let expected = "";
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
repo_dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn shows_behind() -> io::Result<()> {
|
fn shows_behind() -> io::Result<()> {
|
||||||
|
@ -16,6 +16,21 @@ enum Expect<'a> {
|
|||||||
TruncationSymbol(&'a str),
|
TruncationSymbol(&'a str),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn show_nothing_on_empty_dir() -> io::Result<()> {
|
||||||
|
let repo_dir = tempfile::tempdir()?;
|
||||||
|
|
||||||
|
let output = common::render_module("hg_branch")
|
||||||
|
.arg("--path")
|
||||||
|
.arg(repo_dir.path())
|
||||||
|
.output()?;
|
||||||
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
let expected = "";
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
repo_dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn test_hg_get_branch_fails() -> io::Result<()> {
|
fn test_hg_get_branch_fails() -> io::Result<()> {
|
||||||
|
@ -6,6 +6,21 @@ use tempfile;
|
|||||||
|
|
||||||
use crate::common::{self, TestCommand};
|
use crate::common::{self, TestCommand};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn show_nothing_on_empty_dir() -> io::Result<()> {
|
||||||
|
let dir = tempfile::tempdir()?;
|
||||||
|
|
||||||
|
let output = common::render_module("python")
|
||||||
|
.arg("--path")
|
||||||
|
.arg(dir.path())
|
||||||
|
.output()?;
|
||||||
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
let expected = "";
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn folder_with_python_version() -> io::Result<()> {
|
fn folder_with_python_version() -> io::Result<()> {
|
||||||
|
@ -3,6 +3,15 @@ use std::io;
|
|||||||
|
|
||||||
use crate::common;
|
use crate::common;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_env_set() -> io::Result<()> {
|
||||||
|
let output = common::render_module("singularity").output()?;
|
||||||
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
let expected = "";
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn env_set() -> io::Result<()> {
|
fn env_set() -> io::Result<()> {
|
||||||
let output = common::render_module("singularity")
|
let output = common::render_module("singularity")
|
||||||
|
Loading…
Reference in New Issue
Block a user