Standardize test output format via test/helpers.lua #11

Closed
opened 2026-04-06 11:45:56 +02:00 by michael · 1 comment
Owner

Problem

Test files use inconsistent summary formats. The parent project steurjan
(DAW/steurjan#134) standardized its test output -- daw-lua-common tests
must match so that a unified run_tests.sh can parse all output reliably.

Current summary variations found in test/:

  • All UUID tests passed! [OK] -- [OK] at end, no label
  • All crypto tests passed! [OK] -- same pattern
  • [OK] All 31 yaml tests passed -- no label in parentheses, no count
  • [OK] All 12 time tests passed -- no label
  • [OK] All 11 config_parser tests passed -- no label
  • [OK] All 32 fs tests passed -- no label
  • [OK] All 7 http_client tests passed -- no label

Required change

Add test/helpers.lua with summarize(passed, failed, label):

-- Output: [OK] All N tests passed  (label)
--      or [FAIL] N failed, M passed  (label)

Update all test/test_*.lua files to use helpers.summarize().

Standardized format

[OK] All N tests passed  (label)
[FAIL] N failed, M passed  (label)

Deliverables

  • test/helpers.lua (new file, identical API to DAW/steurjan test/helpers.lua)
  • test/test_uuid.lua updated
  • test/test_json.lua updated
  • test/test_yaml.lua updated
  • test/test_time.lua updated
  • test/test_config_parser.lua updated
  • test/test_fs.lua updated
  • test/test_http_client.lua updated
  • test/test_crypto.lua updated
  • Exit behavior unchanged: os.exit(1) on failure

Notes

  • No change to test logic, only the summary output format
  • helpers.lua is intentionally a copy, not a shared dependency
    (daw-lua-common has no external test dependencies by design)
  • label argument = short module name, e.g. "uuid", "yaml", "crypto"

DAW/steurjan#134 (origin of this standard)

## Problem Test files use inconsistent summary formats. The parent project steurjan (DAW/steurjan#134) standardized its test output -- daw-lua-common tests must match so that a unified `run_tests.sh` can parse all output reliably. Current summary variations found in `test/`: - `All UUID tests passed! [OK]` -- `[OK]` at end, no label - `All crypto tests passed! [OK]` -- same pattern - `[OK] All 31 yaml tests passed` -- no label in parentheses, no count - `[OK] All 12 time tests passed` -- no label - `[OK] All 11 config_parser tests passed` -- no label - `[OK] All 32 fs tests passed` -- no label - `[OK] All 7 http_client tests passed` -- no label ## Required change Add `test/helpers.lua` with `summarize(passed, failed, label)`: ```lua -- Output: [OK] All N tests passed (label) -- or [FAIL] N failed, M passed (label) ``` Update all `test/test_*.lua` files to use `helpers.summarize()`. ## Standardized format ``` [OK] All N tests passed (label) [FAIL] N failed, M passed (label) ``` ## Deliverables - `test/helpers.lua` (new file, identical API to DAW/steurjan test/helpers.lua) - `test/test_uuid.lua` updated - `test/test_json.lua` updated - `test/test_yaml.lua` updated - `test/test_time.lua` updated - `test/test_config_parser.lua` updated - `test/test_fs.lua` updated - `test/test_http_client.lua` updated - `test/test_crypto.lua` updated - Exit behavior unchanged: `os.exit(1)` on failure ## Notes - No change to test logic, only the summary output format - helpers.lua is intentionally a copy, not a shared dependency (daw-lua-common has no external test dependencies by design) - label argument = short module name, e.g. "uuid", "yaml", "crypto" ## Related DAW/steurjan#134 (origin of this standard)
Author
Owner

test/helpers.lua implements summarize(passed, failed, label) in the standardized format. All test_*.lua files use it. Note: test_http_client.lua from the original deliverables list no longer applies -- see #12.

test/helpers.lua implements summarize(passed, failed, label) in the standardized format. All test_*.lua files use it. Note: test_http_client.lua from the original deliverables list no longer applies -- see #12.
michael 2026-07-19 17:56:03 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-lua-common#11
No description provided.