2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
2016-10-28 15:25:59 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: alias_listing,
|
2019-10-07 00:32:51 -07:00
|
|
|
justfile: "
|
|
|
|
foo:
|
|
|
|
echo foo
|
|
|
|
|
|
|
|
alias f := foo
|
|
|
|
",
|
2019-04-11 12:30:29 -07:00
|
|
|
args: ("--list"),
|
2019-10-07 00:32:51 -07:00
|
|
|
stdout: "
|
|
|
|
Available recipes:
|
|
|
|
foo
|
|
|
|
f # alias for `foo`
|
|
|
|
",
|
2019-04-11 12:30:29 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: alias_listing_multiple_aliases,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "foo:\n echo foo\nalias f := foo\nalias fo := foo",
|
2019-04-11 12:30:29 -07:00
|
|
|
args: ("--list"),
|
2019-10-07 00:32:51 -07:00
|
|
|
stdout: "
|
|
|
|
Available recipes:
|
|
|
|
foo
|
|
|
|
f # alias for `foo`
|
|
|
|
fo # alias for `foo`
|
|
|
|
",
|
2019-04-11 12:30:29 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: alias_listing_parameters,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "foo PARAM='foo':\n echo {{PARAM}}\nalias f := foo",
|
2019-04-11 12:30:29 -07:00
|
|
|
args: ("--list"),
|
2019-10-07 00:32:51 -07:00
|
|
|
stdout: "
|
|
|
|
Available recipes:
|
|
|
|
foo PARAM='foo'
|
|
|
|
f PARAM='foo' # alias for `foo`
|
|
|
|
",
|
2019-04-11 12:30:29 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 15:57:34 -07:00
|
|
|
name: alias_listing_private,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "foo PARAM='foo':\n echo {{PARAM}}\nalias _f := foo",
|
2019-04-11 15:57:34 -07:00
|
|
|
args: ("--list"),
|
2019-10-07 00:32:51 -07:00
|
|
|
stdout: "
|
|
|
|
Available recipes:
|
|
|
|
foo PARAM='foo'
|
|
|
|
",
|
2019-04-11 15:57:34 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: alias,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "foo:\n echo foo\nalias f := foo",
|
2019-04-11 12:30:29 -07:00
|
|
|
args: ("f"),
|
|
|
|
stdout: "foo\n",
|
|
|
|
stderr: "echo foo\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: alias_with_parameters,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "foo value='foo':\n echo {{value}}\nalias f := foo",
|
2019-04-11 12:30:29 -07:00
|
|
|
args: ("f", "bar"),
|
|
|
|
stdout: "bar\n",
|
|
|
|
stderr: "echo bar\n",
|
|
|
|
}
|
|
|
|
|
2021-03-28 22:38:07 -07:00
|
|
|
test! {
|
|
|
|
name: bad_setting,
|
|
|
|
justfile: "
|
|
|
|
set foo
|
|
|
|
",
|
|
|
|
stderr: "
|
2023-10-11 22:04:46 -07:00
|
|
|
error: Unknown setting `foo`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:5
|
|
|
|
│
|
|
|
|
1 │ set foo
|
|
|
|
│ ^^^
|
2023-10-11 22:04:46 -07:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: bad_setting_with_keyword_name,
|
|
|
|
justfile: "
|
|
|
|
set if := 'foo'
|
|
|
|
",
|
|
|
|
stderr: "
|
|
|
|
error: Unknown setting `if`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:5
|
|
|
|
│
|
|
|
|
1 │ set if := 'foo'
|
|
|
|
│ ^^
|
2021-03-28 22:38:07 -07:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: alias_with_dependencies,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "foo:\n echo foo\nbar: foo\nalias b := bar",
|
2019-04-11 12:30:29 -07:00
|
|
|
args: ("b"),
|
|
|
|
stdout: "foo\n",
|
|
|
|
stderr: "echo foo\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: duplicate_alias,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "alias foo := bar\nalias foo := baz\n",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
2019-10-19 20:00:41 -07:00
|
|
|
error: Alias `foo` first defined on line 1 is redefined on line 2
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:7
|
|
|
|
│
|
|
|
|
2 │ alias foo := baz
|
|
|
|
│ ^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-04-11 12:30:29 -07:00
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: unknown_alias_target,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "alias foo := bar\n",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Alias `foo` has an unknown target `bar`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:7
|
|
|
|
│
|
|
|
|
1 │ alias foo := bar
|
|
|
|
│ ^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-04-11 12:30:29 -07:00
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 12:30:29 -07:00
|
|
|
name: alias_shadows_recipe,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
2023-12-27 20:27:15 -08:00
|
|
|
error: Alias `foo` defined on line 3 is redefined as a recipe on line 4
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:4:1
|
|
|
|
│
|
|
|
|
4 │ foo:
|
|
|
|
│ ^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-04-11 12:30:29 -07:00
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: default,
|
|
|
|
justfile: "default:\n echo hello\nother: \n echo bar",
|
|
|
|
stdout: "hello\n",
|
|
|
|
stderr: "echo hello\n",
|
2016-11-05 01:25:36 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: quiet,
|
|
|
|
justfile: "default:\n @echo hello",
|
|
|
|
stdout: "hello\n",
|
2016-12-30 00:09:35 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: verbose,
|
|
|
|
justfile: "default:\n @echo hello",
|
|
|
|
args: ("--verbose"),
|
|
|
|
stdout: "hello\n",
|
|
|
|
stderr: "===> Running recipe `default`...\necho hello\n",
|
2016-12-30 00:09:35 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: order,
|
|
|
|
justfile: "
|
2016-10-28 15:34:01 -07:00
|
|
|
b: a
|
|
|
|
echo b
|
|
|
|
@mv a b
|
|
|
|
|
|
|
|
a:
|
|
|
|
echo a
|
|
|
|
@touch F
|
|
|
|
@touch a
|
|
|
|
|
|
|
|
d: c
|
|
|
|
echo d
|
|
|
|
@rm c
|
|
|
|
|
|
|
|
c: b
|
|
|
|
echo c
|
2017-04-22 16:15:15 -07:00
|
|
|
@mv b c",
|
|
|
|
args: ("a", "d"),
|
|
|
|
stdout: "a\nb\nc\nd\n",
|
|
|
|
stderr: "echo a\necho b\necho c\necho d\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: select,
|
|
|
|
justfile: "b:
|
2016-10-28 16:32:13 -07:00
|
|
|
@echo b
|
|
|
|
a:
|
|
|
|
@echo a
|
|
|
|
d:
|
|
|
|
@echo d
|
|
|
|
c:
|
2017-04-22 16:15:15 -07:00
|
|
|
@echo c",
|
|
|
|
args: ("d", "c"),
|
|
|
|
stdout: "d\nc\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: print,
|
|
|
|
justfile: "b:
|
2016-10-30 00:20:29 -07:00
|
|
|
echo b
|
|
|
|
a:
|
|
|
|
echo a
|
|
|
|
d:
|
|
|
|
echo d
|
|
|
|
c:
|
2017-04-22 16:15:15 -07:00
|
|
|
echo c",
|
|
|
|
args: ("d", "c"),
|
|
|
|
stdout: "d\nc\n",
|
|
|
|
stderr: "echo d\necho c\n",
|
2016-10-30 00:20:29 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: status_passthrough,
|
|
|
|
justfile: "
|
2016-11-16 22:18:55 -08:00
|
|
|
|
|
|
|
hello:
|
|
|
|
|
2016-10-28 15:59:50 -07:00
|
|
|
recipe:
|
2017-04-22 16:15:15 -07:00
|
|
|
@exit 100",
|
|
|
|
args: ("recipe"),
|
2021-04-05 21:28:37 -07:00
|
|
|
stderr: "error: Recipe `recipe` failed on line 5 with exit code 100\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 100,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: unknown_dependency,
|
|
|
|
justfile: "bar:\nhello:\nfoo: bar baaaaaaaz hello",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Recipe `foo` has unknown dependency `baaaaaaaz`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:3:10
|
|
|
|
│
|
|
|
|
3 │ foo: bar baaaaaaaz hello
|
|
|
|
│ ^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_success,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "a := `printf Hello,`\nbar:\n printf '{{a + `printf ' world.'`}}'",
|
2018-08-03 19:53:06 -07:00
|
|
|
stdout: "Hello, world.",
|
|
|
|
stderr: "printf 'Hello, world.'\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_trimming,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "a := `echo Hello,`\nbar:\n echo '{{a + `echo ' world.'`}}'",
|
2018-08-03 19:53:06 -07:00
|
|
|
stdout: "Hello, world.\n",
|
|
|
|
stderr: "echo 'Hello, world.'\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_assignment,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "b := a\na := `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 100
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:6
|
|
|
|
│
|
|
|
|
2 │ a := `exit 100`
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 100,
|
2016-10-30 01:27:05 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_interpolation,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "b := a\na := `echo hello`\nbar:\n echo '{{`exit 200`}}'",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:4:10
|
|
|
|
│
|
|
|
|
4 │ echo '{{`exit 200`}}'
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 200,
|
2016-10-30 01:27:05 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-15 22:40:02 -07:00
|
|
|
name: backtick_code_interpolation_mod,
|
|
|
|
justfile: "f:\n 無{{`exit 200`}}",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:7
|
|
|
|
│
|
|
|
|
2 │ 無{{`exit 200`}}
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-04-15 22:40:02 -07:00
|
|
|
status: 200,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_interpolation_tab,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
backtick-fail:
|
|
|
|
\techo {{`exit 200`}}
|
|
|
|
",
|
2019-10-08 22:03:59 -07:00
|
|
|
stderr: " error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:9
|
|
|
|
│
|
|
|
|
2 │ echo {{`exit 200`}}
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-10-08 22:03:59 -07:00
|
|
|
status: 200,
|
2016-11-11 15:18:42 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_interpolation_tabs,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
backtick-fail:
|
|
|
|
\techo {{\t`exit 200`}}
|
|
|
|
",
|
2019-10-08 22:03:59 -07:00
|
|
|
stderr: "error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:10
|
|
|
|
│
|
|
|
|
2 │ echo {{ `exit 200`}}
|
|
|
|
│ ^^^^^^^^^^
|
2016-11-11 15:18:42 -08:00
|
|
|
",
|
2019-10-08 22:03:59 -07:00
|
|
|
status: 200,
|
2016-11-11 15:18:42 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_interpolation_inner_tab,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
backtick-fail:
|
|
|
|
\techo {{\t`exit\t\t200`}}
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:10
|
|
|
|
│
|
|
|
|
2 │ echo {{ `exit 200`}}
|
|
|
|
│ ^^^^^^^^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-10-08 22:03:59 -07:00
|
|
|
status: 200,
|
2016-11-11 15:18:42 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_interpolation_leading_emoji,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
backtick-fail:
|
|
|
|
\techo 😬{{`exit 200`}}
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:13
|
|
|
|
│
|
|
|
|
2 │ echo 😬{{`exit 200`}}
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-10-08 22:03:59 -07:00
|
|
|
status: 200,
|
2016-11-11 15:18:42 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_interpolation_unicode_hell,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
backtick-fail:
|
|
|
|
\techo \t\t\t😬鎌鼬{{\t\t`exit 200 # \t\t\tabc`}}\t\t\t😬鎌鼬
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:24
|
|
|
|
│
|
|
|
|
2 │ echo 😬鎌鼬{{ `exit 200 # abc`}} 😬鎌鼬
|
|
|
|
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-10-08 22:03:59 -07:00
|
|
|
status: 200,
|
2016-11-11 15:18:42 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: backtick_code_long,
|
2021-04-05 21:28:37 -07:00
|
|
|
justfile: "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
b := a
|
|
|
|
a := `echo hello`
|
|
|
|
bar:
|
|
|
|
echo '{{`exit 200`}}'
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 200
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:10:10
|
|
|
|
│
|
|
|
|
10 │ echo '{{`exit 200`}}'
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 200,
|
2016-11-11 17:15:16 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: shebang_backtick_failure,
|
|
|
|
justfile: "foo:
|
2016-10-30 01:27:05 -07:00
|
|
|
#!/bin/sh
|
|
|
|
echo hello
|
|
|
|
echo {{`exit 123`}}",
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 123
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:4:9
|
|
|
|
│
|
|
|
|
4 │ echo {{`exit 123`}}
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 123,
|
2016-10-30 01:27:05 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: command_backtick_failure,
|
|
|
|
justfile: "foo:
|
2016-10-30 01:27:05 -07:00
|
|
|
echo hello
|
|
|
|
echo {{`exit 123`}}",
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "hello\n",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
echo hello
|
|
|
|
error: Backtick failed with exit code 123
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:3:9
|
|
|
|
│
|
|
|
|
3 │ echo {{`exit 123`}}
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 123,
|
2016-10-30 01:27:05 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: assignment_backtick_failure,
|
|
|
|
justfile: "foo:
|
2016-10-30 01:27:05 -07:00
|
|
|
echo hello
|
|
|
|
echo {{`exit 111`}}
|
2019-04-18 11:48:02 -07:00
|
|
|
a := `exit 222`",
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: "
|
|
|
|
error: Backtick failed with exit code 222
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:4:6
|
|
|
|
│
|
|
|
|
4 │ a := `exit 222`
|
|
|
|
│ ^^^^^^^^^^
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 222,
|
2016-10-30 01:27:05 -07:00
|
|
|
}
|
2016-10-30 03:08:28 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: unknown_override_options,
|
|
|
|
justfile: "foo:
|
2016-10-30 03:08:28 -07:00
|
|
|
echo hello
|
|
|
|
echo {{`exit 111`}}
|
2019-04-18 11:48:02 -07:00
|
|
|
a := `exit 222`",
|
2017-08-18 14:21:18 -07:00
|
|
|
args: ("--set", "foo", "bar", "--set", "baz", "bob", "--set", "a", "b", "a", "b"),
|
2017-04-22 16:15:15 -07:00
|
|
|
stderr: "error: Variables `baz` and `foo` overridden on the command line but not present \
|
2016-11-12 09:28:30 -08:00
|
|
|
in justfile\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2016-10-30 03:08:28 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: unknown_override_args,
|
|
|
|
justfile: "foo:
|
2016-10-30 03:08:28 -07:00
|
|
|
echo hello
|
|
|
|
echo {{`exit 111`}}
|
2019-04-18 11:48:02 -07:00
|
|
|
a := `exit 222`",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo=bar", "baz=bob", "a=b", "a", "b"),
|
|
|
|
stderr: "error: Variables `baz` and `foo` overridden on the command line but not present \
|
2016-11-12 09:28:30 -08:00
|
|
|
in justfile\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2016-11-11 14:33:17 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: unknown_override_arg,
|
|
|
|
justfile: "foo:
|
2016-11-11 14:33:17 -08:00
|
|
|
echo hello
|
|
|
|
echo {{`exit 111`}}
|
2019-04-18 11:48:02 -07:00
|
|
|
a := `exit 222`",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo=bar", "a=b", "a", "b"),
|
|
|
|
stderr: "error: Variable `foo` overridden on the command line but not present in justfile\n",
|
|
|
|
status: EXIT_FAILURE,
|
2016-10-30 03:08:28 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: overrides_first,
|
|
|
|
justfile: r#"
|
2019-04-18 11:48:02 -07:00
|
|
|
foo := "foo"
|
|
|
|
a := "a"
|
|
|
|
baz := "baz"
|
2016-11-12 13:03:33 -08:00
|
|
|
|
2016-10-30 03:08:28 -07:00
|
|
|
recipe arg:
|
|
|
|
echo arg={{arg}}
|
|
|
|
echo {{foo + a + baz}}"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo=bar", "a=b", "recipe", "baz=bar"),
|
|
|
|
stdout: "arg=baz=bar\nbarbbaz\n",
|
|
|
|
stderr: "echo arg=baz=bar\necho barbbaz\n",
|
2016-10-30 03:08:28 -07:00
|
|
|
}
|
2016-10-30 13:14:39 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: overrides_not_evaluated,
|
|
|
|
justfile: r#"
|
2019-04-18 11:48:02 -07:00
|
|
|
foo := `exit 1`
|
|
|
|
a := "a"
|
|
|
|
baz := "baz"
|
2016-11-12 13:03:33 -08:00
|
|
|
|
|
|
|
recipe arg:
|
|
|
|
echo arg={{arg}}
|
|
|
|
echo {{foo + a + baz}}"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo=bar", "a=b", "recipe", "baz=bar"),
|
|
|
|
stdout: "arg=baz=bar\nbarbbaz\n",
|
|
|
|
stderr: "echo arg=baz=bar\necho barbbaz\n",
|
2016-11-12 13:03:33 -08:00
|
|
|
}
|
2016-10-30 13:14:39 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: dry_run,
|
|
|
|
justfile: r#"
|
2019-04-18 11:48:02 -07:00
|
|
|
var := `echo stderr 1>&2; echo backtick`
|
2016-10-30 13:14:39 -07:00
|
|
|
|
|
|
|
command:
|
|
|
|
@touch /this/is/not/a/file
|
|
|
|
{{var}}
|
|
|
|
echo {{`echo command interpolation`}}
|
|
|
|
|
|
|
|
shebang:
|
|
|
|
#!/bin/sh
|
|
|
|
touch /this/is/not/a/file
|
|
|
|
{{var}}
|
|
|
|
echo {{`echo shebang interpolation`}}"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("--dry-run", "shebang", "command"),
|
|
|
|
stdout: "",
|
2017-11-17 20:21:37 -08:00
|
|
|
stderr: "#!/bin/sh
|
2016-10-30 13:14:39 -07:00
|
|
|
touch /this/is/not/a/file
|
2017-11-17 20:21:37 -08:00
|
|
|
`echo stderr 1>&2; echo backtick`
|
|
|
|
echo `echo shebang interpolation`
|
2016-10-30 13:14:39 -07:00
|
|
|
touch /this/is/not/a/file
|
2017-11-17 20:21:37 -08:00
|
|
|
`echo stderr 1>&2; echo backtick`
|
|
|
|
echo `echo command interpolation`
|
2016-10-30 13:14:39 -07:00
|
|
|
",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: line_error_spacing,
|
|
|
|
justfile: r#"
|
2016-10-31 21:53:31 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
|
2023-12-29 12:16:31 -08:00
|
|
|
^^^
|
2016-10-31 21:53:31 -07:00
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Unknown start of token:
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:10:1
|
|
|
|
│
|
|
|
|
10 │ ^^^
|
|
|
|
│ ^
|
2016-10-31 21:53:31 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2016-10-31 21:53:31 -07:00
|
|
|
}
|
2016-11-05 01:01:43 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: argument_single,
|
|
|
|
justfile: "
|
2016-11-11 13:34:28 -08:00
|
|
|
foo A:
|
|
|
|
echo {{A}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo", "ARGUMENT"),
|
|
|
|
stdout: "ARGUMENT\n",
|
|
|
|
stderr: "echo ARGUMENT\n",
|
2016-11-11 13:34:28 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: argument_multiple,
|
|
|
|
justfile: "
|
2016-11-11 13:34:28 -08:00
|
|
|
foo A B:
|
|
|
|
echo A:{{A}} B:{{B}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo", "ONE", "TWO"),
|
|
|
|
stdout: "A:ONE B:TWO\n",
|
|
|
|
stderr: "echo A:ONE B:TWO\n",
|
2016-11-11 13:34:28 -08:00
|
|
|
}
|
2016-11-11 14:33:17 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: argument_mismatch_more,
|
|
|
|
justfile: "
|
2016-11-11 14:33:17 -08:00
|
|
|
foo A B:
|
|
|
|
echo A:{{A}} B:{{B}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo", "ONE", "TWO", "THREE"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Justfile does not contain recipe `THREE`.\n",
|
|
|
|
status: EXIT_FAILURE,
|
2016-11-11 14:33:17 -08:00
|
|
|
}
|
2016-11-12 09:15:13 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: argument_mismatch_fewer,
|
|
|
|
justfile: "
|
2016-11-11 14:33:17 -08:00
|
|
|
foo A B:
|
|
|
|
echo A:{{A}} B:{{B}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo", "ONE"),
|
|
|
|
stdout: "",
|
2018-11-03 14:51:06 -07:00
|
|
|
stderr: "error: Recipe `foo` got 1 argument but takes 2\nusage:\n just foo A B\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2016-11-11 14:33:17 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: argument_mismatch_more_with_default,
|
|
|
|
justfile: "
|
2016-11-12 09:15:13 -08:00
|
|
|
foo A B='B':
|
|
|
|
echo A:{{A}} B:{{B}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo", "ONE", "TWO", "THREE"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Justfile does not contain recipe `THREE`.\n",
|
|
|
|
status: EXIT_FAILURE,
|
2016-11-12 09:15:13 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: argument_mismatch_fewer_with_default,
|
|
|
|
justfile: "
|
2016-11-12 09:15:13 -08:00
|
|
|
foo A B C='C':
|
|
|
|
echo A:{{A}} B:{{B}} C:{{C}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo", "bar"),
|
|
|
|
stdout: "",
|
2020-02-10 20:07:06 -08:00
|
|
|
stderr: "
|
|
|
|
error: Recipe `foo` got 1 argument but takes at least 2
|
|
|
|
usage:
|
|
|
|
just foo A B C='C'
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: unknown_recipe,
|
|
|
|
justfile: "hello:",
|
|
|
|
args: ("foo"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Justfile does not contain recipe `foo`.\n",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: unknown_recipes,
|
|
|
|
justfile: "hello:",
|
|
|
|
args: ("foo", "bar"),
|
|
|
|
stdout: "",
|
2024-06-13 19:41:45 -07:00
|
|
|
stderr: "error: Justfile does not contain recipe `foo`.\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: color_always,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "b := a\na := `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("--color", "always"),
|
|
|
|
stdout: "",
|
2023-12-29 13:25:30 -08:00
|
|
|
stderr: "\u{1b}[1;31merror\u{1b}[0m: \u{1b}[1mBacktick failed with exit code 100\u{1b}[0m\n \u{1b}[1;34m——▶\u{1b}[0m justfile:2:6\n \u{1b}[1;34m│\u{1b}[0m\n\u{1b}[1;34m2 │\u{1b}[0m a := `exit 100`\n \u{1b}[1;34m│\u{1b}[0m \u{1b}[1;31m^^^^^^^^^^\u{1b}[0m\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 100,
|
2016-11-07 21:01:27 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: color_never,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "b := a\na := `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("--color", "never"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Backtick failed with exit code 100
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:6
|
|
|
|
│
|
|
|
|
2 │ a := `exit 100`
|
|
|
|
│ ^^^^^^^^^^
|
2016-11-11 18:46:04 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 100,
|
2016-11-11 18:46:04 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: color_auto,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "b := a\na := `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("--color", "auto"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Backtick failed with exit code 100
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:6
|
|
|
|
│
|
|
|
|
2 │ a := `exit 100`
|
|
|
|
│ ^^^^^^^^^^
|
2016-11-11 18:46:04 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 100,
|
2016-11-11 18:46:04 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: colors_no_context,
|
|
|
|
justfile: "
|
2016-11-07 21:01:27 -08:00
|
|
|
recipe:
|
2017-04-22 16:15:15 -07:00
|
|
|
@exit 100",
|
|
|
|
args: ("--color=always"),
|
|
|
|
stdout: "",
|
2019-12-12 17:55:55 -08:00
|
|
|
stderr: "\u{1b}[1;31merror\u{1b}[0m: \u{1b}[1m\
|
2021-04-05 21:28:37 -07:00
|
|
|
Recipe `recipe` failed on line 2 with exit code 100\u{1b}[0m\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: 100,
|
2016-11-11 14:33:17 -08:00
|
|
|
}
|
2016-11-07 21:01:27 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: dump,
|
|
|
|
justfile: r#"
|
2016-11-12 23:31:19 -08:00
|
|
|
# this recipe does something
|
2016-11-18 07:03:34 -08:00
|
|
|
recipe a b +d:
|
2017-04-22 16:15:15 -07:00
|
|
|
@exit 100"#,
|
|
|
|
args: ("--dump"),
|
|
|
|
stdout: "# this recipe does something
|
2016-11-18 07:03:34 -08:00
|
|
|
recipe a b +d:
|
2016-11-11 20:25:37 -08:00
|
|
|
@exit 100
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: mixed_whitespace,
|
|
|
|
justfile: "bar:\n\t echo hello",
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Found a mix of tabs and spaces in leading whitespace: `␉␠`
|
2017-01-08 19:01:48 -08:00
|
|
|
Leading whitespace may consist of tabs or spaces, but not both
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:1
|
|
|
|
│
|
|
|
|
2 │ echo hello
|
|
|
|
│ ^^^^^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: extra_leading_whitespace,
|
|
|
|
justfile: "bar:\n\t\techo hello\n\t\t\techo goodbye",
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Recipe line has extra leading whitespace
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:3:3
|
|
|
|
│
|
|
|
|
3 │ echo goodbye
|
|
|
|
│ ^^^^^^^^^^^^^^^^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: inconsistent_leading_whitespace,
|
|
|
|
justfile: "bar:\n\t\techo hello\n\t echo goodbye",
|
|
|
|
stdout: "",
|
2017-05-12 19:09:47 -07:00
|
|
|
stderr: "error: Recipe line has inconsistent leading whitespace. \
|
|
|
|
Recipe started with `␉␉` but found line with `␉␠`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:3:1
|
|
|
|
│
|
|
|
|
3 │ echo goodbye
|
|
|
|
│ ^^^^^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: required_after_default,
|
|
|
|
justfile: "bar:\nhello baz arg='foo' bar:",
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Non-default parameter `bar` follows default parameter
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:21
|
|
|
|
│
|
|
|
|
2 │ hello baz arg='foo' bar:
|
|
|
|
│ ^^^
|
2016-11-12 09:15:13 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2016-11-12 09:15:13 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2020-06-13 01:49:13 -07:00
|
|
|
name: required_after_plus_variadic,
|
2017-04-22 16:15:15 -07:00
|
|
|
justfile: "bar:\nhello baz +arg bar:",
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Parameter `bar` follows variadic parameter
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:16
|
|
|
|
│
|
|
|
|
2 │ hello baz +arg bar:
|
|
|
|
│ ^^^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
2020-06-13 01:49:13 -07:00
|
|
|
test! {
|
|
|
|
name: required_after_star_variadic,
|
|
|
|
justfile: "bar:\nhello baz *arg bar:",
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Parameter `bar` follows variadic parameter
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:16
|
|
|
|
│
|
|
|
|
2 │ hello baz *arg bar:
|
|
|
|
│ ^^^
|
2020-06-13 01:49:13 -07:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: use_string_default,
|
|
|
|
justfile: r#"
|
2016-11-12 09:15:13 -08:00
|
|
|
bar:
|
|
|
|
hello baz arg="XYZ\t\" ":
|
|
|
|
echo '{{baz}}...{{arg}}'
|
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("hello", "ABC"),
|
|
|
|
stdout: "ABC...XYZ\t\"\t\n",
|
|
|
|
stderr: "echo 'ABC...XYZ\t\"\t'\n",
|
2016-11-12 09:15:13 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: use_raw_string_default,
|
|
|
|
justfile: r#"
|
2016-11-12 09:15:13 -08:00
|
|
|
bar:
|
2018-08-03 19:53:06 -07:00
|
|
|
hello baz arg='XYZ" ':
|
2017-04-22 16:15:15 -07:00
|
|
|
printf '{{baz}}...{{arg}}'
|
2016-11-12 09:15:13 -08:00
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("hello", "ABC"),
|
2018-08-03 19:53:06 -07:00
|
|
|
stdout: "ABC...XYZ\"\t",
|
|
|
|
stderr: "printf 'ABC...XYZ\"\t'\n",
|
2016-11-12 09:15:13 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: supply_use_default,
|
|
|
|
justfile: r#"
|
2016-11-12 09:15:13 -08:00
|
|
|
hello a b='B' c='C':
|
|
|
|
echo {{a}} {{b}} {{c}}
|
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("hello", "0", "1"),
|
|
|
|
stdout: "0 1 C\n",
|
|
|
|
stderr: "echo 0 1 C\n",
|
2016-11-12 09:15:13 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: supply_defaults,
|
|
|
|
justfile: r#"
|
2016-11-12 09:15:13 -08:00
|
|
|
hello a b='B' c='C':
|
|
|
|
echo {{a}} {{b}} {{c}}
|
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("hello", "0", "1", "2"),
|
|
|
|
stdout: "0 1 2\n",
|
|
|
|
stderr: "echo 0 1 2\n",
|
2016-11-12 09:15:13 -08:00
|
|
|
}
|
2016-11-12 11:40:52 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: list,
|
|
|
|
justfile: r#"
|
2016-11-12 23:31:19 -08:00
|
|
|
|
|
|
|
# this does a thing
|
2016-11-12 11:40:52 -08:00
|
|
|
hello a b='B ' c='C':
|
|
|
|
echo {{a}} {{b}} {{c}}
|
|
|
|
|
2016-11-12 23:31:19 -08:00
|
|
|
# this comment will be ignored
|
|
|
|
|
2016-11-12 11:40:52 -08:00
|
|
|
a Z="\t z":
|
2017-10-06 23:48:07 -07:00
|
|
|
|
|
|
|
# this recipe will not appear
|
|
|
|
_private-recipe:
|
2016-11-12 11:40:52 -08:00
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("--list"),
|
2019-10-08 22:52:51 -07:00
|
|
|
stdout: r#"
|
|
|
|
Available recipes:
|
|
|
|
a Z="\t z"
|
|
|
|
hello a b='B ' c='C' # this does a thing
|
|
|
|
"#,
|
2017-11-30 15:03:59 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-11-30 15:03:59 -08:00
|
|
|
name: list_alignment,
|
|
|
|
justfile: r#"
|
|
|
|
|
|
|
|
# this does a thing
|
|
|
|
hello a b='B ' c='C':
|
|
|
|
echo {{a}} {{b}} {{c}}
|
|
|
|
|
|
|
|
# something else
|
|
|
|
a Z="\t z":
|
|
|
|
|
|
|
|
# this recipe will not appear
|
|
|
|
_private-recipe:
|
|
|
|
"#,
|
|
|
|
args: ("--list"),
|
2019-10-08 22:52:51 -07:00
|
|
|
stdout: r#"
|
|
|
|
Available recipes:
|
2024-06-05 12:29:55 -07:00
|
|
|
a Z="\t z" # something else
|
2019-10-08 22:52:51 -07:00
|
|
|
hello a b='B ' c='C' # this does a thing
|
|
|
|
"#,
|
2017-11-30 15:03:59 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-11-30 15:03:59 -08:00
|
|
|
name: list_alignment_long,
|
|
|
|
justfile: r#"
|
|
|
|
|
|
|
|
# this does a thing
|
|
|
|
hello a b='B ' c='C':
|
|
|
|
echo {{a}} {{b}} {{c}}
|
|
|
|
|
|
|
|
# this does another thing
|
|
|
|
x a b='B ' c='C':
|
|
|
|
echo {{a}} {{b}} {{c}}
|
|
|
|
|
|
|
|
# something else
|
2024-05-14 19:37:00 -07:00
|
|
|
this-recipe-is-very-very-very-very-very-very-very-very-important Z="\t z":
|
2017-11-30 15:03:59 -08:00
|
|
|
|
|
|
|
# this recipe will not appear
|
|
|
|
_private-recipe:
|
|
|
|
"#,
|
|
|
|
args: ("--list"),
|
2019-10-08 22:52:51 -07:00
|
|
|
stdout: r#"
|
|
|
|
Available recipes:
|
|
|
|
hello a b='B ' c='C' # this does a thing
|
2024-05-14 19:37:00 -07:00
|
|
|
this-recipe-is-very-very-very-very-very-very-very-very-important Z="\t z" # something else
|
2019-10-08 22:52:51 -07:00
|
|
|
x a b='B ' c='C' # this does another thing
|
|
|
|
"#,
|
2016-11-12 11:40:52 -08:00
|
|
|
}
|
2016-11-12 12:36:12 -08:00
|
|
|
|
2020-08-21 15:13:54 -07:00
|
|
|
test! {
|
|
|
|
name: list_sorted,
|
|
|
|
justfile: r#"
|
|
|
|
alias c := b
|
|
|
|
b:
|
|
|
|
a:
|
|
|
|
"#,
|
|
|
|
args: ("--list"),
|
|
|
|
stdout: r#"
|
|
|
|
Available recipes:
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c # alias for `b`
|
|
|
|
"#,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: list_unsorted,
|
|
|
|
justfile: r#"
|
|
|
|
alias c := b
|
|
|
|
b:
|
|
|
|
a:
|
|
|
|
"#,
|
|
|
|
args: ("--list", "--unsorted"),
|
|
|
|
stdout: r#"
|
|
|
|
Available recipes:
|
|
|
|
b
|
|
|
|
c # alias for `b`
|
|
|
|
a
|
|
|
|
"#,
|
|
|
|
}
|
|
|
|
|
2021-02-09 01:00:04 -08:00
|
|
|
test! {
|
|
|
|
name: list_heading,
|
|
|
|
justfile: r#"
|
|
|
|
a:
|
|
|
|
b:
|
|
|
|
"#,
|
|
|
|
args: ("--list", "--list-heading", "Cool stuff…\n"),
|
|
|
|
stdout: r#"
|
|
|
|
Cool stuff…
|
|
|
|
a
|
|
|
|
b
|
|
|
|
"#,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: list_prefix,
|
|
|
|
justfile: r#"
|
|
|
|
a:
|
|
|
|
b:
|
|
|
|
"#,
|
|
|
|
args: ("--list", "--list-prefix", "····"),
|
|
|
|
stdout: r#"
|
|
|
|
Available recipes:
|
|
|
|
····a
|
|
|
|
····b
|
|
|
|
"#,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: list_empty_prefix_and_heading,
|
|
|
|
justfile: r#"
|
|
|
|
a:
|
|
|
|
b:
|
|
|
|
"#,
|
|
|
|
args: ("--list", "--list-heading", "", "--list-prefix", ""),
|
|
|
|
stdout: r#"
|
|
|
|
a
|
|
|
|
b
|
|
|
|
"#,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: run_suggestion,
|
|
|
|
justfile: r#"
|
2016-11-12 12:36:12 -08:00
|
|
|
hello a b='B ' c='C':
|
|
|
|
echo {{a}} {{b}} {{c}}
|
|
|
|
|
|
|
|
a Z="\t z":
|
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("hell"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Justfile does not contain recipe `hell`.\nDid you mean `hello`?\n",
|
|
|
|
status: EXIT_FAILURE,
|
2016-11-12 12:36:12 -08:00
|
|
|
}
|
2016-11-12 15:45:12 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: line_continuation_with_space,
|
2023-10-08 19:34:05 -07:00
|
|
|
justfile: r"
|
2016-11-12 15:45:12 -08:00
|
|
|
foo:
|
|
|
|
echo a\
|
|
|
|
b \
|
|
|
|
c
|
2023-10-08 19:34:05 -07:00
|
|
|
",
|
2020-06-08 22:37:12 -07:00
|
|
|
stdout: "ab c\n",
|
|
|
|
stderr: "echo ab c\n",
|
2016-11-12 15:45:12 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: line_continuation_with_quoted_space,
|
2023-10-08 19:34:05 -07:00
|
|
|
justfile: r"
|
2016-11-12 15:45:12 -08:00
|
|
|
foo:
|
|
|
|
echo 'a\
|
|
|
|
b \
|
|
|
|
c'
|
2023-10-08 19:34:05 -07:00
|
|
|
",
|
2020-06-08 22:37:12 -07:00
|
|
|
stdout: "ab c\n",
|
|
|
|
stderr: "echo 'ab c'\n",
|
2016-11-12 15:45:12 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: line_continuation_no_space,
|
2023-10-08 19:34:05 -07:00
|
|
|
justfile: r"
|
2016-11-12 15:45:12 -08:00
|
|
|
foo:
|
|
|
|
echo a\
|
|
|
|
b\
|
|
|
|
c
|
2023-10-08 19:34:05 -07:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "abc\n",
|
|
|
|
stderr: "echo abc\n",
|
2016-11-12 15:45:12 -08:00
|
|
|
}
|
2016-11-12 16:12:00 -08:00
|
|
|
|
2020-10-03 13:54:19 -07:00
|
|
|
test! {
|
2022-01-02 16:51:22 -08:00
|
|
|
name: infallible_command,
|
2020-10-03 13:54:19 -07:00
|
|
|
justfile: r#"
|
2022-01-02 16:51:22 -08:00
|
|
|
infallible:
|
2020-10-03 13:54:19 -07:00
|
|
|
-exit 101
|
|
|
|
"#,
|
|
|
|
stderr: "exit 101\n",
|
|
|
|
status: EXIT_SUCCESS,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
2022-01-02 16:51:22 -08:00
|
|
|
name: infallible_with_failing,
|
2020-10-03 13:54:19 -07:00
|
|
|
justfile: r#"
|
2022-01-02 16:51:22 -08:00
|
|
|
infallible:
|
2020-10-03 13:54:19 -07:00
|
|
|
-exit 101
|
|
|
|
exit 202
|
|
|
|
"#,
|
|
|
|
stderr: r#"exit 101
|
|
|
|
exit 202
|
2022-01-02 16:51:22 -08:00
|
|
|
error: Recipe `infallible` failed on line 3 with exit code 202
|
2020-10-03 13:54:19 -07:00
|
|
|
"#,
|
|
|
|
status: 202,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: quiet_recipe,
|
|
|
|
justfile: r#"
|
2016-11-12 16:12:00 -08:00
|
|
|
@quiet:
|
|
|
|
# a
|
|
|
|
# b
|
|
|
|
@echo c
|
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "c\n",
|
|
|
|
stderr: "echo c\n",
|
2016-11-12 16:12:00 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: quiet_shebang_recipe,
|
|
|
|
justfile: r#"
|
2016-11-12 16:12:00 -08:00
|
|
|
@quiet:
|
|
|
|
#!/bin/sh
|
|
|
|
echo hello
|
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "hello\n",
|
|
|
|
stderr: "#!/bin/sh\necho hello\n",
|
2016-11-12 16:12:00 -08:00
|
|
|
}
|
2016-11-13 00:01:42 -08:00
|
|
|
|
2022-11-19 12:38:41 -08:00
|
|
|
#[cfg(not(windows))]
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: shebang_line_numbers,
|
|
|
|
justfile: r#"
|
2021-04-05 21:28:37 -07:00
|
|
|
quiet:
|
|
|
|
#!/usr/bin/env cat
|
2016-11-16 21:37:43 -08:00
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
a
|
2016-11-16 21:37:43 -08:00
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
b
|
2016-11-16 21:37:43 -08:00
|
|
|
|
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
c
|
2016-11-16 21:37:43 -08:00
|
|
|
|
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
"#,
|
|
|
|
stdout: "
|
|
|
|
#!/usr/bin/env cat
|
2016-11-16 21:37:43 -08:00
|
|
|
|
|
|
|
|
2022-11-19 12:38:41 -08:00
|
|
|
a
|
|
|
|
|
|
|
|
b
|
|
|
|
|
|
|
|
|
|
|
|
c
|
|
|
|
",
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
test! {
|
|
|
|
name: shebang_line_numbers,
|
|
|
|
justfile: r#"
|
|
|
|
quiet:
|
|
|
|
#!/usr/bin/env cat
|
|
|
|
|
|
|
|
a
|
|
|
|
|
|
|
|
b
|
|
|
|
|
|
|
|
|
|
|
|
c
|
|
|
|
|
|
|
|
|
|
|
|
"#,
|
|
|
|
stdout: "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
a
|
2016-11-16 21:37:43 -08:00
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
b
|
2016-11-16 21:37:43 -08:00
|
|
|
|
|
|
|
|
2021-04-05 21:28:37 -07:00
|
|
|
c
|
|
|
|
",
|
2016-11-16 21:37:43 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: complex_dependencies,
|
|
|
|
justfile: r#"
|
2016-11-13 00:01:42 -08:00
|
|
|
a: b
|
|
|
|
b:
|
|
|
|
c: b a
|
|
|
|
"#,
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("b"),
|
|
|
|
stdout: "",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-12-02 05:37:10 -08:00
|
|
|
name: unknown_function_in_assignment,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: r#"foo := foo() + "hello"
|
2017-12-02 05:37:10 -08:00
|
|
|
bar:"#,
|
|
|
|
args: ("bar"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: r#"error: Call to unknown function `foo`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:8
|
|
|
|
│
|
|
|
|
1 │ foo := foo() + "hello"
|
|
|
|
│ ^^^
|
2017-12-02 05:37:10 -08:00
|
|
|
"#,
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
2017-01-08 19:01:48 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-12-07 04:03:03 -08:00
|
|
|
name: dependency_takes_arguments_exact,
|
|
|
|
justfile: "
|
|
|
|
a FOO:
|
|
|
|
b: a
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("b"),
|
|
|
|
stdout: "",
|
2019-12-07 04:03:03 -08:00
|
|
|
stderr: "error: Dependency `a` got 0 arguments but takes 1 argument
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:4
|
|
|
|
│
|
|
|
|
2 │ b: a
|
|
|
|
│ ^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-12-07 04:03:03 -08:00
|
|
|
name: dependency_takes_arguments_at_least,
|
|
|
|
justfile: "
|
|
|
|
a FOO LUZ='hello':
|
|
|
|
b: a
|
|
|
|
",
|
|
|
|
args: ("b"),
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "",
|
2019-12-07 04:03:03 -08:00
|
|
|
stderr: "error: Dependency `a` got 0 arguments but takes at least 1 argument
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:4
|
|
|
|
│
|
|
|
|
2 │ b: a
|
|
|
|
│ ^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-12-07 04:03:03 -08:00
|
|
|
name: dependency_takes_arguments_at_most,
|
|
|
|
justfile: "
|
|
|
|
a FOO LUZ='hello':
|
|
|
|
b: (a '0' '1' '2')
|
|
|
|
",
|
|
|
|
args: ("b"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Dependency `a` got 3 arguments but takes at most 2 arguments
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:5
|
|
|
|
│
|
|
|
|
2 │ b: (a '0' '1' '2')
|
|
|
|
│ ^
|
2019-12-07 04:03:03 -08:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: duplicate_parameter,
|
|
|
|
justfile: "a foo foo:",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("a"),
|
|
|
|
stdout: "",
|
2019-12-07 04:03:03 -08:00
|
|
|
stderr: "error: Recipe `a` has duplicate parameter `foo`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:7
|
|
|
|
│
|
|
|
|
1 │ a foo foo:
|
|
|
|
│ ^^^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: duplicate_recipe,
|
|
|
|
justfile: "b:\nb:",
|
|
|
|
args: ("b"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Recipe `b` first defined on line 1 is redefined on line 2
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:1
|
|
|
|
│
|
|
|
|
2 │ b:
|
|
|
|
│ ^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: duplicate_variable,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "a := 'hello'\na := 'hello'\nfoo:",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("foo"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Variable `a` has multiple definitions
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:1
|
|
|
|
│
|
|
|
|
2 │ a := 'hello'
|
|
|
|
│ ^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-11-14 13:03:26 -08:00
|
|
|
name: unexpected_token_in_dependency_position,
|
2017-04-22 16:15:15 -07:00
|
|
|
justfile: "foo: 'bar'",
|
|
|
|
args: ("foo"),
|
|
|
|
stdout: "",
|
2021-07-22 00:20:25 -07:00
|
|
|
stderr: "error: Expected '&&', comment, end of file, end of line, \
|
2021-04-05 21:28:37 -07:00
|
|
|
identifier, or '(', but found string
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:6
|
|
|
|
│
|
|
|
|
1 │ foo: 'bar'
|
|
|
|
│ ^^^^^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-11-14 13:03:26 -08:00
|
|
|
name: unexpected_token_after_name,
|
|
|
|
justfile: "foo 'bar'",
|
|
|
|
args: ("foo"),
|
|
|
|
stdout: "",
|
2021-04-05 21:28:37 -07:00
|
|
|
stderr: "error: Expected '*', ':', '$', identifier, or '+', but found string
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:5
|
|
|
|
│
|
|
|
|
1 │ foo 'bar'
|
|
|
|
│ ^^^^^
|
2017-11-14 13:03:26 -08:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
2017-01-08 19:01:48 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: self_dependency,
|
|
|
|
justfile: "a: a",
|
|
|
|
args: ("a"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Recipe `a` depends on itself
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:4
|
|
|
|
│
|
|
|
|
1 │ a: a
|
|
|
|
│ ^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: long_circular_recipe_dependency,
|
|
|
|
justfile: "a: b\nb: c\nc: d\nd: a",
|
|
|
|
args: ("a"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Recipe `d` has circular dependency `a -> b -> c -> d -> a`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:4:4
|
|
|
|
│
|
|
|
|
4 │ d: a
|
|
|
|
│ ^
|
2016-11-13 00:01:42 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2016-11-13 00:01:42 -08:00
|
|
|
}
|
2016-11-13 14:04:20 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: variable_self_dependency,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "z := z\na:",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("a"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Variable `z` is defined in terms of itself
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:1
|
|
|
|
│
|
|
|
|
1 │ z := z
|
|
|
|
│ ^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: variable_circular_dependency,
|
2019-04-18 11:48:02 -07:00
|
|
|
justfile: "x := y\ny := z\nz := x\na:",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("a"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Variable `x` depends on its own value: `x -> y -> z -> x`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:1
|
|
|
|
│
|
|
|
|
1 │ x := y
|
|
|
|
│ ^
|
2017-01-08 19:01:48 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-08 19:01:48 -08:00
|
|
|
}
|
|
|
|
|
2021-07-19 18:10:35 -07:00
|
|
|
test! {
|
|
|
|
name: variable_circular_dependency_with_additional_variable,
|
|
|
|
justfile: "
|
|
|
|
a := ''
|
|
|
|
x := y
|
|
|
|
y := x
|
|
|
|
|
|
|
|
a:
|
|
|
|
",
|
|
|
|
args: ("a"),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Variable `x` depends on its own value: `x -> y -> x`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:1
|
|
|
|
│
|
|
|
|
2 │ x := y
|
|
|
|
│ ^
|
2021-07-19 18:10:35 -07:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2020-06-13 01:49:13 -07:00
|
|
|
name: plus_variadic_recipe,
|
2017-04-22 16:15:15 -07:00
|
|
|
justfile: "
|
2016-11-18 07:03:34 -08:00
|
|
|
a x y +z:
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("a", "0", "1", "2", "3", " 4 "),
|
|
|
|
stdout: "0 1 2 3 4\n",
|
|
|
|
stderr: "echo 0 1 2 3 4 \n",
|
2016-11-18 07:03:34 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2020-06-13 01:49:13 -07:00
|
|
|
name: plus_variadic_ignore_default,
|
2017-04-22 16:15:15 -07:00
|
|
|
justfile: "
|
2016-11-18 07:03:34 -08:00
|
|
|
a x y +z='HELLO':
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("a", "0", "1", "2", "3", " 4 "),
|
|
|
|
stdout: "0 1 2 3 4\n",
|
|
|
|
stderr: "echo 0 1 2 3 4 \n",
|
2016-11-18 07:03:34 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2020-06-13 01:49:13 -07:00
|
|
|
name: plus_variadic_use_default,
|
2017-04-22 16:15:15 -07:00
|
|
|
justfile: "
|
2016-11-18 07:03:34 -08:00
|
|
|
a x y +z='HELLO':
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("a", "0", "1"),
|
|
|
|
stdout: "0 1 HELLO\n",
|
|
|
|
stderr: "echo 0 1 HELLO\n",
|
2016-11-18 07:03:34 -08:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2020-06-13 01:49:13 -07:00
|
|
|
name: plus_variadic_too_few,
|
2017-04-22 16:15:15 -07:00
|
|
|
justfile: "
|
2016-11-18 07:03:34 -08:00
|
|
|
a x y +z:
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("a", "0", "1"),
|
|
|
|
stdout: "",
|
2018-11-03 14:51:06 -07:00
|
|
|
stderr: "error: Recipe `a` got 2 arguments but takes at least 3\nusage:\n just a x y +z\n",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2016-11-18 07:03:34 -08:00
|
|
|
}
|
2016-12-10 16:35:52 -08:00
|
|
|
|
2020-06-13 01:49:13 -07:00
|
|
|
test! {
|
|
|
|
name: star_variadic_recipe,
|
|
|
|
justfile: "
|
|
|
|
a x y *z:
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
|
|
|
args: ("a", "0", "1", "2", "3", " 4 "),
|
|
|
|
stdout: "0 1 2 3 4\n",
|
|
|
|
stderr: "echo 0 1 2 3 4 \n",
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: star_variadic_none,
|
|
|
|
justfile: "
|
|
|
|
a x y *z:
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
|
|
|
args: ("a", "0", "1"),
|
|
|
|
stdout: "0 1\n",
|
|
|
|
stderr: "echo 0 1 \n",
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: star_variadic_ignore_default,
|
|
|
|
justfile: "
|
|
|
|
a x y *z='HELLO':
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
|
|
|
args: ("a", "0", "1", "2", "3", " 4 "),
|
|
|
|
stdout: "0 1 2 3 4\n",
|
|
|
|
stderr: "echo 0 1 2 3 4 \n",
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: star_variadic_use_default,
|
|
|
|
justfile: "
|
|
|
|
a x y *z='HELLO':
|
|
|
|
echo {{x}} {{y}} {{z}}
|
|
|
|
",
|
|
|
|
args: ("a", "0", "1"),
|
|
|
|
stdout: "0 1 HELLO\n",
|
|
|
|
stderr: "echo 0 1 HELLO\n",
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: star_then_plus_variadic,
|
|
|
|
justfile: "
|
|
|
|
foo *a +b:
|
|
|
|
echo {{a}} {{b}}
|
|
|
|
",
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Expected \':\' or \'=\', but found \'+\'
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:8
|
|
|
|
│
|
|
|
|
1 │ foo *a +b:
|
|
|
|
│ ^
|
2020-06-13 01:49:13 -07:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: plus_then_star_variadic,
|
|
|
|
justfile: "
|
|
|
|
foo +a *b:
|
|
|
|
echo {{a}} {{b}}
|
|
|
|
",
|
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Expected \':\' or \'=\', but found \'*\'
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:8
|
|
|
|
│
|
|
|
|
1 │ foo +a *b:
|
|
|
|
│ ^
|
2020-06-13 01:49:13 -07:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: argument_grouping,
|
|
|
|
justfile: "
|
2016-12-10 16:35:52 -08:00
|
|
|
FOO A B='blarg':
|
|
|
|
echo foo: {{A}} {{B}}
|
|
|
|
|
|
|
|
BAR X:
|
|
|
|
echo bar: {{X}}
|
|
|
|
|
|
|
|
BAZ +Z:
|
|
|
|
echo baz: {{Z}}
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
args: ("BAR", "0", "FOO", "1", "2", "BAZ", "3", "4", "5"),
|
|
|
|
stdout: "bar: 0\nfoo: 1 2\nbaz: 3 4 5\n",
|
|
|
|
stderr: "echo bar: 0\necho foo: 1 2\necho baz: 3 4 5\n",
|
2016-12-10 16:35:52 -08:00
|
|
|
}
|
2017-01-18 20:32:55 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-04-22 16:15:15 -07:00
|
|
|
name: missing_second_dependency,
|
|
|
|
justfile: "
|
2017-01-18 20:32:55 -08:00
|
|
|
x:
|
|
|
|
|
|
|
|
a: x y
|
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
stdout: "",
|
|
|
|
stderr: "error: Recipe `a` has unknown dependency `y`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:3:6
|
|
|
|
│
|
|
|
|
3 │ a: x y
|
|
|
|
│ ^
|
2017-01-18 20:32:55 -08:00
|
|
|
",
|
2017-04-22 16:15:15 -07:00
|
|
|
status: EXIT_FAILURE,
|
2017-01-18 20:32:55 -08:00
|
|
|
}
|
2017-06-01 18:01:35 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-06-01 18:01:35 -07:00
|
|
|
name: list_colors,
|
|
|
|
justfile: "
|
|
|
|
# comment
|
|
|
|
a B C +D='hello':
|
|
|
|
echo {{B}} {{C}} {{D}}
|
|
|
|
",
|
|
|
|
args: ("--color", "always", "--list"),
|
2019-10-08 22:52:51 -07:00
|
|
|
stdout: "
|
|
|
|
Available recipes:
|
|
|
|
a \
|
2017-06-03 22:46:07 -07:00
|
|
|
\u{1b}[36mB\u{1b}[0m \u{1b}[36mC\u{1b}[0m \u{1b}[35m+\
|
2019-04-11 23:58:08 -07:00
|
|
|
\u{1b}[0m\u{1b}[36mD\u{1b}[0m=\u{1b}[32m'hello'\u{1b}[0m \
|
2019-10-08 22:52:51 -07:00
|
|
|
\u{1b}[34m#\u{1b}[0m \u{1b}[34mcomment\u{1b}[0m
|
|
|
|
",
|
2017-06-01 18:01:35 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-06-01 18:01:35 -07:00
|
|
|
name: run_colors,
|
|
|
|
justfile: "
|
|
|
|
# comment
|
|
|
|
a:
|
|
|
|
echo hi
|
|
|
|
",
|
|
|
|
args: ("--color", "always", "--highlight", "--verbose"),
|
|
|
|
stdout: "hi\n",
|
|
|
|
stderr: "\u{1b}[1;36m===> Running recipe `a`...\u{1b}[0m\n\u{1b}[1mecho hi\u{1b}[0m\n",
|
|
|
|
}
|
2017-08-18 14:21:18 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
|
|
|
name: no_highlight,
|
|
|
|
justfile: "
|
|
|
|
# comment
|
|
|
|
a:
|
|
|
|
echo hi
|
|
|
|
",
|
|
|
|
args: ("--color", "always", "--highlight", "--no-highlight", "--verbose"),
|
|
|
|
stdout: "hi\n",
|
|
|
|
stderr: "\u{1b}[1;36m===> Running recipe `a`...\u{1b}[0m\necho hi\n",
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
2017-08-18 14:21:18 -07:00
|
|
|
name: trailing_flags,
|
|
|
|
justfile: "
|
|
|
|
echo A B C:
|
|
|
|
echo {{A}} {{B}} {{C}}
|
|
|
|
",
|
|
|
|
args: ("echo", "--some", "--awesome", "--flags"),
|
|
|
|
stdout: "--some --awesome --flags\n",
|
|
|
|
stderr: "echo --some --awesome --flags\n",
|
|
|
|
}
|
2017-11-15 12:53:01 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2017-11-15 12:53:01 -08:00
|
|
|
name: comment_before_variable,
|
|
|
|
justfile: "
|
|
|
|
#
|
2019-04-18 11:48:02 -07:00
|
|
|
A:='1'
|
2017-11-15 12:53:01 -08:00
|
|
|
echo:
|
|
|
|
echo {{A}}
|
|
|
|
",
|
|
|
|
args: ("echo"),
|
|
|
|
stdout: "1\n",
|
|
|
|
stderr: "echo 1\n",
|
|
|
|
}
|
2018-03-05 13:21:35 -08:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2018-06-30 19:19:13 -07:00
|
|
|
name: invalid_escape_sequence_message,
|
|
|
|
justfile: r#"
|
2019-04-18 11:48:02 -07:00
|
|
|
X := "\'"
|
2018-06-30 19:19:13 -07:00
|
|
|
"#,
|
|
|
|
stdout: "",
|
|
|
|
stderr: r#"error: `\'` is not a valid escape sequence
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:6
|
|
|
|
│
|
|
|
|
1 │ X := "\'"
|
|
|
|
│ ^^^^
|
2018-06-30 19:19:13 -07:00
|
|
|
"#,
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
2019-04-11 23:58:08 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 23:58:08 -07:00
|
|
|
name: unknown_variable_in_default,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
foo x=bar:
|
|
|
|
",
|
2019-04-11 23:58:08 -07:00
|
|
|
stdout: "",
|
|
|
|
stderr: r#"error: Variable `bar` not defined
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:7
|
|
|
|
│
|
|
|
|
1 │ foo x=bar:
|
|
|
|
│ ^^^
|
2019-04-11 23:58:08 -07:00
|
|
|
"#,
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 23:58:08 -07:00
|
|
|
name: unknown_function_in_default,
|
|
|
|
justfile: "
|
|
|
|
foo x=bar():
|
|
|
|
",
|
|
|
|
stdout: "",
|
|
|
|
stderr: r#"error: Call to unknown function `bar`
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:7
|
|
|
|
│
|
|
|
|
1 │ foo x=bar():
|
|
|
|
│ ^^^
|
2019-04-11 23:58:08 -07:00
|
|
|
"#,
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 23:58:08 -07:00
|
|
|
name: default_string,
|
|
|
|
justfile: "
|
|
|
|
foo x='bar':
|
|
|
|
echo {{x}}
|
|
|
|
",
|
|
|
|
stdout: "bar\n",
|
|
|
|
stderr: "echo bar\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2022-05-28 19:07:53 -07:00
|
|
|
name: default_concatenation,
|
2019-04-11 23:58:08 -07:00
|
|
|
justfile: "
|
|
|
|
foo x=(`echo foo` + 'bar'):
|
|
|
|
echo {{x}}
|
|
|
|
",
|
|
|
|
stdout: "foobar\n",
|
|
|
|
stderr: "echo foobar\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 23:58:08 -07:00
|
|
|
name: default_backtick,
|
|
|
|
justfile: "
|
|
|
|
foo x=`echo foo`:
|
|
|
|
echo {{x}}
|
|
|
|
",
|
|
|
|
stdout: "foo\n",
|
|
|
|
stderr: "echo foo\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-11 23:58:08 -07:00
|
|
|
name: default_variable,
|
|
|
|
justfile: "
|
2019-04-18 11:48:02 -07:00
|
|
|
y := 'foo'
|
2019-04-11 23:58:08 -07:00
|
|
|
foo x=y:
|
|
|
|
echo {{x}}
|
|
|
|
",
|
|
|
|
stdout: "foo\n",
|
|
|
|
stderr: "echo foo\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-10-08 22:52:51 -07:00
|
|
|
name: unterminated_interpolation_eol,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
foo:
|
|
|
|
echo {{
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: r#"
|
|
|
|
error: Unterminated interpolation
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:8
|
|
|
|
│
|
|
|
|
2 │ echo {{
|
|
|
|
│ ^^
|
2019-10-08 22:52:51 -07:00
|
|
|
"#,
|
|
|
|
status: EXIT_FAILURE,
|
2019-04-15 22:40:02 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-10-08 22:52:51 -07:00
|
|
|
name: unterminated_interpolation_eof,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
foo:
|
|
|
|
echo {{
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: r#"
|
|
|
|
error: Unterminated interpolation
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:2:8
|
|
|
|
│
|
|
|
|
2 │ echo {{
|
|
|
|
│ ^^
|
2019-10-08 22:52:51 -07:00
|
|
|
"#,
|
|
|
|
status: EXIT_FAILURE,
|
2019-04-15 22:40:02 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-10-08 22:52:51 -07:00
|
|
|
name: unknown_start_of_token,
|
|
|
|
justfile: "
|
2021-03-25 18:35:24 -07:00
|
|
|
assembly_source_files = %(wildcard src/arch/$(arch)/*.s)
|
2019-04-15 22:40:02 -07:00
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stderr: r#"
|
|
|
|
error: Unknown start of token:
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:25
|
|
|
|
│
|
|
|
|
1 │ assembly_source_files = %(wildcard src/arch/$(arch)/*.s)
|
|
|
|
│ ^
|
2019-10-08 22:52:51 -07:00
|
|
|
"#,
|
2019-04-15 22:40:02 -07:00
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
2019-04-16 19:52:16 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-10-08 22:52:51 -07:00
|
|
|
name: backtick_variable_cat,
|
|
|
|
justfile: "
|
2019-04-18 11:48:02 -07:00
|
|
|
stdin := `cat`
|
2019-04-16 19:52:16 -07:00
|
|
|
|
|
|
|
default:
|
|
|
|
echo {{stdin}}
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stdin: "STDIN",
|
|
|
|
stdout: "STDIN\n",
|
|
|
|
stderr: "echo STDIN\n",
|
2019-04-16 19:52:16 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-16 19:52:16 -07:00
|
|
|
name: backtick_default_cat_stdin,
|
|
|
|
justfile: "
|
|
|
|
default stdin = `cat`:
|
|
|
|
echo {{stdin}}
|
|
|
|
",
|
|
|
|
stdin: "STDIN",
|
|
|
|
stdout: "STDIN\n",
|
|
|
|
stderr: "echo STDIN\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-10-08 22:52:51 -07:00
|
|
|
name: backtick_default_cat_justfile,
|
|
|
|
justfile: "
|
2021-04-05 21:28:37 -07:00
|
|
|
default stdin = `cat justfile`:
|
|
|
|
echo '{{stdin}}'
|
|
|
|
",
|
2019-10-08 22:52:51 -07:00
|
|
|
stdout: "
|
|
|
|
default stdin = `cat justfile`:
|
|
|
|
echo {{stdin}}
|
|
|
|
",
|
|
|
|
stderr: "
|
2021-04-05 21:28:37 -07:00
|
|
|
echo 'default stdin = `cat justfile`:
|
2021-06-02 22:12:39 -07:00
|
|
|
echo '{{stdin}}''
|
2019-10-08 22:52:51 -07:00
|
|
|
",
|
2019-04-16 19:52:16 -07:00
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-16 19:52:16 -07:00
|
|
|
name: backtick_variable_read_single,
|
|
|
|
justfile: "
|
2019-04-18 11:48:02 -07:00
|
|
|
password := `read PW && echo $PW`
|
2019-04-16 19:52:16 -07:00
|
|
|
|
|
|
|
default:
|
|
|
|
echo {{password}}
|
|
|
|
",
|
|
|
|
stdin: "foobar\n",
|
|
|
|
stdout: "foobar\n",
|
|
|
|
stderr: "echo foobar\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-16 19:52:16 -07:00
|
|
|
name: backtick_variable_read_multiple,
|
|
|
|
justfile: "
|
2019-04-18 11:48:02 -07:00
|
|
|
a := `read A && echo $A`
|
|
|
|
b := `read B && echo $B`
|
2019-04-16 19:52:16 -07:00
|
|
|
|
|
|
|
default:
|
|
|
|
echo {{a}}
|
|
|
|
echo {{b}}
|
|
|
|
",
|
|
|
|
stdin: "foo\nbar\n",
|
|
|
|
stdout: "foo\nbar\n",
|
|
|
|
stderr: "echo foo\necho bar\n",
|
|
|
|
}
|
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2019-04-16 19:52:16 -07:00
|
|
|
name: backtick_default_read_multiple,
|
|
|
|
justfile: "
|
|
|
|
|
|
|
|
default a=`read A && echo $A` b=`read B && echo $B`:
|
|
|
|
echo {{a}}
|
|
|
|
echo {{b}}
|
|
|
|
",
|
|
|
|
stdin: "foo\nbar\n",
|
|
|
|
stdout: "foo\nbar\n",
|
|
|
|
stderr: "echo foo\necho bar\n",
|
|
|
|
}
|
2019-04-18 11:48:02 -07:00
|
|
|
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
test! {
|
2021-10-01 18:37:28 -07:00
|
|
|
name: old_equals_assignment_syntax_produces_error,
|
2019-10-07 00:32:51 -07:00
|
|
|
justfile: "
|
|
|
|
foo = 'bar'
|
2019-04-18 11:48:02 -07:00
|
|
|
|
2019-10-07 00:32:51 -07:00
|
|
|
default:
|
|
|
|
echo {{foo}}
|
|
|
|
",
|
|
|
|
stderr: "
|
2021-10-01 18:37:28 -07:00
|
|
|
error: Expected '*', ':', '$', identifier, or '+', but found '='
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:5
|
|
|
|
│
|
|
|
|
1 │ foo = 'bar'
|
|
|
|
│ ^
|
2019-10-07 00:32:51 -07:00
|
|
|
",
|
2021-03-28 23:39:23 -07:00
|
|
|
status: EXIT_FAILURE,
|
2019-04-18 11:48:02 -07:00
|
|
|
}
|
2019-11-22 11:33:56 -08:00
|
|
|
|
2019-12-07 04:03:03 -08:00
|
|
|
test! {
|
|
|
|
name: dependency_argument_string,
|
|
|
|
justfile: "
|
|
|
|
release: (build 'foo') (build 'bar')
|
|
|
|
|
|
|
|
build target:
|
|
|
|
echo 'Building {{target}}...'
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "Building foo...\nBuilding bar...\n",
|
|
|
|
stderr: "echo 'Building foo...'\necho 'Building bar...'\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: dependency_argument_parameter,
|
|
|
|
justfile: "
|
|
|
|
default: (release '1.0')
|
|
|
|
|
|
|
|
release version: (build 'foo' version) (build 'bar' version)
|
|
|
|
|
|
|
|
build target version:
|
|
|
|
echo 'Building {{target}}@{{version}}...'
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "Building foo@1.0...\nBuilding bar@1.0...\n",
|
|
|
|
stderr: "echo 'Building foo@1.0...'\necho 'Building bar@1.0...'\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: dependency_argument_function,
|
|
|
|
justfile: "
|
|
|
|
foo: (bar env_var_or_default('x', 'y'))
|
|
|
|
|
|
|
|
bar arg:
|
|
|
|
echo {{arg}}
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "y\n",
|
|
|
|
stderr: "echo y\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
2023-06-13 05:49:46 -07:00
|
|
|
test! {
|
|
|
|
name: env_function_as_env_var,
|
|
|
|
justfile: "
|
|
|
|
foo: (bar env('x'))
|
|
|
|
|
|
|
|
bar arg:
|
|
|
|
echo {{arg}}
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
env: { "x": "z", },
|
|
|
|
stdout: "z\n",
|
|
|
|
stderr: "echo z\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: env_function_as_env_var_or_default,
|
|
|
|
justfile: "
|
|
|
|
foo: (bar env('x', 'y'))
|
|
|
|
|
|
|
|
bar arg:
|
|
|
|
echo {{arg}}
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
env: { "x": "z", },
|
|
|
|
stdout: "z\n",
|
|
|
|
stderr: "echo z\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: env_function_as_env_var_with_existing_env_var,
|
|
|
|
justfile: "
|
|
|
|
foo: (bar env('x'))
|
|
|
|
|
|
|
|
bar arg:
|
|
|
|
echo {{arg}}
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
env: { "x": "z", },
|
|
|
|
stdout: "z\n",
|
|
|
|
stderr: "echo z\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: env_function_as_env_var_or_default_with_existing_env_var,
|
|
|
|
justfile: "
|
|
|
|
foo: (bar env('x', 'y'))
|
|
|
|
|
|
|
|
bar arg:
|
|
|
|
echo {{arg}}
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
env: { "x": "z", },
|
|
|
|
stdout: "z\n",
|
|
|
|
stderr: "echo z\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
2019-12-07 04:03:03 -08:00
|
|
|
test! {
|
|
|
|
name: dependency_argument_backtick,
|
|
|
|
justfile: "
|
|
|
|
export X := 'X'
|
|
|
|
|
|
|
|
foo: (bar `echo $X`)
|
|
|
|
|
|
|
|
bar arg:
|
|
|
|
echo {{arg}}
|
|
|
|
echo $X
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "X\nX\n",
|
|
|
|
stderr: "echo X\necho $X\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: dependency_argument_assignment,
|
|
|
|
justfile: "
|
|
|
|
v := '1.0'
|
|
|
|
|
|
|
|
default: (release v)
|
|
|
|
|
|
|
|
release version:
|
|
|
|
echo Release {{version}}...
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "Release 1.0...\n",
|
|
|
|
stderr: "echo Release 1.0...\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
2020-06-13 01:49:13 -07:00
|
|
|
name: dependency_argument_plus_variadic,
|
2019-12-07 04:03:03 -08:00
|
|
|
justfile: "
|
|
|
|
foo: (bar 'A' 'B' 'C')
|
|
|
|
|
|
|
|
bar +args:
|
|
|
|
echo {{args}}
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "A B C\n",
|
|
|
|
stderr: "echo A B C\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: duplicate_dependency_no_args,
|
|
|
|
justfile: "
|
|
|
|
foo: bar bar bar bar
|
|
|
|
|
|
|
|
bar:
|
|
|
|
echo BAR
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "BAR\n",
|
|
|
|
stderr: "echo BAR\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: duplicate_dependency_argument,
|
|
|
|
justfile: "
|
|
|
|
foo: (bar 'BAR') (bar `echo BAR`)
|
|
|
|
|
|
|
|
bar bar:
|
|
|
|
echo {{bar}}
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "BAR\n",
|
|
|
|
stderr: "echo BAR\n",
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: parameter_cross_reference_error,
|
|
|
|
justfile: "
|
|
|
|
foo:
|
|
|
|
|
|
|
|
bar a b=a:
|
|
|
|
",
|
|
|
|
args: (),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "
|
|
|
|
error: Variable `a` not defined
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:3:9
|
|
|
|
│
|
|
|
|
3 │ bar a b=a:
|
|
|
|
│ ^
|
2019-12-07 04:03:03 -08:00
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
shell: false,
|
|
|
|
}
|
2020-01-28 18:02:58 -08:00
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
test! {
|
|
|
|
name: pwsh_invocation_directory,
|
|
|
|
justfile: r#"
|
|
|
|
set shell := ["pwsh", "-NoProfile", "-c"]
|
|
|
|
|
|
|
|
pwd:
|
|
|
|
@Test-Path {{invocation_directory()}} > result.txt
|
|
|
|
"#,
|
|
|
|
args: (),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "",
|
|
|
|
status: EXIT_SUCCESS,
|
|
|
|
shell: false,
|
|
|
|
}
|
2020-03-13 22:19:43 -07:00
|
|
|
|
|
|
|
test! {
|
|
|
|
name: variables,
|
|
|
|
justfile: "
|
|
|
|
z := 'a'
|
|
|
|
a := 'z'
|
|
|
|
",
|
|
|
|
args: ("--variables"),
|
|
|
|
stdout: "a z\n",
|
|
|
|
stderr: "",
|
|
|
|
shell: false,
|
|
|
|
}
|
2020-06-09 15:16:05 -07:00
|
|
|
|
|
|
|
test! {
|
|
|
|
name: interpolation_evaluation_ignore_quiet,
|
|
|
|
justfile: r#"
|
|
|
|
foo:
|
|
|
|
{{"@echo foo 2>/dev/null"}}
|
|
|
|
"#,
|
|
|
|
args: (),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "
|
|
|
|
@echo foo 2>/dev/null
|
|
|
|
error: Recipe `foo` failed on line 2 with exit code 127
|
|
|
|
",
|
|
|
|
status: 127,
|
|
|
|
shell: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: interpolation_evaluation_ignore_quiet_continuation,
|
|
|
|
justfile: r#"
|
|
|
|
foo:
|
|
|
|
{{""}}\
|
|
|
|
@echo foo 2>/dev/null
|
|
|
|
"#,
|
|
|
|
args: (),
|
|
|
|
stdout: "",
|
|
|
|
stderr: "
|
|
|
|
@echo foo 2>/dev/null
|
|
|
|
error: Recipe `foo` failed on line 3 with exit code 127
|
|
|
|
",
|
|
|
|
status: 127,
|
|
|
|
shell: false,
|
|
|
|
}
|
2020-06-27 16:38:56 -07:00
|
|
|
|
2021-03-24 19:46:53 -07:00
|
|
|
test! {
|
|
|
|
name: brace_escape,
|
|
|
|
justfile: "
|
|
|
|
foo:
|
|
|
|
echo '{{{{'
|
|
|
|
",
|
|
|
|
stdout: "{{\n",
|
|
|
|
stderr: "
|
|
|
|
echo '{{'
|
|
|
|
",
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: brace_escape_extra,
|
|
|
|
justfile: "
|
|
|
|
foo:
|
|
|
|
echo '{{{{{'
|
|
|
|
",
|
|
|
|
stdout: "{{{\n",
|
|
|
|
stderr: "
|
|
|
|
echo '{{{'
|
|
|
|
",
|
|
|
|
}
|
|
|
|
|
2021-04-03 19:59:13 -07:00
|
|
|
test! {
|
|
|
|
name: multi_line_string_in_interpolation,
|
|
|
|
justfile: "
|
|
|
|
foo:
|
|
|
|
echo {{'a
|
|
|
|
echo b
|
|
|
|
echo c'}}z
|
|
|
|
echo baz
|
|
|
|
",
|
|
|
|
stdout: "a\nb\ncz\nbaz\n",
|
|
|
|
stderr: "echo a\n echo b\n echo cz\necho baz\n",
|
|
|
|
}
|
|
|
|
|
2020-06-27 16:38:56 -07:00
|
|
|
#[cfg(windows)]
|
|
|
|
test! {
|
|
|
|
name: windows_interpreter_path_no_base,
|
|
|
|
justfile: r#"
|
|
|
|
foo:
|
|
|
|
#!powershell
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
"#,
|
|
|
|
args: (),
|
|
|
|
}
|