diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-16 19:23:35 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-16 19:23:35 +0200 |
| commit | f822a250f9b2759207d64cc53b3d80c0c08d2082 (patch) | |
| tree | b3ea539a252b7d7c34b08410b371cd58f583ca05 /test/fixtures | |
| parent | 4538896ce65156883dc44cc3355435d40d7e682b (diff) | |
| download | conky-theme-udt-f822a250f9b2759207d64cc53b3d80c0c08d2082.tar.gz conky-theme-udt-f822a250f9b2759207d64cc53b3d80c0c08d2082.zip | |
feat: add /proc and /sys parsers with fixture tests
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>
Diffstat (limited to 'test/fixtures')
| -rw-r--r-- | test/fixtures/proc_meminfo | 7 | ||||
| -rw-r--r-- | test/fixtures/proc_stat | 5 | ||||
| -rw-r--r-- | test/fixtures/temp1_input | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/test/fixtures/proc_meminfo b/test/fixtures/proc_meminfo new file mode 100644 index 0000000..9c279aa --- /dev/null +++ b/test/fixtures/proc_meminfo @@ -0,0 +1,7 @@ +MemTotal: 31943076 kB +MemFree: 4291244 kB +MemAvailable: 25627088 kB +Buffers: 123456 kB +Cached: 6789012 kB +SwapTotal: 8388604 kB +SwapFree: 8388604 kB diff --git a/test/fixtures/proc_stat b/test/fixtures/proc_stat new file mode 100644 index 0000000..2914cca --- /dev/null +++ b/test/fixtures/proc_stat @@ -0,0 +1,5 @@ +cpu 209094 2199 135469 11604898 24408 0 946 0 0 0 +cpu0 5294 11 2928 740049 460 0 592 0 0 0 +cpu1 5210 18 2801 740512 431 0 12 0 0 0 +intr 12345678 +ctxt 987654321 diff --git a/test/fixtures/temp1_input b/test/fixtures/temp1_input new file mode 100644 index 0000000..46fba94 --- /dev/null +++ b/test/fixtures/temp1_input @@ -0,0 +1 @@ +53125 |
