<commit_before>//
//  Mock.swift
//  InstantMock
//
//  Created by Patrick on 06/05/2017.
//  Copyright © 2017 pirishd. All rights reserved.
//

import Foundation


/** Main protocol for adding mocking capabilities to any object, using delegation */
public protocol MockProtocol {

    /// Provide mock instance
    var it: Mock { get }
}


/** Protocol for mock expectations */
public protocol MockExpectationProtocol {

    /// Create new expectation for current instance
    func expect() -> Expectation

    /// Verify all expections on the current instance
    func verify()
}


/** Protocol for stubs */
public protocol MockStubProtocol {

    /// Create new stub for current instance
    func stub() -> Stub
}



/**
    A `Mock` instance is dedicated to being used in unit tests, in order to mock some specific behaviors.
    It can be used in two particular cases:
    - **verify** some behaviors with **expectations** (represented by the `Expectation` class)
    - **stub** behaviors, to return or perform some actions under certain conditions (stubs are represented by the
    `Stub` class)

    Example of an expectation being verified:

        let mock: Mock
        mock.expect().call(mock.someMethod())
        mock.verify()

    Example of a stub:

        let mock: Mock
        mock.stub().call(mock.someMethod()).andReturn(someValue)

 */
public class Mock {

}


extension Mock: MockExpectationProtocol {

    @discardableResult
    public func expect() -> Expectation {
        return Expectation() // FIXME: just for now
    }


    public func verify() {
        // FIXME: nothing for now
    }

}


extension Mock: MockStubProtocol {

    @discardableResult
    public func stub() -> Stub {
        return Stub() // FIXME: just for now
    }

}<commit_msg>Add a few comments<commit_after>//
//  Mock.swift
//  InstantMock
//
//  Created by Patrick on 06/05/2017.
//  Copyright © 2017 pirishd. All rights reserved.
//

import Foundation


/** Main protocol for adding mocking capabilities to any object, using delegation */
public protocol MockProtocol {

    /// Provide mock instance
    var it: Mock { get }
}


/** Protocol for mock expectations */
public protocol MockExpectationProtocol {

    /// Create new expectation for current instance
    func expect() -> Expectation

    /// Verify all expections on the current instance
    func verify()
}


/** Protocol for stubs */
public protocol MockStubProtocol {

    /// Create new stub for current instance
    func stub() -> Stub
}



/**
    A `Mock` instance is dedicated to being used in unit tests, in order to mock some specific behaviors.
    It can be used in two particular cases:
    - **verify** some behaviors with **expectations** (represented by the `Expectation` class)
    - **stub** behaviors, to return or perform some actions under certain conditions (stubs are represented by the
    `Stub` class)

    Example of an expectation being verified:

        let mock: Mock
        mock.expect().call(mock.someMethod())
        mock.verify()

    Example of a stub:

        let mock: Mock
        mock.stub().call(mock.someMethod()).andReturn(someValue)

 */
public class Mock {

}


/* Extension for handling mock expectations */
extension Mock: MockExpectationProtocol {

    @discardableResult
    public func expect() -> Expectation {
        return Expectation() // FIXME: just for now
    }


    public func verify() {
        // FIXME: nothing for now
    }

}


/* Extension for handling stubs */
extension Mock: MockStubProtocol {

    @discardableResult
    public func stub() -> Stub {
        return Stub() // FIXME: just for now
    }

}
{'fraction_non_alphanumeric': 0.0959166895039737, 'fraction_numerical': 0.006577144423129624, 'mean_word_length': 2.6683417085427137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1268254', 'n_tokens_mistral': 1004, 'n_tokens_neox': 948, 'n_words': 390}