mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Allow key values to be quoted
This commit is contained in:
@@ -246,6 +246,32 @@ func TestNestedMaps(t *testing.T) {
|
||||
expect(t, lx, expectedItems)
|
||||
}
|
||||
|
||||
func TestQuotedKeys(t *testing.T) {
|
||||
expectedItems := []item{
|
||||
{itemKey, "foo", 1},
|
||||
{itemInteger, "123", 1},
|
||||
{itemEOF, "", 1},
|
||||
}
|
||||
lx := lex("foo : 123")
|
||||
expect(t, lx, expectedItems)
|
||||
lx = lex("'foo' : 123")
|
||||
expect(t, lx, expectedItems)
|
||||
lx = lex("\"foo\" : 123")
|
||||
expect(t, lx, expectedItems)
|
||||
}
|
||||
|
||||
func TestQuotedKeysWithSpace(t *testing.T) {
|
||||
expectedItems := []item{
|
||||
{itemKey, " foo", 1},
|
||||
{itemInteger, "123", 1},
|
||||
{itemEOF, "", 1},
|
||||
}
|
||||
lx := lex("' foo' : 123")
|
||||
expect(t, lx, expectedItems)
|
||||
lx = lex("\" foo\" : 123")
|
||||
expect(t, lx, expectedItems)
|
||||
}
|
||||
|
||||
func TestColonKeySep(t *testing.T) {
|
||||
expectedItems := []item{
|
||||
{itemKey, "foo", 1},
|
||||
|
||||
Reference in New Issue
Block a user