(b *testing.B)
| 70 | } |
| 71 | |
| 72 | func BenchmarkJSONStringUtils(b *testing.B) { |
| 73 | tests := []struct { |
| 74 | input string |
| 75 | output string |
| 76 | }{ |
| 77 | {`test`, `"test"`}, |
| 78 | {`"test"`, `"\"test\""`}, |
| 79 | {"\x00", `"\u0000"`}, |
| 80 | } |
| 81 | |
| 82 | for _, test := range tests { |
| 83 | b.Run("ConvertToJSONString "+test.input, func(b *testing.B) { |
| 84 | for i := 0; i < b.N; i++ { |
| 85 | _ = ConvertToJSONString(test.input) |
| 86 | } |
| 87 | }) |
| 88 | b.Run("ConvertJSONString "+test.input, func(b *testing.B) { |
| 89 | for i := 0; i < b.N; i++ { |
| 90 | _ = ConvertJSONString(test.output) |
| 91 | } |
| 92 | }) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | func TestConvertBackQuotedStrings(t *testing.T) { |
| 97 | tests := []struct { |
nothing calls this directly
no test coverage detected