Detect test functions correctly with customized `IFS` variable.

Set `IFS` variable explicitly for `read` to successfully detect the test functions even if the variable was changed globally by the test.

PiperOrigin-RevId: 420356425
diff --git a/src/test/shell/unittest_test.py b/src/test/shell/unittest_test.py
index 1314290..b2e2eb6 100644
--- a/src/test/shell/unittest_test.py
+++ b/src/test/shell/unittest_test.py
@@ -560,6 +560,32 @@
         "WARNING: Both --test_arg and --test_filter specified, ignoring --test_arg"
     )
 
+  def test_custom_ifs_variable_finds_and_runs_test(self):
+    for sharded in (False, True):
+      with self.subTest(sharded=sharded):
+        self.__custom_ifs_variable_finds_and_runs_test(sharded)
+
+  def __custom_ifs_variable_finds_and_runs_test(self, sharded):
+    self.write_file(
+        "thing.sh",
+        textwrap.dedent(r"""
+        IFS=$'\t'
+        function test_foo() {
+          :
+        }
+
+        run_suite "custom IFS test"
+        """))
+
+    result = self.execute_test(
+        "thing.sh",
+        env={} if not sharded else {
+            "TEST_TOTAL_SHARDS": 2,
+            "TEST_SHARD_INDEX": 1
+        })
+    result.assertSuccess("custom IFS test")
+    result.assertTestPassed("test_foo")
+
 
 if __name__ == "__main__":
   unittest.main()