Sample Header Ad - 728x90

How to write automated tests for zsh completion?

4 votes
2 answers
808 views
I have a project in which I automatically generate zsh completion functions. As I work on it, I've found corner cases and bugs which I'm just writing down and making sure to re-test when I make changes. Obviously, I want to write a proper testsuite, but I can't figure out how. For bash completions, testing is quite easy -- set COMP_* variables, run the function, and check COMP_REPLY. I'd like to do something similar for zsh. I've read the compsys docs to the best of my ability, but I'm not seeing a solution. I'd like to set the context by hand, run my completions, and then see an array of descriptions or something. Has anyone found a way to test completions?
Asked by sirosen (143 rep)
Sep 11, 2021, 08:22 PM
Last activity: Feb 5, 2025, 06:06 PM