From fbde7713061af1abab595b45f13c253b90f85c4f Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sat, 23 Nov 2024 17:54:46 +0100 Subject: [PATCH] tests: speedup readhistory reduce test (#12785) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example on my machine: | test duration (ms) | master | PR | | :- | -: | -: | | regular run | 2645.94 | 106.83 (÷24.8) | | coverage run | 26133.27 | 641.59 (÷40.7) | --- spec/unit/readhistory_spec.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/unit/readhistory_spec.lua b/spec/unit/readhistory_spec.lua index 91e542958..fefecb056 100644 --- a/spec/unit/readhistory_spec.lua +++ b/spec/unit/readhistory_spec.lua @@ -267,16 +267,18 @@ describe("ReadHistory module", function() end rm(file("history.lua")) local h = reload() - for i = 1000, 1, -1 do + for i = 600, 1, -1 do touch(to_file(i)) - h:addItem(to_file(i)) + h:addItem(to_file(i), nil, i ~= 1) end - for i = 1, 500 do -- at most 500 items are stored + -- at most 500 items are stored + assert.is.same(500, #h.hist) + for i = 1, 500 do assert_item_is(h, i, string.format("%04d", i)) end - for i = 1, 1000 do + for i = 1, 600 do rm(to_file(i)) end end)