2

I am trying to write unit tests on functions that take in a storage reference as parameters. There is not much great documentation around how to create literals for these types. These include: address payable[] storage, mapping(address=>uint) storage.

IIUC, I could define these values at the contract scope and then declare storage variables that point to them but that just feels like very evil programming. Is there anyway to create storage variables within the scope of a function that I could use when unit testing?

0

Is there anyway to create storage variables within the scope of a function that I could use when unit testing?

I don't believe so. Storage is only used for state variables, which can only be declared at contract scope.

  • that's what i thought...thanks! – brianSan Apr 8 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.