waynemoore / sublime-gherkin-formatter

Gherkin Formatter for Sublime Text 2 and 3
MIT License
26 stars 3 forks source link

Allow gherkin files to be auto-formatted on save #19

Closed markalfred closed 3 years ago

waynemoore commented 9 years ago

@markalfred that's great thanks! Any chance you could knock out some tests for that code?

markalfred commented 9 years ago

I'd like to but I'm not sure what could be tested. We'd need to implement some MockEventListener to make sure the event fires and results in auto-formatting -- but that would just be a test of the Mock code, right?

waynemoore commented 9 years ago

It's a fair point. I thought I already had mocks in place that would help you but now I remember I abandoned that approach because I would have had to practically mock the whole of Sublime -- which would wouldn't be worth in IMO ;) I ended up extracting most of the code out of the main .py file and into separate modules so they could be tested with a small subset of Sublime mocks.

So, don't worry about it for now, if sublime-gherkin-formatter.py gets any more complicated than this, I'm going to have to work out a test strategy (quite a few people are using this plugin now and I'd had to deliver something broken).

Thanks again for this contribution, have you tested this on both ST2 and 3?

markalfred commented 9 years ago

Agreed, I started to write the mock system to handle it, but it ended up with exactly that... "mocking the whole of sublime." Let me take a day and play around with this in every situation I can think of to see if I can find any issues. One thing that comes to mind immediately is that this commit may cause some users to think the plugin "broke" if they're not using Gherkin syntax highlighting. It may be better to scope only the "autosave" to gherkin files, and allow the hotkeys to work in any type of file at all.