src-d / hercules

Gaining advanced insights from Git repository history.
Other
2.63k stars 334 forks source link

chore: assert statements mostly use wrong arg order #246

Open bobheadxi opened 5 years ago

bobheadxi commented 5 years ago

according to the official documentation, what you expect should come first, and what you actually get should come second:

image

so assert statements like:

    assert.Equal(t, tss.tick0.Year(), 1969)

should actually be:

    assert.Equal(t, 1969, tss.tick0.Year())

otherwise, you get mildly misleading output:

            Error Trace:    ticks_test.go:210
            Error:          Not equal: 
                            expected: 1970
                            actual  : 1969
            Test:           TestTicksSinceStartConsumeZero

^^^ what that should actually say is:

            Error Trace:    ticks_test.go:210
            Error:          Not equal: 
                            expected: 1969
                            actual  : 1970
            Test:           TestTicksSinceStartConsumeZero
vmarkovtsev commented 5 years ago

Yes, this is rooted in my experience with other testing frameworks where the arguments order is not Yoda-style. It would be nice to change everywhere, but the amount of required boring work has always stopped me.