1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 16:44:26 +00:00
gitea/modules/validation
WGH 98fd085039 Fix lax comparison in validation tests (#7815)
If you add t.Logf("%+v %+v", actual, testCase.expectedErrors) to
the test code, you'll notice that only Errors' Messages are being
compared:

    --- PASS: Test_ValidURLValidation/Invalid_schema (0.00s)
    binding_test.go:43: [Url] [Url]

FieldNames and Classification are ignored in comparison.

Moreover, an Errors slice with a single Error with empty message
is formatted as '[]' (the same as empty slice), which is also
error-prone. I discovered this when working on #7791 when one test which
was not supposed to pass did pass. https://play.golang.org/p/qC4wVLrm4NG

This commit changes the test to do the comparison properly.
2019-08-12 10:17:25 +08:00
..
binding_test.go Fix lax comparison in validation tests (#7815) 2019-08-12 10:17:25 +08:00
binding.go Clean up ref name rules (#6437) 2019-03-26 21:59:48 +02:00
helpers_test.go Validate External Tracker URL Format (#7089) 2019-05-31 10:21:15 +01:00
helpers.go Validate External Tracker URL Format (#7089) 2019-05-31 10:21:15 +01:00
refname_test.go Clean up ref name rules (#6437) 2019-03-26 21:59:48 +02:00
validurl_test.go Better URL validation (#1507) 2017-04-19 11:02:20 +08:00