Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 07d097d

Browse filesBrowse files
author
anonx
committed
AssertNotEqual and AssertNotContains have been added
1 parent 6f4ee24 commit 07d097d
Copy full SHA for 07d097d

File tree

Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed

‎tests.go

Copy file name to clipboardExpand all lines: tests.go
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ func (t *TestSuite) AssertEqual(expected, actual interface{}) {
221221
}
222222
}
223223

224+
func (t *TestSuite) AssertNotEqual(expected, actual interface{}) {
225+
if Equal(expected, actual) {
226+
panic(fmt.Errorf("(expected) %v == %v (actual)", expected, actual))
227+
}
228+
}
229+
224230
func (t *TestSuite) Assert(exp bool) {
225231
t.Assertf(exp, "Assertion failed")
226232
}
@@ -238,6 +244,13 @@ func (t *TestSuite) AssertContains(s string) {
238244
}
239245
}
240246

247+
// Assert that the response does not contain the given string.
248+
func (t *TestSuite) AssertNotContains(s string) {
249+
if bytes.Contains(t.ResponseBody, []byte(s)) {
250+
panic(fmt.Errorf("Assertion failed. Expected response not to contain %s", s))
251+
}
252+
}
253+
241254
// Assert that the response matches the given regular expression.BUG
242255
func (t *TestSuite) AssertContainsRegex(regex string) {
243256
r := regexp.MustCompile(regex)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.