-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·38 lines (32 loc) · 783 Bytes
/
Copy pathtest.sh
File metadata and controls
executable file
·38 lines (32 loc) · 783 Bytes
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
#!/bin/sh
readme="${1:-README.md}"
EXIT=
assert () {
if [ "$1" != "$2" ]; then
echo "expected: $1"
echo "result: $2"
EXIT=1
fi
}
rate_limit() {
if [ "$RATELIMIT" ]; then
echo "Rate limiting"
sleep 5
fi
}
echo "Fetch wikipedia homepage"
xbps-fetch -o /tmp/wikipedia.html https://www.wikipedia.org
e="$(xbps-digest /tmp/wikipedia.html)"
r="$(./purr r https://www.wikipedia.org | xbps-digest)"
assert "$e" "$r"
echo "Pastebin and retrieve - unencrypted"
e="$(xbps-digest "$readme")"
r="$(./purr r $(./purr s "$readme") | xbps-digest)"
assert "$e" "$r"
rate_limit
echo "Pastebin and retrieve - encrypted"
e="$(xbps-digest "$readme")"
r="$(./purr -e r $(./purr -e s "$readme") | xbps-digest)"
assert "$e" "$r"
# TODO: find some reliable way of testing gemi
exit $EXIT