elliotchance / tf

✔️ tf is a microframework for parameterized testing of functions and HTTP in Go.
MIT License
137 stars 3 forks source link

Smarter casting of similar types #7

Closed elliotchance closed 6 years ago

elliotchance commented 6 years ago

For example trying to pass in an int to an int64 results in a panic. It should handle any casting that the compiler would normally handle.

m1ome commented 6 years ago

Can you please say what do you mean, and maybe i can help with this one.

elliotchance commented 6 years ago
Add := tf.Function(t, func (a, b int64) int64 {
    return a + b
})

Add(3, 4).Returns(7) // fails because int(3) isn't compatible with int64(3), etc

If the compiler knew the destination type it would handle most of these castings automation.

m1ome commented 6 years ago

@elliotchance i will jump on this.