-
Kirill Smelkov authored
This is needed to get proper error reporting in situations where UnquoteChar is used to decode input stream step by step: there if we see truncated version of valid character as input always returning ErrSyntax effectively blocks caller from determining what it was - a real syntax error or unexpected end of stream. Unquote error behaviour is preserved to return ErrSyntax always, because Unquote operates on whole input at once - not as on stream - and anything wrong there should be seen as really an error in syntax. Since UnquoteChar is internally used by Unquote, and we already have Unquote tests to cover all kinds of valid input, we only need to add tests to cover UnquoteChar error behaviour. Though, unfortunately, we cannot easily reuse error-behaviour Unquote tests for this. P.S. My original use-case for this change is ogórek where UnquoteChar is used to decode unicode string encoded in Python pickles: https://github.com/kisielk/og-rek/blob/c7dbf2e4/ogorek.go#L530 Change-Id: I611e7f5795560da488396bc93135a81a56482b75
5c39341f