summaryrefslogtreecommitdiff
path: root/tests/t.xdg-copy
blob: c062c9528366269c3f9f5dbdb585b0bbf7e0f38c (plain)
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
#!/bin/sh

# Test that running with no args returns usage
# Test that running with 1 arg returns usage
# Test that running with "--help" returns usage

source=`tempfile -d /tmp`
dest="$source-dest"

echo "TESTING 123" > $source

PATH="../scripts:$PATH"

if [ -e $dest ]; then
    rm $dest || ( echo "Existing file $dest could not be removed" && exit 1 )
fi

### COPY existing file properly ###
xdg-copy "$source" "$dest"
err=$?
if [ $err != 0 ]; then
    echo "FAIL  xdg-copy     # xdg-copy returned $err instead of 0 expected"
elif [ ! -e "$dest" ]; then
    echo "FAIL  xdg-copy     # xdg-copy failed to create dest file $dest"
else
    echo "PASS  xdg-copy"
    rm "$dest"
fi