Swift testing compile errors with @testable

I'm trying out swift-testing for the first time, using the Xcode template to add a test file to my project, but I'm getting compile errors even with the most basic case of a struct with a single, empty @Test function.

The first of the errors is:

/var/folders/xq/ktjjtbds5zj0vtmnclzqvb_40000gn/T/swift-generated-sources/@_swiftmacro_8XitTests0034RemoteListViewModelTestswift_oeBCkfMX31_4_6expectfMf.swift:1:9 Type 'Testing' has no member '__checkBinaryOperation'

The culprit turned out to be using @testable import to bring in my main app bundle. If I remove @testable these errors go away, but then I have other problems because some of the types I'm trying to work with are not public.

Is swift-testing not compatible with @testable import?

Swift Testing is compatible with @testable. Is it possible you have a type named Testing in your module?

That was it! Thanks. I had forgotten about my Testing.

1 Like