-
Notifications
You must be signed in to change notification settings - Fork 7
/
meta
executable file
·68 lines (56 loc) · 1.03 KB
/
meta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
set -euo pipefail
# Init lib.
# shellcheck source=SCRIPTDIR/../lib/vector-test-harness/init.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/../lib/vector-test-harness/init.sh"
#
# Usage
#
register_usage <<END
USAGE
meta [mode] [options]
DESCRIPTION
Provides metadata for the test harness. Useful for scripting.
MODES
test-cases Print test cases
test-subjects Print test subjects
OPTIONS
none
EXAMPLE
meta test-cases
meta test-subjects
END
#
# Implementation
#
dispatch_execution() {
local MODE="${1:-""}"
case "$MODE" in
test-cases)
print_test_cases
;;
test-subjects)
print_test_subjects
;;
"" | -h | --help)
usage
;;
*)
fail_arg_invalid "Invalid mode: $MODE"
;;
esac
}
print_test_cases() {
(
cd cases;
for TEST_CASE in *; do
echo "$TEST_CASE"
done
)
}
print_test_subjects() {
for TEST_SUBJECT in "${TEST_SUBJECT_NAMES[@]}"; do
echo "$TEST_SUBJECT"
done
}
dispatch_execution "$@"