summaryrefslogtreecommitdiff
path: root/src/test/test-extract-word.c
Commit message (Collapse)AuthorAgeFilesLines
* test: Use TEST macroJan Janssen2021-11-251-19/+5
| | | | | | | | | This converts to TEST macro where it is trivial. Some additional notable changes: - simplify HAVE_LIBIDN #ifdef in test-dns-domain.c - use saved_argc/saved_argv in test-copy.c, test-path-util.c, test-tmpfiles.c and test-unit-file.c
* basic/extract-word: add EXTRACT_RETAIN_SEPARATORS flagLuca Boccassi2021-06-241-0/+52
| | | | | Makes the helpers avoid skipping over the separator(s) in the input string
* test: add test cases for EXTRACT_KEEP_QUOTE and EXTRACT_UNQUOTEYu Watanabe2021-06-211-0/+40
|
* test-extract-word: add a couple more corner casesLuca Boccassi2021-04-081-0/+14
|
* basic/extract-word: rename flagZbigniew Jędrzejewski-Szmek2021-03-111-11/+11
| | | | The flag enables "relaxed mode" for all kinds of unescaping, not just c-unescaping.
* basic/extract-word: allow escape character to be escapedZbigniew Jędrzejewski-Szmek2021-03-111-0/+24
| | | | | | With EXTRACT_UNESCAPE_SEPARATORS, backslash is used to escape the separator. But it wasn't possible to insert the backslash itself. Let's allow this and add test.
* basic/extract_word: try to explain what the various options doZbigniew Jędrzejewski-Szmek2021-03-111-0/+21
| | | | | | | | | | A test for stripping of escaped backslashes without any flags was explicitly added back in 4034a06ddb82ec9868cd52496fef2f5faa25575f. So it seems to be on purpose, though I would say that this is at least surprising and hence deserves a comment. In test-extract-word, add tests for standalone EXTRACT_UNESCAPE_SEPARATORS. Only behaviour combined with EXTRACT_CUNESCAPE was tested.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* test-string-util,test-extract-word: add log headersZbigniew Jędrzejewski-Szmek2020-09-041-0/+6
|
* basic/extract-word: add EXTRACT_UNESCAPE_SEPARATORS modeZbigniew Jędrzejewski-Szmek2020-08-051-0/+40
| | | | | This allows separators to be escaped, for example to allow "a\:b:c", to be treated as "a:b", "c" with ":" as the separator.
* test: add another test case for extract_many_wordsLuca Boccassi2020-08-051-1/+19
| | | | Covers some functionality that we want to use for config tuples
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-041-1/+0
|
* shared/conf-parser,networkd: EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE → ↵Zbigniew Jędrzejewski-Szmek2019-07-171-0/+24
| | | | | | | | | | | | | EXTRACT_UNQUOTE It's hard to even say what exactly this combination means. Escaping is necessary when quoting to have quotes within the string. So the escaping of quote characters is inherently tied to quoting. When unquoting, it seems natural to remove escaping which was done for the quoting purposes. But with both flags we would be expected to re-add this escaping after unqouting? Or maybe keep the escaping which is not necessary for quoting but otherwise present? This all seems too complicated, let's just forbid such usage and always fully unescape when unquoting.
* Rename EXTRACT_QUOTES to EXTRACT_UNQUOTEZbigniew Jędrzejewski-Szmek2019-06-281-27/+27
| | | | | | Whenever I see EXTRACT_QUOTES, I'm always confused whether it means to leave the quotes in or to take them out. Let's say "unquote", like we say "cunescape".
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-1/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* log: minimize includes in log.hLennart Poettering2018-01-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | log.h really should only include the bare minimum of other headers, as it is really pulled into pretty much everything else and already in itself one of the most basic pieces of code we have. Let's hence drop inclusion of: 1. sd-id128.h because it's entirely unneeded in current log.h 2. errno.h, dito. 3. sys/signalfd.h which we can replace by a simple struct forward declaration 4. process-util.h which was needed for getpid_cached() which we now hide in a funciton log_emergency_level() instead, which nicely abstracts the details away. 5. sys/socket.h which was needed for struct iovec, but a simple struct forward declaration suffices for that too. Ultimately this actually makes our source tree larger (since users of the functionality above must now include it themselves, log.h won't do that for them), but I think it helps to untangle our web of includes a tiny bit. (Background: I'd like to isolate the generic bits of src/basic/ enough so that we can do a git submodule import into casync for it)
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* core: fix dependency parsingLennart Poettering2015-11-111-0/+12
| | | | | | | | 3d793d29059a7ddf5282efa6b32b953c183d7a4d broke parsing of unit file names that include backslashes, as extract_first_word() strips those. Fix this, by introducing a new EXTRACT_RETAIN_ESCAPE flag which disables looking at any flags, thus being compatible with the classic FOREACH_WORD() behaviour.
* test-extract-word: Move extract-word tests into their own test caseFilipe Brandenburger2015-10-281-0/+546
Tests for the functions defined in src/basic/extract-word.c. Tested that `make check` still passes as expected.