summaryrefslogtreecommitdiffstats
path: root/tests/testsuite
diff options
context:
space:
mode:
authorMatan Kushner <hello@matchai.me>2019-06-10 15:56:17 +0100
committerGitHub <noreply@github.com>2019-06-10 15:56:17 +0100
commit097f1b05f1d82967fe2a900ccf7ba3597c04ad77 (patch)
treee5419607802145bf2521defd9823d224f937b653 /tests/testsuite
parent8239fbd12befad1126e677fa083ce73947d74d8c (diff)
Add support for prompt configuration (#62)
- Create `Config` struct that is added to `Context` when initialized - Read `~/.confg/starship.toml` during initialization (can be updated later to also look at `$XDG_CONFIG_HOME`) - `Context` now has a method for creating modules. This allows us to provide modules with a reference to the configuration specific to that module
Diffstat (limited to 'tests/testsuite')
-rw-r--r--tests/testsuite/directory.rs4
-rw-r--r--tests/testsuite/username.rs21
2 files changed, 14 insertions, 11 deletions
diff --git a/tests/testsuite/directory.rs b/tests/testsuite/directory.rs
index 8835b8440..c2c81d52f 100644
--- a/tests/testsuite/directory.rs
+++ b/tests/testsuite/directory.rs
@@ -67,10 +67,10 @@ fn root_directory() -> io::Result<()> {
#[test]
fn directory_in_root() -> io::Result<()> {
- let output = common::render_module("dir").arg("--path=/tmp").output()?;
+ let output = common::render_module("dir").arg("--path=/usr").output()?;
let actual = String::from_utf8(output.stdout).unwrap();
- let expected = format!("in {} ", Color::Cyan.bold().paint("/tmp"));
+ let expected = format!("in {} ", Color::Cyan.bold().paint("/usr"));
assert_eq!(expected, actual);
Ok(())
}
diff --git a/tests/testsuite/username.rs b/tests/testsuite/username.rs
index c046efef7..ed71e3239 100644
--- a/tests/testsuite/username.rs
+++ b/tests/testsuite/username.rs
@@ -7,31 +7,34 @@ use crate::common;
// Requires mocking
#[test]
-fn no_username_shown() -> io::Result<()> {
- let expected = "";
-
- // No environment variables
+fn no_env_variables() -> io::Result<()> {
let output = common::render_module("username").env_clear().output()?;
let actual = String::from_utf8(output.stdout).unwrap();
- assert_eq!(expected, actual);
+ assert_eq!("", actual);
+ Ok(())
+}
- // LOGNAME == USER
+#[test]
+fn logname_equals_user() -> io::Result<()> {
let output = common::render_module("username")
.env_clear()
.env("LOGNAME", "astronaut")
.env("USER", "astronaut")
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
- assert_eq!(expected, actual);
+ assert_eq!("", actual);
+ Ok(())
+}
+#[test]
+fn ssh_wo_username() -> io::Result<()> {
// SSH connection w/o username
let output = common::render_module("username")
.env_clear()
.env("SSH_CONNECTION", "192.168.223.17 36673 192.168.223.229 22")
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
- assert_eq!(expected, actual);
-
+ assert_eq!("", actual);
Ok(())
}