Repository navigation
Proposal: add an optional unit test target (QtTest + ctest) #1169
CyrilB1531
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'd like to ask how you feel about having unit tests in the project, and what form you'd prefer.
Context
There is currently no test target in the repository. Several contributors have ended up writing tests locally anyway:
tests/folder with a QtTest suite forQRegexSearch, run with ctest in CISo there is some appetite for it, but each contributor is reinventing it, and it's unclear what would be acceptable.
What I have working locally
tests/folder with a QtTest executable that links only the few sources it needs (ScintillaNext,Finder,QRegexSearch,UndoAction, ...) plus scintilla/lexilla/uchardet. NoMainWindow, no full app.ScintillaNexteditors offscreen (QT_QPA_PLATFORM=offscreen), so they exercise the actual editing code, including the custom regex engine.NOTEPADNEXT_BUILD_TESTS, OFF by default, so regular builds and packaging are unchanged.ctest --test-dir build --output-on-failure. The current suite runs in about 30 ms.As an example, the tests for the Trim Trailing Space feature (#1167) cover LF/CRLF/CR line endings, undo as a single step, and the modified flag. They do catch a real pitfall: with a bare
[ \t]+$regex, the CRLF and CR cases fail, because$only matches before\ninQRegexSearch.Questions
cteststep inbuild.yml), or stay local for now?I'm happy to align with #1154 if that gets merged, so we don't end up with two competing setups.
Thanks!
All reactions