Open DivineDominion opened 4 months ago
Test contexts implemented with XCTContext may be useful here.
@DivineDominion Is that also a good first issue? The scope of this seems to be quite narrow.
Oh yeah, that could work indeed for non-UI tests!
Changing that should be simple enough because it's a mechanical change where you'd mostly need to make sure the common tests cover the most ground (in case some of the tests have more assertions than others).
Note:
NSTextViewBuffer
may behave differently w.r.t. maintaining the user's selected range after inserting/deleting/replacing text. I've adapted some parts, but I expect some differences there when merging tests.
My recommendation to approach this would be to start without breaking anything, additively, with the expectation that the tests all stay green (apart from the note above), e.g.
BufferTests
or BufferConformanceTests
class,MutableStringBuffer
(which should cover most of the ground)
E.g.
NSTextViewBuffer
,MutableStringBuffer
,Undoable<Buffer>
should all behave the same.I went with code duplication for each of these so far, but that's getting a bit tedious. I notice that I'm feeling a resistance towards adding new shared
Buffer
features or changing the API because I need to touch 3+ test suites.A shared suite would be cool. As a matter of fact, I have never used something like that with
XCTest
, though.A naive approach would be to merge all test files into 1, and then add a helper that transforms this:
... into something like this: