Skip to content

Commit 8467c86

Browse files
committed
fix(test): mock date and shell_time in clock tests for new priority order
The clock _choose_impl now tries EPOCHREALTIME and date before perl, so tests for perl and python must mock the earlier fallbacks to prevent them from being selected first.
1 parent 28da2dc commit 8467c86

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
### Changed
1717
- Split Windows CI test jobs into parallel chunks to avoid timeouts
18+
- Optimize clock: prioritize EPOCHREALTIME over subprocess-based fallbacks
19+
- Cache function discovery to avoid duplicate pipeline per test file
20+
- Reduce subshells in test execution hot path
21+
- Batch coverage recording with in-memory buffering
1822

1923
## [0.33.0](https://github.com/TypedDevs/bashunit/compare/0.32.0...0.33.0) - 2026-02-15
2024

tests/unit/clock_test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function mock_date_seconds() {
2828

2929
function test_now_with_perl() {
3030
bashunit::mock bashunit::clock::shell_time mock_non_existing_fn
31+
bashunit::mock date mock_non_existing_fn
3132
bashunit::mock perl <<<"1720705883457"
3233
bashunit::mock bashunit::dependencies::has_python mock_false
3334
bashunit::mock bashunit::dependencies::has_node mock_false
@@ -124,6 +125,8 @@ function test_now_prefers_shell_time_over_perl() {
124125
}
125126

126127
function test_now_prefers_python_over_node() {
128+
bashunit::mock bashunit::clock::shell_time mock_non_existing_fn
129+
bashunit::mock date mock_non_existing_fn
127130
bashunit::mock perl mock_non_existing_fn
128131
bashunit::mock bashunit::dependencies::has_python mock_true
129132
bashunit::mock python <<<"777777777777"

0 commit comments

Comments
 (0)