diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-17 19:15:59 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-17 19:15:59 +0200 |
| commit | 7b34edc8e7079a16755e342694173e9d194425d7 (patch) | |
| tree | 57025a7f382a4170f6d34e01c16772da016b2541 /test/test_data.lua | |
| parent | 8a6c0730f8e9f2c1e6033d3e66d2c524d7b9f91d (diff) | |
| download | conky-theme-udt-7b34edc8e7079a16755e342694173e9d194425d7.tar.gz conky-theme-udt-7b34edc8e7079a16755e342694173e9d194425d7.zip | |
feat: add the network card
Two lines on one chart against a shared ceiling, one sample per pixel column
so nothing is interpolated. The history is module state sized from the card's
width, so moving the card reframes the window rather than clearing it.
The public address is refused once stale: an address that may no longer be
yours, displayed with confidence, is worse than a dash.
The fixture uses TEST-NET-1. This repository is public.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'test/test_data.lua')
| -rw-r--r-- | test/test_data.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua index 74167bf..34021c5 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -309,4 +309,17 @@ assert(data.cpu_model('model name\t: AMD Ryzen 9 7950X3D 16-Core Processor\n') == 'Ryzen 9 7950X3D', 'x3d, got ' .. tostring(data.cpu_model('model name\t: AMD Ryzen 9 7950X3D 16-Core Processor\n'))) +-- === Interface address ==================================================== +-- The fixture uses TEST-NET-1 (192.0.2.0/24, RFC 5737). This repository is +-- public: no real LAN address belongs in it, and no test may assert one. +local addr = data.iface_addr_parse(read('test/fixtures/ip_addr')) +assert(addr == '192.0.2.15', 'lan address, got ' .. tostring(addr)) + +-- A down interface has no inet line. nil, so the card shows '--' rather than +-- a stale or invented address. +assert(data.iface_addr_parse('5: br0: <BROADCAST,MULTICAST> mtu 1500 state DOWN\n') == nil, + 'a down interface gives nil') +assert(data.iface_addr_parse('') == nil, 'empty gives nil') +assert(data.iface_addr_parse(nil) == nil, 'nil gives nil') + print('test_data: all assertions passed') |
