From 4b94c29c9144a68e2696cc5f1ef91ccaa8641ce5 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 2 Dec 2020 19:47:07 +0200 Subject: [PATCH] tests: use .replace_each() instead of a .replace() chain --- cmd/tools/modules/testing/common.v | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 690716ae1e..464f8d3727 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -61,8 +61,16 @@ pub fn (mut ts TestSession) print_messages() { return } ts.nmessage_idx++ - msg := rmessage.message.replace('TMP1', '${ts.nmessage_idx:1d}').replace('TMP2', - '${ts.nmessage_idx:2d}').replace('TMP3', '${ts.nmessage_idx:3d}') + msg := rmessage.message.replace_each([ + 'TMP1', + '${ts.nmessage_idx:1d}', + 'TMP2', + '${ts.nmessage_idx:2d}', + 'TMP3', + '${ts.nmessage_idx:3d}', + 'TMP4', + '${ts.nmessage_idx:4d}', + ]) is_ok := rmessage.kind == .ok // time_passed := print_msg_time.elapsed().seconds()