JoshMcguigan / shell_completion

Write shell completion scripts in pure Rust
Apache License 2.0
133 stars 6 forks source link

integration testing #5

Open JoshMcguigan opened 5 years ago

JoshMcguigan commented 5 years ago

Currently all testing in this crate is done at the unit level. While unit testing is useful for verification of some behavior, integration testing will be necessary to prove we are correctly interacting with the shell.

Can we spin up a bash process within a test, then cause it to trigger a completion script of our making? I believe this would involve a few things:

  1. compiling the completion script we want to test
  2. starting a bash process
  3. adding our completion script binary to the path of our bash process (maybe we can get around this if we put the binary in the same directory we trigger the completion?)
  4. use complete to assign our completion binary to some other command
  5. enter some text and trigger a completion
  6. make assertions in our test about the completions that the shell shows

I am very much open to feedback on the best way to pull this off, even if it means completely moving away from the steps above.