| 1 | // Copyright 2019 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 | "testingscip-go gomod github.com/golang/go/src go1.23.0 testing/" |
| 19 | |
| 20 | "github.com/google/cel-go/common/types/refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/" |
| 21 | ) |
| 22 | |
| 23 | func TestType_ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestType_ConvertToType().(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#) { |
| 24 | stdTypes := []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#{ |
| 25 | BoolTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/BoolType., |
| 26 | BytesTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/BytesType., |
| 27 | DoubleTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DoubleType., |
| 28 | DurationTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DurationType., |
| 29 | IntTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntType., |
| 30 | ListTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ListType., |
| 31 | MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType., |
| 32 | NullTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullType., |
| 33 | StringTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/StringType., |
| 34 | TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType., |
| 35 | TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType., |
| 36 | UintTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/UintType., |
| 37 | } |
| 38 | for _, stdType := range stdTypes { |
| 39 | cnv := stdType.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.) |
| 40 | if !cnv.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType.).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) { |
| 41 | t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got %v, wanted 'type'", cnv) |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func TestType_Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestType_Type().(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 | if TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType..Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Type#Type().() != TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType. { |
| 48 | t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("type of type is not type.") |
| 49 | } |
| 50 | } |