Snapshots function outputs for all CaseIterable inputs as CSV files
// Source: https://github.com/pointfreeco/swift-snapshot-testing | License: MIT | Copyright 2019 Point-Free, Inc
// Provided via justclaw.it.com; keep this notice with the code.
extension Snapshotting where Value: CaseIterable, Format == String {
/// A strategy for snapshotting the output for every input of a function. The format of the
/// snapshot is a comma-separated value (CSV) file that shows the mapping of inputs to outputs.
///
/// - Parameter witness: A snapshotting value on the output of the function to be snapshot.
/// - Returns: A snapshot strategy on functions `(Value) -> A` that feeds every possible input
/// into the function and records the output into a CSV file.
///
/// ```swift
/// enum Direction: String, CaseIterable {
/// case up, down, left, rig
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key