summaryrefslogtreecommitdiffstats
path: root/tests/testsuite
diff options
context:
space:
mode:
authoryuri <1969yuri1969@gmail.com>2019-09-29 05:50:38 +0200
committerKevin Song <chipbuster@users.noreply.github.com>2019-09-28 22:50:38 -0500
commit63a45d01f949596f6ee0b037c84b6e0cee598b7d (patch)
treefaf264fb5f1cedb33e1dc4a3656aec4aee17c38a /tests/testsuite
parent8c56729d26ada71f86de2120227db4d1dfd327c3 (diff)
feat: Use tilde for home_directory when under version control (#439)
Diffstat (limited to 'tests/testsuite')
-rw-r--r--tests/testsuite/directory.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/testsuite/directory.rs b/tests/testsuite/directory.rs
index 25926a240..86f2aefd9 100644
--- a/tests/testsuite/directory.rs
+++ b/tests/testsuite/directory.rs
@@ -421,6 +421,37 @@ fn directory_in_git_repo_truncate_to_repo_true() -> io::Result<()> {
#[test]
#[ignore]
+#[cfg(not(target_os = "windows"))]
+fn git_repo_in_home_directory_truncate_to_repo_true() -> io::Result<()> {
+ let tmp_dir = TempDir::new_in(dirs::home_dir().unwrap())?;
+ let dir = tmp_dir.path().join("src/meters/fuel-gauge");
+ fs::create_dir_all(&dir)?;
+ Repository::init(&tmp_dir).unwrap();
+
+ let output = common::render_module("directory")
+ .use_config(toml::toml! {
+ [directory]
+ // `truncate_to_repo = true` should attmpt to display the truncated path
+ truncate_to_repo = true
+ truncation_length = 5
+ })
+ // Set home directory to the temp repository
+ .env("HOME", tmp_dir.path())
+ .arg("--path")
+ .arg(dir)
+ .output()?;
+ let actual = String::from_utf8(output.stdout).unwrap();
+
+ let expected = format!(
+ "in {} ",
+ Color::Cyan.bold().paint("~/src/meters/fuel-gauge")
+ );
+ assert_eq!(expected, actual);
+ Ok(())
+}
+
+#[test]
+#[ignore]
fn use_logical_and_physical_paths() -> io::Result<()> {
/* This test is a bit of a smoke + mirrors trick because all it shows is that
the application is reading the PWD envar correctly (if the shell doesn't