Debian Codegraph @

common/types/string_test.go

raw symbols SCIP
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 "reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/"
19 "testingscip-go gomod github.com/golang/go/src go1.23.0 testing/"
20 "timescip-go gomod github.com/golang/go/src go1.23.0 time/"
21
22 "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/"
23
24 "github.com/google/cel-go/common/overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/"
25 "github.com/google/cel-go/common/types/refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/"
26
27 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`/"
28 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`/"
29 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`/"
30 )
31
32 func TestStringAddscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringAdd().(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#) {
33 if Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").Addscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Add().(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#(" world")) != Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello world") {
34 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Adding two strings did not produce a concatenated value.")
35 }
36 if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").Addscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Add().(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))) {
37 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Adding a string an int did not cause an error")
38 }
39 }
40
41 func TestStringComparescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringCompare().(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#) {
42 a := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("a")
43 b := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("bbbb")
44 c := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("c")
45 if a.Comparescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Compare().(b) != IntNegOnescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntNegOne. {
46 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("'a' was not less than 'bbbb'")
47 }
48 if a.Comparescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Compare().(a) != IntZeroscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntZero. {
49 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("'a' was not equal to 'a'")
50 }
51 if c.Comparescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Compare().(b) != IntOnescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntOne. {
52 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("'c' was not greater than 'bbbb'")
53 }
54 if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(a.Comparescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Compare().(Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.)) {
55 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Comparison to a non-string type did not generate an error.")
56 }
57 }
58
59 func TestStringConvertToNative_Anyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToNative_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#) {
60 val, err := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToNative().(anyValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/anyValueType.)
61 if err != nil {
62 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
63 }
64 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().(wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Stringscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/String().("hello"))
65 if err != nil {
66 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
67 }
68 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) {
69 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected '%v'", val, want)
70 }
71 }
72
73 func TestStringConvertToNative_Errorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToNative_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#) {
74 val, err := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#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().(0))
75 if err == nil {
76 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected error", val)
77 }
78 }
79
80 func TestStringConvertToNative_Jsonscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToNative_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#) {
81 val, err := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToNative().(JSONValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/JSONValueType.)
82 pbVal := 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")
83 if err != nil {
84 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
85 } else 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#), pbVal) {
86 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected json Value type", val)
87 }
88 }
89
90 func TestStringConvertToNative_Ptrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToNative_Ptr().(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#) {
91 ptrType := ""
92 val, err := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#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().(&ptrType))
93 if err != nil {
94 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
95 } else if *val.(*string) != "hello" {
96 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'hello'", val)
97 }
98 }
99
100 func TestStringConvertToNative_Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToNative_String().(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#) {
101 val, err := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#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().(""))
102 if err != nil {
103 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
104 } else if val.(string) != "hello" {
105 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'hello'", val)
106 }
107 }
108
109 type customStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/customString# string
110
111 func TestStringConvertToNative_CustomStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToNative_CustomString().(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#) {
112 val, err := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#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().(customStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/customString#("")))
113 if err != nil {
114 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
115 } else if v, ok := val.(customStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/customString#); !ok || v != "hello" {
116 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got %T with val '%v', expected %T with val 'hello'", val, v, customStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/customString#(""))
117 }
118 }
119
120 func TestStringConvertToNative_Wrapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToNative_Wrapper().(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#) {
121 val, err := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToNative().(stringWrapperTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/stringWrapperType.)
122 if err != nil {
123 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
124 }
125 want := wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Stringscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/String().("hello")
126 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) {
127 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected '%v'", val, want)
128 }
129 }
130
131 func TestStringConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringConvertToType().(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#) {
132 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("-1").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(IntTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntType.).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(IntNegOnescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntNegOne.).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
133 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to int")
134 }
135 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("false").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(BoolTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/BoolType.).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
136 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to bool")
137 }
138 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("1").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(UintTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/UintType.).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1)).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
139 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to uint")
140 }
141 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("2017-01-01T00:00:00Z").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType.).
142 Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#{Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(1483228800, 0).UTCscip-go gomod github.com/golang/go/src go1.23.0 time/Time#UTC().()}).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
143 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to timestamp")
144 }
145 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("1h5s").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(DurationTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DurationType.).
146 Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#{Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Duration.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(3605) * timescip-go gomod github.com/golang/go/src go1.23.0 time/.Secondscip-go gomod github.com/golang/go/src go1.23.0 time/Second.}).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
147 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to duration")
148 }
149 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("2.5").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(DoubleTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DoubleType.).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#(2.5)).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
150 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to double")
151 }
152 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(BytesTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/BytesType.).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("hello")).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
153 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to bytes")
154 }
155 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType.).Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(StringTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/StringType.).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
156 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to type")
157 }
158 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(StringTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/StringType.).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#("goodbye")).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
159 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String could not be converted to itself")
160 }
161 if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("map{}").ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#ConvertToType().(MapTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MapType.)) {
162 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Unsupported string conversion resulted in value.")
163 }
164 }
165
166 func TestStringEqualscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringEqual().(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#) {
167 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Equal().(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
168 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Two equivalent strings were not equal")
169 }
170 if Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello").Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Equal().(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hell")).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
171 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Two inqueal strings were found equal")
172 }
173 if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("c").Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Equal().(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(99))) {
174 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String 'c' equal to int 99 resulted in error, wanted 'false'")
175 }
176 }
177
178 func TestStringIsZeroValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringIsZeroValue().(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#) {
179 if Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("non-zero").IsZeroValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#IsZeroValue().() {
180 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String('non-zero').IsZeroValue() returned true, wanted false.")
181 }
182 if !Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("").IsZeroValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#IsZeroValue().() {
183 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String('').IsZeroValue() returned false, wanted true")
184 }
185 }
186
187 func TestStringMatchscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringMatch().(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#) {
188 str := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello 1 world")
189 sw := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("^hello")
190 ew := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("\\d world$")
191 if !str.Matchscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Match().(sw).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
192 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Did not match starts with pattern.")
193 }
194 if !str.Matchscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Match().(ew).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
195 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Did not match ends with pattern.")
196 }
197 if str.Matchscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Match().(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("ello 1 worlds")).(Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#) {
198 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Matched an incorrect pattern.")
199 }
200 if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(str.Matchscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Match().(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))) {
201 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Matched a non-string pattern.")
202 }
203 }
204
205 func TestStringContainsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringContains().(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 y := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").Receivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Receive().(
207 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/Contains.,
208 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.ContainsStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/ContainsString.,
209 []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#("db")})
210 if y != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. {
211 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'true'", y)
212 }
213 n := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").Receivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Receive().(
214 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.Containsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/Contains.,
215 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.ContainsStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/ContainsString.,
216 []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#("ggood")})
217 if n == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. {
218 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'true'", n)
219 }
220 }
221
222 func TestStringEndsWithscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringEndsWith().(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#) {
223 y := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").Receivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Receive().(
224 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.EndsWithscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/EndsWith.,
225 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.EndsWithStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/EndsWithString.,
226 []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#("bye")})
227 if y == Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False. {
228 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'true'", y)
229 }
230 n := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").Receivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Receive().(
231 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.EndsWithscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/EndsWith.,
232 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.EndsWithStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/EndsWithString.,
233 []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#("good")})
234 if n == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. {
235 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'true'", n)
236 }
237 }
238
239 func TestStringStartsWithscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringStartsWith().(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#) {
240 y := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").Receivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Receive().(
241 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.StartsWithscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/StartsWith.,
242 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.StartsWithStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/StartsWithString.,
243 []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#("good")})
244 if y != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. {
245 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'true'", y)
246 }
247 n := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("goodbye").Receivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Receive().(
248 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.StartsWithscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/StartsWith.,
249 overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.StartsWithStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/StartsWithString.,
250 []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#("db")})
251 if n == Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. {
252 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got '%v', expected 'true'", n)
253 }
254 }
255
256 func TestStringSizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestStringSize().(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#) {
257 if Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("").Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Size().().(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) != 0 {
258 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Empty string had a non-zero size")
259 }
260 if Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello world").Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Size().().(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) != 11 {
261 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String with eleven characters had incorrect size")
262 }
263 if Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("\u65e5\u672c\u8a9e").Sizescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#Size().().(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) != 3 {
264 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("String size must be code points, not UTF8 bytes")
265 }
266 }