summaryrefslogtreecommitdiffstats
path: root/tests/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/config.rs')
-rw-r--r--tests/config.rs28
1 files changed, 5 insertions, 23 deletions
diff --git a/tests/config.rs b/tests/config.rs
index 6c58122..86222a8 100644
--- a/tests/config.rs
+++ b/tests/config.rs
@@ -16,10 +16,7 @@ fn a_relative_root_is_absolutized_once_and_never_doubled() {
let rel = PathBuf::from("target").join("config-root-test").join("runtime");
let _ = std::fs::remove_dir_all(&rel);
- let cfg = Config {
- root: rel.clone(),
- ..Config::default()
- };
+ let cfg = Config { root: rel.clone(), ..Config::default() };
cfg.save().unwrap();
let reloaded = Config::load(&rel).unwrap();
@@ -43,11 +40,7 @@ fn a_relative_root_is_absolutized_once_and_never_doubled() {
#[test]
fn a_stale_relative_root_in_the_file_is_ignored() {
let tmp = tempfile::tempdir().unwrap();
- std::fs::write(
- tmp.path().join("config.json"),
- "{\n \"root\": \"runtime\"\n}\n",
- )
- .unwrap();
+ std::fs::write(tmp.path().join("config.json"), "{\n \"root\": \"runtime\"\n}\n").unwrap();
let cfg = Config::load(tmp.path()).unwrap();
assert_eq!(cfg.root, std::path::absolute(tmp.path()).unwrap());
assert!(!cfg.root.join("runtime").exists());
@@ -70,10 +63,7 @@ fn the_cli_refuses_a_root_that_was_never_initialized() {
.args(["--root", &tmp.path().display().to_string(), "packages"])
.output()
.unwrap();
- assert!(
- !out.status.success(),
- "a root with no config must fail, not answer from an empty server"
- );
+ assert!(!out.status.success(), "a root with no config must fail, not answer from an empty server");
assert!(
out.stdout.is_empty(),
"nothing may be printed as though the server existed: {}",
@@ -91,11 +81,7 @@ fn init_still_runs_where_there_is_no_config_yet() {
.args(["--root", &root.display().to_string(), "init", "--repo", "aur"])
.output()
.unwrap();
- assert!(
- out.status.success(),
- "{}",
- String::from_utf8_lossy(&out.stderr)
- );
+ assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
assert!(root.join("config.json").exists());
assert!(root.join("aur-build.db").exists());
@@ -108,11 +94,7 @@ fn init_still_runs_where_there_is_no_config_yet() {
fn an_absolute_root_is_used_verbatim() {
let tmp = tempfile::tempdir().unwrap();
let dir: &Path = tmp.path();
- std::fs::write(
- dir.join("config.json"),
- format!("{{\n \"root\": \"{}\"\n}}\n", dir.display()),
- )
- .unwrap();
+ std::fs::write(dir.join("config.json"), format!("{{\n \"root\": \"{}\"\n}}\n", dir.display())).unwrap();
assert_eq!(Config::load(dir).unwrap().root, dir);
}