//! What the one git ladder must hold. //! //! Exhaustive over a four-element constant, which is what a pure declaration //! earns: the ORDER is the decision, every entry is absolute, and the shim is //! absent. Whether a path is on this disk is each caller's question and is //! tested where the stat happens. use super::*; #[test] fn the_ladder_is_four_absolute_paths_in_the_order_the_decision_names() { assert_eq!( CANDIDATES, [ "/opt/homebrew/bin/git", "/usr/local/bin/git", "/Library/Developer/CommandLineTools/usr/bin/git", "/Applications/Xcode.app/Contents/Developer/usr/bin/git", ] ); for path in CANDIDATES { assert!(path.starts_with('/'), "{path} is not absolute"); assert!(path.ends_with("/git"), "{path} does not name git"); } } #[test] fn the_shim_is_never_a_candidate() { // The one entry that must never be added. From a GUI app, running it posts // Apple's install-the-tools dialog into an Aqua session nobody is sitting // at, and there is no environment variable that suppresses it. assert_eq!(SHIM, "/usr/bin/git"); assert!(!CANDIDATES.contains(&SHIM)); } #[test] fn the_answer_travels_in_one_variable() { assert_eq!(PROGRAM_ENV, "COTTON_GIT"); }