go/src/regexp/exec_test.go

// TestRE2 tests this package's regexp API against test cases
// considered during RE2's exhaustive tests, which run all possible
// regexps over a given set of atoms and operators, up to a given
// complexity, over all possible strings over a given alphabet,
// up to a given size. Rather than try to link with RE2, we read a
// log file containing the test cases and the expected matches.
// The log file, re2-exhaustive.txt, is generated by running 'make log'
// in the open source RE2 distribution https://github.com/google/re2/.
//
// The test file format is a sequence of stanzas like:
//
//	strings
//	"abc"
//	"123x"
//	regexps
//	"[a-z]+"
//	0-3;0-3
//	-;-
//	"([0-9])([0-9])([0-9])"
//	-;-
//	-;0-3 0-1 1-2 2-3
//
// The stanza begins by defining a set of strings, quoted
// using Go double-quote syntax, one per line. Then the
// regexps section gives a sequence of regexps to run on
// the strings. In the block that follows a regexp, each line
// gives the semicolon-separated match results of running
// the regexp on the corresponding string.
// Each match result is either a single -, meaning no match, or a
// space-separated sequence of pairs giving the match and
// submatch indices. An unmatched subexpression formats
// its pair as a single - (not illustrated above).  For now
// each regexp run produces two match results, one for a
// “full match” that restricts the regexp to matching the entire
// string or nothing, and one for a “partial match” that gives
// the leftmost first match found in the string.
//
// Lines beginning with # are comments. Lines beginning with
// a capital letter are test names printed during RE2's test suite
// and are echoed into t but otherwise ignored.
//
// At time of writing, re2-exhaustive.txt is 59 MB but compresses to 385 kB,
// so we store re2-exhaustive.txt.bz2 in the repository and decompress it on the fly.
func TestRE2Search(t *testing.T) {}

func testRE2(t *testing.T, file string) {}

var run

func runFull(re, refull *Regexp, text string) ([]int, string) {}

func runPartial(re, refull *Regexp, text string) ([]int, string) {}

func runFullLongest(re, refull *Regexp, text string) ([]int, string) {}

func runPartialLongest(re, refull *Regexp, text string) ([]int, string) {}

var match

func matchFull(re, refull *Regexp, text string) (bool, string) {}

func matchPartial(re, refull *Regexp, text string) (bool, string) {}

func matchFullLongest(re, refull *Regexp, text string) (bool, string) {}

func matchPartialLongest(re, refull *Regexp, text string) (bool, string) {}

func isSingleBytes(s string) bool {}

func tryCompile(s string) (re *Regexp, err error) {}

func parseResult(t *testing.T, file string, lineno int, res string) []int {}

// TestFowler runs this package's regexp API against the
// POSIX regular expression tests collected by Glenn Fowler
// at http://www2.research.att.com/~astopen/testregex/testregex.html.
func TestFowler(t *testing.T) {}

var notab

func testFowler(t *testing.T, file string) {}

func parseFowlerResult(s string) (ok, compiled, matched bool, pos []int) {}

var text

func makeText(n int) []byte {}

func BenchmarkMatch(b *testing.B) {}

func BenchmarkMatch_onepass_regex(b *testing.B) {}

var benchData

var benchSizes

func TestLongest(t *testing.T) {}

// TestProgramTooLongForBacktrack tests that a regex which is too long
// for the backtracker still executes properly.
func TestProgramTooLongForBacktrack(t *testing.T) {}