Add just.systems link to --init justfile (#2776)

This commit is contained in:
Casey Rodarmor 2025-06-14 18:12:13 -07:00 committed by GitHub
parent 79623feaa2
commit b48474713b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 12 deletions

View file

@ -151,7 +151,7 @@ use request::Request;
// Used in integration tests.
#[doc(hidden)]
pub use {request::Response, unindent::unindent};
pub use {request::Response, subcommand::INIT_JUSTFILE, unindent::unindent};
type CompileResult<'a, T = ()> = Result<T, CompileError<'a>>;
type ConfigResult<T> = Result<T, ConfigError>;

View file

@ -1,6 +1,11 @@
use {super::*, clap_mangen::Man};
const INIT_JUSTFILE: &str = "default:\n echo 'Hello, world!'\n";
pub const INIT_JUSTFILE: &str = "\
# https://just.systems
foo:
echo 'Hello, world!'
";
fn backtick_re() -> &'static Regex {
static BACKTICK_RE: OnceLock<Regex> = OnceLock::new();

View file

@ -1,6 +1,4 @@
use super::*;
const EXPECTED: &str = "default:\n echo 'Hello, world!'\n";
use {super::*, just::INIT_JUSTFILE};
#[test]
fn current_dir() {
@ -16,7 +14,7 @@ fn current_dir() {
assert_eq!(
fs::read_to_string(tmp.path().join("justfile")).unwrap(),
EXPECTED
INIT_JUSTFILE
);
}
@ -72,7 +70,7 @@ fn invocation_directory() {
.arg("--init")
.run();
assert_eq!(fs::read_to_string(justfile_path).unwrap(), EXPECTED);
assert_eq!(fs::read_to_string(justfile_path).unwrap(), INIT_JUSTFILE);
}
#[test]
@ -92,7 +90,7 @@ fn parent_dir() {
assert_eq!(
fs::read_to_string(tmp.path().join("justfile")).unwrap(),
EXPECTED
INIT_JUSTFILE
);
}
@ -112,7 +110,7 @@ fn alternate_marker() {
assert_eq!(
fs::read_to_string(tmp.path().join("justfile")).unwrap(),
EXPECTED
INIT_JUSTFILE
);
}
@ -135,7 +133,7 @@ fn search_directory() {
assert_eq!(
fs::read_to_string(tmp.path().join("sub/justfile")).unwrap(),
EXPECTED
INIT_JUSTFILE
);
}
@ -159,7 +157,7 @@ fn justfile() {
assert_eq!(
fs::read_to_string(tmp.path().join("justfile")).unwrap(),
EXPECTED
INIT_JUSTFILE
);
}
@ -185,7 +183,7 @@ fn justfile_and_working_directory() {
assert_eq!(
fs::read_to_string(tmp.path().join("justfile")).unwrap(),
EXPECTED
INIT_JUSTFILE
);
}