#!/usr/bin/env bash

cat <<EOF >.mise.toml
[tasks.a]
run = 'echo a'
[tasks.b]
run = ['echo b && mise run a']
EOF

assert "mise run --output prefix b" "\
[b] b
[a] a"

cat <<EOF >.mise.toml
[tasks.a]
run = 'echo a'
[tasks.b]
run = ['echo b && mise run a']
[tasks.c]
run = ['echo c && mise run b']
EOF

assert "mise run --output prefix c" "\
[c] c
[b] b
[a] a"

assert "mise run --no-timings --output prefix c 2>&1" '[c] $ echo c && mise run b
[c] c
[b] $ echo b && mise run a
[b] b
[a] $ echo a
[a] a'
