We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The code below passes on 1.4.2. On tip (devel +52c84c3), the short test passes but the long test results in a panic.
cc @michaelmatloob
panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x8 pc=0x57e0a] goroutine 5 [running]: testing.tRunner.func1(0x208336000) /Users/mbrennan/.gimme/versions/go/src/testing/testing.go:446 +0x174 regexp.(*bitState).reset(0x0, 0x13, 0x4, 0x4) /Users/mbrennan/.gimme/versions/go/src/regexp/backtrack.go:70 +0x2a regexp.(*machine).backtrack(0x2082b4ea0, 0x22084693e8, 0x2082b4f78, 0x0, 0x13, 0x4, 0x20835b6c0) /Users/mbrennan/.gimme/versions/go/src/regexp/backtrack.go:314 +0x117 regexp.(*Regexp).doExecute(0x208326320, 0x0, 0x0, 0x0, 0x0, 0x0, 0x197510, 0x13, 0x0, 0x4, ...) /Users/mbrennan/.gimme/versions/go/src/regexp/exec.go:449 +0x413 regexp.(*Regexp).FindStringSubmatch(0x208326320, 0x197510, 0x13, 0x0, 0x0, 0x0) /Users/mbrennan/.gimme/versions/go/src/regexp/regexp.go:883 +0x9a command-line-arguments.TestMustCompile(0x208336000) /Users/mbrennan/civis/gocode/src/github.com/civisanalytics/regex_fail/regexp_test.go:23 +0x525 testing.tRunner(0x208336000, 0x24f330) /Users/mbrennan/.gimme/versions/go/src/testing/testing.go:452 +0xae created by testing.RunTests /Users/mbrennan/.gimme/versions/go/src/testing/testing.go:560 +0xa4b
package main import ( "regexp" "testing" ) var shortRegex, longRegex *regexp.Regexp func TestMustCompile(t *testing.T) { testString := "100 SESAME ST APT 1" shortRegex = regexp.MustCompile(`(ST|STREET|ALLEY|ANNEX|ARCADE|BEND|BOULEVARD|ALY|ANX|ARC|AVE|BYU|BCH|BND|BLVD|BYPASS|BYP|CAUSEWAY|CSWY|CIRCLE|CIR|CIRCLES|CIRS|CORNER|COR|COURT|CT|COURTS|CTS|CRESCENT|CRES|CREST|CRST|CROSSING|XING|CURVE|CURV|DALE|DL|DRIVE|DR|DRIVES|DRS|ESTATE|EST|ESTATES|ESTS|EXPRESSWAY|EXPY|EXTENSION|EXT|EXTENSIONS|EXTS|FORK|FRK|FORKS|FRKS|FREEWAY|FWY|GARDEN|GDN|GARDENS|GDNS|HEIGHTS|HTS|HIGHWAY|HWY|HILL|HL|HILLS|HLS|HOLLOW|HOLW|INLET|INLT|ISLAND|IS|STREETS|STS|SUMMIT|SMT|TERRACE|TER|THROUGHWAY|TRWY|TRACE|TRCE|TRACK|TRAK|TRAFFICWAY|TRFY|TRAIL|TRL|TRAILER|TRLR|TUNNEL|TUNL|TURNPIKE|TPKE|UNDERPASS|UPAS|VALLEY|VLY|VALLEYS|VLYS|VIADUCT|VIA|WALK|WALKS|WAY|WAYS)`) longRegex = regexp.MustCompile(`(ST|STREET|ALLEY|ANNEX|ARCADE|BEND|BOULEVARD|ALY|ANX|ARC|AVE|BYU|BCH|BND|BLVD|BYPASS|BYP|CAUSEWAY|CSWY|CIRCLE|CIR|CIRCLES|CIRS|CORNER|COR|COURT|CT|COURTS|CTS|CRESCENT|CRES|CREST|CRST|CROSSING|XING|CURVE|CURV|DALE|DL|DRIVE|DR|DRIVES|DRS|ESTATE|EST|ESTATES|ESTS|EXPRESSWAY|EXPY|EXTENSION|EXT|EXTENSIONS|EXTS|FORK|FRK|FORKS|FRKS|FREEWAY|FWY|GARDEN|GDN|GARDENS|GDNS|HEIGHTS|HTS|HIGHWAY|HWY|HILL|HL|HILLS|HLS|HOLLOW|HOLW|INLET|INLT|ISLAND|IS|STREETS|STS|SUMMIT|SMT|TERRACE|TER|THROUGHWAY|TRWY|TRACE|TRCE|TRACK|TRAK|TRAFFICWAY|TRFY|TRAIL|TRL|TRAILER|TRLR|TUNNEL|TUNL|TURNPIKE|TPKE|UNDERPASS|UPAS|VALLEY|VLY|VALLEYS|VLYS|VIADUCT|VIA|WALK|WALKS|WAY|WAYS|BREAKAGE)`) t.Logf("short regex string: %s", shortRegex.String()) t.Logf("long regex string: %s", longRegex.String()) shortMatches := shortRegex.FindStringSubmatch(testString) t.Logf("%+v", shortMatches) if shortMatches[0] != "ST" { t.Errorf("short regex failed") } else { t.Logf("short regex passed") } longMatches := longRegex.FindStringSubmatch(testString) t.Logf("%+v", longMatches) if longMatches[0] != "ST" { t.Errorf("long regex failed") } else { t.Logf("long regex passed") } }
The text was updated successfully, but these errors were encountered:
Fixed with a513088
Sorry, something went wrong.
No branches or pull requests
The code below passes on 1.4.2. On tip (devel +52c84c3), the short test passes but the long test results in a panic.
cc @michaelmatloob
backtrace
code
The text was updated successfully, but these errors were encountered: