Closed Mrodent closed 2 months ago
It looks like your impl
block is missing the faux::methods
attribute. If you want to be able to use the inner fields of a mocked struct then it needs to be in an impl
block where faux::methods
is specified. This is because faux::create
changes the insides of your struct to make it mockable so those fields aren't as accessible anymore.
I am closing this but lmk if you are still having issues
Me again... your example works, as I said.
But when I put
faux = "0.1.10"
under[dependencies]
and then try to use these "faux" directives on my own code (a much simplified testing example for the real app I'm developing), I get a problem error just by the first step, i.e. putting#[faux: create]
in front of thestruct
, like so:... this use of
Rc::new_cyclic
to create aHandlingFramework
is unfortunately necessary. So thestruct
has to be constructed inside that closure.I get this error:
... the field certainly does exist, and
HandlingFramework
is not a "tuple struct" (!) and the compiler's suggestion did not work (see attempt commented out in the above code block).Do you have any explanation for this odd result (all I've done so far is put
#[faux::create]
overpub struct HandlingFramework
)?