File: common.sh

package info (click to toggle)
pkg-php-tools 1.49
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 528 kB
  • sloc: php: 1,737; sh: 501; perl: 444; xml: 184; makefile: 17
file content (25 lines) | stat: -rw-r--r-- 610 bytes parent folder | download | duplicates (6)
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
expect_equal() {
  local ret=0
  local output
  output="$(eval $1)" || ret=$?
  if [ "${ret}" != '0' ]; then
    echo "FAIL: $1 ($output) failed with exit code ${ret}"
    return 1
  fi
  if [ "${output}" != "$2" ]; then
    local expected_out=$(mktemp)
    local out=$(mktemp)
    echo "${2}" > "${expected_out}"
    echo "${output}" > "${out}"
    echo "FAIL: $1"
    diff  --label Expected --label Actual -u "$expected_out" "$out"
    rm -f "$expected_out" "$out"
    return 1
  fi
}

_pkgtools() {
  local ret=0
  php -d "include_path=${PWD}/share/php" "${PWD}/bin/pkgtools" "$@" || ret=$?
  return $ret
}