1 /**
   2  * JDK-8007522: IllegalStateException thrown from String.prototype.search function
   3  *
   4  * @test
   5  * @run
   6  */
   7 
   8 var str = "hello";
   9 // search used to result in IllegalStateException
  10 if (str.search(/foo/g) != -1) {
  11     fail("String.prototype.search failed");
  12 }
  13