Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nitely committed Nov 30, 2023
1 parent 93b3839 commit 5e447c3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/tests2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,14 @@ test "treplace":
check "aaa".replace(re2"a", "b", 1) == "baa"
check "Nim is awesome!".replace(re2"(\w\B)", "$1_") ==
"N_i_m i_s a_w_e_s_o_m_e!"
check "a".replace(re2"(a)|(b)", "m($1)") == "m(a)"
check "a".replace(re2"(a)|(b)", "m($2)") == "m()"
check "a".replace(re2"(b)|(a)", "m($2)") == "m(a)"
check "a".replace(re2"(b)|(a)", "m($1)") == "m()"
check "a".replace(re2"(a)|()", "m($1)") == "m(a)m()"
check "a".replace(re2"(a)|()", "m($2)") == "m()m()"
check "a".replace(re2"()|(a)", "m($2)") == "m()am()"
check "a".replace(re2"()|(a)", "m($1)") == "m()am()"

block:
proc by(m: RegexMatch2, s: string): string =
Expand Down

0 comments on commit 5e447c3

Please sign in to comment.