|
33 | 33 | assert_success |
34 | 34 | } |
35 | 35 |
|
36 | | -@test "${BATS_TEST_NUMBER} run -v" { |
| 36 | +function test_version() { |
37 | 37 | execute_test_command |
38 | 38 | assert_output --regexp "^[0-9]+\.[0-9]+\.[0-9]$" |
39 | 39 | assert_success |
40 | 40 | } |
| 41 | +@test "${BATS_TEST_NUMBER} run -v" { test_version; } |
| 42 | +@test "${BATS_TEST_NUMBER} run --version" { test_version; } |
41 | 43 |
|
42 | | -@test "${BATS_TEST_NUMBER} run --version" { |
43 | | - execute_test_command |
44 | | - assert_output --regexp "^[0-9]+\.[0-9]+\.[0-9]$" |
45 | | - assert_success |
46 | | -} |
47 | | - |
48 | | -@test "${BATS_TEST_NUMBER} run -h" { |
| 44 | +function test_help() { |
49 | 45 | execute_test_command |
50 | 46 | assert_output -p "runfile.sh" |
51 | 47 | assert_output --regexp "[0-9]+\.[0-9]+\.[0-9]" |
52 | 48 | assert_output -p "Usage" |
53 | | - assert_output -p "Actions" |
54 | | - assert_output -p "Options" |
55 | 49 | assert_success |
56 | 50 | } |
| 51 | +@test "${BATS_TEST_NUMBER} run --help" { test_help; } |
| 52 | +@test "${BATS_TEST_NUMBER} run -h" { test_help; } |
57 | 53 |
|
58 | | -@test "${BATS_TEST_NUMBER} run --help" { |
| 54 | +function test_runfile() { |
59 | 55 | execute_test_command |
60 | | - assert_output -p "runfile.sh" |
61 | | - assert_output --regexp "[0-9]+\.[0-9]+\.[0-9]" |
62 | | - assert_output -p "Usage" |
63 | | - assert_output -p "Actions" |
64 | | - assert_output -p "Options" |
| 56 | + assert_output "$( cat ./Runfile )" |
65 | 57 | assert_success |
66 | 58 | } |
| 59 | +@test "${BATS_TEST_NUMBER} run --runfile" { test_runfile; } |
| 60 | +@test "${BATS_TEST_NUMBER} run -r" { test_runfile; } |
67 | 61 |
|
68 | | -@test "${BATS_TEST_NUMBER} run --usage" { |
| 62 | +function test_runfile_compact() { |
69 | 63 | execute_test_command |
70 | | - assert_output -p "runfile.sh" |
71 | | - assert_output --regexp "[0-9]+\.[0-9]+\.[0-9]" |
72 | | - assert_output -p "Usage" |
73 | | - assert_output -p "Actions" |
74 | | - assert_output -p "Options" |
| 64 | + assert_output "$( cat ./Runfile | sed -e '/^$/d' -e 's/^[[:space:]]//' )" |
75 | 65 | assert_success |
76 | 66 | } |
| 67 | +@test "${BATS_TEST_NUMBER} run --runfile --compact" { test_runfile_compact; } |
| 68 | +@test "${BATS_TEST_NUMBER} run -r --compact" { test_runfile_compact; } |
77 | 69 |
|
78 | | -@test "${BATS_TEST_NUMBER} run --runfile" { |
| 70 | +function test_makefile() { |
79 | 71 | execute_test_command |
80 | | - assert_output "$( cat ./Runfile )" |
| 72 | + assert_output "$( cat ./Makefile )" |
81 | 73 | assert_success |
82 | 74 | } |
| 75 | +@test "${BATS_TEST_NUMBER} run --makefile" { test_makefile; } |
| 76 | +@test "${BATS_TEST_NUMBER} run -m" { test_makefile; } |
83 | 77 |
|
84 | | -@test "${BATS_TEST_NUMBER} run --runfile --runfile-compact" { |
| 78 | +function test_makefile_task_start() { |
85 | 79 | execute_test_command |
86 | | - assert_output "$( cat ./Runfile | sed -e '/^$/d' -e 's/^[[:space:]]//' )" |
87 | | - assert_success |
88 | | -} # shortcut for above: |
89 | | -@test "${BATS_TEST_NUMBER} run --runfile-compact" { |
90 | | - execute_test_command |
91 | | - assert_output "$( cat ./Runfile | sed -e '/^$/d' -e 's/^[[:space:]]//' )" |
| 80 | + assert_output -p "$( cat ./Makefile | grep "@" | head -4 | sed 's/^.*@//' )" |
92 | 81 | assert_success |
93 | 82 | } |
| 83 | +@test "${BATS_TEST_NUMBER} run --makefile start" { test_makefile_task_start; } |
| 84 | +@test "${BATS_TEST_NUMBER} run -m start" { test_makefile_task_start; } |
94 | 85 |
|
95 | | -@test "${BATS_TEST_NUMBER} run --makefile" { |
| 86 | +function test_makefile_task_stop() { |
96 | 87 | execute_test_command |
97 | | - assert_output "$( cat ./Makefile )" |
98 | | - assert_success |
99 | | -} # same as above; --runfile-compact should have no effect: |
100 | | -@test "${BATS_TEST_NUMBER} run --makefile --runfile-compact" { |
101 | | - execute_test_command |
102 | | - assert_output "$( cat ./Makefile )" |
| 88 | + assert_output -p "$( cat ./Makefile | grep "@" | head -5 | tail -1 | sed 's/^.*@//' )" |
103 | 89 | assert_success |
104 | 90 | } |
| 91 | +@test "${BATS_TEST_NUMBER} run --makefile stop" { test_makefile_task_stop; } |
| 92 | +@test "${BATS_TEST_NUMBER} run -m stop" { test_makefile_task_stop; } |
105 | 93 |
|
106 | | -@test "${BATS_TEST_NUMBER} run --runfile-aliases" { |
| 94 | +@test "${BATS_TEST_NUMBER} run --alias" { |
107 | 95 | execute_test_command |
108 | 96 | assert_output "$( cat <<-EOF |
109 | 97 | # Runfile Aliases |
|
0 commit comments