(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func TestPopulateParameters(t *testing.T) { |
| 89 | timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC) |
| 90 | timeStr := timeT.Format(time.RFC3339Nano) |
| 91 | timePb := timestamppb.New(timeT) |
| 92 | |
| 93 | durationT := 13 * time.Hour |
| 94 | durationStr := durationT.String() |
| 95 | durationPb := durationpb.New(durationT) |
| 96 | |
| 97 | optionalStr := "str" |
| 98 | fieldmaskStr := "float_value,double_value" |
| 99 | fieldmaskPb := &field_mask.FieldMask{Paths: []string{"float_value", "double_value"}} |
| 100 | |
| 101 | structValueJsonStrings := []string{`{"a":{"b":1}}`, `""`, "{}", "[]", "true", "0"} |
| 102 | structValueValues := make([]*structpb.Value, len(structValueJsonStrings)) |
| 103 | for i := range structValueValues { |
| 104 | structValueValues[i] = &structpb.Value{} |
| 105 | err := structValueValues[i].UnmarshalJSON([]byte(structValueJsonStrings[i])) |
| 106 | if err != nil { |
| 107 | t.Errorf("build struct.Value value failed: %s", err.Error()) |
| 108 | } |
| 109 | } |
| 110 | structJsonStrings := []string{`{"a":{"b":1}}`, "{}", `{"c":[1,2],"d":[{"e":1,"f":{}}]}`} |
| 111 | structValues := make([]*structpb.Struct, len(structJsonStrings)) |
| 112 | for i := range structValues { |
| 113 | structValues[i] = &structpb.Struct{} |
| 114 | err := structValues[i].UnmarshalJSON([]byte(structJsonStrings[i])) |
| 115 | if err != nil { |
| 116 | t.Errorf("build struct.Struct value failed: %s", err.Error()) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | for i, spec := range []struct { |
| 121 | values url.Values |
| 122 | filter *utilities.DoubleArray |
| 123 | want proto.Message |
| 124 | wanterr error |
| 125 | }{ |
| 126 | { |
| 127 | values: url.Values{ |
| 128 | "float_value": {"1.5"}, |
| 129 | "double_value": {"2.5"}, |
| 130 | "int64_value": {"-1"}, |
| 131 | "int32_value": {"-2"}, |
| 132 | "uint64_value": {"3"}, |
| 133 | "uint32_value": {"4"}, |
| 134 | "bool_value": {"true"}, |
| 135 | "string_value": {"str"}, |
| 136 | "bytes_value": {"YWJjMTIzIT8kKiYoKSctPUB-"}, |
| 137 | "repeated_value": {"a", "b", "c"}, |
| 138 | "optional_value": {optionalStr}, |
| 139 | "repeated_message": {"1", "2", "3"}, |
| 140 | "enum_value": {"1"}, |
| 141 | "repeated_enum": {"1", "2", "0"}, |
| 142 | "timestamp_value": {timeStr}, |
| 143 | "duration_value": {durationStr}, |
| 144 | "fieldmask_value": {fieldmaskStr}, |
| 145 | "wrapper_float_value": {"1.5"}, |
nothing calls this directly
no test coverage detected