From 3b51ad24b257d4512cf25ffa0faeb6aa5e91080f Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 19 Jul 2024 09:43:51 +0100 Subject: [PATCH] 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. --- fs/rc/rcserver/rcserver_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/rc/rcserver/rcserver_test.go b/fs/rc/rcserver/rcserver_test.go index 69fd7eef7..7b55f2e03 100644 --- a/fs/rc/rcserver/rcserver_test.go +++ b/fs/rc/rcserver/rcserver_test.go @@ -153,7 +153,9 @@ func testServer(t *testing.T, tests []testRun, opt *rc.Options) { actualNormalized := normalizeJSON(t, string(body)) assert.Equal(t, expectedNormalized, actualNormalized, "Normalized JSON does not match") } else if test.Contains == nil { - assert.Equal(t, test.Expected, string(body)) + // go1.23 started putting an html wrapper + bodyNormalized := strings.TrimPrefix(string(body), "\n\n") + assert.Equal(t, test.Expected, bodyNormalized) } else { assert.True(t, test.Contains.Match(body), fmt.Sprintf("body didn't match: %v: %v", test.Contains, string(body))) }