-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored --help usage. Also added additional flags unit tests (wip)…
…. Updated dockerfile to run daemon in foreground with a fg command
- Loading branch information
Showing
6 changed files
with
157 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Craig Tomkow | ||
// August 16, 2019 | ||
|
||
package configuration | ||
|
||
import ( | ||
"flag" | ||
//"os" | ||
"testing" | ||
) | ||
|
||
func Test_ParseFlags(t *testing.T) { | ||
|
||
ParseFlags() | ||
} | ||
|
||
func Test_SetConfFlag(t *testing.T) { | ||
|
||
SetConfFlag() | ||
|
||
flagPtr := flag.Lookup("conf") | ||
if flagPtr == nil { | ||
t.Errorf("Set conf flag failed; found, expected: %#v, %s", flagPtr, "not nil ptr") | ||
} | ||
} | ||
|
||
// TODO: test is currently broken. It doesn't test failure scenarios at all. I thought flag.Usage sends to stderr... | ||
func Test_SetUserUsage(t *testing.T) { | ||
|
||
SetUserUsage("usage", "commands", "flags") | ||
flag.Usage() | ||
|
||
/* | ||
var errBuff []byte | ||
numOfBytes, _ := os.Stderr.Read(errBuff) | ||
if numOfBytes == 0 { | ||
t.Errorf("Usage test failed; found, expected: %d, %s", numOfBytes, "not zero") | ||
} | ||
*/ | ||
} | ||
|
||
func Test_SetLogToStderr(t *testing.T) { | ||
|
||
if err := SetLogToStderr(); err != nil { | ||
t.Errorf("Set log to stderr test failed; found, expected: %#v, %s", err, "nil err") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters