Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
7df1d773
Commit
7df1d773
authored
Dec 16, 2015
by
Tim Swast
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improves readability of Go example test.
parent
1cc541b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
25 deletions
+5
-25
list_people_test.go
examples/list_people_test.go
+5
-25
No files found.
examples/list_people_test.go
View file @
7df1d773
...
...
@@ -21,34 +21,14 @@ func TestWritePersonWritesPerson(t *testing.T) {
}
// [END populate_proto]
writePerson
(
buf
,
&
p
)
want
:=
strings
.
Split
(
`Person ID: 1234
got
:=
buf
.
String
()
want
:=
`Person ID: 1234
Name: John Doe
E-mail address: jdoe@example.com
Home phone #: 555-4321
`
,
"
\n
"
)
got
:=
strings
.
Split
(
buf
.
String
(),
"
\n
"
)
if
len
(
got
)
!=
len
(
want
)
{
t
.
Errorf
(
"writePerson(%s) =>
\n\t
%q has %d lines, want %d"
,
p
.
String
(),
buf
.
String
(),
len
(
got
),
len
(
want
))
}
lines
:=
len
(
got
)
if
lines
>
len
(
want
)
{
lines
=
len
(
want
)
}
for
i
:=
0
;
i
<
lines
;
i
++
{
if
got
[
i
]
!=
want
[
i
]
{
t
.
Errorf
(
"writePerson(%s) =>
\n\t
line %d %q, want %q"
,
p
.
String
(),
i
,
got
[
i
],
want
[
i
])
}
`
if
got
!=
want
{
t
.
Errorf
(
"writePerson(%s) =>
\n\t
%q, want %q"
,
p
.
String
(),
got
,
want
)
}
}
...
...
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