cuelang.org/go@v0.10.1/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 "cuelang.org/go/cue/parser" 21 "cuelang.org/go/internal" 22 "cuelang.org/go/internal/core/adt" 23 "cuelang.org/go/internal/core/compile" 24 "cuelang.org/go/internal/core/eval" 25 "cuelang.org/go/internal/core/runtime" 26 "cuelang.org/go/internal/cuedebug" 27 ) 28 29 // For debugging purposes, do not remove. 30 func TestX(t *testing.T) { 31 t.Skip() 32 33 r := runtime.New() 34 // Uncomment to use default evaluator. 35 r.SetVersion(internal.DevVersion) 36 r.SetDebugOptions(&cuedebug.Config{Sharing: true}) 37 ctx := eval.NewContext(r, nil) 38 39 const gt = `a: *1 | int` 40 const lt = `a: (*1 | int) & 1` 41 42 a := parse(t, ctx, gt) 43 b := parse(t, ctx, lt) 44 45 p := Profile{Defaults: true} 46 err := p.Check(ctx, a, b) 47 t.Error(err) 48 } 49 50 func parse(t *testing.T, ctx *adt.OpContext, str string) *adt.Vertex { 51 t.Helper() 52 53 file, err := parser.ParseFile("subsume", str) 54 if err != nil { 55 t.Fatal(err) 56 } 57 58 root, errs := compile.Files(nil, ctx, "", file) 59 if errs != nil { 60 t.Fatal(errs) 61 } 62 63 root.Finalize(ctx) 64 65 return root 66 }