一个 Nimble 匹配器,用于 https://github.com/pointfreeco/swift-snapshot-testing,其灵感来源于 https://github.com/ashfurrow/Nimble-Snapshots 和 https://github.com/Killectro/swift-snapshot-testing-nimble 中的工作。
要运行示例项目,请先克隆仓库,并从 Example 目录运行 pod install
。
CocoaPods 或 Swift 5.3 或更高版本,用于 Swift 包管理器
Nimble-SnapshotTesting 可通过 CocoaPods 获取。要安装它,只需将以下行添加到你的 Podfile 中
pod 'Nimble-SnapshotTesting'
对于 Swift 包管理器
.package(url: "https://github.com/tahirmt/Nimble-SnapshotTesting.git", .upToNextMajor(from: "2.0.0")),
要将此库与 Nimble
一起使用,你有两种方式
let view = UIView()
expect(view).to(haveValidSnapshot(as: .image))
或者你甚至可以使用 ==
语法
let view = UIView()
expect(view) == snapshot(as: .image)
Nimble-SnapshotTesting 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。