diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-07 13:33:18 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-07 13:33:18 +0900 |
| commit | 0fb9e401912f89d25ff96b0dd36aabf43b4fab8f (patch) | |
| tree | 9f64f1055b70ec9bef09b7e0c004f76f9e416981 /helper/args_test.go | |
| parent | 9647eb6a6b5607e9aac1e2c113e80f2e966ec0ac (diff) | |
helper/args: MustNewCheckedArgs for cleaner hardcoded args
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'helper/args_test.go')
| -rw-r--r-- | helper/args_test.go | 15 |
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) + }) } |
