mirror of
https://github.com/wneessen/niljson.git
synced 2024-11-22 05:30:49 +01:00
Add additional nil checks in niljson_test.go
Enhanced the test coverage by adding nil checks for ByteSlice and Float32 types after reset. This ensures that more types are adequately handled and validated for nil values in the tests. Additionally, included a check for the string using the Get method.
This commit is contained in:
parent
fcc4f5d0d0
commit
80f2ea15a5
1 changed files with 12 additions and 0 deletions
|
@ -75,10 +75,22 @@ func TestVariable_UnmarshalJSON(t *testing.T) {
|
||||||
t.Errorf("expected string to be 'test', got %s", jt.String.Value())
|
t.Errorf("expected string to be 'test', got %s", jt.String.Value())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if jt.String.Get() != "test" {
|
||||||
|
t.Errorf("expected string to be 'test', got %s", jt.String.Get())
|
||||||
|
}
|
||||||
|
|
||||||
jt.Bool.Reset()
|
jt.Bool.Reset()
|
||||||
if jt.Bool.NotNil() {
|
if jt.Bool.NotNil() {
|
||||||
t.Errorf("expected bool to be nil after reset")
|
t.Errorf("expected bool to be nil after reset")
|
||||||
}
|
}
|
||||||
|
jt.ByteSlice.Reset()
|
||||||
|
if jt.ByteSlice.NotNil() {
|
||||||
|
t.Errorf("expected byte slice to be nil after reset")
|
||||||
|
}
|
||||||
|
jt.Float32.Reset()
|
||||||
|
if jt.Float32.NotNil() {
|
||||||
|
t.Errorf("expected float32 to be nil after reset")
|
||||||
|
}
|
||||||
jt.Float64.Reset()
|
jt.Float64.Reset()
|
||||||
if jt.Float64.NotNil() {
|
if jt.Float64.NotNil() {
|
||||||
t.Errorf("expected float64 to be nil after reset")
|
t.Errorf("expected float64 to be nil after reset")
|
||||||
|
|
Loading…
Reference in a new issue