Files
nvm/test/fast/Unit tests/assert_ok
Андрій Шовкошитний 20d52b6419 [tests] remove double-substitution in assert_ok and assert_not_ok
Co-authored-by: Андрій Шовкошитний <198119344+enlightened88@users.noreply.github.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2026-04-23 17:16:32 +03:00

18 lines
433 B
Bash
Executable File

#!/bin/sh
die () { echo "$@" ; exit 1; }
\. ../../common.sh
_returns_zero() { return 0; }
_returns_nonzero() { return 1; }
# assert_ok should pass for a zero-exit function
assert_ok _returns_zero \
|| die 'assert_ok failed on a function that returns 0'
# assert_ok should fail for a non-zero-exit function
if (assert_ok _returns_nonzero 2>/dev/null); then
die 'assert_ok incorrectly passed for a function that returns 1'
fi