Add a centralized ui module with Arc's visual identity: colored commit IDs (magenta), bookmarks (cyan), tags (yellow), status symbols, and diff highlighting. Update all command output and tests accordingly.
49 lines
1.2 KiB
Rust
49 lines
1.2 KiB
Rust
use std::process::Command;
|
|
use tempfile::TempDir;
|
|
|
|
fn arc_cmd() -> Command {
|
|
let mut cmd = Command::new(env!("CARGO_BIN_EXE_arc"));
|
|
cmd.env("NO_COLOR", "1");
|
|
cmd
|
|
}
|
|
|
|
#[test]
|
|
fn repo_structure_is_consistent_after_init() {
|
|
let dir = TempDir::new().unwrap();
|
|
arc_cmd()
|
|
.arg("init")
|
|
.current_dir(dir.path())
|
|
.output()
|
|
.expect("failed to run arc");
|
|
|
|
let arc = dir.path().join(".arc");
|
|
|
|
let expected_dirs = ["commits", "bookmarks", "tags", "stashes"];
|
|
for d in expected_dirs {
|
|
assert!(arc.join(d).is_dir(), "{d} directory should exist");
|
|
}
|
|
|
|
let expected_files = ["config.yml", "HEAD"];
|
|
for f in expected_files {
|
|
assert!(arc.join(f).is_file(), "{f} file should exist");
|
|
}
|
|
|
|
assert!(
|
|
arc.join("bookmarks").join("main").is_file(),
|
|
"bookmarks/main should exist"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn head_references_main_bookmark() {
|
|
let dir = TempDir::new().unwrap();
|
|
arc_cmd()
|
|
.arg("init")
|
|
.current_dir(dir.path())
|
|
.output()
|
|
.expect("failed to run arc");
|
|
|
|
let head = std::fs::read_to_string(dir.path().join(".arc").join("HEAD")).unwrap();
|
|
assert!(head.contains("main"));
|
|
assert!(head.contains("unborn"));
|
|
}
|