aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2026-09-17feat: add wind conversion, Beaufort and compass tablesDanilo M.1-0/+50
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17fix: guard a nil timestamp in the icon lookupDanilo M.1-0/+15
icon(800, nil, 1500, 1900) compared nil against a number and raised, which in this project is a blank dashboard with no message. The module's own header promises nothing raises, and is_day() already guards the same case, so the inconsistency was the bug. Not reachable from the widget as written: it passes os.time(), and parse() refuses a response without sunrise and sunset, so no caller can currently produce the failing combination. Fixed anyway, because the contract is what future callers will rely on and the fix is one word. The test file also now says why the codepoint VALUES carry no assertion: comparing M.ICON.snow against a literal would only prove the escape was typed twice. Whether E31A draws a snow cloud is what the glyph sheet is for, and mutation testing confirms the assertions cannot see it. Found by code review. The same fix is applied to the plan, so Tasks 2-5 inherit the guarded version. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add OWM condition id to icon mappingDanilo M.1-0/+65
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16test: make the layout assertion actually able to failDanilo M.1-1/+6
The out-of-grid check iterated `G.layout or {}`. With layout unexported that walks an empty table, so the block passed vacuously and the test could never detect the very condition it existed to check. Confirmed by unexporting layout and watching the suite still pass. Drops the fallback and asserts the export first. Verified by mutation: unexporting layout now fails with "dashboard.lua must export layout", and moving the clock to col=5 fails with "layout entry out of columns", so both paths have teeth. The plan's Step 3 expected a failure that could not happen; it now says what the failure looks like and warns that a pass there means the test is broken rather than the code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16test: check grid maths on both real screen sizesDanilo M.1-0/+60
The grid's justification is that one layout table works on differently shaped screens, so assert it: every cell lands inside the margins at 2560x1080 and 1920x1080, a spanning cell absorbs the gap it covers, and no shipped layout entry falls outside the declared grid. dashboard.lua exports its internals for this; cairo and lib.card are stubbed via package.preload since they only exist inside Conky. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16docs: fix a comment naming a function that does not existDanilo M.1-1/+1
The test comment said "cpu_percent", but the API is new_cpu_counter() plus :sample(). Prose only, the code was always consistent, but a comment naming a nonexistent function sends the next reader looking for it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16feat: add stateful CPU percentage counterDanilo M.1-0/+18
Load is a delta, so one reading cannot yield a percentage. The first call returns nil rather than a fabricated number: 100% on startup reads as a real spike. A non-advancing counter also returns nil instead of dividing by zero, and the result is clamped because a suspend/resume can produce a nonsense delta. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16feat: add /proc and /sys parsers with fixture testsDanilo M.4-0/+52
Parsers take file contents as a string, not a path, so they test against committed fixtures with no filesystem mocking. hwmon is globbed by its name file rather than a fixed index, carried over from the old config: indices drift across kernel reorders and a stale one silently reads a different chip. Failure returns nil, never 0. A sensor reading 0 C is legitimate, so 0 cannot double as an error value. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>