Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
f9138301
Commit
f9138301
authored
Feb 20, 2013
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regexp: use Scanner in exec_test
R=rsc CC=golang-dev
https://golang.org/cl/7381046
parent
9dcf3eee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
src/pkg/regexp/exec_test.go
src/pkg/regexp/exec_test.go
+6
-11
No files found.
src/pkg/regexp/exec_test.go
View file @
f9138301
...
...
@@ -89,7 +89,7 @@ func testRE2(t *testing.T, file string) {
txt
=
f
}
lineno
:=
0
r
:=
bufio
.
NewRead
er
(
txt
)
scanner
:=
bufio
.
NewScann
er
(
txt
)
var
(
str
[]
string
input
[]
string
...
...
@@ -99,16 +99,8 @@ func testRE2(t *testing.T, file string) {
nfail
int
ncase
int
)
for
{
line
,
err
:=
r
.
ReadString
(
'\n'
)
if
err
!=
nil
{
if
err
==
io
.
EOF
{
break
}
t
.
Fatalf
(
"%s:%d: %v"
,
file
,
lineno
,
err
)
}
line
=
line
[
:
len
(
line
)
-
1
]
// chop \n
lineno
++
for
lineno
:=
1
;
scanner
.
Scan
();
lineno
++
{
line
:=
scanner
.
Text
()
switch
{
case
line
==
""
:
t
.
Fatalf
(
"%s:%d: unexpected blank line"
,
file
,
lineno
)
...
...
@@ -204,6 +196,9 @@ func testRE2(t *testing.T, file string) {
t
.
Fatalf
(
"%s:%d: out of sync: %s
\n
"
,
file
,
lineno
,
line
)
}
}
if
err
:=
scanner
.
Err
();
err
!=
nil
{
t
.
Fatalf
(
"%s:%d: %v"
,
file
,
lineno
,
err
)
}
if
len
(
input
)
!=
0
{
t
.
Fatalf
(
"%s:%d: out of sync: have %d strings left at EOF"
,
file
,
lineno
,
len
(
input
))
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment