From 80f2ea15a578bb6c16101ccef0b466547407dce6 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Sun, 1 Sep 2024 16:51:10 +0200 Subject: [PATCH] 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. --- niljson_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/niljson_test.go b/niljson_test.go index 9b67fa0..106f3c9 100644 --- a/niljson_test.go +++ b/niljson_test.go @@ -75,10 +75,22 @@ func TestVariable_UnmarshalJSON(t *testing.T) { 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() if jt.Bool.NotNil() { 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() if jt.Float64.NotNil() { t.Errorf("expected float64 to be nil after reset")