-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Solidity test invoking function in ABI order instead of original source order #812
Comments
@fdouglis Do you have a way to reproduce? Even if you can show the 'fubared' order that might be helpful for diagnosing. |
As I said in my report, I can reproduce this in my system, but I But the very good news is that when you asked me essentially to try harder to come up with a simplified repeatable sample, I noticed something about the contract that broke. I had taken it as a given that I was dealing with a single contract, since in essence my test contract was the only thing I cared about. But I had used a recipe I'd found online to augment my contract with event calls through inheritance rather than simply cutting & pasting. (I'd wanted to include a separate file for each, and couldn't figure out how to do this for the test files, so I wound up pasting in place.) The one that gets the wrong order has this extra contract while without it, it runs properly. Here is the output of truffle -- all tests pass in this simple test, but the order of the tests changes:
Here is TestOrder.sol, without the extra inheritance. The adding stuff was because my original theory was that the amount of work done by a function was affecting when it ran.
Finally, the one with the wrapper, TestOrder2.sol, breaks:
|
@fdouglis Oh cool, thank you! Will check this out . . . |
@fdouglis Haven't worked out why this is happening but as a workaround it looks like if you put The top of your file would look like:
If you have a chance could you verify that's the case? Sorry, thanks. |
@fdouglis This has a fix pending at truffle-compile 45. Not sure it will make it into the next patch release, since that's tomorrow. Thanks again for reporting. We'll leave this issue open until it's available in a some published form. |
@cgewecke How about that ... The whole reason I had it in its own contract was that I wanted to include Debuggable, but in the test directory, I muffed the syntax to include it. I could have sworn I tried the simple import "./XXX" you suggested, and failed. But it worked here, anyway, and it did run the tests in the correct order. Thanks. |
@fdouglis Believe this is fixed in |
Issue
The order of function calls in a Solidity test file doesn't necessarily match the original file.
Steps to Reproduce
I don't know exactly how to reproduce this. For example, I created another file with several functions, and they all execute in the order expected.
Expected Behavior
The first function in the test contract should be called, then the second, and so on.
Actual Results
In my case, the first function is called, then the third, then the fourth, and finally the second.
Environment
truffle version
): Running truffle via node doesn't offer that option. It was built from a clean download of the truffle git as of 2-23-18.node --version
): v6.11.0npm --version
): 3.10.10I verified that the version I was previously using does invoke the functions in the expected order.:
I discussed this with @gnidan in the gitter. We discussed some related changes: trufflesuite/truffle-compile#42 ... I verified that OrderABI was being called in my code. Yet the order was still fubared. Suggestions?
The text was updated successfully, but these errors were encountered: