Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve --init/--fmt compatibility (#1115) #1116

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/subcommand.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::common::*;

const INIT_JUSTFILE: &str = "default:\n\techo 'Hello, world!'\n";
const INIT_JUSTFILE: &str = "default:\n echo 'Hello, world!'\n";

#[derive(PartialEq, Clone, Debug)]
pub(crate) enum Subcommand {
Expand Down
18 changes: 17 additions & 1 deletion tests/init.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::common::*;

const EXPECTED: &str = "default:\n\techo 'Hello, world!'\n";
const EXPECTED: &str = "default:\n echo 'Hello, world!'\n";

#[test]
fn current_dir() {
Expand Down Expand Up @@ -188,3 +188,19 @@ fn justfile_and_working_directory() {
EXPECTED
);
}

#[test]
fn fmt_compatibility() {
let tempdir = Test::new()
.no_justfile()
.arg("--init")
.stderr_regex("Wrote justfile to `.*`\n")
.run();
Test::with_tempdir(tempdir)
.no_justfile()
.arg("--unstable")
.arg("--check")
.arg("--fmt")
.status(EXIT_SUCCESS)
.run();
}