assert_file_contains: print regex on error

In case of assertion failure, seeing the missing regex
in the test output is helpful.

Add unit test on assertion output.

Signed-off-by: Andrea Panattoni <panattoni.andrea@gmail.com>
diff --git a/bats-support b/bats-support
new file mode 160000
index 0000000..3c8fadc
--- /dev/null
+++ b/bats-support
@@ -0,0 +1 @@
+Subproject commit 3c8fadc5097c9acfc96d836dced2bb598e48b009
diff --git a/src/file.bash b/src/file.bash
index 3daf456..355c580 100644
--- a/src/file.bash
+++ b/src/file.bash
@@ -543,7 +543,7 @@
   if ! grep -q "$regex" "$file"; then
     local -r rem="${BATSLIB_FILE_PATH_REM-}"
     local -r add="${BATSLIB_FILE_PATH_ADD-}"
-    batslib_print_kv_single 4 'path' "${file/$rem/$add}" \
+    batslib_print_kv_single 4 'path' "${file/$rem/$add}" 'regex' "$regex" \
       | batslib_decorate 'file does not contain regex' \
       | fail
   fi
diff --git a/test/67-assert-10-assert_file_contains.bats b/test/67-assert-10-assert_file_contains.bats
index 338e8e2..4dfffe8 100644
--- a/test/67-assert-10-assert_file_contains.bats
+++ b/test/67-assert-10-assert_file_contains.bats
@@ -31,3 +31,16 @@
   run assert_file_contains "${TEST_FIXTURE_ROOT}/dir/non-empty-file" "XXX"
   [ "$status" -eq 1 ]
 }
+@test 'assert_file_contains() <file>: show missing regex in case of failure' {
+  local -r file="${TEST_FIXTURE_ROOT}/dir/non-empty-file"
+  run assert_file_contains "$file" "XXX"
+  [ "$status" -eq 1 ]
+  [ "${#lines[@]}" -eq 4 ]
+  [ "${lines[0]}" == '-- file does not contain regex --' ]
+  [ "${lines[1]}" == "path : $file" ]
+  [ "${lines[2]}" == "regex : XXX" ]
+  [ "${lines[3]}" == '--' ]
+}
+
+
+  
\ No newline at end of file