3

Is it possible? Would it require a existing whitewashed and/or blacklisted datasets, or not? How would you know an exception did not exist?

blunders
  • 3,619
  • 10
  • 43
  • 65
  • 2
    possible duplicate of [How do you unit test regular expressions?](http://stackoverflow.com/questions/488601/how-do-you-unit-test-regular-expressions) – Matthew Whited Oct 20 '10 at 13:03

2 Answers2

3

whitelists and blacklists sounds a good approach, I don't think you can "prove" it will work without exception so empirical verification is appropriate and in keeping with the spirit of unit testing

as you think up more complex/edge-case examples to test with, just add them and see if it still works, thus building a test suite in which you have ever greater levels of confidence

also, answered previously very thoroughly here

How do you unit test regular expressions?

Community
  • 1
  • 1
Brian
  • 6,391
  • 3
  • 33
  • 49
  • **@Brian:** Thanks, that's what I thought, just wanted to make sure I wasn't missing something. – blunders Oct 20 '10 at 13:02
  • np, sometimes it's nice to get a second opinion, so FWIW I would do exactly what you're suggesting – Brian Oct 20 '10 at 13:04
2

You might want to look at the following link with an identical discussion that has several good solutions:

How do you unit test regular expressions?
How do you unit test regular expressions?

Community
  • 1
  • 1
atconway
  • 20,624
  • 30
  • 159
  • 229