From f7799cbb7fb21483ba2df825aff5a4eb3a29f496 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 27 Sep 2015 15:30:04 +0200 Subject: [PATCH] Refactior test-leaks a bit I think it looks nicer with this helper function. Signed-off-by: Uli Schlachter --- tests/test-leaks.lua | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tests/test-leaks.lua b/tests/test-leaks.lua index e91727a80..32797f3ef 100644 --- a/tests/test-leaks.lua +++ b/tests/test-leaks.lua @@ -9,12 +9,15 @@ local wibox = require("wibox") local errors = {} local prepare_for_collect = nil +local function emit_refresh() + awesome.emit_signal("refresh") +end -- Make the layoutbox in the default config GC'able mywibox[1].visible = false mywibox = nil mylayoutbox = nil -awesome.emit_signal("refresh") +emit_refresh() -- Test if some objects can be garbage collected local function collectable(a, b, c, d, e, f, g, h, last) @@ -45,23 +48,14 @@ collectable(awful.widget.prompt()) collectable(awful.widget.textclock()) collectable(awful.widget.layoutbox(1)) -function prepare_for_collect() - -- Only after doing the pending update can a taglist be GC'd. - awesome.emit_signal("refresh") -end +-- Some widgets do things via timer.delayed_call +prepare_for_collect = emit_refresh collectable(awful.widget.taglist(1, awful.widget.taglist.filter.all)) -function prepare_for_collect() - -- Only after doing the pending update can a taglist be GC'd. - awesome.emit_signal("refresh") -end +prepare_for_collect = emit_refresh collectable(awful.widget.tasklist(1, awful.widget.tasklist.filter.currenttags)) --- And finally a full wibox -function prepare_for_collect() - -- Only after doing the pending repaint can a wibox be GC'd. - awesome.emit_signal("refresh") -end +prepare_for_collect = emit_refresh collectable(create_wibox()) require("_runner").run_steps({ function() return true end })