From d962915f35c07c652aaf127e7ccb0aad1725e871 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 19 Nov 2016 22:20:38 +0100
Subject: [PATCH] Add uuid.meta test.

---
 test.sh                   | 24 ++++++++----------------
 test/test_files/uuid.meta |  1 -
 2 files changed, 8 insertions(+), 17 deletions(-)
 delete mode 100644 test/test_files/uuid.meta

diff --git a/test.sh b/test.sh
index 4daff6b..c64c2e9 100755
--- a/test.sh
+++ b/test.sh
@@ -8,7 +8,7 @@ cp test/test_files/bar\ baz.md test/test_dir/
 cd test/test_dir
 redo
 cd ../..
-for file in test/test_files/*.html; do
+for file in test/test_files/*.html test/test_files/*.meta; do
   cmp_file=`echo "$file" | sed 's/test_files/test_dir/'`
   printf "== %s diff test ==\n" "$cmp_file"
   diff "$file" "$cmp_file"
@@ -18,18 +18,10 @@ for file in test/test_files/*.html; do
     echo "== test FAILURE =="
   fi
 done
-for file in test/test_files/*meta; do
-  if [ "$file" = "test/test_files/uuid.meta" ]; then
-    true
-    # TODO: validate UUID
-  else
-    cmp_file=`echo "$file" | sed 's/test_files/test_dir/'`
-    printf "== %s diff test ==\n" "$cmp_file"
-    diff "$file" "$cmp_file"
-    if [ "$?" = "0" ]; then
-      echo "== test SUCCESS =="
-    else
-      echo "== test FAILURE =="
-    fi
-  fi
-done
+uuid_file=test/test_dir/uuid.meta
+printf "== %s UUID pattern match test ==\n" "$uuid_file"
+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
+  echo "== test SUCCESS =="
+else
+  echo "== test FAILURE =="
+fi
diff --git a/test/test_files/uuid.meta b/test/test_files/uuid.meta
deleted file mode 100644
index 09e4abd..0000000
--- a/test/test_files/uuid.meta
+++ /dev/null
@@ -1 +0,0 @@
-438b364d-e7e9-4225-952e-1e9ae312026f
-- 
2.30.2