diff options
author | Arne Juul <arnej@yahooinc.com> | 2023-02-17 12:56:35 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2023-02-17 12:56:35 +0000 |
commit | b9f10138d4a80e1e2cc826809af41e0b3a8bb16d (patch) | |
tree | e39f87fb4bdce4ea997ae08cb185154acc3abb6d /client/go/internal/cli/cmd/visit_test.go | |
parent | 58cc508408d72d861f997fae3cb121fcde8b1efa (diff) |
add quoting
Diffstat (limited to 'client/go/internal/cli/cmd/visit_test.go')
-rw-r--r-- | client/go/internal/cli/cmd/visit_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/client/go/internal/cli/cmd/visit_test.go b/client/go/internal/cli/cmd/visit_test.go new file mode 100644 index 00000000000..9f4fbb66e00 --- /dev/null +++ b/client/go/internal/cli/cmd/visit_test.go @@ -0,0 +1,25 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package cmd + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestQuoteFunc(t *testing.T) { + var buf []byte = make([]byte, 3) + buf[0] = 'a' + buf[2] = 'z' + for i := 0; i < 256; i++ { + buf[1] = byte(i) + s := string(buf) + res := quoteArgForUrl(s) + if i < 32 || i > 127 { + assert.Equal(t, "a+z", res) + } else { + fmt.Printf("res %3d => '%s'\n", i, res) + } + } +} |