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 cp "$expected_files_dir"/test.md "$generated_files_dir"/
36 cp "$expected_files_dir"/foo.rst "$generated_files_dir"/
37 cp "$expected_files_dir"/bar\ baz.md "$generated_files_dir"/
38 cd "$generated_files_dir"
42 # Simple file comparison tests and UUID tests.
43 uuid_test "$generated_files_dir""/uuid.meta"
44 for file in "$expected_files_dir"/*.html "$expected_files_dir"/*.meta; do
45 sed_expression='s/'"$expected_files_dir_escaped"'/'"$generated_files_dir_escaped"'/'
46 cmp_file=`echo "$file" | sed "$sed_expression"`
47 if [ ! "$file" = "$expected_files_dir""/index.html" ] && \
48 echo "$file" | grep -q "\.html$"; then
49 uuid_test "${cmp_file%.html}.uuid"
51 diff_test "$file" "$cmp_file"
54 # To compare feed.xml, ignore all variable date and uuid strings.
55 original_file="$generated_files_dir""/feed.xml"
56 generated_file="$original_file".ignoring
57 expected_file="$expected_files_dir""/feed.xml.ignoring"
58 cat "$original_file" | \
59 sed 's/>[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z</>IGNORE</' | \
60 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</' \
62 diff_test "$expected_file" "$generated_file"