1
1
mirror of https://github.com/casey/just.git synced 2024-11-30 00:57:14 +03:00
just/tests/json.rs

1033 lines
22 KiB
Rust
Raw Normal View History

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