truptivala / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

containsString helper should cast value to string #202

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
strpos() casts non-string $needle arguments to an integer and treats it as a 
character code. This causes this test to fail:

    assertThat("The answer is 42", containsString(42));

Given that the helper specifically states that the argument is a string, it 
should cast it as such.

Q: Is this break in backward compatibility acceptable? Does anyone use this 
method expecting it to search for a character code? Would a new 
containsCharacter() helper be sufficient?

Original issue reported on code.google.com by dharkn...@gmail.com on 5 Aug 2013 at 9:58