Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
e5043ff0
Commit
e5043ff0
authored
Oct 17, 2017
by
Brendan O'Brien
Committed by
Steven Allen
Nov 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add basic single quote test, restore key test on marshal cases
parent
5fc52816
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
key_test.go
key_test.go
+11
-0
No files found.
key_test.go
View file @
e5043ff0
...
...
@@ -163,6 +163,7 @@ func TestKeyMarshalJSON(t *testing.T) {
err
string
}{
{
NewKey
(
"/a/b/c"
),
[]
byte
(
"
\"
/a/b/c
\"
"
),
""
},
{
NewKey
(
"/shouldescapekey
\"
/with/quote"
),
[]
byte
(
"
\"
/shouldescapekey
\"
/with/quote
\"
"
),
""
},
}
for
i
,
c
:=
range
cases
{
...
...
@@ -173,6 +174,16 @@ func TestKeyMarshalJSON(t *testing.T) {
if
!
bytes
.
Equal
(
c
.
data
,
out
)
{
t
.
Errorf
(
"case %d value mismatch: expected: %s, got: %s"
,
i
,
string
(
c
.
data
),
string
(
out
))
}
if
c
.
err
==
""
{
key
:=
Key
{}
if
err
:=
key
.
UnmarshalJSON
(
out
);
err
!=
nil
{
t
.
Errorf
(
"case %d error parsing key from json output: %s"
,
i
,
err
.
Error
())
}
if
!
c
.
key
.
Equal
(
key
)
{
t
.
Errorf
(
"case %d parsed key from json output mismatch. expected: %s, got: %s"
,
i
,
c
.
key
.
String
(),
key
.
String
())
}
}
}
}
...
...
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