pqarrays

Paddy 2016-02-25 Parent:bfe2a4af6bdf Child:9a415db0346a

1:ce9c92fc81ab Go to Latest

pqarrays/parser_test.go

Fix bug parsing empty arrays, make golint and go vet happy. Add comments to make golint happy. Also, because comments are a good thing to have. Turn += 1 and -= 1 into ++ and --, respectively, so golint will be happy. Fix an improperly formated errorf, where a rune was being treated as a string. Thanks, go vet! Fix whitespace parsing, returning the parse functions again instead of just skipping the one character. Now if we have more than one whitespace character in a row, they'll all be skipped. Add a parseStringOrNullOrEnd parse function that will be called after the tokenArrayStart character, to fix a bug where empty arrays were expecting a string or null and getting the array end character. This is only valid after tokenArrayStart, however; in other places where parseSeparatorOrDelim is used, it wouldn't be appropriate. Add a parser test for an empty array.

History
     1.1 --- a/parser_test.go	Sun Apr 19 23:47:36 2015 -0400
     1.2 +++ b/parser_test.go	Thu Feb 25 23:52:05 2016 -0800
     1.3 @@ -9,6 +9,7 @@
     1.4  }
     1.5  
     1.6  var parseTestInputs = map[string][]*string{
     1.7 +	`{}`:                            []*string{},
     1.8  	`{lions}`:                       []*string{strPtr("lions")},
     1.9  	`{lions,tigers}`:                []*string{strPtr("lions"), strPtr("tigers")},
    1.10  	`{lions,tigers,NULL}`:           []*string{strPtr("lions"), strPtr("tigers"), nil},