gpt4 book ai didi

ios - 如何测试快速嵌套函数?

转载 作者:搜寻专家 更新时间:2023-11-01 05:53:41 24 4
gpt4 key购买 nike

如何编写 swift 嵌套函数的测试?

因为这个函数在另一个函数里面,所以我不知道如何从外面调用它。

我正在使用嵌套函数,因为我不能在 init 中调用私有(private) self 函数

最佳答案

你不应该测试嵌套函数,就像你不应该测试私有(private)方法一样,来自Bad Testing Practices :

Private means private. Period. If you feel the need to test a private method, there is something conceptually wrong with that method. Usually it is doing too much to be a private method, which in turn violates the Single Responsibility Principle.

关于ios - 如何测试快速嵌套函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35179632/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com