File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 6
6
7
7
See http://swift.org/LICENSE.txt for license information
8
8
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9
- */
9
+ */
10
10
11
+ import Basics
11
12
import TSCBasic
12
13
13
14
public class MockHashAlgorithm : HashAlgorithm {
14
15
public typealias Hash = ( ByteString ) -> ByteString
15
16
16
- public private( set) var hashes : [ ByteString ] = [ ]
17
+ public private( set) var hashes = ThreadSafeArrayStore < ByteString > ( )
17
18
private var hashFunction : Hash !
18
19
19
20
public init ( hash: Hash ? = nil ) {
20
- hashFunction = hash ?? { hash in
21
+ self . hashFunction = hash ?? { hash in
21
22
self . hashes. append ( hash)
22
23
return ByteString ( hash. contents. reversed ( ) )
23
24
}
24
25
}
25
26
26
27
public func hash( _ bytes: ByteString ) -> ByteString {
27
- return hashFunction ( bytes)
28
+ return self . hashFunction ( bytes)
28
29
}
29
30
}
You can’t perform that action at this time.
0 commit comments