@@ -45,6 +45,73 @@ public func assertSnapshot<Value, Format>(
4545 XCTFail ( message, file: file, line: line)
4646}
4747
48+ /// Asserts that a given value matches a reference on disk.
49+ ///
50+ /// - Parameters:
51+ /// - value: A value to compare against a reference.
52+ /// - snapshotting: An dictionnay of names and strategies for serializing, deserializing, and comparing values.
53+ /// - recording: Whether or not to record a new reference.
54+ /// - timeout: The amount of time a snapshot must be generated in.
55+ /// - file: The file in which failure occurred. Defaults to the file name of the test case in which this function was called.
56+ /// - testName: The name of the test in which failure occurred. Defaults to the function name of the test case in which this function was called.
57+ /// - line: The line number on which failure occurred. Defaults to the line number on which this function was called.
58+ public func assertSnapshots< Value, Format> (
59+ matching value: @autoclosure ( ) throws -> Value ,
60+ as strategies: [ String : Snapshotting < Value , Format > ] ,
61+ record recording: Bool = false ,
62+ timeout: TimeInterval = 5 ,
63+ file: StaticString = #file,
64+ testName: String = #function,
65+ line: UInt = #line
66+ ) {
67+
68+ strategies. forEach { name, strategy in
69+ assertSnapshot (
70+ matching: value,
71+ as: strategy,
72+ named: name,
73+ record: recording,
74+ timeout: timeout,
75+ file: file,
76+ testName: testName,
77+ line: line
78+ )
79+ }
80+ }
81+
82+ /// Asserts that a given value matches a reference on disk.
83+ ///
84+ /// - Parameters:
85+ /// - value: A value to compare against a reference.
86+ /// - snapshotting: An array of strategies for serializing, deserializing, and comparing values.
87+ /// - recording: Whether or not to record a new reference.
88+ /// - timeout: The amount of time a snapshot must be generated in.
89+ /// - file: The file in which failure occurred. Defaults to the file name of the test case in which this function was called.
90+ /// - testName: The name of the test in which failure occurred. Defaults to the function name of the test case in which this function was called.
91+ /// - line: The line number on which failure occurred. Defaults to the line number on which this function was called.
92+ public func assertSnapshots< Value, Format> (
93+ matching value: @autoclosure ( ) throws -> Value ,
94+ as strategies: [ Snapshotting < Value , Format > ] ,
95+ record recording: Bool = false ,
96+ timeout: TimeInterval = 5 ,
97+ file: StaticString = #file,
98+ testName: String = #function,
99+ line: UInt = #line
100+ ) {
101+
102+ strategies. forEach { strategy in
103+ assertSnapshot (
104+ matching: value,
105+ as: strategy,
106+ record: recording,
107+ timeout: timeout,
108+ file: file,
109+ testName: testName,
110+ line: line
111+ )
112+ }
113+ }
114+
48115/// Verifies that a given value matches a reference on disk.
49116///
50117/// - Parameters:
0 commit comments