File: functions.sh

package info (click to toggle)
git-publish 1.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 200 kB
  • sloc: python: 861; sh: 281; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 645 bytes parent folder | download | duplicates (2)
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
26
27
28
29
30
31
32
33
34
35
# Utility functions for test case shell scripts
#
# Copyright 2019 Red Hat, Inc.
#
# Authors:
#   Eduardo Habkost <ehabkost@redhat.com>
#
# This work is licensed under the MIT License.  Please see the LICENSE file or
# http://opensource.org/licenses/MIT.


tail_fake_git_log()
{
    if [ -r "$FAKE_GIT_LOG" ];then
        echo "---- last 5 lines of fake_git log: ----" >&2
        tail -n 5 "$FAKE_GIT_LOG" >&2
        echo "---- end of fake_git log ----" >&2
    fi
}

abort()
{
    echo "TEST FAILURE: $@" >&2
    exit 1
}

assert()
{
    "$@" || abort "Assertion failed: $@"
}

assert_false()
{
    ! "$@" || abort "Assertion failed: ! $@"
}