Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent omitting empty matches field from complete_reply during json serialization #785

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class AlmondPreprocessor(
Some(extraCode0)
} else
None
case(_, _, t: G#Import) => None
case (_, _, t: G#Import) => None
case (_, code, t) =>
val ident = code
val extraCode0 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ object Complete {
implicit val requestCodec: JsonValueCodec[Request] =
JsonCodecMaker.make
implicit val replyCodec: JsonValueCodec[Reply] =
JsonCodecMaker.make
JsonCodecMaker.makeWithRequiredCollectionFields

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ object ProtocolTests extends TestSuite {
assert(result == expected)
}
}

test("complete_reply") {
test("preserve matches field in json reply even if no match found") {
val reply = Complete.Reply(
matches = Nil,
cursor_start = 0,
cursor_end = 7,
metadata = RawJson.emptyObj
)
val json = writeToString(reply)
assert(json.contains(""""matches":[]"""))
}
}
}

}