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 expected_files_dir_escaped="test\\/test_files"
30 generated_files_dir="test/test_dir"
31 generated_files_dir_escaped="test\\/test_dir"
32 rm -rf "$generated_files_dir"
33 ./add_dir.sh "$generated_files_dir"
35 cd "$generated_files_dir"
37 cp "$working_dir/$expected_files_dir"/test.md .
39 cp "$working_dir/$expected_files_dir"/bar\ baz.md .
41 cp "$working_dir/$expected_files_dir"/foo.rst .
45 # Simple file comparison tests and UUID tests.
46 uuid_test "$generated_files_dir""/metadata/uuid"
47 for file in "$expected_files_dir"/*.html "$expected_files_dir"/metadata/*; do
48 sed_expression='s/'"$expected_files_dir_escaped"'/'"$generated_files_dir_escaped"'/'
49 cmp_file=`echo "$file" | sed "$sed_expression"`
50 if [ ! "$file" = "$expected_files_dir""/index.html" ] && \
51 echo "$file" | grep -q "\.html$"; then
52 basename=$(basename "$cmp_file")
53 uuid_test "${generated_files_dir}/metadata/${basename%.html}.uuid"
55 diff_test "$file" "$cmp_file"
58 # To compare feed.xml, ignore all variable date and uuid strings.
59 original_file="$generated_files_dir""/feed.xml"
60 generated_file="$original_file".ignoring
61 expected_file="$expected_files_dir""/feed.xml.ignoring"
62 cat "$original_file" | \
63 sed 's/>[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z</>IGNORE</' | \
64 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</' \
66 diff_test "$expected_file" "$generated_file"
69 # Check symbolic links.
70 for file in "$generated_files_dir"/feed.xml "$generated_files_dir"/*.html; do
71 basename=$(basename "$file")
72 linkname=$(readlink "$generated_files_dir/public/$basename")
73 printf "== public/%s symbolic link test ==\n" "$basename"
74 if [ "$working_dir/$generated_files_dir/$basename" = "$linkname" ]; then
75 echo "== test SUCCESS =="
77 echo "== test FAILURE =="