mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Add explicit test case for Capture pos
This commit is contained in:
@@ -499,6 +499,31 @@ test_word_boundaries :: proc(t: ^testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test
|
||||||
|
test_pos_index_explicitly :: proc(t: ^testing.T) {
|
||||||
|
STR :: "This is an island."
|
||||||
|
EXPR :: `\bis\b`
|
||||||
|
|
||||||
|
rex, err := regex.create(EXPR, { .Global })
|
||||||
|
if !testing.expect_value(t, err, nil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer regex.destroy(rex)
|
||||||
|
|
||||||
|
capture, success := regex.match(rex, STR)
|
||||||
|
log.info(capture, success)
|
||||||
|
if !testing.expect(t, success) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer regex.destroy(capture)
|
||||||
|
|
||||||
|
if !testing.expect_value(t, len(capture.pos), 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
testing.expect_value(t, capture.pos[0][0], 5)
|
||||||
|
testing.expect_value(t, capture.pos[0][1], 7)
|
||||||
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
test_non_word_boundaries :: proc(t: ^testing.T) {
|
test_non_word_boundaries :: proc(t: ^testing.T) {
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user