mirror of
https://github.com/megastep/makeself.git
synced 2025-12-24 11:51:16 +08:00
* move from bashunit to shunit2 move run-tests.sh to test simplify build.yml * back shunit2 to submodule
45 lines
1.1 KiB
Bash
45 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -eu
|
|
THIS="$(realpath "$0")"
|
|
THISDIR="$(dirname "${THIS}")"
|
|
SRCDIR="$(dirname "${THISDIR}")"
|
|
|
|
################################################################################
|
|
|
|
# Take makeself options, generate a predefined archive, print --lsm to stdout.
|
|
#
|
|
# $@ : makeself options
|
|
withlsm() (
|
|
cd "${SRCDIR}"
|
|
mkdir -p lsmtest
|
|
./makeself.sh "$@" ./lsmtest ./lsmtest.run lsmtest ls -lah >/dev/null 2>&1
|
|
assertEquals "$?" 0 >&2
|
|
./lsmtest.run --lsm
|
|
assertEquals "$?" 0 >&2
|
|
rm -rf lsmtest lsmtest.run
|
|
)
|
|
|
|
test_lsm_empty() {
|
|
printf '' >lsm_empty.txt
|
|
wc lsm_empty.txt
|
|
withlsm --lsm lsm_empty.txt
|
|
rm -f lsm_empty.txt
|
|
}
|
|
|
|
test_lsm_one_line() {
|
|
printf 'one line\n' >lsm_one_line.txt
|
|
withlsm --lsm lsm_one_line.txt
|
|
rm -f lsm_one_line.txt
|
|
}
|
|
|
|
test_lsm_one_line_without_nl() {
|
|
printf 'one line without nl' >lsm_one_line_without_nl.txt
|
|
withlsm --lsm lsm_one_line_without_nl.txt
|
|
rm -f lsm_one_line_without_nl.txt
|
|
}
|
|
|
|
################################################################################
|
|
|
|
# Load and run shUnit2.
|
|
source "./shunit2/shunit2"
|