Skip to content

Commit 6f85528

Browse files
committed
test cases for primitives and dynamic
1 parent 948cf8c commit 6f85528

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

tftypes/value_test.go

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,32 @@ func TestValueIsNull(t *testing.T) {
768768
}
769769

770770
tests := map[string]testCase{
771-
"nil-object": {
771+
"primitive": {
772+
value: NewValue(Number, 990),
773+
expectedIsNull: false,
774+
expectedIsFullyNull: false,
775+
},
776+
"primitive-null": {
777+
value: NewValue(Number, nil),
778+
expectedIsNull: true,
779+
expectedIsFullyNull: true,
780+
},
781+
"dynamic": {
782+
value: NewValue(DynamicPseudoType, "hello"),
783+
expectedIsNull: false,
784+
expectedIsFullyNull: false,
785+
},
786+
"dynamic-null": {
787+
value: NewValue(DynamicPseudoType, nil),
788+
expectedIsNull: true,
789+
expectedIsFullyNull: true,
790+
},
791+
"simple-object": {
792+
value: NewValue(simpleObjectTyp, map[string]Value{"capacity": NewValue(Number, 4096)}),
793+
expectedIsNull: false,
794+
expectedIsFullyNull: false,
795+
},
796+
"simple-object-null": {
772797
value: NewValue(simpleObjectTyp, nil),
773798
expectedIsNull: true,
774799
expectedIsFullyNull: true,
@@ -783,11 +808,6 @@ func TestValueIsNull(t *testing.T) {
783808
expectedIsNull: false,
784809
expectedIsFullyNull: true,
785810
},
786-
"simple-object-with-non-nil-primitive": {
787-
value: NewValue(simpleObjectTyp, map[string]Value{"capacity": NewValue(Number, 4096)}),
788-
expectedIsNull: false,
789-
expectedIsFullyNull: false,
790-
},
791811
"object-with-no-nils": {
792812
value: NewValue(objectTyp, map[string]Value{
793813
"id": NewValue(String, "#00decaf"),

0 commit comments

Comments
 (0)