From bc70c90b8d6bb6c9acca6445e56f1dd4c820eea9 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 11 Mar 2019 19:04:47 -0400 Subject: ob_parse_changelog(): Pass args, not global vars, to cb And update test file. --- (limited to 'tests/ob_parse_changelog.sh') diff --git a/tests/ob_parse_changelog.sh b/tests/ob_parse_changelog.sh index 8c29042..d406d6c 100755 --- a/tests/ob_parse_changelog.sh +++ b/tests/ob_parse_changelog.sh @@ -1,6 +1,6 @@ # Tests for ob_parse_changelog() # -# Copyright (C) 2018 Patrick McDermott +# Copyright (C) 2018, 2019 Patrick McDermott # # This file is part of opkbuild. # @@ -68,28 +68,44 @@ is() entry_1() { - is 'source' "${OB_CHANGELOG_SOURCE}" 'bar' - is 'version' "${OB_CHANGELOG_VERSION}" '4' - is 'distribution' "${OB_CHANGELOG_DISTRIBUTION}" 'dev' - is 'changes' "${OB_CHANGELOG_CHANGES}" "$(cat <<-EOF + local source="${1}" + local version="${2}" + local distribution="${3}" + local changes="${4}" + local maintainer="${5}" + local date="${6}" + shift 6 + + is 'source' "${source}" 'bar' + is 'version' "${version}" '4' + is 'distribution' "${distribution}" 'dev' + is 'changes' "${changes}" "$(cat <<-EOF bar (4) dev * Non-maintainer upload. Rename package and upload elsewhere. EOF )" - is 'maintainer' "${OB_CHANGELOG_MAINTAINER}" \ + is 'maintainer' "${maintainer}" \ '"K. Random Hacker" ' - is 'date' "${OB_CHANGELOG_DATE}" 'Sun, 04 Jan 1970 00:00:00 +0000' + is 'date' "${date}" 'Sun, 04 Jan 1970 00:00:00 +0000' return 0 } entry_2() { - is 'source' "${OB_CHANGELOG_SOURCE}" 'foo' - is 'version' "${OB_CHANGELOG_VERSION}" '3' - is 'distribution' "${OB_CHANGELOG_DISTRIBUTION}" 'trunk' - is 'changes' "${OB_CHANGELOG_CHANGES}" "$(cat <<-EOF + local source="${1}" + local version="${2}" + local distribution="${3}" + local changes="${4}" + local maintainer="${5}" + local date="${6}" + shift 6 + + is 'source' "${source}" 'foo' + is 'version' "${version}" '3' + is 'distribution' "${distribution}" 'trunk' + is 'changes' "${changes}" "$(cat <<-EOF foo (3) trunk @@ -97,26 +113,34 @@ entry_2() * Break all the things. EOF )" - is 'maintainer' "${OB_CHANGELOG_MAINTAINER}" \ + is 'maintainer' "${maintainer}" \ '"J. Random Hacker" ' - is 'date' "${OB_CHANGELOG_DATE}" 'Sat, 03 Jan 1970 00:00:00 +0000' + is 'date' "${date}" 'Sat, 03 Jan 1970 00:00:00 +0000' return 0 } entry_3() { - is 'source' "${OB_CHANGELOG_SOURCE}" 'foo' - is 'version' "${OB_CHANGELOG_VERSION}" '2' - is 'distribution' "${OB_CHANGELOG_DISTRIBUTION}" 'trunk' - is 'changes' "${OB_CHANGELOG_CHANGES}" "$(cat <<-EOF + local source="${1}" + local version="${2}" + local distribution="${3}" + local changes="${4}" + local maintainer="${5}" + local date="${6}" + shift 6 + + is 'source' "${source}" 'foo' + is 'version' "${version}" '2' + is 'distribution' "${distribution}" 'trunk' + is 'changes' "${changes}" "$(cat <<-EOF foo (2) trunk * Reticulated splines. EOF )" - is 'maintainer' "${OB_CHANGELOG_MAINTAINER}" \ + is 'maintainer' "${maintainer}" \ '"J. Random Hacker" ' - is 'date' "${OB_CHANGELOG_DATE}" 'Fri, 02 Jan 1970 00:00:00 +0000' + is 'date' "${date}" 'Fri, 02 Jan 1970 00:00:00 +0000' return 1 } @@ -129,7 +153,7 @@ entry_4() entry_cb() { entry=$((${entry} + 1)) - "entry_${entry}" + "entry_${entry}" "${@}" } ob_parse_changelog - entry_cb <<-EOF -- cgit v0.9.1