camera_metadata: Make word breaks work for entry names

- Fixes a bug where word breaks were only inserted once into a string.
- Adds unit tests for word breaks
- Unit tests are now always run when generating metadata

Bug: 12301333
Change-Id: Id604ecd275d026bb8818e56f1af0f03eb66edd41
diff --git a/camera/docs/metadata-parser-sanity-check b/camera/docs/metadata-parser-sanity-check
index 76afc48..386960a 100755
--- a/camera/docs/metadata-parser-sanity-check
+++ b/camera/docs/metadata-parser-sanity-check
@@ -29,6 +29,24 @@
 tmp_tidy1=$(mktemp -t tmp.XXXXXXXXXX)
 tmp_tidy2=$(mktemp -t tmp.XXXXXXXXXX)
 
+function check_test
+{
+    local file="$1"
+    local results
+    results="$(python "$file" 2>&1)"
+    local retval=$?
+    if [[ $retval -ne 0 ]]
+    then
+        echo "$results" >& 2
+        echo "FAILED: Unit tests $file"
+    else
+        echo "SUCCESS: Unit tests $file"
+    fi
+    return $retval
+}
+
+check_test "$thisdir/metadata_model_test.py" || exit 1
+check_test "$thisdir/metadata_helpers_test.py" || exit 1
 python $thisdir/metadata_parser_xml.py $thisdir/metadata_properties.xml $thisdir/metadata_template.mako $tmp_out || exit 1
 tidy -indent -xml -quiet $thisdir/metadata_properties.xml > $tmp_tidy1
 tidy -indent -xml -quiet $tmp_out > $tmp_tidy2