且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Swift、访问修饰符和单元测试

更新时间:2023-11-20 08:41:10

这是一个已知问题,在 Beta 4 发行说明中提到.在提供更多信息之前,您可能希望推迟更改设计.

This is a known issue and mentioned in the Beta 4 release notes. You might want to hold off changing your designs until more information is provided.

我们知道我们的访问控制设计不适合单元测试(这在发行说明中),我们正在评估情况以了解我们能做些什么.

We're aware that our access control design isn't great for unit testing (and this was in the release notes), we're evaluating the situation to see what we can do.

--克里斯·拉特纳

访问控制系统的一个限制是单元测试不能与应用程序中的类和方法交互,除非它们被标记为公共.这是因为单元测试目标不是应用程序模块的一部分.

A limitation of the access control system is that unit tests cannot interact with the classes and methods in an application unless they are marked public. This is because the unit test target is not part of the application module.

-- Xcode beta 4 发行说明

-- Xcode beta 4 release notes

https://github.com/ksm/SwiftInFlux#当前访问控制设计的限制