<commit_before>include nre, unittest

suite "match":
  test "upper bound must be exclusive":
    check("abc".match(re"abc", endpos = 0) == nil)
    check("abc".match(re"abc", endpos = 3) != nil)
  test "examples":
    check("abc".match(re"(\w)").captures[0] == "a")
    check("abc".match(re"(?<letter>\w)").captures["letter"] == "a")
    check("abc".match(re"(\w)\w").captures[-1] == "ab")
    check("abc".match(re"(\w)").captureBounds[0].get == 0..1)
    check("abc".match(re"").captureBounds[-1].get == 0..0)
    check("abc".match(re"abc").captureBounds[-1].get == 0..3)<commit_msg>Add a test case with 0-length match<commit_after>include nre, unittest

suite "match":
  test "upper bound must be exclusive":
    check("abc".match(re"abc", endpos = 0) == nil)
    check("abc".match(re"abc", endpos = 3) != nil)

  test "match examples":
    check("abc".match(re"(\w)").captures[0] == "a")
    check("abc".match(re"(?<letter>\w)").captures["letter"] == "a")
    check("abc".match(re"(\w)\w").captures[-1] == "ab")
    check("abc".match(re"(\w)").captureBounds[0].get == 0..1)
    check("abc".match(re"").captureBounds[-1].get == 0..0)
    check("abc".match(re"abc").captureBounds[-1].get == 0..3)

  test "match test cases":
    check("123".match(re"").matchBounds == 0..0)
{'fraction_non_alphanumeric': 0.26373626373626374, 'fraction_numerical': 0.02511773940345369, 'mean_word_length': 4.141129032258065, 'pattern_counts': {'":': 7, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6909490', 'n_tokens_mistral': 499, 'n_tokens_neox': 472, 'n_words': 78}