MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestJSONStringUtils

Function TestJSONStringUtils

base/util_test.go:50–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestJSONStringUtils(t *testing.T) {
51 tests := []struct {
52 input string
53 output string
54 }{
55 {`test`, `"test"`},
56 {`"test"`, `"\"test\""`},
57 {"\x00", `"\u0000"`},
58 }
59
60 for _, test := range tests {
61 t.Run("ConvertToJSONString "+test.input, func(t *testing.T) {
62 out := ConvertToJSONString(test.input)
63 assert.Equal(t, test.output, out)
64 })
65 t.Run("ConvertJSONString "+test.input, func(t *testing.T) {
66 out := ConvertJSONString(test.output)
67 assert.Equal(t, test.input, out)
68 })
69 }
70}
71
72func BenchmarkJSONStringUtils(b *testing.B) {
73 tests := []struct {

Callers

nothing calls this directly

Calls 4

ConvertToJSONStringFunction · 0.85
ConvertJSONStringFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected