Skip to content

Commit

Permalink
Format --init justfile (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLocehiliosan authored Feb 23, 2022
1 parent fecb5e3 commit 63f9603
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
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();
}

0 comments on commit 63f9603

Please sign in to comment.