New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export format property variables #347
Changes from 4 commits
e93e8b8
50b6671
8e048e2
80eff8b
30e1d5c
28d54b5
6d225f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,6 +190,38 @@ var _ = Describe("Format", func() { | |
Expect(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedFullFailureDiff)) | ||
}) | ||
}) | ||
|
||
Context("With alternate diff lengths", func() { | ||
initialValue := TruncateThreshold // 5 by default | ||
BeforeEach(func() { | ||
TruncateThreshold = 10000 | ||
}) | ||
|
||
AfterEach(func() { | ||
TruncateThreshold = initialValue | ||
}) | ||
It("should show the full diff", func() { | ||
stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
|
||
Expect(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedFullFailureDiff)) | ||
}) | ||
}) | ||
|
||
Context("With alternate diff lengths", func() { | ||
It("long strings that differ only in length", func() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally BDD style tests should read as a sentence. For example the test above reads |
||
smallString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
largeString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
|
||
Expect(MessageWithDiff(largeString, "to equal", smallString)).Should(Equal(expectedTruncatedStartSizeFailureMessage)) | ||
Expect(MessageWithDiff(smallString, "to equal", largeString)).Should(Equal(expectedTruncatedStartSizeSwappedFailureMessage)) | ||
initialValue := CharactersAroundMismatchToInclude // 5 by default | ||
CharactersAroundMismatchToInclude = 10 | ||
Expect(MessageWithDiff(largeString, "to equal", smallString)).Should(Equal(expectedTruncatedStartSizeFailureMessageExtraDiff)) | ||
Expect(MessageWithDiff(smallString, "to equal", largeString)).Should(Equal(expectedTruncatedStartSizeSwappedFailureMessageExtraDiff)) | ||
CharactersAroundMismatchToInclude = initialValue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other tests (the two above for example) set/unset things in a Before/AfterEach. It would be nice to match the style of the other tests as a file is easier to read and maintain if it follows a consistent style. At the moment this test checks both the default and alternative behaviour. Perhaps the default testing should be left to the tests above, and this test should focus only on the alternative behaviour. |
||
}) | ||
}) | ||
}) | ||
|
||
Describe("IndentString", func() { | ||
|
@@ -613,12 +645,24 @@ Expected | |
to equal | | ||
<string>: "...aaaaa" | ||
`) | ||
var expectedTruncatedStartSizeFailureMessageExtraDiff = strings.TrimSpace(` | ||
Expected | ||
<string>: "...aaaaaaaaaaa" | ||
to equal | | ||
<string>: "...aaaaaaaaaa" | ||
`) | ||
var expectedTruncatedStartSizeSwappedFailureMessage = strings.TrimSpace(` | ||
Expected | ||
<string>: "...aaaa" | ||
to equal | | ||
<string>: "...aaaaa" | ||
`) | ||
var expectedTruncatedStartSizeSwappedFailureMessageExtraDiff = strings.TrimSpace(` | ||
Expected | ||
<string>: "...aaaaaaaaa" | ||
to equal | | ||
<string>: "...aaaaaaaaaa" | ||
`) | ||
var expectedTruncatedMultiByteFailureMessage = strings.TrimSpace(` | ||
Expected | ||
<string>: "...tuvwxyz1" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context name is exactly the same as the previous test. I think it should be different and say something like
with alternative number of characters to include around mismatch
.