diff options
Diffstat (limited to 'compat/json/compat_test.go')
-rw-r--r-- | compat/json/compat_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/compat/json/compat_test.go b/compat/json/compat_test.go new file mode 100644 index 0000000..399ff02 --- /dev/null +++ b/compat/json/compat_test.go @@ -0,0 +1,37 @@ +// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// +// SPDX-License-Identifier: GPL-2.0-or-later + +package json + +import ( + "bytes" + + "git.lukeshu.com/go/lowmemjson/internal" +) + +var parseTag = internal.ParseTag + +const ( + startDetectingCyclesAfter = 1000 +) + +func isSpace(c byte) bool { + switch c { + case 0x0020, 0x000A, 0x000D, 0x0009: + return true + default: + return false + } +} + +type encodeState struct { + bytes.Buffer +} + +func (es *encodeState) string(str string, _ bool) { + internal.EncodeStringFromString(&es.Buffer, str) +} +func (es *encodeState) stringBytes(str []byte, _ bool) { + internal.EncodeStringFromBytes(&es.Buffer, str) +} |