diff --git a/core/modules/simpletest/src/Tests/SimpleTestTest.php b/core/modules/simpletest/src/Tests/SimpleTestTest.php
index 41d114e..358d245 100644
--- a/core/modules/simpletest/src/Tests/SimpleTestTest.php
+++ b/core/modules/simpletest/src/Tests/SimpleTestTest.php
@@ -274,6 +274,16 @@ function confirmStubTestResults() {
     $this->assertTrue($test_id, 'Found test ID in results.');
   }
 
+  function testNoLoop() {
+    try {
+      $this->pass('Calling non-existing function');
+      $this->loopForever();
+    }
+    catch (\Exception $e) {
+      $this->pass('The test doesn\'t loop');
+    }
+  }
+
   /**
    * Fetch the test id from the test results.
    */
