Skip to content

Commit 26a7945

Browse files
committed
refactor: clock_test and runner
1 parent 1cfb8d3 commit 26a7945

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/runner.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ function runner::run_test() {
235235
exec 3>&-
236236

237237
local end_time=$(clock::now)
238-
local duration_ns=$(math::calculate "($end_time - $start_time) ")
239-
local duration=$(math::calculate "$duration_ns / 1000000")
238+
local duration_ns=$((end_time - start_time))
239+
local duration=$((duration_ns / 1000000))
240240

241241
if env::is_verbose_enabled; then
242242
if env::is_simple_output_enabled; then

tests/unit/clock_test.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ function test_now_on_osx_without_perl() {
7979
mock dependencies::has_python mock_false
8080
mock dependencies::has_node mock_false
8181

82-
local expected
83-
expected=$(math::calculate "(1727708708 * 1000000000) + (326957 * 1000)")
84-
assert_same "$expected" "$(clock::now)"
82+
assert_same "1727708708326957000" "$(clock::now)"
8583
}
8684

8785
function test_runtime_in_milliseconds_when_not_empty_time() {

tests/unit/console_results_test.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ function test_not_render_execution_time() {
289289

290290
function test_render_execution_time_on_osx_without_perl() {
291291
if ! check_os::is_macos; then
292-
skip
293-
return
292+
skip && return
294293
fi
295294

296295
mock_macos
@@ -308,8 +307,7 @@ function test_render_execution_time_on_osx_without_perl() {
308307

309308
function test_render_execution_time_on_osx_with_perl() {
310309
if ! check_os::is_macos; then
311-
skip
312-
return
310+
skip && return
313311
fi
314312

315313
local render_result

0 commit comments

Comments
 (0)