Unquoting rules in Desktop Entry spec need more examples
freeslave93 at gmail.com
Fri Mar 30 17:21:23 UTC 2018
It's really hard to grasp the unquoting rules right.
It would be easier for programmers to implement the spec if there was a
list of examples that could be easily made into unittests on the target
language. Like this:
assert( unescape(`\\$`) == `\$` )
assert( unquote( unescape(`progname "\\$"`) ) == [`progname`, `$`] ) //
clearly say that we need to do both unescape and unquote
/*same story with escaping and quoting*/
Here I used backticks instead quotes to denote strings to avoid escaping on
the language level. It's called raw strings in some programming languages.
Fallible examples also could be added, like this:
assertThrown( unquote(`progname "--dir=%k"`) ) // Field codes must not be
used inside a quoted argument
We could a prepared set of such examples, so anyone who is interested in
implementing the spec could copy this pseudo-code and adapt it to the
language in use and have the ready set of unittests. Also current
implementations could check if their assumptions were right.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the xdg