mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 07:46:28 +00:00
fix: Failing Tests if home is a git directory (#214)
This commit is contained in:
parent
faa2280620
commit
da86b4f847
@ -70,6 +70,8 @@ Unit tests are written using the built-in Rust testing library in the same file
|
|||||||
|
|
||||||
Unit tests should be fully isolated, only testing a given function's expected output given a specific input, and should be reproducible on any machine. Unit tests should not expect the computer running them to be in any particular state. This includes having any applications pre-installed, having any environment variables set, etc.
|
Unit tests should be fully isolated, only testing a given function's expected output given a specific input, and should be reproducible on any machine. Unit tests should not expect the computer running them to be in any particular state. This includes having any applications pre-installed, having any environment variables set, etc.
|
||||||
|
|
||||||
|
The previous point should be emphasized: even seemingly innocuous ideas like "if we can see the directory, we can read it" or "nobody will have their home directory be a git repo" have bitten us in the past. Having even a single test fail can completely break installation on some platforms, so be careful with tests!
|
||||||
|
|
||||||
### Acceptance Testing
|
### Acceptance Testing
|
||||||
|
|
||||||
Acceptance tests are located in the [`tests/`](tests) directory and are also written using the built-in Rust testing library.
|
Acceptance tests are located in the [`tests/`](tests) directory and are also written using the built-in Rust testing library.
|
||||||
|
@ -12,6 +12,10 @@ use crate::common::{self, TestCommand};
|
|||||||
fn home_directory() -> io::Result<()> {
|
fn home_directory() -> io::Result<()> {
|
||||||
let output = common::render_module("directory")
|
let output = common::render_module("directory")
|
||||||
.arg("--path=~")
|
.arg("--path=~")
|
||||||
|
.use_config(toml::toml! { // Necessary if homedir is a git repo
|
||||||
|
[directory]
|
||||||
|
truncate_to_repo = false
|
||||||
|
})
|
||||||
.output()?;
|
.output()?;
|
||||||
let actual = String::from_utf8(output.stdout).unwrap();
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user