-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.sh
executable file
·67 lines (56 loc) · 2.23 KB
/
test.sh
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
#!/usr/bin/env bash
set -euo pipefail
# shellcheck source=test-utils.sh
source test-utils.sh
# global options
executeWithArguments launchpad --version
executeWithArguments launchpad --help
executeWithArguments launchpad -h
executeWithArguments launchpad
assertError "Missing command or option."
# list subcommand
executeWithArguments launchpad list
executeWithArguments launchpad list --help
executeWithArguments launchpad list -h
executeWithArguments launchpad list --verbose
executeWithArguments launchpad list -v
# explain subcommand
executeWithArguments launchpad explain
assertError "Missing application name or option."
executeWithArguments launchpad explain --help
executeWithArguments launchpad explain -h
executeWithArguments launchpad explain greeter
executeWithArguments launchpad explain broken
# start subcommand
executeWithArguments launchpad start
assertError "Missing application name or option."
executeWithArguments launchpad start --help
executeWithArguments launchpad start -h
#start greeter app
executeWithArguments launchpad start greeter
assertInfo "Obtaining configuration..."
assertError '"Name" parameter not provided. You must provide one.'
executeWithArguments launchpad start greeter --name=John
assertInfo "Obtaining configuration..."
assertWarning '"Title" parameter not provided. Using default.'
assertInfo "Name: John"
assertInfo "Title:"
assertInfo "Obtaining configuration... \[DONE\]"
assertStandardOutputIncludesText "Hi John!"
executeWithArguments launchpad start greeter --name=Jones --title=Mr.
assertInfo "Obtaining configuration..."
assertInfo "Name: Jones"
assertInfo "Title: Mr."
assertInfo "Obtaining configuration... \[DONE\]"
assertStandardOutputIncludesText "Hi Mr. Jones!"
executeWithArguments launchpad start --debug-mode greeter
assertStandardErrorIncludesText 'RequiredConfigurationNotFound: "Name" parameter not present.'
#start broken app
executeWithArguments launchpad start broken
assertInfo "Obtaining configuration..."
assertInfo "Obtaining configuration... \[DONE\]"
executeWithArguments launchpad start broken --raise-error
assertInfo "Obtaining configuration..."
assertInfo "Obtaining configuration... \[DONE\]"
assertError 'Unexpected startup error: "Doh!"'
assertStandardErrorIncludesText "The full stack"