el-mock.el icon indicating copy to clipboard operation
el-mock.el copied to clipboard

Mock functions with many (or unknown number of) parameters

Open DamienCassou opened this issue 7 years ago • 1 comments

When a function takes many parameters, using mock may require passing many stars * which is inconvenient. When a function takes an unknown number of parameters, things get worse (e.g., mocking message or call-process). Would it make sense to let (mock (message *)) mean "any call to message with at least 1 parameter" ? More generally, (mock (FUNC arg1 arg2 ... argn)) could mean "any call to FUNC with first n arguments matching arg(i) and potentially more unconstrained arguments".

Would pcase be of any help?

DamienCassou avatar Apr 14 '17 19:04 DamienCassou

Perhaps, maybe we could add a ** parameter to mock for these cases.

telotortium avatar Mar 30 '22 20:03 telotortium