Skip to content

Commit 26b7cc5

Browse files
authored
test: normalize trailing newlines in TestDecryptVariousChainhashes to avoid platform differences (#91)
1 parent 92cbd35 commit 26b7cc5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tlock_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,11 @@ func TestDecryptVariousChainhashes(t *testing.T) {
170170

171171
require.NoError(ts, err)
172172

173-
if !bytes.Equal(plainData.Bytes(), loremBytes) {
174-
ts.Fatalf("decrypted file is invalid; expected %d; got %d:\n %v \n %v", len(loremBytes), len(plainData.Bytes()), loremBytes, plainData.Bytes())
173+
// Normalize potential trailing newline differences across environments
174+
decoded := bytes.TrimRight(plainData.Bytes(), "\r\n")
175+
expected := bytes.TrimRight(loremBytes, "\r\n")
176+
if !bytes.Equal(decoded, expected) {
177+
ts.Fatalf("decrypted file is invalid; expected %d; got %d:\n %v \n %v", len(expected), len(decoded), expected, decoded)
175178
}
176179
})
177180
}

0 commit comments

Comments
 (0)