| 1 | // Copyright 2018 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package typesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ |
| 16 | |
| 17 | import ( |
| 18 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.23.0 `encoding/json`/" |
| 19 | "fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/" |
| 20 | "mathscip-go gomod github.com/golang/go/src go1.23.0 math/" |
| 21 | "reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/" |
| 22 | "stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/" |
| 23 | "testingscip-go gomod github.com/golang/go/src go1.23.0 testing/" |
| 24 | "timescip-go gomod github.com/golang/go/src go1.23.0 time/" |
| 25 | |
| 26 | "google.golang.org/protobuf/encoding/protojsonscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protojson`/" |
| 27 | "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/" |
| 28 | |
| 29 | "github.com/google/cel-go/common/types/pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/" |
| 30 | "github.com/google/cel-go/common/types/refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/" |
| 31 | "github.com/google/cel-go/common/types/traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/" |
| 32 | |
| 33 | proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/ "github.com/google/cel-go/test/proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/" |
| 34 | anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/ "google.golang.org/protobuf/types/known/anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/" |
| 35 | structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ "google.golang.org/protobuf/types/known/structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/" |
| 36 | tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/ "google.golang.org/protobuf/types/known/timestamppbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/" |
| 37 | wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/ "google.golang.org/protobuf/types/known/wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/" |
| 38 | ) |
| 39 | |
| 40 | type testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct# struct { |
| 41 | Mscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#M. string |
| 42 | Detailsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#Details. []string |
| 43 | ExtraDetailsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#ExtraDetails. string |
| 44 | } |
| 45 | |
| 46 | func TestMapContainsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestMapContains().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 47 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{}) |
| 48 | reflectMap := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[any]any{ |
| 49 | int64(1): "hello", |
| 50 | uint64(2): "world", |
| 51 | }).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 52 | |
| 53 | refValMap := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{ |
| 54 | Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1): Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"), |
| 55 | Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(2): Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("world"), |
| 56 | }).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 57 | |
| 58 | msg := &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{ |
| 59 | MapInt64NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapInt64NestedType.: map[int64]*proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.NestedTestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#{ |
| 60 | 1: {}, |
| 61 | 2: {}, |
| 62 | }, |
| 63 | } |
| 64 | pbMsg := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(msg).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#) |
| 65 | protoMap := pbMsg.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map_int64_nested_type")).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 66 | |
| 67 | tests := []struct { |
| 68 | value any |
| 69 | out Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool# |
| 70 | }{ |
| 71 | {value: 1, out: Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.}, |
| 72 | {value: 1.0, out: Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.}, |
| 73 | {value: uint(1), out: Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.}, |
| 74 | {value: 2, out: Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.}, |
| 75 | {value: 2.0, out: Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.}, |
| 76 | {value: uint(2), out: Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.}, |
| 77 | |
| 78 | {value: 3, out: Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.}, |
| 79 | {value: 1.1, out: Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.}, |
| 80 | {value: 1.1 + mathscip-go gomod github.com/golang/go/src go1.23.0 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.23.0 math/MaxInt64., out: Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.}, |
| 81 | {value: 1.1 + mathscip-go gomod github.com/golang/go/src go1.23.0 math/.MaxUint64scip-go gomod github.com/golang/go/src go1.23.0 math/MaxUint64., out: Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.}, |
| 82 | {value: "3", out: Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.}, |
| 83 | } |
| 84 | |
| 85 | for i, tst := range tests { |
| 86 | tc := tst |
| 87 | t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%d", i), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 88 | v := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(tc.value) |
| 89 | if reflectMap.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(v).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(tc.out) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 90 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("reflectMap.Contains(%v) got %v, wanted %v", v, tc.out.Negatescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#Negate().(), tc.out) |
| 91 | } |
| 92 | if refValMap.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(v).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(tc.out) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 93 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("refValMap.Contains(%v) got %v, wanted %v", v, tc.out.Negatescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#Negate().(), tc.out) |
| 94 | } |
| 95 | if protoMap.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(v).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(tc.out) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 96 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("protoMap.Contains(%v) got %v, wanted %v", v, tc.out.Negatescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#Negate().(), tc.out) |
| 97 | } |
| 98 | }) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func TestStringMapContainsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapContains().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 103 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 104 | mapVal := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 105 | "first": "hello", |
| 106 | "second": "world"}) |
| 107 | if mapVal.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("first")) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 108 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Contains('first') did not return true") |
| 109 | } |
| 110 | if mapVal.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("third")) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 111 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Contains('third') did not return false") |
| 112 | } |
| 113 | if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapVal.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(123))) { |
| 114 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Contains(123) errored, wanted false'.") |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | func TestDynamicMapConvertToNative_Anyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_Any().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 119 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 120 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[string]float32{ |
| 121 | "nested": {"1": -1.0}}) |
| 122 | val, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(anyValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/anyValueType.) |
| 123 | if err != nil { |
| 124 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err) |
| 125 | } |
| 126 | jsonMap := &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{} |
| 127 | err = protojsonscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protojson`/.Unmarshalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protojson`/Unmarshal().([]byte(`{"nested":{"1":-1}}`), jsonMap) |
| 128 | if err != nil { |
| 129 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("protojson.Unmarshal() failed: %v", err) |
| 130 | } |
| 131 | want, err := anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/New().(jsonMap) |
| 132 | if err != nil { |
| 133 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err) |
| 134 | } |
| 135 | if !protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Equal().(val.(protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#), want) { |
| 136 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got %v, wanted %v", val, want) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | func TestDynamicMapConvertToNative_Errorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_Error().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 141 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 142 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[string]float32{ |
| 143 | "nested": {"1": -1.0}}) |
| 144 | val, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().("")) |
| 145 | if err == nil { |
| 146 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToNative(string) got '%v', expected error", val) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | func TestDynamicMapConvertToNative_Jsonscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_Json().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 151 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 152 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[string]float32{ |
| 153 | "nested": {"1": -1.0}}) |
| 154 | json, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(JSONValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/JSONValueType.) |
| 155 | if err != nil { |
| 156 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err) |
| 157 | } |
| 158 | jsonBytes, err := protojsonscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protojson`/.Marshalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protojson`/Marshal().(json.(protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#)) |
| 159 | if err != nil { |
| 160 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("protojson.Marshal(%v) failed: %v", json, err) |
| 161 | } |
| 162 | jsonTxt := string(jsonBytes) |
| 163 | if jsonTxt != `{"nested":{"1":-1}}` { |
| 164 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(jsonTxt) |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | func TestDynamicMapConvertToNative_Structscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_Struct().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 169 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 170 | want := testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#{Mscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#M.: "hello", Detailsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#Details.: []string{"world", "universe"}, ExtraDetailsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#ExtraDetails.: "extra, extra!"} |
| 171 | tests := []map[string]any{ |
| 172 | { |
| 173 | "m": "hello", |
| 174 | "details": []string{"world", "universe"}, |
| 175 | "extra_Details": "extra, extra!", |
| 176 | }, |
| 177 | { |
| 178 | "M": "hello", |
| 179 | "Details": []string{"world", "universe"}, |
| 180 | "extra_details": "extra, extra!", |
| 181 | }, |
| 182 | { |
| 183 | "M": "hello", |
| 184 | "Details": []string{"world", "universe"}, |
| 185 | " extra___details": "extra, extra!", |
| 186 | }, |
| 187 | { |
| 188 | "M": "hello", |
| 189 | "Details_ ": []string{"world", "universe"}, |
| 190 | " extra___details": "extra, extra!", |
| 191 | }, |
| 192 | { |
| 193 | "_m": "hello", |
| 194 | "Details_ ": []string{"world", "universe"}, |
| 195 | " extra___details": "extra, extra!", |
| 196 | }, |
| 197 | { |
| 198 | "_M": "hello", |
| 199 | "Details_ ": []string{"world", "universe"}, |
| 200 | " extra___details": "extra, extra!", |
| 201 | }, |
| 202 | } |
| 203 | for i, tst := range tests { |
| 204 | tc := tst |
| 205 | t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("[%d]", i), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 206 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, tc) |
| 207 | ts, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeForscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeFor().[testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#]()) |
| 208 | if err != nil { |
| 209 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err) |
| 210 | } |
| 211 | if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(ts, want) { |
| 212 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToNative(struct) got %v, wanted %v", ts, want) |
| 213 | } |
| 214 | }) |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | func TestDynamicMapConvertToNative_StructPtrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_StructPtr().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 219 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 220 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]any{ |
| 221 | "m": "hello", |
| 222 | "details": []string{"world", "universe"}, |
| 223 | }) |
| 224 | ts, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(&testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#{})) |
| 225 | if err != nil { |
| 226 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err) |
| 227 | } |
| 228 | want := &testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#{Mscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#M.: "hello", Detailsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#Details.: []string{"world", "universe"}} |
| 229 | if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(ts, want) { |
| 230 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToNative(struct) got %v, wanted %v", ts, want) |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | func TestDynamicMapConvertToNative_StructPtrPtrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_StructPtrPtr().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 235 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 236 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]any{ |
| 237 | "m": "hello", |
| 238 | "details": []string{"world", "universe"}, |
| 239 | }) |
| 240 | ptr := &testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#{} |
| 241 | ts, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(&ptr)) |
| 242 | if err == nil { |
| 243 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got %v, wanted error", ts) |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | func TestDynamicMapConvertToNative_Struct_InvalidFieldErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_Struct_InvalidFieldError().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 248 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 249 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]any{ |
| 250 | "m": "hello", |
| 251 | "details": []string{"world", "universe"}, |
| 252 | "invalid": "invalid field", |
| 253 | }) |
| 254 | ts, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(&testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#{})) |
| 255 | if err == nil { |
| 256 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToNative(struct) got %v, wanted error", ts) |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | func TestDynamicMapConvertToNative_Struct_EmptyFieldErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_Struct_EmptyFieldError().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 261 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 262 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]any{ |
| 263 | "m": "hello", |
| 264 | "details": []string{"world", "universe"}, |
| 265 | "": "empty field", |
| 266 | }) |
| 267 | ts, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(&testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#{})) |
| 268 | if err == nil { |
| 269 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToNative(struct) got %v, wanted error", ts) |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | func TestDynamicMapConvertToNative_Struct_PrivateFieldErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToNative_Struct_PrivateFieldError().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 274 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 275 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]any{ |
| 276 | "message": "hello", |
| 277 | "details": []string{"world", "universe"}, |
| 278 | "private": "private field", |
| 279 | }) |
| 280 | ts, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(&testStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testStruct#{})) |
| 281 | if err == nil { |
| 282 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToNative(struct) got %v, wanted error", ts) |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | func TestStringMapConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapConvertToNative().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 287 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 288 | strMap := map[string]string{ |
| 289 | "first": "hello", |
| 290 | "second": "world", |
| 291 | } |
| 292 | mapVal := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, strMap) |
| 293 | val, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(strMap)) |
| 294 | if err != nil { |
| 295 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative(map[string]string) failed: %v", err) |
| 296 | } |
| 297 | if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(val.(map[string]string), strMap) { |
| 298 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got not-equal, wanted equal for %v == %v", val, strMap) |
| 299 | } |
| 300 | val, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(mapVal)) |
| 301 | if err != nil { |
| 302 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative(baseMap) failed: %v", err) |
| 303 | } |
| 304 | if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(val, mapVal) { |
| 305 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got not-equal, wanted equal for %v == %v", val, mapVal) |
| 306 | } |
| 307 | jsonVal, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(JSONStructTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/JSONStructType.) |
| 308 | if err != nil { |
| 309 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative(jsonStructType) failed: %v", err) |
| 310 | } |
| 311 | jsonBytes, err := protojsonscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protojson`/.Marshalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protojson`/Marshal().(jsonVal.(protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#)) |
| 312 | if err != nil { |
| 313 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("protojson.Marshal() failed: %v", err) |
| 314 | } |
| 315 | jsonTxt := string(jsonBytes) |
| 316 | outMap := map[string]any{} |
| 317 | err = jsonscip-go gomod github.com/golang/go/src go1.23.0 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.23.0 `encoding/json`/Unmarshal().(jsonBytes, &outMap) |
| 318 | if err != nil { |
| 319 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("json.Unmarshal(%q) failed: %v", jsonTxt, err) |
| 320 | } |
| 321 | if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(outMap, map[string]any{ |
| 322 | "first": "hello", |
| 323 | "second": "world", |
| 324 | }) { |
| 325 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got json '%v', expected %v", jsonTxt, outMap) |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | func TestDynamicMapConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapConvertToType().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 330 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 331 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]string{"key": "value"}) |
| 332 | if mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType.) != mapVal { |
| 333 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.ConvertToType(MapType) could not be converted to a map.") |
| 334 | } |
| 335 | if mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType.) != MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType. { |
| 336 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.ConvertToType(TypeType) did not return a map type.") |
| 337 | } |
| 338 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(ListTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ListType.)) { |
| 339 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.ConvertToType(ListType) returned a non-error.") |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | func TestStringMapConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapConvertToType().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 344 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 345 | mapVal := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[string]string{"key": "value"}) |
| 346 | if mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType.) != mapVal { |
| 347 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.ConvertToType(MapType) could not be converted to a map.") |
| 348 | } |
| 349 | if mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType.) != MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType. { |
| 350 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.ConvertToType(TypeType) did not return the map type.") |
| 351 | } |
| 352 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(ListTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ListType.)) { |
| 353 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.ConvertToType(ListType) did not error.") |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | func TestDynamicMapEqual_Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapEqual_True().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 358 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 359 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[int32]float32{ |
| 360 | "nested": {1: -1.0, 2: 2.0}, |
| 361 | "empty": {}}) |
| 362 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 363 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(mapVal) did not return true") |
| 364 | } |
| 365 | |
| 366 | if nestedVal := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested")); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(nestedVal) { |
| 367 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(nestedVal) |
| 368 | } else if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(nestedVal) == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || |
| 369 | nestedVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 370 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Same length, but different key names did not result in error") |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | func TestStringMapEqual_Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapEqual_True().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 375 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 376 | mapVal := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 377 | "first": "hello", |
| 378 | "second": "world"}) |
| 379 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 380 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(mapVal) did not return true") |
| 381 | } |
| 382 | equivDyn := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]string{ |
| 383 | "second": "world", |
| 384 | "first": "hello"}) |
| 385 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(equivDyn) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 386 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(equivDyn) did not return true, and was key-order dependent") |
| 387 | } |
| 388 | equivJSON := NewJSONStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewJSONStruct().(reg, &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{ |
| 389 | Fieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#Fields.: map[string]*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{ |
| 390 | "first": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("hello"), |
| 391 | "second": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"), |
| 392 | }}) |
| 393 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(equivJSON) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. && equivJSON.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 394 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(equivJSON) did not return true") |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | func TestDynamicMapEqual_NotTruescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapEqual_NotTrue().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 399 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 400 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[int32]float32{ |
| 401 | "nested": {1: -1.0, 2: 2.0}, |
| 402 | "empty": {}}) |
| 403 | other := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[int64]float64{ |
| 404 | "nested": {1: -1.0, 2: 2.0, 3: 3.14}, |
| 405 | "empty": {}}) |
| 406 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 407 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(other) did not return false.") |
| 408 | } |
| 409 | other = NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[int64]float64{ |
| 410 | "nested": {1: -1.0, 2: 2.0, 3: 3.14}, |
| 411 | "absent": {}}) |
| 412 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 413 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(other) did not return false.") |
| 414 | } |
| 415 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 416 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Equal(NullValue) returned %v, wanted false", mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)) |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | func TestStringMapEqual_NotTruescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapEqual_NotTrue().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 421 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 422 | mapVal := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 423 | "first": "hello", |
| 424 | "second": "world"}) |
| 425 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 426 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(mapVal) did not return true") |
| 427 | } |
| 428 | other := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 429 | "second": "world", |
| 430 | "first": "goodbye"}) |
| 431 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 432 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(other) with same keys and different values did not return false") |
| 433 | } |
| 434 | other = NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 435 | "first": "hello"}) |
| 436 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 437 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(other) between maps of different size did not return false") |
| 438 | } |
| 439 | other = NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 440 | "first": "hello", |
| 441 | "third": "goodbye"}) |
| 442 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 443 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(other) between maps with different keys did not return false") |
| 444 | } |
| 445 | other = NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]any{ |
| 446 | "first": "hello", |
| 447 | "second": 1}) |
| 448 | if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other)) { |
| 449 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Equal(other) between maps with same keys and different value types errored, wanted 'false'") |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | func TestDynamicMapGetscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapGet().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 454 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 455 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[int32]float32{ |
| 456 | "nested": {1: -1.0, 2: 2.0}, |
| 457 | "empty": {}}) |
| 458 | nestedVal, ok := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested")).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 459 | if !ok { |
| 460 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.Get('nested') got %v, wanted map value", mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested"))) |
| 461 | } |
| 462 | floatVal := nestedVal.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#).Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1)) |
| 463 | if floatVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1.0)) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 464 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("nestedVal.Get(1) got %v, wanted -1.0", floatVal) |
| 465 | } |
| 466 | err := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("absent")) |
| 467 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: absent" { |
| 468 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get('absent') got %v, wanted no such key: absent.", err) |
| 469 | } |
| 470 | err = nestedVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("bad_key")) |
| 471 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: bad_key" { |
| 472 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("nestedVal.Get('bad_key') errored %v, wanted no such key: bad_key.", err) |
| 473 | } |
| 474 | empty, ok := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("empty")).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 475 | if !ok { |
| 476 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.Get('empty') got %v, wanted empty map", mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("empty"))) |
| 477 | } |
| 478 | err = empty.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")) |
| 479 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: hello" { |
| 480 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("empty.Get('hello') got %v, wanted no such key: hello", err) |
| 481 | } |
| 482 | err = empty.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1.0)) |
| 483 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: -1" { |
| 484 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("empty.Get(-1.0) got %v, wanted no such key: -1", err) |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | func TestStringIfaceMapGetscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringIfaceMapGet().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 489 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 490 | mapVal := NewStringInterfaceMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringInterfaceMap().(reg, map[string]any{ |
| 491 | "nested": map[int32]float64{1: -1.0, 2: 2.0}, |
| 492 | "empty": map[string]any{}, |
| 493 | }) |
| 494 | nestedVal, ok := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested")).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 495 | if !ok { |
| 496 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.Get('nested') got %v, wanted map value", mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested"))) |
| 497 | } |
| 498 | floatVal := nestedVal.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#).Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1)) |
| 499 | if floatVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1.0)) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 500 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("nestedVal.Get(1) got %v, wanted -1.0", floatVal) |
| 501 | } |
| 502 | err := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("absent")) |
| 503 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: absent" { |
| 504 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get('absent') got %v, wanted no such key: absent.", err) |
| 505 | } |
| 506 | err = nestedVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("bad_key")) |
| 507 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: bad_key" { |
| 508 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("nestedVal.Get('bad_key') got %v, no such key: bad_key", err) |
| 509 | } |
| 510 | empty, ok := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("empty")).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 511 | if !ok { |
| 512 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.Get('empty') got %v, wanted empty map", mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("empty"))) |
| 513 | } |
| 514 | err = empty.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")) |
| 515 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: hello" { |
| 516 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("empty.Get('hello') got %v, wanted no such key: hello", err) |
| 517 | } |
| 518 | err = empty.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1.0)) |
| 519 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: -1" { |
| 520 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("empty.Get(-1.0) got %v, wanted no such key: -1", err) |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | func TestStringMapGetscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapGet().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 525 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 526 | mapVal := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 527 | "first": "hello", |
| 528 | "second": "world"}) |
| 529 | val := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("first")) |
| 530 | if val.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 531 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get('first') '%v', wanted 'hello'", val) |
| 532 | } |
| 533 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))) { |
| 534 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Get(1) got real value, wanted error") |
| 535 | } |
| 536 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("third"))) { |
| 537 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapVal.Get('third') got real value, wanted error") |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | func TestRefValMapGetscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRefValMapGet().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 542 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 543 | mapVal := NewRefValMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRefValMap().(reg, map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{ |
| 544 | Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested"): NewRefValMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRefValMap().(reg, map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{ |
| 545 | Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1): Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1.0), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2): Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(2.0), |
| 546 | }), |
| 547 | Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("empty"): NewRefValMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRefValMap().(reg, map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{}), |
| 548 | }) |
| 549 | nestedVal, ok := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested")).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 550 | if !ok { |
| 551 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.Get('nested') got %v, wanted map value", mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("nested"))) |
| 552 | } |
| 553 | floatVal := nestedVal.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#).Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1)) |
| 554 | if floatVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1.0)) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 555 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("nestedVal.Get(1) got %v, wanted -1.0", floatVal) |
| 556 | } |
| 557 | err := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("absent")) |
| 558 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: absent" { |
| 559 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get('absent') got %v, wanted no such key: absent.", err) |
| 560 | } |
| 561 | err = nestedVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("bad_key")) |
| 562 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: bad_key" { |
| 563 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("nestedVal.Get('bad_key') got %v, wanted no such key: bad_key.", err) |
| 564 | } |
| 565 | empty, ok := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("empty")).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 566 | if !ok { |
| 567 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.Get('empty') got %v, wanted empty map", mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("empty"))) |
| 568 | } |
| 569 | err = empty.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")) |
| 570 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: hello" { |
| 571 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("empty.Get('hello') got %v, wanted no such key: hello", err) |
| 572 | } |
| 573 | err = empty.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1.0)) |
| 574 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(err) || err.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error() != "no such key: -1" { |
| 575 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("empty.Get(-1.0) got %v, wanted no such key: -1", err) |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | func TestMapIsZeroValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestMapIsZeroValue().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 580 | msg := &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{ |
| 581 | MapStringStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapStringString.: map[string]string{ |
| 582 | "hello": "world", |
| 583 | }, |
| 584 | } |
| 585 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, msg) |
| 586 | obj := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(msg).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#) |
| 587 | |
| 588 | tests := []struct { |
| 589 | val any |
| 590 | isZeroValue bool |
| 591 | }{ |
| 592 | { |
| 593 | val: map[int]int{}, |
| 594 | isZeroValue: true, |
| 595 | }, |
| 596 | { |
| 597 | val: map[string]any{}, |
| 598 | isZeroValue: true, |
| 599 | }, |
| 600 | { |
| 601 | val: map[string]string{}, |
| 602 | isZeroValue: true, |
| 603 | }, |
| 604 | { |
| 605 | val: map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{}, |
| 606 | isZeroValue: true, |
| 607 | }, |
| 608 | { |
| 609 | val: &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{}, |
| 610 | isZeroValue: true, |
| 611 | }, |
| 612 | { |
| 613 | val: obj.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map_int64_nested_type")), |
| 614 | isZeroValue: true, |
| 615 | }, |
| 616 | { |
| 617 | val: map[int]int{1: 1}, |
| 618 | isZeroValue: false, |
| 619 | }, |
| 620 | { |
| 621 | val: map[string]any{"hello": []any{}}, |
| 622 | isZeroValue: false, |
| 623 | }, |
| 624 | { |
| 625 | val: map[string]string{"": ""}, |
| 626 | isZeroValue: false, |
| 627 | }, |
| 628 | { |
| 629 | val: map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.: Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.}, |
| 630 | isZeroValue: false, |
| 631 | }, |
| 632 | { |
| 633 | val: &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{ |
| 634 | Fieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#Fields.: map[string]*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{ |
| 635 | "": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewNullValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewNullValue().(), |
| 636 | }, |
| 637 | }, |
| 638 | isZeroValue: false, |
| 639 | }, |
| 640 | { |
| 641 | val: obj.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map_string_string")), |
| 642 | isZeroValue: false, |
| 643 | }, |
| 644 | } |
| 645 | for i, tst := range tests { |
| 646 | tc := tst |
| 647 | t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%d", i), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 648 | v := DefaultTypeAdapterscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DefaultTypeAdapter..NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/defaultTypeAdapter#NativeToValue().(tc.val) |
| 649 | zv, ok := v.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Zeroerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Zeroer#) |
| 650 | if !ok { |
| 651 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("%v could not be converted to a zero-valuer type", tc.val) |
| 652 | } |
| 653 | if zv.IsZeroValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Zeroer#IsZeroValue.() != tc.isZeroValue { |
| 654 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("%v.IsZeroValue() got %t, wanted %t", v, zv.IsZeroValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Zeroer#IsZeroValue.(), tc.isZeroValue) |
| 655 | } |
| 656 | }) |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | func TestDynamicMapIteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapIterator().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 661 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 662 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]map[int32]float32{ |
| 663 | "nested": {1: -1.0, 2: 2.0}, |
| 664 | "empty": {}}) |
| 665 | it := mapVal.Iteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterable#Iterator.() |
| 666 | var i = 0 |
| 667 | var fieldNames []any |
| 668 | for ; it.HasNextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#HasNext.() == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.; i++ { |
| 669 | fieldName := it.Nextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#Next.() |
| 670 | if value := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(fieldName); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(value) { |
| 671 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(value) |
| 672 | } else { |
| 673 | fieldNames = append(fieldNames, fieldName) |
| 674 | } |
| 675 | } |
| 676 | if len(fieldNames) != 2 { |
| 677 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Did not find the correct number of fields: %v", fieldNames) |
| 678 | } |
| 679 | if it.Nextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#Next.() != nil { |
| 680 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Iterator ran off the end of the field names") |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | func TestStringMapIteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapIterator().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 685 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 686 | mapVal := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 687 | "first": "hello", |
| 688 | "second": "world"}) |
| 689 | it := mapVal.Iteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterable#Iterator.() |
| 690 | var i = 0 |
| 691 | var fieldNames []any |
| 692 | for ; it.HasNextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#HasNext.() == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.; i++ { |
| 693 | fieldName := it.Nextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#Next.() |
| 694 | if value := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(fieldName); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(value) { |
| 695 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(value) |
| 696 | } else { |
| 697 | fieldNames = append(fieldNames, fieldName) |
| 698 | } |
| 699 | } |
| 700 | if len(fieldNames) != 2 { |
| 701 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Did not find the correct number of fields: %v", fieldNames) |
| 702 | } |
| 703 | fieldsMap := map[string]bool{ |
| 704 | "first": false, |
| 705 | "second": false, |
| 706 | } |
| 707 | expectedMap := map[string]bool{ |
| 708 | "first": true, |
| 709 | "second": true, |
| 710 | } |
| 711 | for _, fieldName := range fieldNames { |
| 712 | key := string(fieldName.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#)) |
| 713 | if _, found := fieldsMap[key]; found { |
| 714 | fieldsMap[key] = true |
| 715 | } |
| 716 | } |
| 717 | if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(fieldsMap, expectedMap) { |
| 718 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', wanted '%v'", fieldsMap, expectedMap) |
| 719 | } |
| 720 | if it.Nextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#Next.() != nil { |
| 721 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Iterator ran off the end of the field names") |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | func TestDynamicMapSizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestDynamicMapSize().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 726 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 727 | mapVal := NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[string]int{ |
| 728 | "first": 1, |
| 729 | "second": 2}) |
| 730 | if mapVal.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.() != Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2) { |
| 731 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Size() got '%v', expected 2", mapVal.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.()) |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | func TestStringMapSizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMapSize().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 736 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 737 | mapVal := NewStringStringMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewStringStringMap().(reg, map[string]string{ |
| 738 | "first": "hello", |
| 739 | "second": "world"}) |
| 740 | if mapVal.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.() != Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2) { |
| 741 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Size() got '%v', expected 2", mapVal.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.()) |
| 742 | } |
| 743 | } |
| 744 | |
| 745 | func TestProtoMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestProtoMap().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 746 | strMap := map[string]string{ |
| 747 | "hello": "world", |
| 748 | "goodbye": "for now", |
| 749 | "welcome": "back", |
| 750 | } |
| 751 | msg := &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{MapStringStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapStringString.: strMap} |
| 752 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, msg) |
| 753 | obj := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(msg).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#) |
| 754 | |
| 755 | // Test a simple proto map of string string. |
| 756 | field := obj.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map_string_string")) |
| 757 | mapVal, ok := field.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 758 | if !ok { |
| 759 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("obj.Get('map_string_string') did not return map: (%T)%v", field, field) |
| 760 | } |
| 761 | // CEL type conversion tests. |
| 762 | if mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType.) != mapVal { |
| 763 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToType(MapType) got %v, wanted map type", mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType.)) |
| 764 | } |
| 765 | if mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType.) != MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType. { |
| 766 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToType(TypeType) got %v, wanted type type", mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType.)) |
| 767 | } |
| 768 | conv := mapVal.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(ListTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ListType.) |
| 769 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(conv) { |
| 770 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToType(ListType) got %v, wanted error", conv) |
| 771 | } |
| 772 | // Size test |
| 773 | if mapVal.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.() != Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(len(strMap)) { |
| 774 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Size() got %d, wanted %d", mapVal.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.(), len(strMap)) |
| 775 | } |
| 776 | // Contains, Find, and Get tests. |
| 777 | for k, v := range strMap { |
| 778 | if mapVal.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(k)) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 779 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Contains() missing key: %v", k) |
| 780 | } |
| 781 | kv := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(k)) |
| 782 | if kv.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(v)) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 783 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get(%v) got value %v wanted %v", k, kv, v) |
| 784 | } |
| 785 | } |
| 786 | // Equality test |
| 787 | refStrMap := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(strMap) |
| 788 | if refStrMap.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(refStrMap) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 789 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Equal(refStrMap) not equal to itself: ref.Val %v != ref.Val %v", refStrMap, mapVal) |
| 790 | } |
| 791 | // Iterator test |
| 792 | it := mapVal.Iteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterable#Iterator.() |
| 793 | mapValCopy := map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{} |
| 794 | for it.HasNextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#HasNext.() == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 795 | key := it.Nextscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator#Next.() |
| 796 | mapValCopy[key] = mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(key) |
| 797 | } |
| 798 | mapVal2 := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(mapValCopy) |
| 799 | if mapVal2.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal2) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 800 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Equal(copy) not equal to original: cel ref.Val %v != ref.Val %v", mapVal2, mapVal) |
| 801 | } |
| 802 | if mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 803 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Equal(NullValue) got %v, wanted false", mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)) |
| 804 | } |
| 805 | convMap, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(strMap)) |
| 806 | if err != nil { |
| 807 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 808 | } |
| 809 | if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(strMap, convMap) { |
| 810 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.ConvertToNative() got map %v, wanted %v", convMap, strMap) |
| 811 | } |
| 812 | // Inequality tests. |
| 813 | strNeMap := map[string]string{ |
| 814 | "hello": "world", |
| 815 | "goodbye": "forever", |
| 816 | "welcome": "back", |
| 817 | } |
| 818 | mapNeVal := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(strNeMap) |
| 819 | if mapNeVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapNeVal) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 820 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapNeVal.Equal(mapVal) returned true, wanted false") |
| 821 | } |
| 822 | strNeMap = map[string]string{ |
| 823 | "hello": "world", |
| 824 | "goodbe": "for now", |
| 825 | "welcome": "back", |
| 826 | } |
| 827 | mapNeVal = reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(strNeMap) |
| 828 | if mapNeVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapNeVal) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 829 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapNeVal.Equal(mapVal) returned true, wanted false") |
| 830 | } |
| 831 | mapNeVal = reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[string]string{}) |
| 832 | if mapNeVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapNeVal) != Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 833 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapNeVal.Equal(mapVal) returned true, wanted false") |
| 834 | } |
| 835 | mapNeMap := map[int64]int64{ |
| 836 | 1: 9, |
| 837 | 2: 1, |
| 838 | 3: 1, |
| 839 | } |
| 840 | mapNeVal = reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(mapNeMap) |
| 841 | if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapNeVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal)) || IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapNeVal)) { |
| 842 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("mapNeVal.Equal(mapVal) returned error, wanted false") |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | func TestProtoMapGetscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestProtoMapGet().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 847 | strMap := map[string]string{ |
| 848 | "hello": "world", |
| 849 | "goodbye": "for now", |
| 850 | "welcome": "back", |
| 851 | } |
| 852 | msg := &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{MapStringStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapStringString.: strMap} |
| 853 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, msg) |
| 854 | obj := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(msg).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#) |
| 855 | field := obj.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map_string_string")) |
| 856 | mapVal, ok := field.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 857 | if !ok { |
| 858 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("obj.Get(map_string_string) failed: %v", field) |
| 859 | } |
| 860 | v := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")) |
| 861 | if v.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("world")) == Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. { |
| 862 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get('hello') got %v, wanted 'world'", v) |
| 863 | } |
| 864 | notFound := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("not_found")) |
| 865 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(notFound) || !stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.23.0 strings/Contains().(notFound.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error(), "no such key") { |
| 866 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get('not_found') got %v, wanted no such key error", notFound) |
| 867 | } |
| 868 | badKey := mapVal.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(42)) |
| 869 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(badKey) || !stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.23.0 strings/Contains().(badKey.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#).Error(), "no such key: 42") { |
| 870 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal.Get(42) got %v, wanted no such key: 42", badKey) |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | func TestProtoMapStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestProtoMapString().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 875 | strMap := map[string]string{ |
| 876 | "hello": "world", |
| 877 | } |
| 878 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t) |
| 879 | m := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(strMap) |
| 880 | want := `{hello: world}` |
| 881 | if fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%v", m) != want { |
| 882 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("map.String() got %v, wanted %v", m, want) |
| 883 | } |
| 884 | } |
| 885 | |
| 886 | func TestProtoMapConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestProtoMapConvertToNative().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 887 | strMap := map[string]string{ |
| 888 | "hello": "world", |
| 889 | "goodbye": "for now", |
| 890 | "welcome": "back", |
| 891 | } |
| 892 | msg := &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{MapStringStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapStringString.: strMap} |
| 893 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, msg) |
| 894 | obj := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(msg).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#) |
| 895 | // Test a simple proto map of string string. |
| 896 | field := obj.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map_string_string")) |
| 897 | mapVal, ok := field.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 898 | if !ok { |
| 899 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("obj.Get('map_string_string') did not return map: (%T)%v", field, field) |
| 900 | } |
| 901 | convMap, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(map[string]any{})) |
| 902 | if err != nil { |
| 903 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 904 | } |
| 905 | for k, v := range convMap.(map[string]any) { |
| 906 | if strMap[k] != v { |
| 907 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got differing values for key %q: got %v, wanted: %v", k, strMap[k], v) |
| 908 | } |
| 909 | } |
| 910 | mapVal2 := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(convMap) |
| 911 | if mapVal2.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal2) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 912 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal2.Equal(mapVal) returned false, wanted true") |
| 913 | } |
| 914 | convMap, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(anyValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/anyValueType.) |
| 915 | if err != nil { |
| 916 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 917 | } |
| 918 | mapVal3 := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(convMap) |
| 919 | if mapVal3.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal3) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 920 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal3.Equal(mapVal) returned false, wanted true") |
| 921 | } |
| 922 | convMap, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(JSONValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/JSONValueType.) |
| 923 | if err != nil { |
| 924 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 925 | } |
| 926 | mapVal4 := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(convMap) |
| 927 | if mapVal4.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal4) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 928 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal4.Equal(mapVal) returned false, wanted true") |
| 929 | } |
| 930 | convMap, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(&pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/.Mapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/Map#{})) |
| 931 | if err != nil { |
| 932 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 933 | } |
| 934 | mapVal5 := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(convMap) |
| 935 | if mapVal5.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal5) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 936 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal5.Equal(mapVal) returned false, wanted true") |
| 937 | } |
| 938 | var mapper traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper# = mapVal |
| 939 | convMap, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(mapper)) |
| 940 | if err != nil { |
| 941 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 942 | } |
| 943 | mapVal6 := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(convMap) |
| 944 | if mapVal6.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. || mapVal.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(mapVal6) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. { |
| 945 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("mapVal6.Equal(mapVal) returned false, wanted true") |
| 946 | } |
| 947 | _, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(JSONListTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/JSONListType.) |
| 948 | if err == nil { |
| 949 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() succeeded for invalid type") |
| 950 | } |
| 951 | _, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(map[int32]string{})) |
| 952 | if err == nil { |
| 953 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() succeeded for invalid type") |
| 954 | } |
| 955 | _, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(map[string]int64{})) |
| 956 | if err == nil { |
| 957 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() succeeded for invalid type") |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | func TestProtoMapConvertToNative_NestedProtoscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestProtoMapConvertToNative_NestedProto().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 962 | nestedTypeMap := map[int64]*proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.NestedTestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#{ |
| 963 | 1: { |
| 964 | Payloadscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#Payload.: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{ |
| 965 | SingleBoolWrapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#SingleBoolWrapper.: wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Boolscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Bool().(true), |
| 966 | }, |
| 967 | }, |
| 968 | 2: { |
| 969 | Childscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#Child.: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.NestedTestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#{ |
| 970 | Payloadscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#Payload.: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{ |
| 971 | SingleTimestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#SingleTimestamp.: tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/New().(timescip-go gomod github.com/golang/go/src go1.23.0 time/.Nowscip-go gomod github.com/golang/go/src go1.23.0 time/Now().()), |
| 972 | }, |
| 973 | }, |
| 974 | }, |
| 975 | } |
| 976 | msg := &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{MapInt64NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapInt64NestedType.: nestedTypeMap} |
| 977 | reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, msg) |
| 978 | obj := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(msg).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#) |
| 979 | // Test a simple proto map of string string. |
| 980 | field := obj.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map_int64_nested_type")) |
| 981 | mapVal, ok := field.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 982 | if !ok { |
| 983 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("obj.Get('map_int64_nested_type') did not return map: (%T)%v", field, field) |
| 984 | } |
| 985 | convMap, err := mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(map[int32]any{})) |
| 986 | if err != nil { |
| 987 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 988 | } |
| 989 | for k, v := range convMap.(map[int32]any) { |
| 990 | if !protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Equal().(nestedTypeMap[int64(k)], v.(protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#)) { |
| 991 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got differing values for key %q: got %v, wanted: %v", k, nestedTypeMap[int64(k)], v) |
| 992 | } |
| 993 | } |
| 994 | convMap, err = mapVal.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(map[int32]protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#{})) |
| 995 | if err != nil { |
| 996 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("mapVal.ConvertToNative() failed: %v", err) |
| 997 | } |
| 998 | for k, v := range convMap.(map[int32]protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#) { |
| 999 | if !protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Equal().(nestedTypeMap[int64(k)], v) { |
| 1000 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got differing values for key %q: got %v, wanted: %v", k, nestedTypeMap[int64(k)], v) |
| 1001 | } |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | func TestMutableMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestMutableMap().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 1006 | m := NewMutableMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewMutableMap().( |
| 1007 | DefaultTypeAdapterscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DefaultTypeAdapter., |
| 1008 | map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"): Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("world")}) |
| 1009 | m.Insertscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MutableMapper#Insert.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye"), Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("cruel world")) |
| 1010 | im := m.ToImmutableMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MutableMapper#ToImmutableMap.() |
| 1011 | if im.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.() != Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2) { |
| 1012 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("m.ToImmutableMap() had size %d, wanted 2", im.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.()) |
| 1013 | } |
| 1014 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(m.Insertscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MutableMapper#Insert.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye"), Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("happy world"))) { |
| 1015 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("m.Insert('goodbye', 'happy world') suceeded, wanted error") |
| 1016 | } |
| 1017 | m.Insertscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MutableMapper#Insert.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("well"), Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("well")) |
| 1018 | if im.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.() != Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2) { |
| 1019 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("m.Insert() mutated storage for immutable map: had size %d, wanted 2", im.Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.()) |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | func TestMapFoldscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestMapFold().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 1024 | pbDB := pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/.NewDbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/NewDb().() |
| 1025 | fd, err := pbDB.RegisterMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/Db#RegisterMessage().(&proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{}) |
| 1026 | if err != nil { |
| 1027 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("pbdb.RegisterMessage(TestAllTypes) failed: %v", err) |
| 1028 | } |
| 1029 | td, found := fd.GetTypeDescriptionscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/FileDescription#GetTypeDescription().(string((&proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{}).ProtoReflectscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#ProtoReflect().().Descriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Descriptor().().FullNamescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Descriptor#FullName().())) |
| 1030 | if !found { |
| 1031 | t.Fatalscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatal().("fd.GetTypeDescription() failed") |
| 1032 | } |
| 1033 | mapStrStrFD, found := td.FieldByNamescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/TypeDescription#FieldByName().("map_string_string") |
| 1034 | if !found { |
| 1035 | t.Fatalscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatal().("Could not find map_string_string field") |
| 1036 | } |
| 1037 | |
| 1038 | mapStrDesc := (&proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{}).ProtoReflectscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#ProtoReflect().().Descriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Descriptor().().Fieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/MessageDescriptor#Fields().().ByNamescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptors#ByName().("map_string_string") |
| 1039 | tests := []struct { |
| 1040 | m any |
| 1041 | folds int |
| 1042 | foldLimit int |
| 1043 | }{ |
| 1044 | { |
| 1045 | m: map[string]any{"a": 1, "b": 2}, |
| 1046 | folds: 2, |
| 1047 | foldLimit: 2, |
| 1048 | }, |
| 1049 | { |
| 1050 | m: map[string]string{"hello": "world"}, |
| 1051 | folds: 1, |
| 1052 | foldLimit: 2, |
| 1053 | }, |
| 1054 | { |
| 1055 | m: map[string]string{"hello": "world", "goodbye": "cruel world"}, |
| 1056 | folds: 1, |
| 1057 | foldLimit: 1, |
| 1058 | }, |
| 1059 | { |
| 1060 | m: map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{}, |
| 1061 | folds: 0, |
| 1062 | foldLimit: 20, |
| 1063 | }, |
| 1064 | { |
| 1065 | m: map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{ |
| 1066 | (Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")): Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("world"), |
| 1067 | (Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye")): Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("cruel world"), |
| 1068 | }, |
| 1069 | folds: 1, |
| 1070 | foldLimit: 1, |
| 1071 | }, |
| 1072 | { |
| 1073 | m: testCreateStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testCreateStruct().(t, map[string]any{ |
| 1074 | "hello": []any{}, |
| 1075 | "world": map[string]any{}, |
| 1076 | }), |
| 1077 | folds: 2, |
| 1078 | foldLimit: 2, |
| 1079 | }, |
| 1080 | { |
| 1081 | m: testCreateStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testCreateStruct().(t, map[string]any{ |
| 1082 | "hello": []any{}, |
| 1083 | "world": map[string]any{}, |
| 1084 | }), |
| 1085 | folds: 1, |
| 1086 | foldLimit: 1, |
| 1087 | }, |
| 1088 | { |
| 1089 | m: (&proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{ |
| 1090 | MapInt64NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapInt64NestedType.: map[int64]*proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.NestedTestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#{ |
| 1091 | 1: {}, |
| 1092 | 2: {}, |
| 1093 | 3: {}, |
| 1094 | }, |
| 1095 | }).GetMapInt64NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#GetMapInt64NestedType().(), |
| 1096 | folds: 3, |
| 1097 | foldLimit: 3, |
| 1098 | }, |
| 1099 | { |
| 1100 | m: (&proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{ |
| 1101 | MapInt64NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapInt64NestedType.: map[int64]*proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.NestedTestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#{ |
| 1102 | 1: {}, |
| 1103 | 2: {}, |
| 1104 | 3: {}, |
| 1105 | }, |
| 1106 | }).GetMapInt64NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#GetMapInt64NestedType().(), |
| 1107 | folds: 2, |
| 1108 | foldLimit: 2, |
| 1109 | }, |
| 1110 | { |
| 1111 | m: &pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/.Mapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/Map#{ |
| 1112 | Mapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/Map#Map.: (&proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{ |
| 1113 | MapStringStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapStringString.: map[string]string{ |
| 1114 | "1": "one", |
| 1115 | "2": "two", |
| 1116 | }, |
| 1117 | }).ProtoReflectscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#ProtoReflect().().Getscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Get().(mapStrDesc).Mapscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Map().(), |
| 1118 | KeyTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/Map#KeyType.: mapStrStrFD.KeyTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/FieldDescription#KeyType., |
| 1119 | ValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/Map#ValueType.: mapStrStrFD.ValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/FieldDescription#ValueType., |
| 1120 | }, |
| 1121 | folds: 1, |
| 1122 | foldLimit: 1, |
| 1123 | }, |
| 1124 | } |
| 1125 | reg := NewEmptyRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewEmptyRegistry().() |
| 1126 | for i, tst := range tests { |
| 1127 | tc := tst |
| 1128 | m := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(tc.m).(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 1129 | foldKinds := map[string]traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Foldablescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Foldable#{ |
| 1130 | "modern": ToFoldableMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ToFoldableMap().(m), |
| 1131 | "legacy": ToFoldableMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ToFoldableMap().(proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#{proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy.: m}), |
| 1132 | } |
| 1133 | for foldKind, foldable := range foldKinds { |
| 1134 | t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("[%d]%s", i, foldKind), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 1135 | f := &testMapFolderscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#{foldLimitscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#foldLimit.: tc.foldLimit} |
| 1136 | foldable.Foldscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Foldable#Fold.(f) |
| 1137 | if f.foldsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#folds. != tc.folds { |
| 1138 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("m.Fold(f) got %d, wanted %d folds", f.foldsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#folds., tc.folds) |
| 1139 | } |
| 1140 | }) |
| 1141 | } |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | func TestInsertMapKeyValue_MutableMapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestInsertMapKeyValue_MutableMapper().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 1146 | m := NewMutableMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewMutableMap().(DefaultTypeAdapterscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DefaultTypeAdapter., map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("first"): Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1)}) |
| 1147 | modified := InsertMapKeyValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/InsertMapKeyValue().(m, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("second"), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2)) |
| 1148 | if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(modified) { |
| 1149 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("InsertMapKeyValue() got error: %v, wanted insertion", modified) |
| 1150 | } |
| 1151 | if modified != m { |
| 1152 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("InsertMapKeyValue() created a new map for a mutable input: %v", modified) |
| 1153 | } |
| 1154 | im := m.ToImmutableMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MutableMapper#ToImmutableMap.() |
| 1155 | if _, found := im.Findscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#Find.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("first")); !found { |
| 1156 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("InsertMapKeyValue() did not preserve entry 'first': %v", im) |
| 1157 | } |
| 1158 | if _, found := im.Findscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#Find.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("second")); !found { |
| 1159 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("InsertMapKeyValue() did not insert entry 'second': %v", im) |
| 1160 | } |
| 1161 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(InsertMapKeyValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/InsertMapKeyValue().(m, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("second"), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(3))) { |
| 1162 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("InsertMapKeyValue('second', 3) modified the map instead of erroring: %v", m) |
| 1163 | } |
| 1164 | } |
| 1165 | |
| 1166 | func TestInsertMapKeyValue_Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestInsertMapKeyValue_Mapper().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) { |
| 1167 | m := NewRefValMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRefValMap().(DefaultTypeAdapterscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DefaultTypeAdapter., map[refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("first"): Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1)}) |
| 1168 | modified := InsertMapKeyValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/InsertMapKeyValue().(m, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("second"), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2)) |
| 1169 | if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(modified) { |
| 1170 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("InsertMapKeyValue() got error: %v, wanted insertion", modified) |
| 1171 | } |
| 1172 | if modified == m { |
| 1173 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("InsertMapKeyValue() modified an immutable input: %v", modified) |
| 1174 | } |
| 1175 | im := modified.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#) |
| 1176 | if _, found := im.Findscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#Find.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("first")); !found { |
| 1177 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("InsertMapKeyValue() did not preserve entry 'first': %v", im) |
| 1178 | } |
| 1179 | if _, found := im.Findscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#Find.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("second")); !found { |
| 1180 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("InsertMapKeyValue() did not insert entry 'second': %v", im) |
| 1181 | } |
| 1182 | if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(InsertMapKeyValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/InsertMapKeyValue().(im, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("second"), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(3))) { |
| 1183 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("InsertMapKeyValue('second', 3) modified the map instead of erroring: %v", m) |
| 1184 | } |
| 1185 | } |
| 1186 | |
| 1187 | type testMapFolderscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder# struct { |
| 1188 | foldLimitscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#foldLimit. int |
| 1189 | foldsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#folds. int |
| 1190 | } |
| 1191 | |
| 1192 | func (f *testMapFolderscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#) FoldEntryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#FoldEntry().(k, v any) bool { |
| 1193 | if f.foldLimitscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#foldLimit. != 0 { |
| 1194 | if f.foldsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#folds. >= f.foldLimitscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#foldLimit. { |
| 1195 | return false |
| 1196 | } |
| 1197 | } |
| 1198 | f.foldsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testMapFolder#folds.++ |
| 1199 | return true |
| 1200 | } |
| 1201 | |
| 1202 | func testCreateStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testCreateStruct().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#, m map[string]any) *structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct# { |
| 1203 | t.Helperscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Helper().() |
| 1204 | v, err := structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStructscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStruct().(m) |
| 1205 | if err != nil { |
| 1206 | t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("structpb.NewStruct(m) failed: %v", err) |
| 1207 | } |
| 1208 | return v |
| 1209 | } |
| 1210 | |
| 1211 | // proxyLegacyMap omits the foldable interfaces associated with all core Mapper implementations |
| 1212 | type proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap# struct { |
| 1213 | proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy. traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Mapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper# |
| 1214 | } |
| 1215 | |
| 1216 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#ConvertToNative().(typeDesc reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.Typescip-go gomod github.com/golang/go/src go1.23.0 reflect/Type#) (any, error) { |
| 1217 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(typeDesc) |
| 1218 | } |
| 1219 | |
| 1220 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#ConvertToType().(typeValue refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 1221 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(typeValue) |
| 1222 | } |
| 1223 | |
| 1224 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Equal().(other refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 1225 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other) |
| 1226 | } |
| 1227 | |
| 1228 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Type().() refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type# { |
| 1229 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Type.() |
| 1230 | } |
| 1231 | |
| 1232 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Valuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Value().() any { |
| 1233 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Valuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Value.() |
| 1234 | } |
| 1235 | |
| 1236 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Contains().(value refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 1237 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Container#Contains.(value) |
| 1238 | } |
| 1239 | |
| 1240 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Findscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Find().(key refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) (refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#, bool) { |
| 1241 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Findscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Mapper#Find.(key) |
| 1242 | } |
| 1243 | |
| 1244 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Get().(index refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 1245 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(index) |
| 1246 | } |
| 1247 | |
| 1248 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Iteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Iterator().() traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Iteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterator# { |
| 1249 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Iteratorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Iterable#Iterator.() |
| 1250 | } |
| 1251 | |
| 1252 | func (m proxyLegacyMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#) Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#Size().() refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 1253 | return m.proxyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/proxyLegacyMap#proxy..Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Sizer#Size.() |
| 1254 | } |