summaryrefslogtreecommitdiff
path: root/methods_test.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-01-25 23:11:06 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-01-25 23:20:18 -0700
commite483afa206686ce748ad270140f99fad9d713aad (patch)
tree2f65755ece7059579e902132cf0e44cb0fbbb0d6 /methods_test.go
parentf834aaeb56b929ed06e0545a589b7dd82b4602d3 (diff)
Delete things I don't want to document
Diffstat (limited to 'methods_test.go')
-rw-r--r--methods_test.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/methods_test.go b/methods_test.go
index a74532c..3a5254f 100644
--- a/methods_test.go
+++ b/methods_test.go
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com>
+// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com>
//
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -18,8 +18,8 @@ import (
type ShortSum string
func (s ShortSum) EncodeJSON(w io.Writer) error {
- // Test that it's OK to call lowmemjson.Encode for the top-level value in a method.
- return lowmemjson.Encode(w, string(s))
+ // Test that it's OK to call lowmemjson.Encoder.Encode for the top-level value in a method.
+ return lowmemjson.NewEncoder(w).Encode(string(s))
}
type SumRun struct {
@@ -50,7 +50,7 @@ func (sg SumRunWithGaps) EncodeJSON(w io.Writer) error {
return err
}
}
- if err := lowmemjson.Encode(w, run); err != nil {
+ if err := lowmemjson.NewEncoder(w).Encode(run); err != nil {
return err
}
}
@@ -74,18 +74,18 @@ func (sg *SumRunWithGaps) DecodeJSON(r io.RuneScanner) error {
var name string
return lowmemjson.DecodeObject(r,
func(r io.RuneScanner) error {
- return lowmemjson.Decode(r, &name)
+ return lowmemjson.NewDecoder(r).Decode(&name)
},
func(r io.RuneScanner) error {
switch name {
case "Addr":
- return lowmemjson.Decode(r, &sg.Addr)
+ return lowmemjson.NewDecoder(r).Decode(&sg.Addr)
case "Size":
- return lowmemjson.Decode(r, &sg.Size)
+ return lowmemjson.NewDecoder(r).Decode(&sg.Size)
case "Runs":
return lowmemjson.DecodeArray(r, func(r io.RuneScanner) error {
var run SumRun
- if err := lowmemjson.Decode(r, &run); err != nil {
+ if err := lowmemjson.NewDecoder(r).Decode(&run); err != nil {
return err
}
if run.ChecksumSize > 0 {
@@ -112,11 +112,11 @@ func TestMethods(t *testing.T) {
},
}
var buf bytes.Buffer
- assert.NoError(t, lowmemjson.Encode(&buf, in))
+ assert.NoError(t, lowmemjson.NewEncoder(&buf).Encode(in))
assert.Equal(t,
`{"Addr":13631488,"Size":416033783808,"Runs":[{"Gap":1082130432},{"ChecksumSize":4,"Addr":1095761920,"Sums":"c160817cb5c72bbbe"},{"Gap":416033783808}]}`,
buf.String())
var out SumRunWithGaps
- assert.NoError(t, lowmemjson.Decode(&buf, &out))
+ assert.NoError(t, lowmemjson.NewDecoder(&buf).Decode(&out))
assert.Equal(t, in, out)
}