<commit_before>/**
* qunit.basicMock v0.5 - A Basic JavaScript Mocking object for the QUnit Unit Testing Framework
*
* Copyright (c) 2012 <NAME> - @JoeDoyle23 - 
* Licensed under the MIT (MIT-LICENSE.txt)
*/

(function (exports) {
    exports.lightMock = function () {
        var _mock = {
            stubs: [],
            raiseFail: function (message) {
                ok(false, message);
            },
            raiseSuccess: function (message) {
                ok(true, message);
            },
            restoreAll: function () {
                for (var i = 0; i < this.stubs.length; i++) {
                    this.stubs[i].restore(0);
                }

                this.stubs.length = 0;
            },
            extend: function (obj) {
                ///<summary>Identifies the object that owns the fucntion to be stubbed</summary>
                var stubs = this.stubs;
                obj.stub = function (name, newBehavior) {
                    var callLimit = null, callCount = 0, callParameters = [];
                    var original = obj[name];

                    obj[name] = function () {
                        ++callCount;
                        if (callLimit !== null && callLimit < callCount) {
                            _mock.raiseFail("'" + name + "' has been called more than the expected limit of " + callLimit);
                        }
                        callParameters = arguments;
                        return newBehavior.apply(obj, arguments);
                    };
                    var stubDelegate = obj[name];
                    stubDelegate.original = original;
                    stubDelegate.parameters = function (n) {
                        return callParameters[n];
                    };
                    stubDelegate.restore = function () {
                        ///<summary>Removes the test stub and restores the original behavior</summary>
                        if (!!obj[name].original) {
                            obj[name] = obj[name].original;
                            var index = stubs.indexOf(obj[name]);
                            if (index >= 0) { stubs.splice(index, 1); }
                        }
                        return obj;<commit_msg>Added default empty function if no replacement is required.<commit_after>/**
* qunit.basicMock v0.5.1 - A Basic JavaScript Mocking object for the QUnit Unit Testing Framework
*
* Copyright (c) 2012 <NAME> - @JoeDoyle23 - 
* Licensed under the MIT (MIT-LICENSE.txt)
*/

(function (exports) {
    exports.lightMock = function () {
        var _mock = {
            stubs: [],
            raiseFail: function (message) {
                ok(false, message);
            },
            raiseSuccess: function (message) {
                ok(true, message);
            },
            restoreAll: function () {
                for (var i = 0; i < this.stubs.length; i++) {
                    this.stubs[i].restore(0);
                }

                this.stubs.length = 0;
            },
            extend: function (obj) {
                ///<summary>Identifies the object that owns the fucntion to be stubbed</summary>
                var stubs = this.stubs;
                obj.stub = function (name, newBehavior) {
                    //Use empty method if none provided
                    newBehavior = newBehavior || function() {};
                    
                    var callLimit = null, callCount = 0, callParameters = [];
                    var original = obj[name];

                    obj[name] = function () {
                        ++callCount;
                        if (callLimit !== null && callLimit < callCount) {
                            _mock.raiseFail("'" + name + "' has been called more than the expected limit of " + callLimit);
                        }
                        callParameters = arguments;
                        return newBehavior.apply(obj, arguments);
                    };
                    var stubDelegate = obj[name];
                    stubDelegate.original = original;
                    stubDelegate.parameters = function (n) {
                        return callParameters[n];
                    };
                    stubDelegate.restore = function () {
                        ///<summary>Removes the test stub and restores the original behavior</summary>
                        if (!!obj[name].original) {
                            obj[name] = obj[name].original;
                            var index = stubs.indexOf(obj[name]);
                            if (index >= 0) { stubs.splice(index, 1); }
                        }
                        return obj;
{'fraction_non_alphanumeric': 0.10014915832090347, 'fraction_numerical': 0.006179416151715321, 'mean_word_length': 1.179201485608171, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '1296101', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1063, 'n_words': 300}