package repl import ( "fmt" "testing" "github.com/zclconf/go-cty/cty" ) func TestFormatValue(t *testing.T) { tests := []struct { Val cty.Value Want string }{ { cty.NullVal(cty.DynamicPseudoType), `null`, }, { cty.NullVal(cty.String), `tostring(null)`, }, { cty.NullVal(cty.Number), `tonumber(null)`, }, { cty.NullVal(cty.Bool), `tobool(null)`, }, { cty.NullVal(cty.List(cty.String)), `tolist(null) /* of string */`, }, { cty.NullVal(cty.Set(cty.Number)), `toset(null) /* of number */`, }, { cty.NullVal(cty.Map(cty.Bool)), `tomap(null) /* of bool */`, }, { cty.NullVal(cty.Object(map[string]cty.Type{"a": cty.Bool})), `null /* object */`, // Ideally this would display the full object type, including its attributes }, { cty.UnknownVal(cty.DynamicPseudoType), `(known after apply)`, }, { cty.StringVal(""), `""`, }, { cty.StringVal("hello"), `"hello"`, }, { cty.StringVal("hello\nworld"), `<