File: test_install_move.bats

package info (click to toggle)
dh-exec 0.31
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: ansic: 530; perl: 178; makefile: 126; sh: 67
file content (65 lines) | stat: -rwxr-xr-x 1,576 bytes parent folder | download | duplicates (3)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
## -*- shell-script -*-

load "test.lib"

setup () {
        td=$(mktemp -d --tmpdir=.)
        cd "${td}"
}

teardown () {
    cd ..
    rm -rf "${td}"
}

@test "install: moving works" {
    install -d var/lib/dh-exec
    echo foo >var/lib/dh-exec/test-output

    run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
=> var/lib/dh-exec/test-output
EOF

    expect_file "/var/lib/dh-exec/test-output"
    ! [ -f var/lib/dh-exec/test-output ]
}

@test "install: moving from debian/tmp works" {
    install -d debian/tmp/var/lib/dh-exec
    echo foo >debian/tmp/var/lib/dh-exec/test-output

    run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
=> var/lib/dh-exec/test-output
EOF

    expect_file "/var/lib/dh-exec/test-output"
    ! [ -f debian/tmp/var/lib/dh-exec/test-output ]
}

@test "install: rename takes priority over move" {
    install -d var/lib/dh-exec
    echo foo >var/lib/dh-exec/test-output

    run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
var/lib/dh-exec/test-output => var/lib/dh-exec/test-output
EOF

    expect_file "/var/lib/dh-exec/test-output"
    [ -f var/lib/dh-exec/test-output ]
}

@test "install: move can override rename on request" {
    install -d var/lib/dh-exec
    echo foo >var/lib/dh-exec/test-output

    run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec --with-scripts=install-move
var/lib/dh-exec/test-output => var/lib/dh-exec/test-output
EOF

    expect_file "/var/lib/dh-exec/test-output"
    ! [ -f var/lib/dh-exec/test-output ]
}