Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare 2.5.1 release #21

Merged
merged 189 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
75f29a1
implement Value type for arbitrary JSON values
eli-darkly Dec 12, 2019
14cea8b
force CI rebuild
eli-darkly Dec 12, 2019
529f2a1
add go get
eli-darkly Dec 12, 2019
25fdf9e
fix go get
eli-darkly Dec 13, 2019
7478aa3
fix lint in CI
eli-darkly Dec 13, 2019
845020e
add Equal()
eli-darkly Dec 13, 2019
30fcb62
add EvaluationDetail and EvaluationReason
eli-darkly Dec 13, 2019
82923f6
fix import path
eli-darkly Dec 13, 2019
141acc1
readme fixes
eli-darkly Dec 13, 2019
0f673b0
update for v2
eli-darkly Dec 13, 2019
0342b4b
Merge branch 'v2' into eb/ch49035/detail-reason
eli-darkly Dec 13, 2019
d327ff8
fix doc comments
eli-darkly Dec 13, 2019
681a43d
add OptionalString
eli-darkly Dec 17, 2019
3220b69
misc cleanup, method renaming, better test coverage
eli-darkly Jan 23, 2020
44328ab
package comments
eli-darkly Jan 23, 2020
4cfc041
changed repo name
eli-darkly Jan 23, 2020
62437a9
numbers can't have leading decimal point
eli-darkly Jan 23, 2020
4dd29c8
Merge pull request #1 from launchdarkly/eb/ch49035/value-type
eli-darkly Jan 24, 2020
fd5ee91
actually we decided on go-sdk-common, not go-sdk-core
eli-darkly Jan 24, 2020
4a686f5
add license file
eli-darkly Jan 24, 2020
293c8b2
Merge branch 'public-v1' into v1
eli-darkly Jan 24, 2020
16fc315
OptionalString improvements + misc fixes
eli-darkly Jan 24, 2020
412e802
add OrElse
eli-darkly Jan 24, 2020
5e07050
add tests
eli-darkly Jan 24, 2020
7f9a2eb
comment
eli-darkly Jan 24, 2020
871db18
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common-private in…
eli-darkly Jan 24, 2020
ec60b93
remove unsafe interface{} usage
eli-darkly Jan 24, 2020
bfb9c44
copy User and related types from go-server-sdk
eli-darkly Jan 24, 2020
7a88acd
OptionalString improvements + misc fixes (#2)
eli-darkly Jan 24, 2020
a626c5e
(common v2/SDK v5) don't use pointers or interface{}s in User
eli-darkly Jan 28, 2020
b57319b
lint
eli-darkly Jan 28, 2020
e5a23b3
lint
eli-darkly Jan 28, 2020
16c7079
Merge branch 'eb/ch58941/copy-user' into eb/ch58941/common-v2-user
eli-darkly Jan 28, 2020
312476d
rm references to obsolete function
eli-darkly Jan 28, 2020
87d4910
Merge branch 'eb/ch58941/copy-user' into eb/ch58941/common-v2-user
eli-darkly Jan 28, 2020
576fd88
(v2 - #1) copy User and related types from go-server-sdk (#3)
eli-darkly Jan 28, 2020
558a682
Merge branch 'v2' into eb/ch58941/common-v2-user
eli-darkly Jan 28, 2020
e63561b
Merge pull request #4 from launchdarkly/eb/ch58941/common-v2-user
eli-darkly Jan 28, 2020
88414be
hide all User fields, improve internal structure, add getters
eli-darkly Jan 28, 2020
b0924fd
lint
eli-darkly Jan 28, 2020
67e75cc
Merge pull request #5 from launchdarkly/eb/ch58941/hide-user-fields
eli-darkly Jan 28, 2020
a9f1f8a
Merge branch 'v1' into v2
eli-darkly Jan 29, 2020
7ccd883
Merge branch 'eb/ch63370/remove-unsafe' into eb/ch58941/user-accessors
eli-darkly Jan 29, 2020
7a480b8
add convenience methods for enumerable types
eli-darkly Jan 29, 2020
4058727
User model improvements related to custom/private attributes
eli-darkly Jan 29, 2020
6ad0ad0
lint
eli-darkly Jan 29, 2020
5db5e14
Merge branch 'v2' into eb/ch63370/remove-unsafe
eli-darkly Jan 29, 2020
8459cbe
Merge branch 'eb/ch63370/remove-unsafe' into eb/ch58941/value-enumera…
eli-darkly Jan 29, 2020
4df7f25
Merge branch 'eb/ch58941/value-enumeration' into eb/ch58941/user-acce…
eli-darkly Jan 29, 2020
2284162
Merge pull request #6 from launchdarkly/eb/ch63370/remove-unsafe
eli-darkly Jan 30, 2020
ec4cad1
Merge pull request #7 from launchdarkly/eb/ch58941/value-enumeration
eli-darkly Jan 30, 2020
3e63beb
Merge pull request #8 from launchdarkly/eb/ch58941/user-accessors
eli-darkly Jan 30, 2020
e588112
Merge branch 'public-v1' into v1
eli-darkly Feb 1, 2020
b1956fd
update release config
eli-darkly Feb 1, 2020
3f638e7
Merge branch 'public-v1' into v1
eli-darkly Feb 1, 2020
50130e8
Merge branch 'v1' into v2
eli-darkly Feb 1, 2020
7688db6
update release config
eli-darkly Feb 1, 2020
aece760
Merge branch 'public-v1' into v1
eli-darkly Feb 1, 2020
4ef5401
Merge branch 'v2' into eb/ch63866/detail-reason
eli-darkly Feb 1, 2020
256b653
fix package references
eli-darkly Feb 1, 2020
0b761e2
Merge pull request #9 from launchdarkly/eb/ch63866/detail-reason
eli-darkly Feb 3, 2020
547cd23
Merge branch 'v1' of github.com:launchdarkly/go-sdk-common into v1
eli-darkly Feb 4, 2020
065bb63
Merge branch 'v1' into v2
eli-darkly Feb 4, 2020
357513b
add ldlog package to go-sdk-common
eli-darkly Feb 4, 2020
1f08c69
lint
eli-darkly Feb 4, 2020
f7d094e
drop Go 1.8-1.11 and update linter
eli-darkly Feb 4, 2020
fb76722
gitignore
eli-darkly Feb 4, 2020
085fb8b
Merge pull request #11 from launchdarkly/eb/ch62105/drop-old-go
eli-darkly Feb 4, 2020
ebb06d6
Merge branch 'v2' into eb/ch64207/ldlog-common
eli-darkly Feb 4, 2020
0490d52
lint
eli-darkly Feb 4, 2020
08c2cf5
Merge pull request #10 from launchdarkly/eb/ch64207/ldlog-common
eli-darkly Feb 4, 2020
0e5056e
add ldtime package for time helpers
eli-darkly Feb 23, 2020
9ce753b
Merge pull request #12 from launchdarkly/eb/ch64206/time-type
eli-darkly Feb 24, 2020
ecc98c6
add Go 1.14 in CI
eli-darkly Mar 2, 2020
d551adb
Merge pull request #13 from launchdarkly/eb/ch67936/go-1.14
eli-darkly Mar 2, 2020
e9701ec
Merge branch 'v1' into v2
eli-darkly Mar 2, 2020
24c7e66
desupport Go 1.12
eli-darkly Mar 2, 2020
bdf9ef7
makefile improvement
eli-darkly Mar 2, 2020
82ce336
Merge pull request #14 from launchdarkly/eb/ch67936/no-go-1.12
eli-darkly Mar 2, 2020
e085a3a
Merge branch 'public-v2' into v2
eli-darkly Apr 1, 2020
7b18d72
make repo a module
eli-darkly Jun 4, 2020
343917d
don't install dep
eli-darkly Jun 4, 2020
6798fbe
yaml fix
eli-darkly Jun 4, 2020
0e0d49f
update golangci-lint + misc code cleanup
eli-darkly Jun 4, 2020
a9985bd
Merge branch 'eb/ch78747/linter-update' into eb/ch78731/modules
eli-darkly Jun 4, 2020
79fddc6
add methods for detecting current log level
eli-darkly Jun 4, 2020
a4bcae8
enforce consistent import groups
eli-darkly Jun 4, 2020
37676bf
enable stylecheck, fix comment
eli-darkly Jun 4, 2020
c1a52d2
add prerelease readme note
eli-darkly Jun 4, 2020
8e0ba06
Merge pull request #17 from launchdarkly/eb/ch77304/detect-debug-level
eli-darkly Jun 4, 2020
9bca369
Merge pull request #15 from launchdarkly/eb/ch78747/linter-update
eli-darkly Jun 4, 2020
09af655
Merge pull request #16 from launchdarkly/eb/ch78731/modules
eli-darkly Jun 4, 2020
3252370
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Jun 4, 2020
4547f29
improve test coverage and enforce coverage goals (#18)
eli-darkly Jun 11, 2020
306b165
update readme note about import path, add godoc badge
eli-darkly Jun 12, 2020
78993dd
better badge
eli-darkly Jun 12, 2020
d882b28
omit unset properties in user JSON instead of serializing null value
eli-darkly Jun 16, 2020
4c03ea3
don't allocate extra objects when setting user builder properties
eli-darkly Jun 16, 2020
5dbe2b1
Merge pull request #19 from launchdarkly/eb/ch79884/compact-user-json
eli-darkly Jun 16, 2020
c3da53a
Merge pull request #20 from launchdarkly/eb/ch77304/single-user-build…
eli-darkly Jun 16, 2020
2608fda
add generic user attr setter and more Value helper methods
eli-darkly Jun 16, 2020
d61956f
add benchmarks and enforce zero-allocation goals
eli-darkly Jun 16, 2020
5065348
Merge pull request #21 from launchdarkly/eb/ch79888/set-any-user-attr
eli-darkly Jun 16, 2020
fbe1e72
Merge pull request #22 from launchdarkly/eb/ch77270/benchmarks
eli-darkly Jun 16, 2020
467c837
implement streaming JSON serialization (#23)
eli-darkly Jun 17, 2020
ea7567b
fix bug in JSONBuffer state when writing zeroes
eli-darkly Jun 17, 2020
201d583
Merge pull request #24 from launchdarkly/eb/ch79944/jsonstream-zero-bug
eli-darkly Jun 17, 2020
503da9b
fix note about import path
eli-darkly Jun 18, 2020
2422e4e
go mod tidy
eli-darkly Jun 18, 2020
50ddf12
fix JSONBuffer string escaping, + slight refactor
eli-darkly Jun 18, 2020
0e2db4d
remove accidental inclusions from another branch
eli-darkly Jun 18, 2020
b33a319
lint
eli-darkly Jun 18, 2020
cc049b5
remove inapplicable comments
eli-darkly Jun 18, 2020
454b10c
add ability to send buffered JSON output to another writer
eli-darkly Jun 18, 2020
7aec220
Merge pull request #25 from launchdarkly/eb/ch79944/json-string-escaping
eli-darkly Jun 19, 2020
660a5ba
Merge pull request #26 from launchdarkly/eb/ch79944/stream-to-writer
eli-darkly Jun 19, 2020
2d6f974
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Jun 24, 2020
1bfadb3
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Jun 24, 2020
cc24b10
add log test helper package
eli-darkly Jun 25, 2020
2360388
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Jul 1, 2020
d755157
Merge pull request #27 from launchdarkly/eb/ch80986/mock-log
eli-darkly Jul 6, 2020
68c56ca
add UnmarshalText and other helper methods to OptionalString
eli-darkly Jul 6, 2020
e4e7b0f
Merge pull request #29 from launchdarkly/eb/ch81912/opt-string-parsing
eli-darkly Jul 6, 2020
290b7ab
use go-test-helpers v2 (removes unwanted eventsource dependency) (#28)
eli-darkly Jul 6, 2020
70fdf76
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Jul 6, 2020
cb3c12e
user unmarshaling should fail if key is missing (#30)
eli-darkly Aug 6, 2020
5191ba8
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Aug 6, 2020
ac7a4c2
add OptionalInt type
eli-darkly Sep 3, 2020
a383e5c
test coverage
eli-darkly Sep 3, 2020
6ff09df
keep method signature of NewEvaluationDetail the same as it used to be
eli-darkly Sep 3, 2020
bd5f1bf
comment
eli-darkly Sep 3, 2020
3dca288
Merge pull request #31 from launchdarkly/eb/ch88692/optional-int
eli-darkly Sep 3, 2020
7a1f7e4
add OptionalBool type and use it for User.Anonymous (#32)
eli-darkly Sep 3, 2020
82e9f20
add ldlogtest helper for dumping captured log output
eli-darkly Sep 3, 2020
cfcb090
Merge pull request #33 from launchdarkly/eb/ch88720/dump-log
eli-darkly Sep 8, 2020
434739c
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Sep 8, 2020
53178e7
add Go 1.15 build and remove beta changelog
eli-darkly Sep 18, 2020
6302689
update Go version in readme
eli-darkly Sep 18, 2020
be72603
Merge pull request #34 from launchdarkly/eb/ch89155/go-1.15
eli-darkly Sep 18, 2020
d9215ea
rm prerelease note
eli-darkly Sep 18, 2020
7556128
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Sep 18, 2020
21ad18b
better error reporting when unmarshaling User, OptionalString, etc. (…
eli-darkly Oct 8, 2020
50ef603
merge from public after release
LaunchDarklyCI Oct 8, 2020
7844258
add IsDefined() methods to optional-like types
eli-darkly Oct 2, 2020
f3db75e
Merge pull request #36 from launchdarkly/eb/ch91412/is-defined
eli-darkly Oct 9, 2020
b545324
better copy-on-write behavior for maps/slices; expose map & array types
eli-darkly Oct 10, 2020
1e30957
Merge pull request #37 from launchdarkly/eb/ch92116/copy-on-write
eli-darkly Oct 16, 2020
b81e13a
use new go-jsonstream API (#38)
eli-darkly Dec 10, 2020
80fa3ab
change go-jsonstream import path back to gopkg.in since the repo is p…
eli-darkly Dec 10, 2020
d7a8d17
merge from public after release
LaunchDarklyCI Dec 14, 2020
1c18400
Merge branch 'v2' into new-jsonstream
eli-darkly Dec 15, 2020
5acdcbf
add conditionally-compiled EasyJSON methods
eli-darkly Dec 15, 2020
32bd357
Merge pull request #39 from launchdarkly/eb/ch95135/easyjson
eli-darkly Dec 16, 2020
1049278
update for go-jsonstream API changes
eli-darkly Dec 18, 2020
08b45d0
Merge pull request #40 from launchdarkly/eb/ch95135/jsonstream-changes
eli-darkly Dec 18, 2020
d7d467f
merge from public after release
LaunchDarklyCI Dec 18, 2020
16b2c97
build in Windows with Go 1.14
eli-darkly Dec 18, 2020
9785c02
update CircleCI Windows image
eli-darkly Dec 18, 2020
9bbe0c2
Merge pull request #41 from launchdarkly/eb/ch97113/go-1.14-windows
eli-darkly Dec 18, 2020
ba60e19
treat null as equivalent to empty array for privateAttributeNames in …
eli-darkly Jan 5, 2021
8fa0de1
Merge pull request #42 from launchdarkly/eb/ch97664/private-attrs-null
eli-darkly Jan 5, 2021
684e429
merge from public after release
LaunchDarklyCI Jan 5, 2021
965ab94
EasyJSON optimizations for ldvalue and lduser types (#43)
eli-darkly Jan 15, 2021
1c0219d
merge from public after release
LaunchDarklyCI Jan 15, 2021
a35d544
Removed the guides link
bwoskow-ld Feb 3, 2021
35e3f2d
Add inExperiment attribute to FALLTHROUGH and RULE_MATCH reasons (#45)
samstokes Mar 19, 2021
533467f
Enable tests when releasing (#46)
bwoskow-ld Mar 19, 2021
348f102
Enable tests when releasing (#46)
bwoskow-ld Mar 19, 2021
04e65b6
add unbounded segments status to evaluation reasons (#44)
eli-darkly Mar 19, 2021
2f53ef2
"big" is the new "unbounded" (#47)
eli-darkly Mar 23, 2021
998938a
update go-jsonstream version for ch110425 bugfix
eli-darkly Jun 3, 2021
cf908f1
Merge pull request #48 from launchdarkly/eb/ch110425/json-number-parsing
eli-darkly Jun 3, 2021
266985e
merge from public after release
LaunchDarklyCI Jun 3, 2021
961db96
Merge branch 'exp-alloc' into v2
eli-darkly Jun 17, 2021
059aba0
merge from public after release
LaunchDarklyCI Jun 17, 2021
d5f921d
Merge branch 'v2' into big-segments
eli-darkly Jul 19, 2021
79f3e09
merge from public after release
Jul 19, 2021
688c607
update to newer Releaser config format, add Go 1.16 CI (#50)
eli-darkly Sep 15, 2021
b9be211
Updates docs URLs
ember-stevens Sep 26, 2021
2a9d448
Merge pull request #51 from launchdarkly/emberstevens/sc-118589/url-a…
ember-stevens Sep 27, 2021
5066530
add CI job for Go 1.17; update linter & test coverage script
eli-darkly Oct 4, 2021
62664a7
Merge pull request #52 from launchdarkly/eb/ch118928/go-1.17
eli-darkly Oct 4, 2021
70b88ba
merge from public after release
Oct 14, 2021
e35b070
Merge branch 'v2' of github.com:launchdarkly/go-sdk-common into v2
eli-darkly Oct 14, 2021
91fe3b9
add comparative benchmarks for v2 (#66)
eli-darkly Mar 1, 2022
de00407
transparently convert empty raw JSON value to null
eli-darkly Jun 29, 2022
82310bf
fix linter in build
eli-darkly Jun 29, 2022
9d048df
lint
eli-darkly Jun 29, 2022
9f57645
Merge pull request #82 from launchdarkly/eb/sc-158489/empty-raw-value…
eli-darkly Jun 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
transparently convert empty raw JSON value to null
  • Loading branch information
eli-darkly committed Jun 29, 2022
commit de00407e0aef3365ec0f6719ffe3ab055780d6b6
16 changes: 16 additions & 0 deletions ldvalue/value_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ func String(value string) Value {
}

// Raw creates an unparsed JSON Value.
//
// This constructor will store the json.RawMessage value as-is without syntax validation, and will set
// the type of the Value to ldvalue.RawType. That means, for instance, that ldvalue.Raw(json.RawMessage("true"))
// is not logically equivalent to ldvalue.Bool(true), even though they will produce the same result if
// they are re-encoded to JSON.
//
// That also means that if you pass malformed data that is not valid JSON, you will get malformed data if
// it is re-encoded to JSON. It is the caller's responsibility to make sure the json.RawMessage really is
// valid JSON. However, since it is easy to mistakenly write json.RawMessage(nil) (a zero-length value)
// when what is really meant is a JSON null value, the ldvalue.Value JSON encoder will detect any use of
// json.RawMessage(nil) or json.RawMessage("") and transparently convert it to "null" when it is
// being encoded to JSON.
func Raw(value json.RawMessage) Value {
return Value{valueType: RawType, stringValue: string(value)}
}
Expand Down Expand Up @@ -355,6 +367,10 @@ func (v Value) AsOptionalString() OptionalString {
//
// If the value was originally created from a RawMessage, it returns the same value. For all other
// values, it converts the value to its JSON representation and returns that representation.
//
// Note that the ldvalue.Raw(json.RawMessage) constructor does not do any syntax validation, so
// if you create a Value from a malformed string such as ldvalue.Raw(json.RawMessage("{{{")), you
// will get back the same string from AsRaw().
func (v Value) AsRaw() json.RawMessage {
if v.valueType == RawType {
return json.RawMessage(v.stringValue)
Expand Down
12 changes: 10 additions & 2 deletions ldvalue/value_serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ func (v Value) MarshalJSON() ([]byte, error) {
case ObjectType:
return v.objectValue.MarshalJSON()
case RawType:
return []byte(v.stringValue), nil
if len(v.stringValue) == 0 {
return nullAsJSONBytes, nil // we don't check for other kinds of malformed JSON here, but if it was nil/"" we can assume they meant null
} else {
return []byte(v.stringValue), nil
}
}
return nil, errors.New("unknown data type") // should not be possible
}
Expand Down Expand Up @@ -137,7 +141,11 @@ func (v Value) WriteToJSONWriter(w *jwriter.Writer) {
case ObjectType:
v.objectValue.WriteToJSONWriter(w)
case RawType:
w.Raw([]byte(v.stringValue))
if len(v.stringValue) == 0 {
w.Null() // we don't check for other kinds of malformed JSON here, but if it was nil/"" we can assume they meant null
} else {
w.Raw([]byte(v.stringValue))
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions ldvalue/value_serialization_easyjson.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build launchdarkly_easyjson
// +build launchdarkly_easyjson

package ldvalue
Expand Down Expand Up @@ -34,6 +35,12 @@ func (v Value) MarshalEasyJSON(writer *ej_jwriter.Writer) {
v.arrayValue.MarshalEasyJSON(writer)
case ObjectType:
v.objectValue.MarshalEasyJSON(writer)
case RawType:
if len(v.stringValue) == 0 {
writer.Raw(nullAsJSONBytes, nil) // see Value.MarshalJSON
} else {
writer.RawString(v.stringValue)
}
}
}

Expand Down
22 changes: 22 additions & 0 deletions ldvalue/value_serialization_easyjson_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build launchdarkly_easyjson
// +build launchdarkly_easyjson

package ldvalue
Expand Down Expand Up @@ -63,3 +64,24 @@ func TestEasyJsonUnmarshalErrorConditions(t *testing.T) {
})
}
}

func TestEasyJsonMarshalRaw(t *testing.T) {
// This is separate from the MarshalUnmarshal test because you never get a Raw when you unmarshal.
for _, params := range []struct {
desc string
input json.RawMessage
output string
}{
{"valid JSON", json.RawMessage(`{"a":1}`), `{"a":1}`},
{"zero-length", json.RawMessage{}, `null`},
{"nil", json.RawMessage(nil), `null`},
} {
t.Run(params.desc, func(t *testing.T) {
value := Raw(params.input)

j, err := easyjson.Marshal(value)
assert.NoError(t, err)
assert.Equal(t, params.output, string(j))
})
}
}
31 changes: 21 additions & 10 deletions ldvalue/value_serialization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,29 @@ func TestJsonMarshalUnmarshal(t *testing.T) {

func TestMarshalRaw(t *testing.T) {
// This is separate from the MarshalUnmarshal test because you never get a Raw when you unmarshal.
s := `{"a":1}`
value := Raw(json.RawMessage(s))
for _, params := range []struct {
desc string
input json.RawMessage
output string
}{
{"valid JSON", json.RawMessage(`{"a":1}`), `{"a":1}`},
{"zero-length", json.RawMessage{}, `null`},
{"nil", json.RawMessage(nil), `null`},
} {
t.Run(params.desc, func(t *testing.T) {
value := Raw(params.input)

bytes, err := json.Marshal(value)
assert.NoError(t, err)
assert.Equal(t, s, string(bytes))
bytes, err := json.Marshal(value)
assert.NoError(t, err)
assert.Equal(t, params.output, string(bytes))

var buf jsonstream.JSONBuffer
value.WriteToJSONBuffer(&buf)
bytes, err = buf.Get()
assert.NoError(t, err)
assert.Equal(t, s, string(bytes))
var buf jsonstream.JSONBuffer
value.WriteToJSONBuffer(&buf)
bytes, err = buf.Get()
assert.NoError(t, err)
assert.Equal(t, params.output, string(bytes))
})
}
}

func TestUnmarshalErrorConditions(t *testing.T) {
Expand Down