pirishd / InstantMock
Showing 8 of 29 files from the diff.

@@ -34,7 +34,7 @@
Loading
34 34
35 35
36 36
/** Extension for actually store arguments */
37 -
extension ArgumentStorageImpl: ArgumentStorage{
37 +
extension ArgumentStorageImpl: ArgumentStorage {
38 38
39 39
    func store(_ arg: Argument) {
40 40
        self.storage.append(arg)

@@ -34,12 +34,13 @@
Loading
34 34
        } else {
35 35
            value = "none"
36 36
        }
37 -
        
37 +
38 38
        return value
39 39
    }
40 -
    
40 +
41 41
}
42 42
43 +
43 44
/** Extension that returns the number of args of any kinds */
44 45
extension ArgumentsConfiguration {
45 46

@@ -22,9 +22,10 @@
Loading
22 22
        self.function = function
23 23
        self.args = args
24 24
    }
25 -
    
25 +
26 26
}
27 27
28 +
28 29
/** Two configurations are comparable, in terms of arguments */
29 30
extension CallConfiguration: Comparable {}
30 31

@@ -6,7 +6,6 @@
Loading
6 6
//  Copyright © 2017 pirishd. All rights reserved.
7 7
//
8 8
9 -
10 9
/** Extension for making `Int` easily usage in mocks */
11 10
extension FixedWidthInteger where Self: MockUsable {
12 11
@@ -19,28 +18,28 @@
Loading
19 18
20 19
extension Int: MockUsable {
21 20
    public static let any = 42
22 -
    
21 +
23 22
    public static var anyValue: MockUsable {
24 23
        return Int.any
25 24
    }
26 25
}
27 26
extension Int64: MockUsable {
28 27
    public static let any = 42 as Int64
29 -
    
28 +
30 29
    public static var anyValue: MockUsable {
31 30
        return Int64.any
32 31
    }
33 32
}
34 33
extension UInt: MockUsable {
35 34
    public static let any = 42 as UInt
36 -
    
35 +
37 36
    public static var anyValue: MockUsable {
38 37
        return UInt.any
39 38
    }
40 39
}
41 40
extension UInt64: MockUsable {
42 41
    public static let any = 42 as UInt64
43 -
    
42 +
44 43
    public static var anyValue: MockUsable {
45 44
        return UInt64.any
46 45
    }

@@ -69,6 +69,5 @@
Loading
69 69
70 70
        return ret
71 71
    }
72 -
    
73 -
}
74 72
73 +
}

@@ -42,5 +42,5 @@
Loading
42 42
    var description: String {
43 43
        return "any<\(self.typeDescription)>"
44 44
    }
45 -
    
45 +
46 46
}

@@ -40,7 +40,6 @@
Loading
40 40
}
41 41
42 42
43 -
44 43
/**
45 44
    A `Mock` instance is dedicated to being used in unit tests, in order to mock some specific behaviors.
46 45
    It can be used in two particular cases:
@@ -91,19 +90,20 @@
Loading
91 90
        self.expectationFactory = expectationFactory
92 91
    }
93 92
94 -
    
93 +
95 94
    // MARK: Methods
96 95
    /** Resets all expectations and rejects */
97 96
    public func resetExpectations() {
98 97
        self.expectationBeingRegistered = nil
99 98
        self.expectationStorage.removeAll()
100 99
    }
101 -
    
100 +
102 101
    /** Resets all stubs */
103 102
    public func resetStubs() {
104 103
        self.stubBeingRegistered = nil
105 104
        self.stubStorage.removeAll()
106 105
    }
106 +
107 107
}
108 108
109 109
@@ -150,7 +150,6 @@
Loading
150 150
/* Extension for handling mock expectations */
151 151
extension Mock {
152 152
153 -
154 153
    /**
155 154
        Verify that all expectations are ok
156 155
        - parameter file: optional string for the name of the file being verified, default takes caller file name
@@ -270,16 +269,14 @@
Loading
270 269
        return (ret, useDefaultValue)
271 270
    }
272 271
273 -
274 272
}
275 273
276 274
277 275
/** Extension for handling calls to the mock */
278 276
extension Mock {
279 277
280 -
281 278
    /** Call with no return value */
282 -
    public func call(_ args: Any?..., function: String = #function) -> Void {
279 +
    public func call(_ args: Any?..., function: String = #function) {
283 280
        let ret: Void? = try? self.doCall(args, function: function)
284 281
        return ret ?? ()
285 282
    }
@@ -292,7 +289,7 @@
Loading
292 289
293 290
294 291
    /** Throwing call with no return value */
295 -
    public func callThrowing(_ args: Any?..., function: String = #function) throws -> Void {
292 +
    public func callThrowing(_ args: Any?..., function: String = #function) throws {
296 293
        let ret: Void? = try self.doCall(args, function: function)
297 294
        return ret ?? ()
298 295
    }
@@ -410,5 +407,4 @@
Loading
410 407
        return ret
411 408
    }
412 409
413 -
414 410
}

@@ -16,8 +16,7 @@
Loading
16 16
17 17
18 18
/** This class represents the configuration of an argument that captures passed values */
19 -
final class ArgumentCaptureImpl<T>: ArgumentCapture  {
20 -
19 +
final class ArgumentCaptureImpl<T>: ArgumentCapture {
21 20
22 21
    /// Type description for the arg
23 22
    private let typeDescription: String
@@ -32,7 +31,7 @@
Loading
32 31
33 32
    /// Last captured value (typed)
34 33
    var valueTyped: T? {
35 -
        var ret: T? = nil
34 +
        var ret: T?
36 35
        if let val = self.values.last {
37 36
            ret = val
38 37
        }
Files Coverage
Sources/InstantMock 98.05%
Project Totals (42 files) 98.05%
104.2
TRAVIS_OS_NAME=osx

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading