Commit Graph
12 Commits
Author SHA1 Message Date
Nihal AjayakumarandDaniel Hofstetter 372d0a96c5 hostid: remove test_normal superseded by test_output_format
Per review feedback, drop the weaker unanchored test_normal now that
test_output_format's fully-anchored regex covers the same ground.
2026-02-26 08:47:25 +01:00
Nihal AjayakumarandDaniel Hofstetter b372e0ff9e hostid: add output format and help flag tests
The existing test_normal test used the unanchored regex `^[0-9a-f]{8}`,
which checks only the start of stdout. This would incorrectly accept
output like "00000000garbage\n". The source formats output with
`{result:0>8x}` via `writeln!`, producing exactly 8 lowercase hex
digits and a newline.

- Add test_output_format: asserts the complete output matches
  `^[0-9a-f]{8}\n$`, enforcing the full expected line format.
- Add test_help: asserts --help exits with code 0 and stdout contains
  the expected about text. Follows the same pattern as test_arch_help
  in test_arch.rs.

No production code is modified.
2026-02-26 08:47:25 +01:00
Dorian Peron 6e23d4e979 tests: patch tests to simplify imports 2025-07-01 03:36:46 +02:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
Ben Wiederhake f5f8cf08e0 hostid: return correct exit code on error 2024-04-14 15:42:13 +02:00
Sylvestre Ledru bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Daniel Hofstetter 7a888da409 tests: remove all "extern crate" statements 2023-04-10 08:31:31 +02:00
Gilad Naaman b91fadd8f4 Refactored tests for more utilities 2021-04-18 02:32:43 +03:00
Gilad Naaman 81d42aa2b3 Fix some tests to not use CmdResult fields 2021-04-10 23:30:50 +03:00
Sylvestre LedruandGitHub f87b041e27 test(hostid) add a test for hostid (#1533) 2020-06-08 09:09:44 +02:00
Roy Ivy III 1b3bb56e66 tests ~ add missing test_UTIL module files (with 'ToDO' comments)
- common_core utils
- additional 'windows' utils
- additional 'unix' utils
2020-06-02 11:25:09 -05:00