Use deep equal after conversion.

pull/106/head
Raphael Meyer 2014-11-30 09:22:56 +01:00
parent 88bce07c05
commit 807610fbf1
3 changed files with 15 additions and 2 deletions

12
.travis.yml Normal file
View File

@ -0,0 +1,12 @@
language: go
go:
- 1.0
- 1.1
- 1.2
- 1.3
- tip
script:
- go test -v ./...

View File

@ -1,6 +1,8 @@
Testify - Thou Shalt Write Tests
================================
[![Build Status](https://travis-ci.org/raphaelmeyer/testify.png)](https://travis-ci.org/raphaelmeyer/testify)
Go code (golang) set of packages that provide many tools for testifying that your code will behave as you intend.
Features include:

View File

@ -39,9 +39,8 @@ func ObjectsAreEqual(expected, actual interface{}) bool {
actualType := reflect.TypeOf(actual)
expectedType := reflect.TypeOf(expected)
if actualType.ConvertibleTo(expectedType) {
expectedValue := reflect.ValueOf(expected)
actualValue := reflect.ValueOf(actual).Convert(expectedType)
if actualValue == expectedValue {
if reflect.DeepEqual(actualValue.Interface(), expected) {
return true
}
}