From 32bc95213204e7c0e71eefe9c4a06cfa77a96f84 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Sat, 27 Jun 2020 14:35:10 +0200 Subject: [PATCH] utils.regex: Fix unittest depending on unsound array equality check The previous test really depended on `-preview=fieldwise`. See https://github.com/dlang/druntime/pull/3142#issuecomment-648400109. --- utils/regex.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/regex.d b/utils/regex.d index c9236886..eae64e77 100644 --- a/utils/regex.d +++ b/utils/regex.d @@ -342,8 +342,9 @@ private Transformation[] splitRETransformation(string s) unittest { - Transformation result = { type : Transformation.Type.replace, replace : { search : "from", replacement : "to", flags : "" } }; - assert(splitRETransformation("s/from/to/") == [result]); + auto actual = splitRETransformation("s/from/to/"); + Transformation expected = { type : Transformation.Type.replace, replace : { search : "from", replacement : "to", flags : "" } }; + assert(actual.length == 1 && actual[0].tupleof == expected.tupleof); } /// Apply sed-like regex transformation (in the form of "s/FROM/TO/FLAGS") to a string.