go-expect lets you write better assertions

When you use go-expect, you write beautiful assertions as if you were writing a text. When you write assertions in this way, you don’t need to remember the order of actual and expected arguments to functions like assert.equal, which helps you write better tests.
$ go get github.com/viniciusmarson/go-expect/expect
package main
import (
"testing"
"github.com/viniciusmarson/go-expect/expect"
)
func TestToInclude(t *testing.T) {
expect := expect.New(t)
expect([]int{10,9,8}).ToInclude(10)
}
func TestBubbleSort(t *testing.T) {
expect := expect.New(t)
theExpectedResponse := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
response := []int{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}
BubbleSort(response)
expect(response).ToBe(theExpectedResponse)
}
expect(value).ToExist()
Asserts the given value is not nil.
expect("something truthy").ToExist()
expect(value).ToNotExist()
Asserts the given value is nil.
expect(nil).ToNotExist()
expect(value).ToBe(expectedValue)
Asserts that value is strictly equal to expectedValue.
expect([]int{ 1, 2, 3, 4 }).ToBe([]int{ 1, 2, 3, 4 })
expect("test").ToBe("test")
expect(11).ToBe(11)
expect(value).ToNotBe(expectedValue)
Asserts that value is not strictly equal to expectedValue.
expect([]int{ 1, 2, 3, 4 }).ToNotBe([]int{ 4, 3, 2, 1 })
expect("test").ToNotBe("tset")
expect(10).ToNotBe(11)
expect(value).ToBeAn(expectedType)
Asserts that value is of the type expectedType.
expect("test").ToBeA("string")
expect(true).ToBeA("bool")
expect(10).ToBeAn("int")
expect([]int{}).ToBeA("slice")
expect(`some interface{}`).ToBeAn("interface")
expect(`some struct`).ToBeA("struct")
expect(bool).ToBeTrue()
Asserts that bool is true.
expect(true).ToBeTrue()
expect(bool).ToBeFalse()
Asserts that bool is false.
expect(false).ToBeFalse()
expect(string).Contains(expectedString)
Asserts that string contains expectedString.
expect("banana").Contains("nana")
expect(string).NotContains(notExpectedString)
Asserts that string not contains notExpectedString.
expect("banana").NotContains("haha")
expect(number).ToBeLessThan(value)
Asserts the given number is less than value.
expect(2).ToBeLessThan(3)
expect(number).ToBeLessThanOrEqualTo(value)
Asserts the given number is less than or equal to value.
expect(2).ToBeLessThanOrEqualTo(3)
expect(number).ToBeGreaterThan(valu)
Asserts the given number is greater than value.
expect(3).ToBeGreaterThan(2)
expect(number).ToBeGreaterThanOrEqualTo(value)
Asserts the given number is greater than or equal to value.
expect(3).ToBeGreaterThanOrEqualTo(2)
expect(slice).ToInclude(value)
Asserts the given slice contains the value.
expect([]int{ 10, 9 , 8 }).ToInclude(9)
expect(slice).ToExclude(value)
Asserts the given slice not contains the value.
expect([]int{ 10, 9 , 8 }).ToExclude(2)
expect().Fail()
Explicitly forces failure.
expect().Fail()
expect().Fail("Custom message")
