File: print-at.sh

package info (click to toggle)
yabasic 1%3A2.90.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,104 kB
  • sloc: ansic: 12,214; sh: 4,417; makefile: 21
file content (39 lines) | stat: -rwxr-xr-x 796 bytes parent folder | download | duplicates (5)
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
#!/bin/bash

#
# Test printing at specific position
# Use tmux as a remote control
#

# Prepare variables
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
EXPECTED="abc"

# start tmux
tmux -u new-session -d -x 80 -y 20 -s print-at

# Start yabasic within tmux-session and supply input
tmux send -l -t print-at "./yabasic tests/resources/print-at.yab"
tmux send -t print-at ENTER
sleep 2

# Get and compare output of script from tmux
FOUND=`tmux capture-pane -t print-at -p`
grep -q "$EXPECTED" <<EOF
$FOUND
EOF
RET=$?

# End tmux session
tmux kill-session -t print-at

# Evaluate result
if [ $RET -ne 0 ] ; then
    echo "Did not find expected string >>$EXPECTED<<"
    echo "Found this instead:"
    echo $FOUND
    exit 1
fi

echo "Found expected string >>$EXPECTED<<"
exit 0