Unquoting rules in Desktop Entry spec need more examples
Roman Chistokhodov <[email protected]>
| Newsgroups | gmane.linux.xdg.devel |
|---|---|
| Message-ID | <CADy21kER0MZOzcD9MnbvGd5ayjpjuM+zGPESuS4zH30e+Zm+9g@mail.gmail.com> |
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. _______________________________________________ xdg mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/xdg