File: lsmtest

package info (click to toggle)
makeself 2.5.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 308 kB
  • sloc: sh: 2,139; makefile: 20
file content (44 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -eu
THIS="$(readlink -f "$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"