test.bmx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. SuperStrict
  2. Framework Text.Regex
  3. Import BRL.MaxUnit
  4. New TTestSuite.run()
  5. Type TRegexTest Extends TTest
  6. Method test() { test }
  7. End Method
  8. End Type
  9. Type TRegexNoOptionsTest Extends TTest
  10. Field options:TRegExOptions
  11. Method setup() { before }
  12. options = New TRegExOptions
  13. End Method
  14. Method testCaseSensitivePattern() { test }
  15. options.onlyPatternOptions = True
  16. Local regex:TRegEx = New TRegEx("hello", options)
  17. AssertNotNull(regex.Find("hello"))
  18. AssertNull(regex.Find("Hello"))
  19. regex:TRegEx = New TRegEx("(?i)hello", options)
  20. AssertNotNull(regex.Find("hello"))
  21. AssertNotNull(regex.Find("Hello"))
  22. AssertNotNull(regex.Find("HeLLo"))
  23. End Method
  24. Method testCaseSensitiveOptions() { test }
  25. options.caseSensitive = True
  26. Local regex:TRegEx = New TRegEx("hello", options)
  27. AssertNotNull(regex.Find("hello"))
  28. AssertNull(regex.Find("Hello"))
  29. options.caseSensitive = False
  30. regex = New TRegEx("hello", options)
  31. AssertNotNull(regex.Find("hello"))
  32. AssertNotNull(regex.Find("Hello"))
  33. AssertNotNull(regex.Find("HeLLo"))
  34. End Method
  35. End Type