macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.47k stars 680 forks source link

Add basic tests for MacVim #1454

Closed ychin closed 8 months ago

ychin commented 8 months ago

Add a few tests for MacVim using XCTest. Previously MacVim had essentially zero automatic tests. While we run the Vim tests in CI, those mostly exercise Vim features, not MacVim. These new tests are Objective C tests that are designed for MacVim-layer functionality instead. Only adding a few tests (both unit tests and integration tests) now to get started and set up a template for different types of tests but more will be added later.

Since MacVim consists of a lot of macOS API calls, a lot of those functionality are not easy to test automatically as they rely on behaviors out of MacVim's control (e.g. full screen functionality). The goal here is not to get 100% test coverage, but to catch areas prone to have regressions, code with non-straightforward logic, functionality that are annoying to manually test (e.g. key input), code blocks that perform calculations and can be easily unit tested. Areas that would be harder to add tests for include integration with macOS, e.g. full screen or dual monitor, interacting with the windowing system, or things that require screenshots in order to properly validate.

The goal here is to progressively add more tests as we touch different parts of MacVim to help catch regressions. Old code that works and isn't being touched will be lower priority as it's unlikely they will suddenly break.

ychin commented 8 months ago

I mentioned all the way back in 2018 that I was going to add more automatic testing for MacVim, so I guess I'm just 5 years late…