gotestyourself / gotestyourself/gotest.tools
Feature: Implement data type comparison
- Dominant language
- Go
- Stars
- 576
- Forks
- 54
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 2
Description
In order to compare between data types, I am doing
```go
type (
CustomInterface interface {
Foo() string
}
CustomType1 struct { }
CustomType2 struct { }
)
func (ct1 CustomType1) Foo() {}
func (ct2 CustomType2) Foo() {}
...
func TestType(t testing.T) {
var i interface{} = &CustomType1{}
_, isType1 := i.(CustomType1)
_, isType2 := i.(CustomType1)
assert.Assert(t, isType1) // Success
assert.Assert(t, isType2) // Fail
}
```
It would be better if
```golang
customType := &CustomType1{}
assert.Assert(t, is.SameType(customType, CustomType1) // Success
assert.Assert(t, is.SameType(customType, CustomType2) // Fail
```
Contributor guide
Assessment
This issue has not been assessed yet.