File: simple-test.sh

package info (click to toggle)
detox 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,500 kB
  • sloc: ansic: 2,496; sh: 1,468; yacc: 234; makefile: 189; lex: 68; php: 32
file content (66 lines) | stat: -rwxr-xr-x 1,183 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
#
# Very simple test suite.
#
# Run:
# 	bin/simple-test.sh
#
# Full Test Suite:
# 	tests/test.sh src/detox
#

set -e

PROJECT_ROOT=$(dirname "$(dirname "$(realpath "$0")")")
DETOX="$PROJECT_ROOT/src/detox"
DETOXRC="$PROJECT_ROOT/etc/detoxrc"

if [ ! -x "$DETOX" ] ; then
	echo "please compile detox first"
	exit 1
fi

echo -n "version: "
$DETOX -V

# -------------------------------------------

# just checking for errors

$DETOX -L -v > /dev/null

# ------------------------------------------

# still just checking for errors

if [ -f "$DETOXRC" ] ; then
	$DETOX -f "$DETOXRC" -L -v > /dev/null
else
	echo "couldn't find detoxrc"
fi

# -------------------------------------------

INPUT="hi there"
OUTPUT="hi_there"

CHECK=$(echo "$INPUT" | $DETOX --inline)
if [ "$CHECK" != "$OUTPUT" ] ; then
	echo "failed to rename \"$INPUT\" to \"$OUTPUT\""
	exit 1
fi

# -------------------------------------------

INPUT="hi - - - there"
OUTPUT="hi-there"

CHECK=$(echo "$INPUT" | $DETOX --inline)
if [ "$CHECK" != "$OUTPUT" ] ; then
	echo "failed to rename \"$INPUT\" to \"$OUTPUT\""
	exit 1
fi

# -------------------------------------------

echo "simple tests passed"