Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Delta Between Two Patch Sets: src/pkg/regexp/exec_test.go

Issue 12485044: code review 12485044: undo CL 12486043 / ab644299d124 (Closed)
Left Patch Set: Created 11 years, 7 months ago
Right Patch Set: diff -r ab644299d124 https://go.googlecode.com/hg/ Created 11 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/path/match.go ('k') | src/pkg/regexp/regexp.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package regexp 5 package regexp
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "compress/bzip2" 9 "compress/bzip2"
10 "fmt" 10 "fmt"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 i := 0 286 i := 0
287 n = 0 287 n = 0
288 for j := 0; j <= len(res); j++ { 288 for j := 0; j <= len(res); j++ {
289 if j == len(res) || res[j] == ' ' { 289 if j == len(res) || res[j] == ' ' {
290 // Process a single pair. - means no submatch. 290 // Process a single pair. - means no submatch.
291 pair := res[i:j] 291 pair := res[i:j]
292 if pair == "-" { 292 if pair == "-" {
293 out[n] = -1 293 out[n] = -1
294 out[n+1] = -1 294 out[n+1] = -1
295 } else { 295 } else {
296 » » » » k := strings.IndexByte(pair, '-') 296 » » » » k := strings.Index(pair, "-")
297 if k < 0 { 297 if k < 0 {
298 t.Fatalf("%s:%d: invalid pair %s", file, lineno, pair) 298 t.Fatalf("%s:%d: invalid pair %s", file, lineno, pair)
299 } 299 }
300 lo, err1 := strconv.Atoi(pair[:k]) 300 lo, err1 := strconv.Atoi(pair[:k])
301 hi, err2 := strconv.Atoi(pair[k+1:]) 301 hi, err2 := strconv.Atoi(pair[k+1:])
302 if err1 != nil || err2 != nil || lo > hi { 302 if err1 != nil || err2 != nil || lo > hi {
303 t.Fatalf("%s:%d: invalid pair %s", file, lineno, pair) 303 t.Fatalf("%s:%d: invalid pair %s", file, lineno, pair)
304 } 304 }
305 out[n] = lo 305 out[n] = lo
306 out[n+1] = hi 306 out[n+1] = hi
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 flag := field[0] 449 flag := field[0]
450 switch flag[0] { 450 switch flag[0] {
451 case '?', '&', '|', ';', '{', '}': 451 case '?', '&', '|', ';', '{', '}':
452 // Ignore all the control operators. 452 // Ignore all the control operators.
453 // Just run everything. 453 // Just run everything.
454 flag = flag[1:] 454 flag = flag[1:]
455 if flag == "" { 455 if flag == "" {
456 continue Reading 456 continue Reading
457 } 457 }
458 case ':': 458 case ':':
459 » » » i := strings.IndexByte(flag[1:], ':') 459 » » » i := strings.Index(flag[1:], ":")
460 if i < 0 { 460 if i < 0 {
461 t.Logf("skip: %s", line) 461 t.Logf("skip: %s", line)
462 continue Reading 462 continue Reading
463 } 463 }
464 flag = flag[1+i+1:] 464 flag = flag[1+i+1:]
465 case 'C', 'N', 'T', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': 465 case 'C', 'N', 'T', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
466 t.Logf("skip: %s", line) 466 t.Logf("skip: %s", line)
467 continue Reading 467 continue Reading
468 } 468 }
469 469
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 t.Fatal(err) 706 t.Fatal(err)
707 } 707 }
708 if g, w := re.FindString("ab"), "a"; g != w { 708 if g, w := re.FindString("ab"), "a"; g != w {
709 t.Errorf("first match was %q, want %q", g, w) 709 t.Errorf("first match was %q, want %q", g, w)
710 } 710 }
711 re.Longest() 711 re.Longest()
712 if g, w := re.FindString("ab"), "ab"; g != w { 712 if g, w := re.FindString("ab"), "ab"; g != w {
713 t.Errorf("longest match was %q, want %q", g, w) 713 t.Errorf("longest match was %q, want %q", g, w)
714 } 714 }
715 } 715 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b