Skip to content

Commit

Permalink
emit deprecation warning for Measure
Browse files Browse the repository at this point in the history
  • Loading branch information
onsi committed May 29, 2021
1 parent 084bfa8 commit e91d894
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
)

const VERSION = "1.16.2"
const VERSION = "1.16.3"

type GinkgoConfigType struct {
RandomSeed int64
Expand Down
4 changes: 4 additions & 0 deletions ginkgo_dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,24 +473,28 @@ func By(text string, callbacks ...func()) {
//The body function must have the signature:
// func(b Benchmarker)
func Measure(text string, body interface{}, samples int) bool {
deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1))
global.Suite.PushMeasureNode(text, body, types.FlagTypeNone, codelocation.New(1), samples)
return true
}

//You can focus individual Measures using FMeasure
func FMeasure(text string, body interface{}, samples int) bool {
deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1))
global.Suite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples)
return true
}

//You can mark Measurements as pending using PMeasure
func PMeasure(text string, _ ...interface{}) bool {
deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1))
global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0)
return true
}

//You can mark Measurements as pending using XMeasure
func XMeasure(text string, _ ...interface{}) bool {
deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1))
global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0)
return true
}
Expand Down
4 changes: 2 additions & 2 deletions types/deprecation_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func (d deprecations) Async() Deprecation {

func (d deprecations) Measure() Deprecation {
return Deprecation{
Message: "Measure is deprecated in Ginkgo V2",
Message: "Measure is deprecated and will be removed in Ginkgo V2. Please migrate to gomega/gmeasure.",
DocLink: "removed-measure",
Version: "1.16.0",
Version: "1.16.3",
}
}

Expand Down

0 comments on commit e91d894

Please sign in to comment.