mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 02:14:42 +01:00
rc: fix tests after go1.23 upgrade
go1.23 adds a doctype to the HTML output when serving file listings. This adapts the tests for that.
This commit is contained in:
parent
485aa90d13
commit
3b51ad24b2
@ -153,7 +153,9 @@ func testServer(t *testing.T, tests []testRun, opt *rc.Options) {
|
|||||||
actualNormalized := normalizeJSON(t, string(body))
|
actualNormalized := normalizeJSON(t, string(body))
|
||||||
assert.Equal(t, expectedNormalized, actualNormalized, "Normalized JSON does not match")
|
assert.Equal(t, expectedNormalized, actualNormalized, "Normalized JSON does not match")
|
||||||
} else if test.Contains == nil {
|
} else if test.Contains == nil {
|
||||||
assert.Equal(t, test.Expected, string(body))
|
// go1.23 started putting an html wrapper
|
||||||
|
bodyNormalized := strings.TrimPrefix(string(body), "<!doctype html>\n<meta name=\"viewport\" content=\"width=device-width\">\n")
|
||||||
|
assert.Equal(t, test.Expected, bodyNormalized)
|
||||||
} else {
|
} else {
|
||||||
assert.True(t, test.Contains.Match(body), fmt.Sprintf("body didn't match: %v: %v", test.Contains, string(body)))
|
assert.True(t, test.Contains.Match(body), fmt.Sprintf("body didn't match: %v: %v", test.Contains, string(body)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user