2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
2021-11-17 00:07:48 -08:00
|
|
|
|
2023-12-27 20:27:15 -08:00
|
|
|
fn case(justfile: &str, value: Value) {
|
2021-11-17 00:07:48 -08:00
|
|
|
Test::new()
|
|
|
|
.justfile(justfile)
|
2023-01-03 22:31:56 -08:00
|
|
|
.args(["--dump", "--dump-format", "json", "--unstable"])
|
2021-11-17 00:07:48 -08:00
|
|
|
.stdout(format!("{}\n", serde_json::to_string(&value).unwrap()))
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn alias() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
alias f := foo
|
|
|
|
|
|
|
|
foo:
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
"aliases": {
|
|
|
|
"f": {
|
|
|
|
"name": "f",
|
|
|
|
"target": "foo",
|
2022-12-20 00:44:19 -08:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"assignments": {},
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn assignment() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"foo := 'bar'",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {
|
|
|
|
"foo": {
|
|
|
|
"export": false,
|
|
|
|
"name": "foo",
|
|
|
|
"value": "bar",
|
2024-05-14 18:39:42 -07:00
|
|
|
"depth": 0,
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"first": null,
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn body() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
foo:
|
|
|
|
bar
|
|
|
|
abc{{ 'xyz' }}def
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"body": [
|
|
|
|
["bar"],
|
|
|
|
["abc", ["xyz"], "def"],
|
|
|
|
],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dependencies() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
foo:
|
|
|
|
bar: foo
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"bar": {
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"doc": null,
|
|
|
|
"name": "bar",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "bar",
|
2021-11-17 00:07:48 -08:00
|
|
|
"body": [],
|
|
|
|
"dependencies": [{
|
|
|
|
"arguments": [],
|
|
|
|
"recipe": "foo"
|
|
|
|
}],
|
|
|
|
"parameters": [],
|
|
|
|
"priors": 1,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
|
|
|
},
|
|
|
|
"foo": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dependency_argument() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
x := 'foo'
|
|
|
|
foo *args:
|
|
|
|
bar: (
|
|
|
|
foo
|
|
|
|
'baz'
|
|
|
|
('baz')
|
|
|
|
('a' + 'b')
|
|
|
|
`echo`
|
|
|
|
x
|
|
|
|
if 'a' == 'b' { 'c' } else { 'd' }
|
|
|
|
arch()
|
|
|
|
env_var('foo')
|
|
|
|
join('a', 'b')
|
|
|
|
replace('a', 'b', 'c')
|
|
|
|
)
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
"assignments": {
|
|
|
|
"x": {
|
|
|
|
"export": false,
|
|
|
|
"name": "x",
|
|
|
|
"value": "foo",
|
2024-05-14 18:39:42 -07:00
|
|
|
"depth": 0,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
},
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"bar": {
|
|
|
|
"doc": null,
|
|
|
|
"name": "bar",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "bar",
|
2021-11-17 00:07:48 -08:00
|
|
|
"body": [],
|
|
|
|
"dependencies": [{
|
|
|
|
"arguments": [
|
|
|
|
"baz",
|
|
|
|
"baz",
|
2022-12-30 12:36:08 -08:00
|
|
|
["concatenate", "a", "b"],
|
2021-11-17 00:07:48 -08:00
|
|
|
["evaluate", "echo"],
|
|
|
|
["variable", "x"],
|
2024-05-14 18:55:32 -07:00
|
|
|
["if", ["==", "a", "b"], "c", "d"],
|
2021-11-17 00:07:48 -08:00
|
|
|
["call", "arch"],
|
|
|
|
["call", "env_var", "foo"],
|
|
|
|
["call", "join", "a", "b"],
|
|
|
|
["call", "replace", "a", "b", "c"],
|
|
|
|
],
|
|
|
|
"recipe": "foo"
|
|
|
|
}],
|
|
|
|
"parameters": [],
|
|
|
|
"priors": 1,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
"foo": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "args",
|
|
|
|
"export": false,
|
|
|
|
"default": null,
|
|
|
|
"kind": "star",
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2022-02-14 18:37:06 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2022-02-14 18:37:06 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2022-02-14 18:37:06 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-02-14 18:37:06 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2022-02-14 18:37:06 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2022-02-14 18:37:06 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn duplicate_recipes() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2022-02-14 18:37:06 -08:00
|
|
|
"
|
|
|
|
set allow-duplicate-recipes
|
|
|
|
alias f := foo
|
|
|
|
|
|
|
|
foo:
|
|
|
|
foo bar:
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2022-02-14 18:37:06 -08:00
|
|
|
"aliases": {
|
|
|
|
"f": {
|
2022-12-20 00:44:19 -08:00
|
|
|
"attributes": [],
|
2022-02-14 18:37:06 -08:00
|
|
|
"name": "f",
|
|
|
|
"target": "foo",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"assignments": {},
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2022-02-14 18:37:06 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2022-02-14 18:37:06 -08:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "bar",
|
|
|
|
"export": false,
|
|
|
|
"default": null,
|
|
|
|
"kind": "singular",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2022-02-14 18:37:06 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
|
|
|
"allow_duplicate_recipes": true,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"export": false,
|
|
|
|
"fallback": false,
|
|
|
|
"ignore_comments": false,
|
|
|
|
"positional_arguments": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shell": null,
|
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"windows_powershell": false,
|
|
|
|
"windows_shell": null,
|
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2024-05-14 18:39:42 -07:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn duplicate_variables() {
|
|
|
|
case(
|
|
|
|
"
|
|
|
|
set allow-duplicate-variables
|
|
|
|
x := 'foo'
|
|
|
|
x := 'bar'
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {
|
|
|
|
"x": {
|
|
|
|
"export": false,
|
|
|
|
"name": "x",
|
|
|
|
"value": "bar",
|
|
|
|
"depth": 0,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"first": null,
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2024-05-14 18:39:42 -07:00
|
|
|
"modules": {},
|
|
|
|
"recipes": {},
|
|
|
|
"settings": {
|
|
|
|
"allow_duplicate_recipes": false,
|
|
|
|
"allow_duplicate_variables": true,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn doc_comment() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"# hello\nfoo:",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
"assignments": {},
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": "hello",
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn empty_justfile() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": null,
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn parameters() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
a:
|
|
|
|
b x:
|
|
|
|
c x='y':
|
|
|
|
d +x:
|
|
|
|
e *x:
|
|
|
|
f $x:
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"first": "a",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
"assignments": {},
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"a": {
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "a",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "a",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
|
|
|
},
|
|
|
|
"b": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "b",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "b",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "x",
|
|
|
|
"export": false,
|
|
|
|
"default": null,
|
|
|
|
"kind": "singular",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
"c": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "c",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "c",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "x",
|
|
|
|
"export": false,
|
|
|
|
"default": "y",
|
|
|
|
"kind": "singular",
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
"d": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "d",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "d",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "x",
|
|
|
|
"export": false,
|
|
|
|
"default": null,
|
|
|
|
"kind": "plus",
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
"e": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "e",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "e",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "x",
|
|
|
|
"export": false,
|
|
|
|
"default": null,
|
|
|
|
"kind": "star",
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
"f": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "f",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "f",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "x",
|
|
|
|
"export": true,
|
|
|
|
"default": null,
|
|
|
|
"kind": "singular",
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn priors() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
a:
|
|
|
|
b: a && c
|
|
|
|
c:
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "a",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"a": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "a",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "a",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
|
|
|
"b": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [
|
|
|
|
{
|
|
|
|
"arguments": [],
|
|
|
|
"recipe": "a",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"arguments": [],
|
|
|
|
"recipe": "c",
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"doc": null,
|
|
|
|
"name": "b",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "b",
|
2021-11-17 00:07:48 -08:00
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 1,
|
|
|
|
},
|
|
|
|
"c": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "c",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "c",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn private() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"_foo:",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "_foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"_foo": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "_foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "_foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": true,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn quiet() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"@foo:",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": true,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn settings() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
set dotenv-load
|
2023-10-11 22:04:46 -07:00
|
|
|
set dotenv-filename := \"filename\"
|
|
|
|
set dotenv-path := \"path\"
|
2021-11-17 00:07:48 -08:00
|
|
|
set export
|
2022-10-19 19:00:09 -07:00
|
|
|
set fallback
|
2021-11-17 00:07:48 -08:00
|
|
|
set positional-arguments
|
2024-01-12 12:38:23 -08:00
|
|
|
set quiet
|
2022-10-04 17:32:30 -07:00
|
|
|
set ignore-comments
|
2021-11-17 00:07:48 -08:00
|
|
|
set shell := ['a', 'b', 'c']
|
|
|
|
foo:
|
|
|
|
#!bar
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
|
|
|
"body": [["#!bar"]],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": true,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": "filename",
|
2021-11-17 00:07:48 -08:00
|
|
|
"dotenv_load": true,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": "path",
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": true,
|
2022-10-19 19:00:09 -07:00
|
|
|
"fallback": true,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": true,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": true,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": true,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": {
|
|
|
|
"arguments": ["b", "c"],
|
|
|
|
"command": "a",
|
|
|
|
},
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir": null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shebang() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"
|
|
|
|
foo:
|
|
|
|
#!bar
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
|
|
|
"body": [["#!bar"]],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": true,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir": null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn simple() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2021-11-17 00:07:48 -08:00
|
|
|
"foo:",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2021-11-17 00:07:48 -08:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2021-11-17 00:07:48 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": [],
|
2022-10-25 16:32:36 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2022-10-25 16:32:36 -07:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2022-10-25 16:32:36 -07:00
|
|
|
"ignore_comments": false,
|
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2022-10-25 16:32:36 -07:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir": null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-10-25 16:32:36 -07:00
|
|
|
"windows_powershell": false,
|
|
|
|
"windows_shell": null,
|
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2022-10-25 16:32:36 -07:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn attribute() {
|
2023-12-27 20:27:15 -08:00
|
|
|
case(
|
2022-10-25 16:32:36 -07:00
|
|
|
"
|
|
|
|
[no-exit-message]
|
|
|
|
foo:
|
|
|
|
",
|
|
|
|
json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "foo",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
2022-10-25 16:32:36 -07:00
|
|
|
"recipes": {
|
|
|
|
"foo": {
|
2022-10-31 00:52:03 -07:00
|
|
|
"attributes": ["no-exit-message"],
|
2022-10-25 16:32:36 -07:00
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "foo",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo",
|
2022-10-25 16:32:36 -07:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
2022-02-14 18:37:06 -08:00
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-10-11 22:04:46 -07:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"export": false,
|
2022-11-25 13:02:01 -08:00
|
|
|
"fallback": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2021-11-17 00:07:48 -08:00
|
|
|
"shell": null,
|
2022-10-25 16:57:20 -07:00
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2022-10-04 17:32:30 -07:00
|
|
|
"ignore_comments": false,
|
2022-01-18 11:02:15 -08:00
|
|
|
"windows_powershell": false,
|
2022-05-31 13:01:59 -07:00
|
|
|
"windows_shell": null,
|
2021-11-17 00:07:48 -08:00
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2021-11-17 00:07:48 -08:00
|
|
|
"warnings": [],
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
2023-12-27 20:27:15 -08:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn module() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
2024-06-28 21:13:11 -07:00
|
|
|
# hello
|
2023-12-27 20:27:15 -08:00
|
|
|
mod foo
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.tree(tree! {
|
|
|
|
"foo.just": "bar:",
|
|
|
|
})
|
|
|
|
.args(["--dump", "--dump-format", "json", "--unstable"])
|
|
|
|
.test_round_trip(false)
|
|
|
|
.stdout(format!(
|
|
|
|
"{}\n",
|
|
|
|
serde_json::to_string(&json!({
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": null,
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": null,
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {
|
|
|
|
"foo": {
|
|
|
|
"aliases": {},
|
|
|
|
"assignments": {},
|
|
|
|
"first": "bar",
|
2024-06-28 21:13:11 -07:00
|
|
|
"doc": "hello",
|
2023-12-27 20:27:15 -08:00
|
|
|
"modules": {},
|
|
|
|
"recipes": {
|
|
|
|
"bar": {
|
|
|
|
"attributes": [],
|
|
|
|
"body": [],
|
|
|
|
"dependencies": [],
|
|
|
|
"doc": null,
|
|
|
|
"name": "bar",
|
2024-01-08 13:26:33 -08:00
|
|
|
"namepath": "foo::bar",
|
2023-12-27 20:27:15 -08:00
|
|
|
"parameters": [],
|
|
|
|
"priors": 0,
|
|
|
|
"private": false,
|
|
|
|
"quiet": false,
|
|
|
|
"shebang": false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"settings": {
|
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"export": false,
|
|
|
|
"fallback": false,
|
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"shell": null,
|
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"ignore_comments": false,
|
|
|
|
"windows_powershell": false,
|
|
|
|
"windows_shell": null,
|
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2023-12-27 20:27:15 -08:00
|
|
|
"warnings": [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"recipes": {},
|
|
|
|
"settings": {
|
|
|
|
"allow_duplicate_recipes": false,
|
2024-05-14 18:39:42 -07:00
|
|
|
"allow_duplicate_variables": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"dotenv_filename": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_load": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"dotenv_path": null,
|
2024-05-30 16:12:07 -07:00
|
|
|
"dotenv_required": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"export": false,
|
|
|
|
"fallback": false,
|
|
|
|
"positional_arguments": false,
|
2024-01-12 12:38:23 -08:00
|
|
|
"quiet": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"shell": null,
|
|
|
|
"tempdir" : null,
|
2024-07-07 20:45:03 -07:00
|
|
|
"unstable": false,
|
2023-12-27 20:27:15 -08:00
|
|
|
"ignore_comments": false,
|
|
|
|
"windows_powershell": false,
|
|
|
|
"windows_shell": null,
|
|
|
|
},
|
2024-06-05 13:16:47 -07:00
|
|
|
"unexports": [],
|
2023-12-27 20:27:15 -08:00
|
|
|
"warnings": [],
|
|
|
|
}))
|
|
|
|
.unwrap()
|
|
|
|
))
|
|
|
|
.run();
|
|
|
|
}
|