-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrun_tests.sh
executable file
·54 lines (42 loc) · 1.53 KB
/
run_tests.sh
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
#!/bin/bash
# See my ans: https://stackoverflow.com/a/60157372/4561887
FULL_PATH_TO_HERE="$(realpath "$0")"
DIRECTORY="$(dirname "$FULL_PATH_TO_HERE")"
starting_dir="$(pwd)"
cd "$DIRECTORY"
test_num=0
test_pdf2searchablepdf() {
((test_num++))
echo -e "============================ START OF TEST $test_num ==============================="
echo -e "=== Running 'pdf2searchablepdf $@' ==="
echo -e "----------------------------------------------------------------------------"
pdf2searchablepdf "$@"
echo -e "=== END TEST $test_num ===\n"
}
# First, ensure the user has installed `pdf2searchablepdf`
if [ ! -f ~/bin/pdf2searchablepdf ]; then
echo "Installing pdf2searchablepdf"
./install.sh
fi
# ===========
# Tests
# ===========
run_all_tests() {
# Print help menu
test_pdf2searchablepdf -h
test_pdf2searchablepdf -?
# Print version
test_pdf2searchablepdf -v
# Convert some PDFs into searchable PDFs
test_pdf2searchablepdf "tests/pdfs/test1.pdf"
test_pdf2searchablepdf "tests/pdfs/test1_edited_w_foxit.pdf"
test_pdf2searchablepdf "tests/pdfs/Wikipedia_pdf_screenshot.pdf"
# Convert a whole directory of images into a single, searchable pdf:
test_pdf2searchablepdf "tests/imgs"
# Convert a single image (NOT IMPLEMENTED YET)
# test_pdf2searchablepdf tests/pdfs/Wikipedia_pdf_screenshot.png
}
time run_all_tests
# cd back to the starting dir in case this script is run as a part of a user's main process with
# a trailing `&`, rather than as a subprocess.
cd "$starting_dir"