aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/args_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'helper/args_test.go')
-rw-r--r--helper/args_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/helper/args_test.go b/helper/args_test.go
index 378c6dcc..5675a879 100644
--- a/helper/args_test.go
+++ b/helper/args_test.go
@@ -10,8 +10,6 @@ import (
)
func Test_argsFD_String(t *testing.T) {
- argsOnce.Do(prepareArgs)
-
wantString := strings.Join(want, " ")
if got := argsWt.(fmt.Stringer).String(); got != wantString {
t.Errorf("String(): got %v; want %v",
@@ -26,4 +24,17 @@ func TestNewCheckedArgs(t *testing.T) {
args,
err, helper.ErrContainsNull)
}
+
+ t.Run("must panic", func(t *testing.T) {
+ badPayload := []string{"\x00"}
+ defer func() {
+ wantPanic := "argument contains null character"
+ if r := recover(); r != wantPanic {
+ t.Errorf("MustNewCheckedArgs(%q) panic = %v, wantPanic %v",
+ badPayload,
+ r, wantPanic)
+ }
+ }()
+ helper.MustNewCheckedArgs(badPayload)
+ })
}