Skip to content

Commit 4704b17

Browse files
committed
Bump to v1.27.10
1 parent a9d61a9 commit 4704b17

9 files changed

+21
-12
lines changed

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ Here are some examples:
15101510
- `Expect(resp).To(HaveHTTPHeaderWithValue("Content-Type", "application/json"))`:
15111511
asserts that the `Content-Type` header has exactly the value `application/json`.
15121512

1513-
- `Expect(resp).To(HaveHTTPHeaderWithValue(ContainsSubstring("json")))`:
1513+
- `Expect(resp).To(HaveHTTPHeaderWithValue(ContainSubstring("json")))`:
15141514
asserts that the `Content-Type` header contains the substring `json`.
15151515

15161516
### Asserting on Panics

format/format.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func Object(object interface{}, indentation uint) string {
259259
indent := strings.Repeat(Indent, int(indentation))
260260
value := reflect.ValueOf(object)
261261
commonRepresentation := ""
262-
if err, ok := object.(error); ok {
262+
if err, ok := object.(error); ok && !isNilValue(value) { // isNilValue check needed here to avoid nil deref due to boxed nil
263263
commonRepresentation += "\n" + IndentString(err.Error(), indentation) + "\n" + indent
264264
}
265265
return fmt.Sprintf("%s<%s>: %s%s", indent, formatType(value), commonRepresentation, formatValue(value, indentation))
@@ -302,7 +302,7 @@ func formatType(v reflect.Value) string {
302302
case reflect.Map:
303303
return fmt.Sprintf("%s | len:%d", v.Type(), v.Len())
304304
default:
305-
return fmt.Sprintf("%s", v.Type())
305+
return v.Type().String()
306306
}
307307
}
308308

gleak/goroutine/goroutine.go

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
// - "copystack"
3434
// - "preempted"
3535
// - ("???" ... something IS severely broken.)
36+
//
3637
// In case a goroutine is in waiting state, the State field instead starts with
3738
// one of the following strings, never showing a lonely "waiting" string, but
3839
// rather one of the reasons for waiting:
@@ -176,6 +177,9 @@ func findCreator(backtrace string) (creator, location string) {
176177
}
177178
location = strings.TrimSpace(details[1][:offsetpos])
178179
creator = details[0]
180+
if offsetpos := strings.LastIndex(creator, " in goroutine "); offsetpos >= 0 {
181+
creator = creator[:offsetpos]
182+
}
179183
return
180184
}
181185

gomega_dsl.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/bsm/gomega/types"
2323
)
2424

25-
const GOMEGA_VERSION = "1.27.7"
25+
const GOMEGA_VERSION = "1.27.10"
2626

2727
const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler.
2828
If you're using Ginkgo then you probably forgot to put your assertion in an It().

matchers.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ func Succeed() types.GomegaMatcher {
8181
//
8282
// These are valid use-cases:
8383
//
84-
// Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error"
85-
// Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual)
86-
// Expect(err).Should(MatchError(ContainsSubstring("sprocket not found"))) // asserts that edrr.Error() contains substring "sprocket not found"
84+
// Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error"
85+
// Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual)
86+
// Expect(err).Should(MatchError(ContainSubstring("sprocket not found"))) // asserts that edrr.Error() contains substring "sprocket not found"
8787
//
8888
// It is an error for err to be nil or an object that does not implement the
8989
// Error interface

matchers/be_a_directory.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message
5252
}
5353

5454
func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) {
55-
return format.Message(actual, fmt.Sprintf("not be a directory"))
55+
return format.Message(actual, "not be a directory")
5656
}

matchers/be_a_regular_file.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (messag
5252
}
5353

5454
func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) {
55-
return format.Message(actual, fmt.Sprintf("not be a regular file"))
55+
return format.Message(actual, "not be a regular file")
5656
}

matchers/be_an_existing_file.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool,
3232
}
3333

3434
func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) {
35-
return format.Message(actual, fmt.Sprintf("to exist"))
35+
return format.Message(actual, "to exist")
3636
}
3737

3838
func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) {
39-
return format.Message(actual, fmt.Sprintf("not to exist"))
39+
return format.Message(actual, "not to exist")
4040
}

matchers/have_exact_elements.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool
4444

4545
elemMatcher := matchers[i].(omegaMatcher)
4646
match, err := elemMatcher.Match(values[i])
47-
if err != nil || !match {
47+
if err != nil {
48+
matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{
49+
index: i,
50+
failure: err.Error(),
51+
})
52+
} else if !match {
4853
matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{
4954
index: i,
5055
failure: elemMatcher.FailureMessage(values[i]),

0 commit comments

Comments
 (0)