summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-02-25 18:12:15 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-02-25 18:12:15 -0700
commit4233e5012ece6d5a7fee3b5a518c41d916e1cf52 (patch)
treee4f79cf857a59512198f259552b5c8675f734d1e
parent2a41777072f48467bef02bb3bd670d95c2b02102 (diff)
compat/json: compat_test.go: Change the package to "json_test"
-rw-r--r--compat/json/compat_test.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/compat/json/compat_test.go b/compat/json/compat_test.go
index 43f17f1..3de48f7 100644
--- a/compat/json/compat_test.go
+++ b/compat/json/compat_test.go
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-2.0-or-later
-package json
+package json_test
import (
"bytes"
@@ -11,6 +11,8 @@ import (
"testing"
"github.com/stretchr/testify/assert"
+
+ "git.lukeshu.com/go/lowmemjson/compat/json"
)
func TestCompatHTMLEscape(t *testing.T) {
@@ -31,7 +33,7 @@ func TestCompatHTMLEscape(t *testing.T) {
t.Parallel()
t.Logf("in=%q", tc.In)
var dst bytes.Buffer
- HTMLEscape(&dst, []byte(tc.In))
+ json.HTMLEscape(&dst, []byte(tc.In))
assert.Equal(t, tc.Out, dst.String())
})
}
@@ -58,7 +60,7 @@ func TestCompatValid(t *testing.T) {
t.Run(tcName, func(t *testing.T) {
t.Parallel()
t.Logf("in=%q", tc.In)
- act := Valid([]byte(tc.In))
+ act := json.Valid([]byte(tc.In))
assert.Equal(t, tc.Exp, act)
})
}
@@ -88,7 +90,7 @@ func TestCompatCompact(t *testing.T) {
t.Parallel()
t.Logf("in=%q", tc.In)
var out bytes.Buffer
- err := Compact(&out, []byte(tc.In))
+ err := json.Compact(&out, []byte(tc.In))
assert.Equal(t, tc.Out, out.String())
if tc.Err == "" {
assert.NoError(t, err)
@@ -130,7 +132,7 @@ func TestCompatIndent(t *testing.T) {
t.Parallel()
t.Logf("in=%q", tc.In)
var out bytes.Buffer
- err := Indent(&out, []byte(tc.In), ">", ".")
+ err := json.Indent(&out, []byte(tc.In), ">", ".")
assert.Equal(t, tc.Out, out.String())
if tc.Err == "" {
assert.NoError(t, err)
@@ -157,7 +159,7 @@ func TestCompatMarshal(t *testing.T) {
tc := tc
t.Run(tcName, func(t *testing.T) {
t.Parallel()
- out, err := Marshal(tc.In)
+ out, err := json.Marshal(tc.In)
assert.Equal(t, tc.Out, string(out))
if tc.Err == "" {
assert.NoError(t, err)
@@ -218,7 +220,7 @@ func TestCompatUnmarshal(t *testing.T) {
var out any
ptr = &out
}
- err := Unmarshal([]byte(tc.In), ptr)
+ err := json.Unmarshal([]byte(tc.In), ptr)
assert.Equal(t, tc.ExpOut, reflect.ValueOf(ptr).Elem().Interface())
if tc.ExpErr == "" {
assert.NoError(t, err)
@@ -261,7 +263,7 @@ func TestCompatDecode(t *testing.T) {
var out any
ptr = &out
}
- err := NewDecoder(strings.NewReader(tc.In)).Decode(ptr)
+ err := json.NewDecoder(strings.NewReader(tc.In)).Decode(ptr)
assert.Equal(t, tc.ExpOut, reflect.ValueOf(ptr).Elem().Interface())
if tc.ExpErr == "" {
assert.NoError(t, err)