Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
29fb5d3e
Commit
29fb5d3e
authored
Oct 28, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xml: simplify test
R=golang-dev, adg CC=golang-dev
https://golang.org/cl/5320051
parent
134d6e4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
marshal_test.go
src/pkg/xml/marshal_test.go
+15
-18
No files found.
src/pkg/xml/marshal_test.go
View file @
29fb5d3e
...
@@ -314,27 +314,27 @@ func TestMarshal(t *testing.T) {
...
@@ -314,27 +314,27 @@ func TestMarshal(t *testing.T) {
}
}
var
marshalErrorTests
=
[]
struct
{
var
marshalErrorTests
=
[]
struct
{
Value
interface
{}
Value
interface
{}
E
xpectErr
string
E
rr
string
ExpectKind
reflect
.
Kind
Kind
reflect
.
Kind
}{
}{
{
{
Value
:
make
(
chan
bool
),
Value
:
make
(
chan
bool
),
E
xpectErr
:
"xml: unsupported type: chan bool"
,
E
rr
:
"xml: unsupported type: chan bool"
,
ExpectKind
:
reflect
.
Chan
,
Kind
:
reflect
.
Chan
,
},
},
{
{
Value
:
map
[
string
]
string
{
Value
:
map
[
string
]
string
{
"question"
:
"What do you get when you multiply six by nine?"
,
"question"
:
"What do you get when you multiply six by nine?"
,
"answer"
:
"42"
,
"answer"
:
"42"
,
},
},
E
xpectE
rr
:
"xml: unsupported type: map[string] string"
,
Err
:
"xml: unsupported type: map[string] string"
,
Expect
Kind
:
reflect
.
Map
,
Kind
:
reflect
.
Map
,
},
},
{
{
Value
:
map
[
*
Ship
]
bool
{
nil
:
false
},
Value
:
map
[
*
Ship
]
bool
{
nil
:
false
},
E
xpectErr
:
"xml: unsupported type: map[*xml.Ship] bool"
,
E
rr
:
"xml: unsupported type: map[*xml.Ship] bool"
,
ExpectKind
:
reflect
.
Map
,
Kind
:
reflect
.
Map
,
},
},
}
}
...
@@ -342,14 +342,11 @@ func TestMarshalErrors(t *testing.T) {
...
@@ -342,14 +342,11 @@ func TestMarshalErrors(t *testing.T) {
for
idx
,
test
:=
range
marshalErrorTests
{
for
idx
,
test
:=
range
marshalErrorTests
{
buf
:=
bytes
.
NewBuffer
(
nil
)
buf
:=
bytes
.
NewBuffer
(
nil
)
err
:=
Marshal
(
buf
,
test
.
Value
)
err
:=
Marshal
(
buf
,
test
.
Value
)
if
got
,
want
:=
err
,
test
.
ExpectErr
;
got
==
nil
{
if
err
==
nil
||
err
.
String
()
!=
test
.
Err
{
t
.
Errorf
(
"#%d: want error %s"
,
idx
,
want
)
t
.
Errorf
(
"#%d: marshal(%#v) = [error] %q, want %q"
,
idx
,
test
.
Value
,
err
,
test
.
Err
)
continue
}
else
if
got
.
String
()
!=
want
{
t
.
Errorf
(
"#%d: marshal(%#v) = [error] %q, want %q"
,
idx
,
test
.
Value
,
got
,
want
)
}
}
if
got
,
want
:=
err
.
(
*
UnsupportedTypeError
)
.
Type
.
Kind
(),
test
.
ExpectKind
;
got
!=
want
{
if
kind
:=
err
.
(
*
UnsupportedTypeError
)
.
Type
.
Kind
();
kind
!=
test
.
Kind
{
t
.
Errorf
(
"#%d: marshal(%#v) = [error kind] %s, want %s"
,
idx
,
test
.
Value
,
got
,
want
)
t
.
Errorf
(
"#%d: marshal(%#v) = [error kind] %s, want %s"
,
idx
,
test
.
Value
,
kind
,
test
.
Kind
)
}
}
}
}
}
}
...
...
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