Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
f21db281
Commit
f21db281
authored
Apr 20, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better testing of the help printing on CLIs
parent
109be6b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
packer/environment_test.go
packer/environment_test.go
+14
-1
No files found.
packer/environment_test.go
View file @
f21db281
...
...
@@ -4,6 +4,7 @@ import (
"bytes"
"cgl.tideland.biz/asserts"
"os"
"strings"
"testing"
)
...
...
@@ -63,9 +64,21 @@ func TestEnvironment_DefaultCli_Help(t *testing.T) {
defaultEnv
:=
testEnvironment
()
// Test the basic version options
// A little lambda to help us test the output actually contains help
testOutput
:=
func
()
{
buffer
:=
defaultEnv
.
Ui
()
.
(
*
ReaderWriterUi
)
.
Writer
.
(
*
bytes
.
Buffer
)
output
:=
buffer
.
String
()
buffer
.
Reset
()
assert
.
True
(
strings
.
Contains
(
output
,
"usage: packer"
),
"should print help"
)
}
// Test "--help"
assert
.
Equal
(
defaultEnv
.
Cli
([]
string
{
"--help"
}),
1
,
"--help should print"
)
testOutput
()
// Test "-h"
assert
.
Equal
(
defaultEnv
.
Cli
([]
string
{
"-h"
}),
1
,
"--help should print"
)
testOutput
()
}
func
TestEnvironment_DefaultCli_Version
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment