realize icon indicating copy to clipboard operation
realize copied to clipboard

Unit test, mock exec command in a smart way

Open asoseil opened this issue 7 years ago • 3 comments

Missing unit test for some files. We should find a way to make a specific mock for exec.Command. In this case, channels are involved and there are multiple answers to consider. A classic exec.Command mock doesn't seem right.

asoseil avatar Oct 16 '17 21:10 asoseil

One solution doesn't fit all. But mocking based on where the code flow is happening makes sense. exec.command is being used here. An interface that can execute the commands and implementing a mock struct of the interface is a good option.

smothiki avatar Oct 17 '17 00:10 smothiki

I can help with it. External mock libraries can be used?

rodrigo-brito avatar Oct 21 '17 23:10 rodrigo-brito

yes, this isn't a problem

asoseil avatar Oct 22 '17 09:10 asoseil