mirror of
https://github.com/wneessen/niljson.git
synced 2024-11-24 22:40:49 +01:00
Remove redundant Get() method
The Get() method was simply an alias for the Value() method and did not add any functionality. This simplification makes the code cleaner and reduces unnecessary duplication, improving maintainability.
This commit is contained in:
parent
b11f8257d8
commit
1150734ab0
2 changed files with 0 additions and 41 deletions
|
@ -19,11 +19,6 @@ func (v *Variable[T]) Value() T {
|
|||
return v.value
|
||||
}
|
||||
|
||||
// Get is an alias method for Value()
|
||||
func (v *Variable[T]) Get() T {
|
||||
return v.Value()
|
||||
}
|
||||
|
||||
// NotNil returns true when a Variable is not nil
|
||||
func (v *Variable[T]) NotNil() bool {
|
||||
return v.notNil
|
||||
|
|
|
@ -49,9 +49,6 @@ func TestVariable_UnmarshalJSON_Boolean(t *testing.T) {
|
|||
if !jt.Value.Value() {
|
||||
t.Errorf("expected value to be true, got %t", jt.Value.Value())
|
||||
}
|
||||
if !jt.Value.Get() {
|
||||
t.Errorf("expected value to be true, got %t", jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -79,9 +76,6 @@ func TestVariable_UnmarshalJSON_ByteSlice(t *testing.T) {
|
|||
if !bytes.Equal(jt.Value.Value(), []byte("bytes")) {
|
||||
t.Errorf("expected value to be %q, got %q", "bytes", jt.Value.Value())
|
||||
}
|
||||
if !bytes.Equal(jt.Value.Get(), []byte("bytes")) {
|
||||
t.Errorf("expected value to be %q, got %q", "bytes", jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -110,9 +104,6 @@ func TestVariable_UnmarshalJSON_Float32(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -141,9 +132,6 @@ func TestVariable_UnmarshalJSON_Float64(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -172,9 +160,6 @@ func TestVariable_UnmarshalJSON_Int(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -203,9 +188,6 @@ func TestVariable_UnmarshalJSON_Int64(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -234,9 +216,6 @@ func TestVariable_UnmarshalJSON_String(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %s, got %s", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %s, got %s", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -265,9 +244,6 @@ func TestVariable_UnmarshalJSON_UInt(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -296,9 +272,6 @@ func TestVariable_UnmarshalJSON_UInt8(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -327,9 +300,6 @@ func TestVariable_UnmarshalJSON_UInt16(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -358,9 +328,6 @@ func TestVariable_UnmarshalJSON_UInt32(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
@ -389,9 +356,6 @@ func TestVariable_UnmarshalJSON_UInt64(t *testing.T) {
|
|||
if jt.Value.Value() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
|
||||
}
|
||||
if jt.Value.Get() != expected {
|
||||
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
|
||||
}
|
||||
|
||||
jt.Value.Reset()
|
||||
if jt.Value.NotNil() {
|
||||
|
|
Loading…
Reference in a new issue