diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-01-05 10:53:01 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-01-05 10:53:01 (EST) |
commit | 837d2a8ad902052d20e2729e7e505d95a593f3b8 (patch) | |
tree | 4710c6c97f2d9b3acef3553e42da9bae4c243068 /tests | |
parent | ddf9028ac7a32f5ac54099e341b059b62da46915 (diff) |
ob_parse_control(): Pass field name and value as args
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/ob_parse_control.sh | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/tests/ob_parse_control.sh b/tests/ob_parse_control.sh index 90bcb0e..26222f2 100755 --- a/tests/ob_parse_control.sh +++ b/tests/ob_parse_control.sh @@ -54,8 +54,12 @@ is() field_1() { - is 'maintainer field name' "${OB_CONTROL_NAME}" 'Maintainer' - is 'maintainer field value' "${OB_CONTROL_VALUE}" \ + local name="${1}" + local value="${2}" + shift 2 + + is 'maintainer field name' "${name}" 'Maintainer' + is 'maintainer field value' "${value}" \ '"J. Random Hacker" <jrandom@example.com>' return 0 @@ -63,8 +67,12 @@ field_1() field_2() { - is 'build-depends field name' "${OB_CONTROL_NAME}" 'Build-Depends' - is 'build-depends field value' "${OB_CONTROL_VALUE}" \ + local name="${1}" + local value="${2}" + shift 2 + + 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 @@ -72,9 +80,12 @@ field_2() field_3() { - is 'homepage field name' "${OB_CONTROL_NAME}" 'Homepage' - is 'homepage field value' "${OB_CONTROL_VALUE}" \ - 'http://www.example.com/' + local name="${1}" + local value="${2}" + shift 2 + + is 'homepage field name' "${name}" 'Homepage' + is 'homepage field value' "${value}" 'http://www.example.com/' return 0 } @@ -87,7 +98,7 @@ field_4() field_cb() { field=$((${field} + 1)) - "field_${field}" + "field_${field}" "${@}" } ob_parse_control - field_cb 'Maintainer' 'Build-Depends Homepage' <<-EOF |