3
# Copyright (C) 2012, Benjamin Drung <bdrung@debian.org>
5
# Permission to use, copy, modify, and/or distribute this software for any
6
# purpose with or without fee is hereby granted, provided that the above
7
# copyright notice and this permission notice appear in all copies.
9
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
COMMAND="perl -I ${0%/*}/.. ${0%/*}/../scripts/debchange.pl"
19
. "${0%/*}/shunit2-helper-functions.sh"
22
runCommand "-c ${SHUNIT_TMPDIR}/changelog $1" "" "" 0
26
local start_param="$1"
28
local start_version="$3"
29
local expected_version="$4"
30
rm -f ${SHUNIT_TMPDIR}/changelog
31
success "--create $start_param --package test-package -v $start_version \"Devscripts Test Suite.\""
32
success "$param \"Version test.\""
33
local version=$(dpkg-parsechangelog -l${SHUNIT_TMPDIR}/changelog | sed -n 's/^Version: //p')
34
assertEquals "\"dch $param\" from version $start_version" "$expected_version" "$version"
37
checkDebianVersion() {
38
checkVersion "--vendor Debian -D unstable" "--vendor Debian $1" "$2" "$3"
41
checkUbuntuVersion() {
42
checkVersion "--vendor Debian -D unstable" "--vendor Ubuntu $1" "$2" "$3"
45
testDebianIncrement() {
46
checkDebianVersion "-i" "1.0-1" "1.0-2"
47
checkDebianVersion "-i" "12" "13"
50
testUbuntuIncrement() {
51
checkUbuntuVersion "-i" "12" "12ubuntu1"
52
checkUbuntuVersion "-i" "3.4" "3.4ubuntu1"
53
checkUbuntuVersion "-i" "3.4.5" "3.4.5ubuntu1"
54
checkUbuntuVersion "-i" "5.6-7" "5.6-7ubuntu1"
55
checkUbuntuVersion "-i" "5.6-7.1" "5.6-7.1ubuntu1"
56
checkUbuntuVersion "-i" "5.6-7.1.8" "5.6-7.1.8ubuntu1"
57
checkUbuntuVersion "-i" "2.13-14build5" "2.13-14ubuntu1"
58
checkUbuntuVersion "-i" "0.45-2ubuntu3" "0.45-2ubuntu4"
59
checkUbuntuVersion "-i" "0.45-2ubuntu3.1" "0.45-2ubuntu3.2"
60
checkUbuntuVersion "-i" "0.45-2ubuntu3.1.0" "0.45-2ubuntu3.1.1"
64
checkUbuntuVersion "-R" "3.4" "3.4build1"
65
checkUbuntuVersion "-R" "2.0-4" "2.0-4build1"
66
checkUbuntuVersion "-R" "1.42-4ubuntu5" "1.42-4ubuntu6"
67
checkUbuntuVersion "-R" "0.1-2build3" "0.1-2build4"