This repository was archived by the owner on Dec 29, 2021. It is now read-only.
This repository was archived by the owner on Dec 29, 2021. It is now read-only.
assert_cmd! unexpected behaviour, which might eat your laundry #22
Closed
Description
This morning I made the following observation:
assert_cmd!(rm foo.bar)
is equivalent toassert_cmd!(rm foo . bar)
.
See simplified Playground example. This is due to current limitations of the macro system. Macros can not access information about whitespaces. Period.
But quotations #15 won't work as expected either assert_cmd!(rm "foo.bar")
will run rm "\"foo.bar\""
.
rm: cannot remove '"foo.bar"': No such file or directory
This turns out to be way more problematic than initially thought...
Interpreting arguments as expressions is also problematic.
- In this world
assert_cmd!(rm "foo.bar")
would work - but
assert_cmd!(rm foo)
could have serious side effects, e.g. iflet foo = "/ -r"
This situation doesn't look good at all.
Metadata
Metadata
Assignees
Labels
No labels