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