6 printf "== %s UUID pattern match test ==\n" "$uuid_file"
7 if cat "$uuid_file" | grep -Eq "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; then
8 echo "== test SUCCESS =="
10 echo "== test FAILURE =="
18 printf "== %s diff test ==\n" "$generated_file"
19 diff "$expected_file" "$generated_file"
20 if [ "$?" = "0" ]; then
21 echo "== test SUCCESS =="
23 echo "== test FAILURE =="
27 # Set up test directory.
28 expected_files_dir="test/test_files"
29 generated_files_dir="test/test_dir"
30 rm -rf "$generated_files_dir"
31 ./add_dir.sh "$generated_files_dir"
33 cd "$generated_files_dir"
35 cp "$working_dir/$expected_files_dir"/test.md .
37 cp "$working_dir/$expected_files_dir"/bar\ baz.md .
39 cp "$working_dir/$expected_files_dir"/foo.rst .
43 # Compare metadata files.
44 uuid_test "$generated_files_dir""/metadata/uuid"
45 for file in "$expected_files_dir"/metadata/*; do
46 basename=$(basename "$file")
47 cmp_file="$generated_files_dir/metadata/$basename"
48 diff_test "$file" "$cmp_file"
51 # Compare generated HTML files. Ignore variable dates.
52 for file in "$expected_files_dir"/*.html.ignoring; do
53 basename=$(basename "$file")
54 cmp_file="$generated_files_dir/${basename%.ignoring}"
55 if [ ! "$file" = "$expected_files_dir""/index.html.ignoring" ]; then
56 uuid_test "${generated_files_dir}/metadata/${basename%.html.ignoring}.uuid"
58 generated_file="$cmp_file".ignoring
60 sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/IGNORE/g' | \
61 sed 's/IGNORET[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z/IGNORE/g' | \
62 sed 's/IGNORE [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\} (UTC)/IGNORE/g' \
64 diff_test "$file" "$generated_file"
67 # Compare feed files. Ignore variable dates and UUIDs.
68 original_file="$generated_files_dir""/feed.xml"
69 generated_file="$original_file".ignoring
70 expected_file="$expected_files_dir""/feed.xml.ignoring"
71 cat "$original_file" | \
72 sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z/IGNORE/g' | \
73 sed 's/urn:uuid:[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/urn:uuid:IGNORE/g' \
75 diff_test "$expected_file" "$generated_file"
78 # Check symbolic links.
79 for file in "$generated_files_dir"/feed.xml "$generated_files_dir"/*.html; do
80 basename=$(basename "$file")
81 linkname=$(readlink "$generated_files_dir/public/$basename")
82 printf "== public/%s symbolic link test ==\n" "$basename"
83 if [ "$working_dir/$generated_files_dir/$basename" = "$linkname" ]; then
84 echo "== test SUCCESS =="
86 echo "== test FAILURE =="