Improve strings::pairs test.

Improve strings::pairs test for repeated keys and invalid pairs, as
per function documentation.

From: Ian Downes <ian.downes@gmail.com>
Review: https://reviews.apache.org/r/14821