Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for NativeToValue (0.32 sec)

  1. staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/model/types_test.go

    	//}
    	//ruleVal := rt.NativeToValue(rule)
    	//if ruleVal == nil {
    	//	t.Error("got CEL rule value of nil, wanted non-nil")
    	//}
    
    	opts, err := rt.EnvOptions(stdEnv.TypeProvider())
    	if err != nil {
    		t.Fatal(err)
    	}
    	ruleEnv, err := stdEnv.Extend(opts...)
    	if err != nil {
    		t.Fatal(err)
    	}
    	helloVal := ruleEnv.TypeAdapter().NativeToValue("hello")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 08 15:52:31 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/cel/types.go

    		return &ref.FieldType{
    			Type: expT,
    		}, true
    	}
    	return nil, false
    }
    
    // NativeToValue is an implementation of the ref.TypeAdapater interface which supports conversion
    // of rule values to CEL ref.Val instances.
    func (rt *DeclTypeProvider) NativeToValue(val interface{}) ref.Val {
    	return rt.typeAdapter.NativeToValue(val)
    }
    
    func (rt *DeclTypeProvider) NewValue(typeName string, fields map[string]ref.Val) ref.Val {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 08 15:52:31 UTC 2023
    - 18K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/model/schemas_test.go

    		prop, found := ts.Properties[f.Name]
    		if !found {
    			t.Errorf("type field not found in schema, field: %s", f.Name)
    		}
    		fdv := f.DefaultValue()
    		if prop.Default.Object != nil {
    			pdv := types.DefaultTypeAdapter.NativeToValue(prop.Default.Object)
    			if !reflect.DeepEqual(fdv, pdv) {
    				t.Errorf("field and schema do not agree on default value for field: %s, field value: %v, schema default: %v", f.Name, fdv, pdv)
    			}
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 16 20:13:14 UTC 2024
    - 14K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/cel/openapi/schemas_test.go

    		prop, found := ts.Properties[f.Name]
    		if !found {
    			t.Errorf("type field not found in schema, field: %s", f.Name)
    		}
    		fdv := f.DefaultValue()
    		if prop.Default != nil {
    			pdv := types.DefaultTypeAdapter.NativeToValue(prop.Default)
    			if !reflect.DeepEqual(fdv, pdv) {
    				t.Errorf("field and schema do not agree on default value for field: %s, field value: %v, schema default: %v", f.Name, fdv, pdv)
    			}
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Dec 14 17:18:27 UTC 2022
    - 13K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiserver/pkg/cel/openapi/values_test.go

    			// CEL performs equality against data literals, but is a good sanity check.
    			if tc.lhs.Equal(types.DefaultTypeAdapter.NativeToValue(tc.rhs.Value())) != types.Bool(tc.equal) {
    				t.Errorf("expected unstructuredVal.Equals(<native type>) to return %v", tc.equal)
    			}
    			if tc.rhs.Equal(types.DefaultTypeAdapter.NativeToValue(tc.lhs.Value())) != types.Bool(tc.equal) {
    				t.Errorf("expected unstructuredVal.Equals(<native type>) to return %v", tc.equal)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 23 22:30:17 UTC 2023
    - 17.7K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/values_test.go

    			// CEL performs equality against data literals, but is a good sanity check.
    			if tc.lhs.Equal(types.DefaultTypeAdapter.NativeToValue(tc.rhs.Value())) != types.Bool(tc.equal) {
    				t.Errorf("expected unstructuredVal.Equals(<native type>) to return %v", tc.equal)
    			}
    			if tc.rhs.Equal(types.DefaultTypeAdapter.NativeToValue(tc.lhs.Value())) != types.Bool(tc.equal) {
    				t.Errorf("expected unstructuredVal.Equals(<native type>) to return %v", tc.equal)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 16 20:13:14 UTC 2024
    - 17.3K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/cel/value_test.go

    	}
    	contained = lv.Contains(elemB.ExprValue())
    	if contained != types.True {
    		t.Errorf("got %v, wanted elemB contained in list value", contained)
    	}
    	contained = lv.Contains(types.DefaultTypeAdapter.NativeToValue([]int32{4}))
    	if contained != types.False {
    		t.Errorf("got %v, wanted empty list not contained", contained)
    	}
    }
    
    func TestListValueConvertToNative(t *testing.T) {
    	lv := NewListValue()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 10 22:05:55 UTC 2022
    - 10.4K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/pkg/cel/value.go

    	for i := 0; i < szRight; i++ {
    		combo[i] = lv.Entries[i].ExprValue()
    	}
    	for i := 0; i < szLeft; i++ {
    		combo[i+szRight] = oArr.Get(types.Int(i))
    	}
    	return types.DefaultTypeAdapter.NativeToValue(combo)
    }
    
    // Append adds another entry into the ListValue.
    func (lv *ListValue) Append(entry *DynValue) {
    	lv.Entries = append(lv.Entries, entry)
    	// The append resets all previously built indices.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 10 22:05:55 UTC 2022
    - 20.5K bytes
    - Viewed (0)
Back to top