diff options
author | Thomas O'Donnell <andytom@users.noreply.github.com> | 2020-04-15 09:55:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 09:55:32 +0200 |
commit | d91b6b7137fbd53486f2225e602c5e0e49a4afe9 (patch) | |
tree | 58f9805c42a1567e4c9f0c46de1024e4baff6b0d | |
parent | d13d508ca2008a3c1dcddf6d4b19180a8d839bb5 (diff) |
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.
-rw-r--r-- | tests/testsuite/git_branch.rs | 16 | ||||
-rw-r--r-- | tests/testsuite/git_commit.rs | 15 | ||||
-rw-r--r-- | tests/testsuite/git_state.rs | 15 | ||||
-rw-r--r-- | tests/testsuite/git_status.rs | 16 | ||||
-rw-r--r-- | tests/testsuite/hg_branch.rs | 15 | ||||
-rw-r--r-- | tests/testsuite/python.rs | 15 | ||||
-rw-r--r-- | tests/testsuite/singularity.rs | 9 |
7 files changed, 101 insertions, 0 deletions
diff --git a/tests/testsuite/git_branch.rs b/tests/testsuite/git_branch.rs index 7fa5aaaef..c8504a4df 100644 --- a/tests/testsuite/git_branch.rs +++ b/tests/testsuite/git_branch.rs @@ -2,10 +2,26 @@ use ansi_term::Color; use remove_dir_all::remove_dir_all; use std::io; use std::process::Command; +use tempfile; 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] fn test_changed_truncation_symbol() -> io::Result<()> { test_truncate_length_with_config( "1337_hello_world", diff --git a/tests/testsuite/git_commit.rs b/tests/testsuite/git_commit.rs index d7ae8e771..cac148070 100644 --- a/tests/testsuite/git_commit.rs +++ b/tests/testsuite/git_commit.rs @@ -6,6 +6,21 @@ use std::{io, str}; 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] fn test_render_commit_hash() -> io::Result<()> { let repo_dir = common::create_fixture_repo()?; diff --git a/tests/testsuite/git_state.rs b/tests/testsuite/git_state.rs index e7da3939b..13a0eaed3 100644 --- a/tests/testsuite/git_state.rs +++ b/tests/testsuite/git_state.rs @@ -6,6 +6,21 @@ use std::process::{Command, Stdio}; 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] #[ignore] fn shows_rebasing() -> io::Result<()> { let repo_dir = create_repo_with_conflict()?; diff --git a/tests/testsuite/git_status.rs b/tests/testsuite/git_status.rs index 58bba46e9..eceadb3b7 100644 --- a/tests/testsuite/git_status.rs +++ b/tests/testsuite/git_status.rs @@ -4,6 +4,7 @@ use std::fs::{self, File}; use std::io; use std::path::PathBuf; use std::process::Command; +use tempfile; use crate::common::{self, TestCommand}; @@ -20,6 +21,21 @@ fn barrier() { } #[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] #[ignore] fn shows_behind() -> io::Result<()> { let repo_dir = common::create_fixture_repo()?; diff --git a/tests/testsuite/hg_branch.rs b/tests/testsuite/hg_branch.rs index df600b698..41bec34e6 100644 --- a/tests/testsuite/hg_branch.rs +++ b/tests/testsuite/hg_branch.rs @@ -17,6 +17,21 @@ enum Expect<'a> { } #[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] #[ignore] fn test_hg_get_branch_fails() -> io::Result<()> { let tempdir = tempfile::tempdir()?; diff --git a/tests/testsuite/python.rs b/tests/testsuite/python.rs index a432f5fec..ffc66612e 100644 --- a/tests/testsuite/python.rs +++ b/tests/testsuite/python.rs @@ -7,6 +7,21 @@ use tempfile; 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] #[ignore] fn folder_with_python_version() -> io::Result<()> { let dir = tempfile::tempdir()?; diff --git a/tests/testsuite/singularity.rs b/tests/testsuite/singularity.rs index 26067baaa..84ae45e65 100644 --- a/tests/testsuite/singularity.rs +++ b/tests/testsuite/singularity.rs @@ -4,6 +4,15 @@ use std::io; 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] fn env_set() -> io::Result<()> { let output = common::render_module("singularity") .env_clear() |