-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: remove some deprecated type/method usages
Motivated by: - cuetdtest/M.Runtime already existing, but nevertheless a lot of avoidable calls to cuetdtest/M.UpdateRuntime cuetdtest: - Add M.Context and express M.Runtime as a wrapper around M.Context - Remove M.UpdateRuntime Because M.Context returns a cue.Context, this creates an import cycle, caused by cue/types_test.go, cue/decode_test.go and cue/attribute_test.go being in package cue. - Move cue/types_test.go, cue/decode_test.go and cue_attribute_test.go to package cue_test in order to break new import cycle. - Similary, subsume/{export|value}_test.go move to subsume_test This gives the opportunity to rework these tests (especially types_test.go) to: - Use the M.Context method, and cue.Context instead of cue.Runtime - Stop using deprecated methods and types Some types tests relied on access to private fields, methods, functions, and vars. - Add cue/export_test.go to carefully lift a few private fields etc to public during tests. Updates #2480. Signed-off-by: Matthew Sackman <matthew@cue.works> Change-Id: I6c597d6bd4bec219cec454373285852cce31b9c3 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1197685 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
- Loading branch information
1 parent
719893f
commit e1f552f
Showing
13 changed files
with
436 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2024 CUE Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cue | ||
|
||
import "cuelang.org/go/internal/core/adt" | ||
|
||
// Export the private Value.v field for testing purposes. But do so as | ||
// a function, not a method, so that we don't run the risk of | ||
// accidentally extending the set of types Value may inhabit during | ||
// tests. | ||
|
||
func ValueVertex(v Value) *adt.Vertex { return v.v } | ||
|
||
var ( | ||
ValueCtx = Value.ctx | ||
|
||
AnyDefinition = anyDefinition | ||
|
||
DebugStr = debugStr | ||
|
||
PathToStrings = pathToStrings | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.