Skip to content

Commit

Permalink
internal/cuetdtest: make M.Flags (internal) public
Browse files Browse the repository at this point in the history
I find it useful to be able to tweak flags from tests: e.g. turning on
logging.

Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: Id97343c97e9a983371efe9ce59ec8d7054ba39a0
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198725
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
  • Loading branch information
cuematthew committed Aug 1, 2024
1 parent 187fb1a commit 91929bd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/cuetdtest/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ import (
type M struct {
*testing.T

// Flags is public to allow tests to customise e.g. logging.
Flags cuedebug.Config

name string
fallback string
version internal.EvaluatorVersion
flags cuedebug.Config
}

func (t *M) Name() string { return t.name }
Expand All @@ -41,7 +43,7 @@ func (t *M) Context() *cue.Context {
ctx := cuecontext.New()
r := (*runtime.Runtime)(ctx)
r.SetVersion(t.version)
r.SetDebugOptions(&t.flags)
r.SetDebugOptions(&t.Flags)
return ctx
}

Expand All @@ -61,7 +63,7 @@ var FullMatrix Matrix = []M{{
name: "v3",
fallback: "v2",
version: internal.DevVersion,
flags: cuedebug.Config{Sharing: true},
Flags: cuedebug.Config{Sharing: true},
}, {
name: "v3-noshare",
fallback: "v2",
Expand Down Expand Up @@ -96,13 +98,13 @@ func (t *M) TODO_V3() {
}

func (t *M) TODO_Sharing() {
if t.flags.Sharing {
if t.Flags.Sharing {
t.Skip("Skipping v3 with sharing")
}
}

func (t *M) TODO_NoSharing() {
if t.version == internal.DevVersion && !t.flags.Sharing {
if t.version == internal.DevVersion && !t.Flags.Sharing {
t.Skip("Skipping v3 without sharing")
}
}

0 comments on commit 91929bd

Please sign in to comment.