/usr/share/gocode/src/github.com/dlclark/regexp2/regexp_options_test.go is in golang-github-dlclark-regexp2-dev 1.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | package regexp2
import "testing"
func TestIgnoreCase_Simple(t *testing.T) {
r := MustCompile("aaamatch thisbbb", IgnoreCase)
m, err := r.FindStringMatch("AaAMatch thisBBb")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if m == nil {
t.Fatalf("no match when one was expected")
}
if want, got := "AaAMatch thisBBb", m.String(); want != got {
t.Fatalf("group 0 wanted '%v', got '%v'", want, got)
}
}
func TestIgnoreCase_Inline(t *testing.T) {
r := MustCompile("aaa(?i:match this)bbb", 0)
m, err := r.FindStringMatch("aaaMaTcH ThIsbbb")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if m == nil {
t.Fatalf("no match when one was expected")
}
if want, got := "aaaMaTcH ThIsbbb", m.String(); want != got {
t.Fatalf("group 0 wanted '%v', got '%v'", want, got)
}
}
func TestIgnoreCase_Revert(t *testing.T) {
r := MustCompile("aaa(?-i:match this)bbb", IgnoreCase)
m, err := r.FindStringMatch("AaAMatch thisBBb")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if m != nil {
t.Fatalf("had a match but expected no match")
}
}
|