Skip to content

Commit

Permalink
Added two additional tests for Unmarshalling a three component Sequen…
Browse files Browse the repository at this point in the history
…ceID with and without embedded quotation marks i.e. 220::222 and "220::222"
  • Loading branch information
Andrew Reslan committed Sep 24, 2015
1 parent 226819e commit e466dff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/github.com/couchbase/sync_gateway/db/sequence_id_test.go
Expand Up @@ -69,6 +69,12 @@ func TestSequenceIDUnmarshalJSON(t *testing.T) {
assertNoError(t, err, "UnmarshalJSON failed")
assert.Equals(t, s, SequenceID{TriggeredBy: 456, Seq: 123})

str = "220::222"
s = SequenceID{}
err = s.UnmarshalJSON([]byte(str))
assertNoError(t, err, "UnmarshalJSON failed")
assert.Equals(t, s, SequenceID{ LowSeq: 220, TriggeredBy: 0, Seq: 222})

str = "\"234\""
s = SequenceID{}
err = s.UnmarshalJSON([]byte(str))
Expand All @@ -80,6 +86,12 @@ func TestSequenceIDUnmarshalJSON(t *testing.T) {
err = s.UnmarshalJSON([]byte(str))
assertNoError(t, err, "UnmarshalJSON failed")
assert.Equals(t, s, SequenceID{TriggeredBy: 567, Seq: 234})

str = "\"220::222\""
s = SequenceID{}
err = s.UnmarshalJSON([]byte(str))
assertNoError(t, err, "UnmarshalJSON failed")
assert.Equals(t, s, SequenceID{ LowSeq: 220, TriggeredBy: 0, Seq: 222})
}

func TestMarshalTriggeredSequenceID(t *testing.T) {
Expand Down

0 comments on commit e466dff

Please sign in to comment.