-
-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter strings that cannot be parsed as Regex no longer cause an SDK …
…crash (#4213) * Fix exception when creating FilterString from string that cannot be parsed as regex * changelog
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.sentry | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertTrue | ||
|
||
class FilterStringTest { | ||
|
||
@Test | ||
fun `turns string into pattern`() { | ||
val filterString = FilterString(".*") | ||
assertTrue(filterString.matches("anything")) | ||
assertEquals(".*", filterString.filterString) | ||
} | ||
|
||
@Test | ||
fun `skips pattern if not a valid regex`() { | ||
// does not throw if the string is not a valid pattern | ||
val filterString = FilterString("I love my mustache {") | ||
assertFalse(filterString.matches("I love my mustache {")) | ||
assertEquals("I love my mustache {", filterString.filterString) | ||
} | ||
} |