summaryrefslogtreecommitdiffstats
path: root/tests/ob_parse_control.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-17 01:23:28 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-17 01:23:28 (EDT)
commite12e99c4fea06eaa13e4d08f4d9001b7f815fe2b (patch)
tree5500182852921d4ac808968b4476417257bd05f8 /tests/ob_parse_control.sh
parentd23cbcd54fb5bc86ad6e00e6a5ae8384bdd8cc0a (diff)
tests/*.sh: Move to tests/lib/
Diffstat (limited to 'tests/ob_parse_control.sh')
-rwxr-xr-xtests/ob_parse_control.sh113
1 files changed, 0 insertions, 113 deletions
diff --git a/tests/ob_parse_control.sh b/tests/ob_parse_control.sh
deleted file mode 100755
index 921d99e..0000000
--- a/tests/ob_parse_control.sh
+++ /dev/null
@@ -1,113 +0,0 @@
-# Tests for ob_parse_control()
-#
-# Copyright (C) 2018, 2019 Patrick McDermott
-#
-# This file is part of opkbuild.
-#
-# opkbuild is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# opkbuild is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with opkbuild. If not, see <http://www.gnu.org/licenses/>.
-
-set -eu
-
-. "${TOP_SRCDIR}/tests/aux/tap-functions.sh"
-. "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}"
-
-LF='
-'
-CONTROL="$(cat <<-'EOF'
- Maintainer: "J. Random Hacker" <jrandom@example.com>
- Build-Depends: opkhelper-3.0,
- libfoo-dev,
- libbar-dev,
- Homepage: http://www.example.com/
- EOF
- )"
-
-plan_ 7
-
-field=0
-
-is()
-{
- local description="${1}"
- local got="${2}"
- local expected="${3}"
- shift 3
-
- if [ "x${got}" = "x${expected}" ]; then
- ok_ -- "${description}"
- else
- not_ok_ -- "${description}"
- diag_ " Failed test '${description}'"
- diag_ " got: '${got}'"
- diag_ " expected: '${expected}'"
- fi
-}
-
-field_1()
-{
- local name="${1}"
- local value="${2}"
- local user_data="${3}"
- shift 3
-
- is 'maintainer field name' "${name}" 'Maintainer'
- is 'maintainer field value' "${value}" \
- '"J. Random Hacker" <jrandom@example.com>'
-
- return 0
-}
-
-field_2()
-{
- local name="${1}"
- local value="${2}"
- local user_data="${3}"
- shift 3
-
- is 'build-depends field name' "${name}" 'Build-Depends'
- is 'build-depends field value' "${value}" \
- "opkhelper-3.0,${LF}libfoo-dev,${LF} libbar-dev,"
-
- return 0
-}
-
-field_3()
-{
- local name="${1}"
- local value="${2}"
- local user_data="${3}"
- shift 3
-
- is 'homepage field name' "${name}" 'Homepage'
- is 'homepage field value' "${value}" 'http://www.example.com/'
-
- return 0
-}
-
-field_4()
-{
- : This should not be reached.
-}
-
-field_cb()
-{
- field=$((${field} + 1))
- "field_${field}" "${@}"
-}
-
-ob_parse_control - field_cb '' 'Maintainer' 'Build-Depends Homepage' <<-EOF
- ${CONTROL}
- EOF
-
-is 'number of parsed fields' "${field}" 3