vburenin / ifacemaker

Generate interfaces from structure methods.
Apache License 2.0
320 stars 43 forks source link

test: use stretchr/testify/assert for assertions #30

Closed markus-wa closed 5 years ago

markus-wa commented 5 years ago

This simplifies many tests and makes it more clear what the expected outcome is. It also gives a very readable diff output if the ouptut isn't as expected.

I'm working on another PR and it's making it much easier to see at a glance what exactly broke after a change.

Example diff output from the test log:

                            Diff:
                                --- Expected
                                +++ Actual
                                @@ -7,14 +7,8 @@
                                 type PersonIface interface {
                                -       // Name ...
                                        Name() string
                                -       // SetName ...
                                        SetName(name string)
                                -       // Age ...
                                        Age() int
                                -       // Age ...
                                        SetAge(age int) int
                                -       // AgeAndName ...
                                        AgeAndName() (int, string)
                                        SetAgeAndName(name string, age int)
                                -       // TelephoneAndName ...
                                        GetNameAndTelephone() (name, telephone string)
vburenin commented 5 years ago

Yah, I also like testify framework for its capabilities. Thanks!