github.com/solo-io/cue@v0.4.7/internal/core/subsume/subsume_test.go (about) 1 // Copyright 2020 CUE Authors 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 subsume 16 17 import ( 18 "testing" 19 20 "github.com/solo-io/cue/cue/parser" 21 "github.com/solo-io/cue/internal/core/adt" 22 "github.com/solo-io/cue/internal/core/compile" 23 "github.com/solo-io/cue/internal/core/eval" 24 "github.com/solo-io/cue/internal/core/runtime" 25 ) 26 27 // For debugging purposes, do not remove. 28 func TestX(t *testing.T) { 29 t.Skip() 30 31 r := runtime.New() 32 ctx := eval.NewContext(r, nil) 33 34 const gt = `a: *1 | int` 35 const lt = `a: (*1 | int) & 1` 36 37 a := parse(t, ctx, gt) 38 b := parse(t, ctx, lt) 39 40 p := Profile{Defaults: true} 41 err := p.Check(ctx, a, b) 42 t.Error(err) 43 } 44 45 func parse(t *testing.T, ctx *adt.OpContext, str string) *adt.Vertex { 46 t.Helper() 47 48 file, err := parser.ParseFile("subsume", str) 49 if err != nil { 50 t.Fatal(err) 51 } 52 53 root, errs := compile.Files(nil, ctx, "", file) 54 if errs != nil { 55 t.Fatal(errs) 56 } 57 58 root.Finalize(ctx) 59 60 return root 61 }