sourcekit-lsp icon indicating copy to clipboard operation
sourcekit-lsp copied to clipboard

Include filename, line and column in test IDs

Open ahoppen opened this issue 2 years ago • 3 comments

The test IDs returned by https://github.com/apple/sourcekit-lsp/pull/1151 don’t qualify the tests with the filename, line and column. Because of this, the test IDs may be ambiguous, eg. when multiple files define a private @Test function with the same name.

We should include the filename, line and column in the test ID as MyModule.S/f()/Tests.swift:2:3.

Note that when trying to test this, the --filter argument takes a regex, so the parentheses need to be escaped (and technically .)

ahoppen avatar Mar 28 '24 15:03 ahoppen

Tracked in Apple’s issue tracker as rdar://125555338

ahoppen avatar Mar 28 '24 15:03 ahoppen

Out of interest how is swift-testing dealing with this? Would a filter MyModule.S/f\(\) run both tests?

adam-fowler avatar Mar 28 '24 18:03 adam-fowler

My understanding is that the filter is a regex and MyModule.S/f\(\) would match both MyModule.S/f\(\)/FileA.swift:1:1 and MyModule.S/f\(\)/FileB.swift:1:1 and thus run both tests.

ahoppen avatar Mar 28 '24 21:03 ahoppen