File: test_install_syntax.bats

package info (click to toggle)
dh-exec 0.31
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 324 kB
  • sloc: ansic: 530; perl: 178; makefile: 126; sh: 67
file content (86 lines) | stat: -rwxr-xr-x 2,221 bytes parent folder | download | duplicates (9)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
## -*- shell-script -*-

load "test.lib"

@test "install: calling without arguments is invalid" {
        run_dh_exec src/dh-exec-install
        expect_error "stdin not acceptable"
}

setup () {
        nullfile=$(mktemp --tmpdir=.)
        touch ${nullfile}
}

teardown () {
        rm -rf "${nullfile}"
        rm -rf debian/
}

@test "install: Calling as a she-bang works" {
        run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile} => /var/lib/dh-exec/test-output
foo/bar /tmp/foo
baz/quux
# This is an empty line:


EOF
        expect_output "debian/tmp/dh-exec\."
}

@test "install: trailing whitespace gets correctly stripped" {
        run_dh_exec_with_input .install <<EOF
#! ${top_builddir}/src/dh-exec-install
${nullfile}   =>   /var/lib/dh-exec/test-output-2  
EOF

        expect_output "debian/tmp/dh-exec\..*/var/lib/dh-exec/test-output-2 /var/lib/dh-exec/$"
}

@test "install: calling with an unqualified debian/install works" {
        run_dh_exec src/dh-exec-install debian/install

        expect_error "No such file or directory"
}

@test "install: calling with a manpages file works" {
        run_dh_exec src/dh-exec-install debian/manpages

        expect_error "No such file or directory"
}

@test "install: calling with an unqualified install works" {
        run_dh_exec src/dh-exec-install install

        expect_error "No such file or directory"
}

@test "install: using an invalid filename fails, even if the file exists" {
        run_dh_exec_with_input .invalid <<EOF
#! ${top_builddir}/src/dh-exec-install
EOF

        expect_error "Unsupported filename extension"
}

@test "install: calling with too many arguments fails" {
        run_dh_exec src/dh-exec-install too.install many.install arguments.install

        expect_error "no argument at all"
}

@test "install: calling with a non-existing file does not work" {
        run_dh_exec src/dh-exec-install --invalid-file--.install

        expect_error "can't open --invalid-file--"
}

@test "install: piping passes through unchanged" {
        DH_EXEC_SOURCE="some-file" run_dh_exec src/dh-exec-install <<EOF
${nullfile}   =>   /var/lib/dh-exec/test-output-2
EOF

        expect_output "=>"
}