add test for tint::utils::ReplaceAll

The new test proves that the algorithm needs to advance 'pos'
past the replacement string.

Change-Id: Ia8fdf6b2c08d6af09e8e631c1d8661752edcb7ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66660
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/utils/string.h b/src/utils/string.h
index 4465243..2e93f51 100644
--- a/src/utils/string.h
+++ b/src/utils/string.h
@@ -23,7 +23,7 @@
 /// @param str the string to apply replacements to
 /// @param substr the string to search for
 /// @param replacement the replacement string to use instead of `substr`
-/// @returns `str` with all occurrances of `substr` replaced with `replacement`
+/// @returns `str` with all occurrences of `substr` replaced with `replacement`
 inline std::string ReplaceAll(std::string str,
                               const std::string& substr,
                               const std::string& replacement) {
diff --git a/src/utils/string_test.cc b/src/utils/string_test.cc
index ab1e14b..5b18470 100644
--- a/src/utils/string_test.cc
+++ b/src/utils/string_test.cc
@@ -27,6 +27,10 @@
   ASSERT_EQ("xyxybbcc", ReplaceAll("aabbcc", "a", "xy"));
   ASSERT_EQ("aaxyxycc", ReplaceAll("aabbcc", "b", "xy"));
   ASSERT_EQ("aabbxyxy", ReplaceAll("aabbcc", "c", "xy"));
+  // Replacement string includes the searched-for string.
+  // This proves that the algorithm needs to advance 'pos'
+  // past the replacement.
+  ASSERT_EQ("aabxybbxybcc", ReplaceAll("aabbcc", "b", "bxyb"));
 }
 
 }  // namespace