Skip to content

Commit

Permalink
Fix typos (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
deining authored Jan 2, 2025
1 parent bb0e550 commit a1d518b
Show file tree
Hide file tree
Showing 36 changed files with 175 additions and 171 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ Require Go 1.22+

### Features

Introducting [gcustom](https://onsi.github.io/gomega/#gcustom-a-convenient-mechanism-for-buildling-custom-matchers) - a convenient mechanism for building custom matchers.
Introducing [gcustom](https://onsi.github.io/gomega/#gcustom-a-convenient-mechanism-for-buildling-custom-matchers) - a convenient mechanism for building custom matchers.

This is an RC release for `gcustom`. The external API may be tweaked in response to feedback however it is expected to remain mostly stable.

Expand Down Expand Up @@ -461,7 +461,7 @@ These improvements are all documented in [Gomega's docs](https://onsi.github.io/
- Fix max number of samples in experiments on non-64-bit systems. (#528) [1c84497]
- Remove dependency on ginkgo v1.16.4 (#530) [4dea8d5]
- Fix for Go 1.18 (#532) [56d2a29]
- Document precendence of timeouts (#533) [b607941]
- Document precedence of timeouts (#533) [b607941]

## 1.18.1

Expand All @@ -478,7 +478,7 @@ These improvements are all documented in [Gomega's docs](https://onsi.github.io/
## Fixes
- Gomega now uses ioutil for Go 1.15 and lower (#492) - official support is only for the most recent two major versions of Go but this will unblock users who need to stay on older unsupported versions of Go. [c29c1c0]

## Maintenace
## Maintenance
- Remove Travis workflow (#491) [72e6040]
- Upgrade to Ginkgo 2.0.0 GA [f383637]
- chore: fix description of HaveField matcher (#487) [2b4b2c0]
Expand Down Expand Up @@ -726,7 +726,7 @@ Improvements:

- Added `BeSent` which attempts to send a value down a channel and fails if the attempt blocks. Can be paired with `Eventually` to safely send a value down a channel with a timeout.
- `Ω`, `Expect`, `Eventually`, and `Consistently` now immediately `panic` if there is no registered fail handler. This is always a mistake that can hide failing tests.
- `Receive()` no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so Ω(c).Should(Receive()) always fails and Ω(c).ShoudlNot(Receive()) always passes with a closed channel.
- `Receive()` no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so Ω(c).Should(Receive()) always fails and Ω(c).ShouldNot(Receive()) always passes with a closed channel.
- Added `HavePrefix` and `HaveSuffix` matchers.
- `ghttp` can now handle concurrent requests.
- Added `Succeed` which allows one to write `Ω(MyFunction()).Should(Succeed())`.
Expand All @@ -736,7 +736,7 @@ Improvements:
- `ghttp` servers can take an `io.Writer`. `ghttp` will write a line to the writer when each request arrives.
- Added `WithTransform` matcher to allow munging input data before feeding into the relevant matcher
- Added boolean `And`, `Or`, and `Not` matchers to allow creating composite matchers
- Added `gbytes.TimeoutCloser`, `gbytes.TimeoutReader`, and `gbytes.TimeoutWriter` - these are convenience wrappers that timeout if the underlying Closer/Reader/Writer does not return within the alloted time.
- Added `gbytes.TimeoutCloser`, `gbytes.TimeoutReader`, and `gbytes.TimeoutWriter` - these are convenience wrappers that timeout if the underlying Closer/Reader/Writer does not return within the allotted time.
- Added `gbytes.BufferReader` - this constructs a `gbytes.Buffer` that asynchronously reads the passed-in `io.Reader` into its buffer.

Bug Fixes:
Expand Down Expand Up @@ -781,7 +781,7 @@ New Matchers:

Updated Matchers:

- `Receive` matcher can take a matcher as an argument and passes only if the channel under test receives an objet that satisfies the passed-in matcher.
- `Receive` matcher can take a matcher as an argument and passes only if the channel under test receives an object that satisfies the passed-in matcher.
- Matchers that implement `MatchMayChangeInTheFuture(actual interface{}) bool` can inform `Eventually` and/or `Consistently` when a match has no chance of changing status in the future. For example, `Receive` returns `false` when a channel is closed.

Misc:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3405,7 +3405,7 @@ Describe("server performance", func() {
baseline := cache.Load("performance regression test", 1)
if baseline == nil {
// this is the first run, let's store a baseline
cache.Save("performacne regression test", 1, experiment)
cache.Save("performance regression test", 1, experiment)
} else {
for _, m := range []string{"fetching one", "listing"} {
baselineStats := baseline.GetStats(m)
Expand Down
2 changes: 1 addition & 1 deletion format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var Indent = " "

var longFormThreshold = 20

// GomegaStringer allows for custom formating of objects for gomega.
// GomegaStringer allows for custom formatting of objects for gomega.
type GomegaStringer interface {
// GomegaString will be used to custom format an object.
// It does not follow UseStringerRepresentation value and will always be called regardless.
Expand Down
4 changes: 2 additions & 2 deletions format/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ var _ = Describe("Format", func() {
Expect(Message(3, "to be three.")).Should(Equal("Expected\n <int>: 3\nto be three."))
})

It("should print out an indented formatted representation of the value and the message, and trucate it when too long", func() {
It("should print out an indented formatted representation of the value and the message, and truncate it when too long", func() {
tooLong := strings.Repeat("s", MaxLength+1)
tooLongResult := strings.Repeat("s", MaxLength) + "...\n" + truncateHelpText
Expect(Message(tooLong, "to be truncated")).Should(Equal("Expected\n <string>: " + tooLongResult + "\nto be truncated"))
})

It("should print out an indented formatted representation of the value and the message, and not trucate it when MaxLength = 0", func() {
It("should print out an indented formatted representation of the value and the message, and not truncate it when MaxLength = 0", func() {
MaxLength = 0
tooLong := strings.Repeat("s", MaxLength+1)
Expect(Message(tooLong, "to be truncated")).Should(Equal("Expected\n <string>: " + tooLong + "\nto be truncated"))
Expand Down
2 changes: 1 addition & 1 deletion gcustom/make_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (c CustomGomegaMatcher) WithTemplate(templ string, data ...any) CustomGomeg
/*
WithPrecompiledTemplate returns a CustomGomegaMatcher configured to use the passed-in template. The template should be precompiled with gcustom.ParseTemplate().
As with WithTemplate() you can provide a single pice of additional data as an optional argument. This is accessed in the template via {{.Data}}
As with WithTemplate() you can provide a single piece of additional data as an optional argument. This is accessed in the template via {{.Data}}
*/
func (c CustomGomegaMatcher) WithPrecompiledTemplate(templ *template.Template, data ...any) CustomGomegaMatcher {
c.templateMessage = templ
Expand Down
4 changes: 2 additions & 2 deletions gexec/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ var _ = Describe("Session", func() {
errWriter = io.Discard
})

It("executes succesfuly", func() {
It("executes successfully", func() {
Eventually(session).Should(Exit())
})
})
Expand Down Expand Up @@ -391,7 +391,7 @@ var _ = Describe("Session", func() {
errWriter = io.Discard
})

It("executes succesfuly", func() {
It("executes successfully", func() {
Eventually(session).Should(Exit())
})
})
Expand Down
2 changes: 1 addition & 1 deletion ghttp/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (g GHTTPWithGomega) RespondWith(statusCode int, body interface{}, optionalH
/*
RespondWithPtr returns a handler that responds to a request with the specified status code and body
Unlike RespondWith, you pass RepondWithPtr a pointer to the status code and body allowing different tests
Unlike RespondWith, you pass RespondWithPtr a pointer to the status code and body allowing different tests
to share the same setup but specify different status codes and bodies.
Also, RespondWithPtr can be given an optional http.Header. The headers defined therein will be added to the response headers.
Expand Down
2 changes: 1 addition & 1 deletion ghttp/test_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var _ = Describe("TestServer", func() {
})
})

Describe("closing server mulitple times", func() {
Describe("closing server multiple times", func() {
It("should not fail", func() {
s.Close()
Expect(s.Close).ShouldNot(Panic())
Expand Down
74 changes: 37 additions & 37 deletions gmeasure/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,50 +106,50 @@ func (cache ExperimentCache) Clear() error {
}

/*
Load fetches an experiment from the cache. Lookup occurs by name. Load requires that the version numer in the cache is equal to or greater than the passed-in version.
Load fetches an experiment from the cache. Lookup occurs by name. Load requires that the version number in the cache is equal to or greater than the passed-in version.
If an experiment with corresponding name and version >= the passed-in version is found, it is unmarshaled and returned.
If no experiment is found, or the cached version is smaller than the passed-in version, Load will return nil.
When paired with Ginkgo you can cache experiments and prevent potentially expensive recomputation with this pattern:
const EXPERIMENT_VERSION = 1 //bump this to bust the cache and recompute _all_ experiments
Describe("some experiments", func() {
var cache gmeasure.ExperimentCache
var experiment *gmeasure.Experiment
BeforeEach(func() {
cache = gmeasure.NewExperimentCache("./gmeasure-cache")
name := CurrentSpecReport().LeafNodeText
experiment = cache.Load(name, EXPERIMENT_VERSION)
if experiment != nil {
AddReportEntry(experiment)
Skip("cached")
}
experiment = gmeasure.NewExperiment(name)
AddReportEntry(experiment)
})
It("foo runtime", func() {
experiment.SampleDuration("runtime", func() {
//do stuff
}, gmeasure.SamplingConfig{N:100})
})
It("bar runtime", func() {
experiment.SampleDuration("runtime", func() {
//do stuff
}, gmeasure.SamplingConfig{N:100})
})
AfterEach(func() {
if !CurrentSpecReport().State.Is(types.SpecStateSkipped) {
cache.Save(experiment.Name, EXPERIMENT_VERSION, experiment)
}
})
})
const EXPERIMENT_VERSION = 1 //bump this to bust the cache and recompute _all_ experiments
Describe("some experiments", func() {
var cache gmeasure.ExperimentCache
var experiment *gmeasure.Experiment
BeforeEach(func() {
cache = gmeasure.NewExperimentCache("./gmeasure-cache")
name := CurrentSpecReport().LeafNodeText
experiment = cache.Load(name, EXPERIMENT_VERSION)
if experiment != nil {
AddReportEntry(experiment)
Skip("cached")
}
experiment = gmeasure.NewExperiment(name)
AddReportEntry(experiment)
})
It("foo runtime", func() {
experiment.SampleDuration("runtime", func() {
//do stuff
}, gmeasure.SamplingConfig{N:100})
})
It("bar runtime", func() {
experiment.SampleDuration("runtime", func() {
//do stuff
}, gmeasure.SamplingConfig{N:100})
})
AfterEach(func() {
if !CurrentSpecReport().State.Is(types.SpecStateSkipped) {
cache.Save(experiment.Name, EXPERIMENT_VERSION, experiment)
}
})
})
*/
func (cache ExperimentCache) Load(name string, version int) *Experiment {
path := filepath.Join(cache.Path, cache.hashOf(name)+CACHE_EXT)
Expand Down
2 changes: 1 addition & 1 deletion gmeasure/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe("Cache", func() {
Ω(cache.Clear()).Should(Succeed())
})

It("returs nil when loading a non-existing experiment", func() {
It("returns nil when loading a non-existing experiment", func() {
Ω(cache.Load("floop", 17)).Should(BeNil())
})
})
Expand Down
38 changes: 19 additions & 19 deletions gmeasure/experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Once measurements are complete, an Experiment can generate a comprehensive repor
Users can also access and analyze the resulting Measurements directly. Use Experiment.Get(NAME) to fetch the Measurement named NAME. This returned struct will have fields containing
all the data points and annotations recorded by the experiment. You can subsequently fetch the Measurement.Stats() to get a Stats struct that contains basic statistical information about the
Measurement (min, max, median, mean, standard deviation). You can order these Stats objects using RankStats() to identify best/worst performers across multpile experiments or measurements.
Measurement (min, max, median, mean, standard deviation). You can order these Stats objects using RankStats() to identify best/worst performers across multiple experiments or measurements.
gmeasure also supports caching Experiments via an ExperimentCache. The cache supports storing and retreiving experiments by name and version. This allows you to rerun code without
gmeasure also supports caching Experiments via an ExperimentCache. The cache supports storing and retrieving experiments by name and version. This allows you to rerun code without
repeating expensive experiments that may not have changed (which can be controlled by the cache version number). It also enables you to compare new experiment runs with older runs to detect
variations in performance/behavior.
Expand Down Expand Up @@ -66,8 +66,8 @@ type SamplingConfig struct {

// The Units decorator allows you to specify units (an arbitrary string) when recording values. It is ignored when recording durations.
//
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Units("inches"))
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Units("inches"))
//
// Units are only set the first time a value of a given name is recorded. In the example above any subsequent calls to e.RecordValue("length", X) will maintain the "inches" units even if a new set of Units("UNIT") are passed in later.
type Units string
Expand All @@ -76,9 +76,9 @@ type Units string
//
// For example:
//
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Annotation("bob"))
// e.RecordValue("length", 2.71, gmeasure.Annotation("jane"))
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Annotation("bob"))
// e.RecordValue("length", 2.71, gmeasure.Annotation("jane"))
//
// ...will result in a Measurement named "length" that records two values )[3.141, 2.71]) annotation with (["bob", "jane"])
type Annotation string
Expand All @@ -88,11 +88,11 @@ type Annotation string
//
// For example:
//
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Style("{{blue}}{{bold}}"))
// e.RecordValue("length", 2.71)
// e.RecordDuration("cooking time", 3 * time.Second, gmeasure.Style("{{red}}{{underline}}"))
// e.RecordDuration("cooking time", 2 * time.Second)
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Style("{{blue}}{{bold}}"))
// e.RecordValue("length", 2.71)
// e.RecordDuration("cooking time", 3 * time.Second, gmeasure.Style("{{red}}{{underline}}"))
// e.RecordDuration("cooking time", 2 * time.Second)
//
// will emit a report with blue bold entries for the length measurement and red underlined entries for the cooking time measurement.
//
Expand All @@ -112,11 +112,11 @@ type PrecisionBundle struct {
//
// For example:
//
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Precision(2))
// e.RecordValue("length", 2.71)
// e.RecordDuration("cooking time", 3214 * time.Millisecond, gmeasure.Precision(100*time.Millisecond))
// e.RecordDuration("cooking time", 2623 * time.Millisecond)
// e := gmeasure.NewExperiment("My Experiment")
// e.RecordValue("length", 3.141, gmeasure.Precision(2))
// e.RecordValue("length", 2.71)
// e.RecordDuration("cooking time", 3214 * time.Millisecond, gmeasure.Precision(100*time.Millisecond))
// e.RecordDuration("cooking time", 2623 * time.Millisecond)
func Precision(p interface{}) PrecisionBundle {
out := DefaultPrecisionBundle
switch reflect.TypeOf(p) {
Expand Down Expand Up @@ -308,7 +308,7 @@ The resulting durations are recorded on a Duration Measurement with the passed-i
The callback is given a zero-based index that increments by one between samples. The callback must return an Annotation - this annotation is attached to the measured duration.
The Sampling is configured via the passed-in SamplingConfig
# The Sampling is configured via the passed-in SamplingConfig
SampleAnnotatedDuration supports the Style() and Precision() decorations.
*/
Expand Down Expand Up @@ -395,7 +395,7 @@ SampleAnnotatedValue samples the passed-in callback and records the return value
The callback is given a zero-based index that increments by one between samples. The callback must return a float64 and an Annotation - the annotation is attached to the recorded value.
The Sampling is configured via the passed-in SamplingConfig
# The Sampling is configured via the passed-in SamplingConfig
SampleValue supports the Style(), Units(), and Precision() decorations.
*/
Expand Down
2 changes: 1 addition & 1 deletion gmeasure/experiment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ var _ = Describe("Experiment", func() {
}).Should(PanicWith("invalid precision type, must be time.Duration or int"))
})

It("panics if an unrecognized argumnet is passed in", func() {
It("panics if an unrecognized argument is passed in", func() {
Ω(func() {
e.RecordValue("sprockets", 2, "boom")
}).Should(PanicWith(`unrecognized argument "boom"`))
Expand Down
2 changes: 1 addition & 1 deletion gmeasure/rank.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *RankingCriteria) UnmarshalJSON(b []byte) error {
func (s RankingCriteria) MarshalJSON() ([]byte, error) { return rcEnumSupport.MarshJSON(uint(s)) }

/*
Ranking ranks a set of Stats by a specified RankingCritera. Use RankStats to create a Ranking.
Ranking ranks a set of Stats by a specified RankingCriteria. Use RankStats to create a Ranking.
When using Ginkgo, you can register Rankings as Report Entries via AddReportEntry. This will emit a formatted table representing the Stats in rank-order when Ginkgo generates the report.
*/
Expand Down
6 changes: 3 additions & 3 deletions gmeasure/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type Stats struct {
// If Type is StatTypeValue then PrecisionBundle.ValueFormat is used to format any values before presentation
PrecisionBundle PrecisionBundle

// N represents the total number of data points in the Meassurement from which this Stat is derived
// N represents the total number of data points in the Measurement from which this Stat is derived
N int

// If Type is StatTypeValue, ValueBundle will be populated with float64s representing this Stat's statistics
Expand All @@ -97,7 +97,7 @@ func (s Stats) String() string {
// ValueFor returns the float64 value for a particular Stat. You should only use this if the Stats has Type StatsTypeValue
// For example:
//
// median := experiment.GetStats("length").ValueFor(gmeasure.StatMedian)
// median := experiment.GetStats("length").ValueFor(gmeasure.StatMedian)
//
// will return the median data point for the "length" Measurement.
func (s Stats) ValueFor(stat Stat) float64 {
Expand All @@ -107,7 +107,7 @@ func (s Stats) ValueFor(stat Stat) float64 {
// DurationFor returns the time.Duration for a particular Stat. You should only use this if the Stats has Type StatsTypeDuration
// For example:
//
// mean := experiment.GetStats("runtime").ValueFor(gmeasure.StatMean)
// mean := experiment.GetStats("runtime").ValueFor(gmeasure.StatMean)
//
// will return the mean duration for the "runtime" Measurement.
func (s Stats) DurationFor(stat Stat) time.Duration {
Expand Down
Loading

0 comments on commit a1d518b

Please sign in to comment.