SimpylFold
SimpylFold copied to clipboard
There should be some tests
I think SimpylFold can benefit from some body of automated testcases. We can use vim-vspec for it. I'll drop different versions of what we can do in comments.
https://github.com/YorikSar/SimpylFold/commit/3587afe
The first approach uses nothing special, only vspec. It looks like this will become huge and ugly if we have to write each test like this.
https://github.com/YorikSar/SimpylFold/commit/6fb9f29
This adds some more preprocessing to vspec and allows to embed chunks of Python code to verify folding in testcases. It looks better, but introduces another script for preprocessing.
I'm thinking about pushing it forward and writing preprocessor that would work with *.py files and spit out vspec scripts.
I like the cleaner test syntax of the second example, but I worry that the complexity of the preprocessing code required to implement it runs counter to the "keep it simple" theme of this plugin. I don't ever expect this project to grow a lot of additional features beyond what it already has, so it may end up being worth keeping the test support code simple even if that makes the syntax of the test cases themselves uglier, since we won't need that many tests to cover everything this plugin can do. But I'll reserve final judgment until you've had a chance to hack on this a little more.
In any case, I really appreciate what you're doing!
Still working on #67, I need to perform kind of a substantial refactoring. Maybe YorikStar's project is not finished yet, but.. do you have any official test files I could use in order to ensure that I am not breaking anything? I wouldn't like to offer a pull request with only half of the feature surviving the experience :P
I'm afraid not. It would be a useful addition to the project, but no one has put anything together so far.
I appreciate your desire to refactor responsibly, though. :) If you create even a simple test file for your own purposes, I'd be happy to include it here. Even if it doesn't cover all possible scenarios, it's better than having nothing at all.
Okay, let's do this then. I'll write test files myself and consider the refactoring non-regressive if it works for them. When this happens (`can't tell when) , feel free to warn we if I've missed anything :)