Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testutil: support empty string cmd args
FakeCommand allows unit tests to check which command-line arguments were passed, by recording a log of calls with their arguments. The following examples do not work: 1. shutdown -r "+0" "" 2. echo "" The last argument supplies the wall message, and an empty argument is valid. Having this support in place allows code to simply pass an empty argument for exec.Command(...). The issue is that both the argument and command delimiter uses null characters, which makes the command split operation split on the first occurrence of two null chars, which breaks the examples above. To add support for this: - Change the command delimiter from \000\000 => \000\f\n\r - Update the Calls() function to split the lines correctly.
- Loading branch information