From e54d9405dd818cd3ee7c203b8ec1d21713470904 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 10:40:18 +0200 Subject: feat: the cache and slackware cards move to quickshell Both cards are now drawn by quickshell, so the conky copies go: the two widgets, their samplers and texeci lines, their fixtures and icons, and du_parse with human_bytes, which only the cache card used. kv_parse stays for breaktimer; its test now runs on an inline string. README gains a Samplers section listing what conky still schedules, and DESIGN.md's examples point at the cards that remain. Their slots in the layout are left open. Co-Authored-By: Claude Opus 5.5 --- test/fixtures/du_output | 5 ----- test/fixtures/slackware_cache | 5 ----- test/test_data.lua | 38 ++++---------------------------------- 3 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 test/fixtures/du_output delete mode 100644 test/fixtures/slackware_cache (limited to 'test') diff --git a/test/fixtures/du_output b/test/fixtures/du_output deleted file mode 100644 index a45b787..0000000 --- a/test/fixtures/du_output +++ /dev/null @@ -1,5 +0,0 @@ -1.6G /home/you/.cache -1.1G /home/you/.cache/mozilla -245M /home/you/.cache/pip -131M /home/you/.cache/go-build -85M /home/you/.cache/opencode diff --git a/test/fixtures/slackware_cache b/test/fixtures/slackware_cache deleted file mode 100644 index 3f2b2ac..0000000 --- a/test/fixtures/slackware_cache +++ /dev/null @@ -1,5 +0,0 @@ -version Slackware 15.0+ -packages 1234 -changelog 1758000000 -birth 1700000000 -kernel 6.12.1 diff --git a/test/test_data.lua b/test/test_data.lua index df6775b..9066241 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -20,30 +20,6 @@ local function read(path) return s end --- === Cache files ========================================================== --- du -sh: total first, then children largest-first. The suffixes must be --- converted, not string-sorted: '1.1G' outranks '245M' numerically and loses --- to it alphabetically. -local cache = data.du_parse(read('test/fixtures/du_output')) -assert(cache.total, 'a total is parsed') -assert(cache.total.label == '1.6G', 'total label, got ' .. tostring(cache.total.label)) -assert(#cache.items == 4, 'four children, got ' .. tostring(#cache.items)) -assert(cache.items[1].name == 'mozilla', 'largest child, got ' .. tostring(cache.items[1].name)) -assert(cache.items[1].label == '1.1G', 'its label, got ' .. tostring(cache.items[1].label)) -assert(cache.items[2].name == 'pip', 'second child, got ' .. tostring(cache.items[2].name)) - --- Sizes are compared as bytes, which is what makes 'biggest' meaningful. -assert(cache.items[1].bytes > cache.items[2].bytes, '1.1G must outrank 245M') -assert(cache.items[1].bytes > 1e9, 'a G suffix is about a billion bytes') -assert(cache.items[4].bytes < 1e8, 'an M suffix is far smaller') - --- Share of the total drives the highlight colour. -assert(cache.items[1].bytes / cache.total.bytes > 0.5, - 'mozilla dominates this fixture, which is what the highlight keys on') - -assert(data.du_parse('') == nil, 'empty input gives nil') -assert(data.du_parse(nil) == nil, 'nil gives nil') - -- === card.truncate ======================================================== -- Truncation is by CHARACTER, not byte: slicing a UTF-8 string mid-sequence -- emits an invalid byte that Cairo draws as a replacement box, and the name @@ -66,16 +42,10 @@ assert(card.truncate(nil, 10) == '', 'nil truncates to empty') assert(card.truncate('abc', 0) == '', 'a zero limit gives empty') -- === kv_parse ============================================================= --- The slackware sampler writes 'key value' lines. The format is deliberately --- dumber than the data: epochs stay integers rather than becoming formatted --- dates, so the widget decides how to render an age and the shell never --- reconstructs a date string. -local kv = data.kv_parse(read('test/fixtures/slackware_cache')) -assert(kv.version == 'Slackware 15.0+', 'version, got ' .. tostring(kv.version)) --- The value keeps its internal spaces: only the FIRST space is the separator. -assert(kv.packages == '1234', 'packages, got ' .. tostring(kv.packages)) -assert(kv.changelog == '1758000000', 'changelog, got ' .. tostring(kv.changelog)) -assert(kv.kernel == '6.12.1', 'kernel, got ' .. tostring(kv.kernel)) +-- Samplers write 'key value' lines; only the FIRST space is the separator. +local kv = data.kv_parse('title Long break\nremain 125\n') +assert(kv.title == 'Long break', 'value keeps its spaces, got ' .. tostring(kv.title)) +assert(kv.remain == '125', 'remain, got ' .. tostring(kv.remain)) -- A key the sampler did not write reads nil, which is how the widget tells -- "the sampler ran but this fact was unavailable" from "no sampler". -- cgit v1.2.3