Source File
testcase.go
Belonging Package
encoding/json/internal/jsontest
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build goexperiment.jsonv2
package jsontest
import (
)
// TODO(https://go.dev/issue/52751): Replace with native testing support.
// CaseName is a case name annotated with a file and line.
type CaseName struct {
Name string
Where CasePos
}
// Name annotates a case name with the file and line of the caller.
func ( string) ( CaseName) {
.Name =
runtime.Callers(2, .Where.pc[:])
return
}
// CasePos represents a file and line number.
type CasePos struct{ pc [1]uintptr }
func ( CasePos) () string {
:= runtime.CallersFrames(.pc[:])
, := .Next()
return fmt.Sprintf("%s:%d", path.Base(.File), .Line)
}
![]() |
The pages are generated with Golds v0.7.7-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |