<commit_before>var chai = require('chai'),
    should = chai.should(),
    flow = require('flow.js').flow,
    expect = chai.expect,
    testRunner = require('..').TestRunner.setup();

var C = {};

describe('js.core.Binding', function () {

    var target,
        model,
        returnValue = "HALLO",
        parameters = ["\'abc\'",123,true,false,"null"],
        parStr = "abc",
        parNum = 123,
        extendedModel,
        ExtendedClass;

    before(function (done) {

        flow()
            .seq(function(cb){
                testRunner.requireClasses({
                    Binding: 'js/core/Binding',
                    Bindable: 'js/core/Bindable',
                    Parser: 'js/lib/parser'
                }, C, cb);

            })
            .seq(function(cb){
                ExtendedClass = C.Bindable.inherit('ExtendedClass', {
                    foo: function () {
                        return returnValue;
                    },
                    bar: function () {
                        var args = Array.prototype.slice.call(arguments);
                        if(args.length !== parameters.length){
                            return false;
                        }
                        for(var i = 0; i < args.length; i++){
                            if(args[i] !== parameters[i]){
                                return false;
                            }
                        }
                        return true;
                    },
                    foobar: function (a,b) {
                        return a === parStr && b === parNum;
                    },

                    // MOCK FUNCTION
                    getScopeForFncName: function (name) {
                        if (this[name]) {
                            return this;
                        }
                        return null;
                    },
                    // MOCK FUNCTION
                    getScopeForKey: function (name) {
                        if (this.$[name]) {
                            return this;
                        }
                        return null;
                    }
                });<commit_msg>fixed binding test<commit_after>var chai = require('chai'),
    should = chai.should(),
    flow = require('flow.js').flow,
    expect = chai.expect,
    testRunner = require('..').TestRunner.setup();

var C = {};

describe('js.core.Binding', function () {

    var target,
        model,
        returnValue = "HALLO",
        parameters = ["'abc'",123,true,false,"null"],
        parStr = "abc",
        parNum = 123,
        extendedModel,
        ExtendedClass;

    before(function (done) {

        flow()
            .seq(function(cb){
                testRunner.requireClasses({
                    Binding: 'js/core/Binding',
                    Bindable: 'js/core/Bindable',
                    Parser: 'js/lib/parser'
                }, C, cb);

            })
            .seq(function(cb){
                ExtendedClass = C.Bindable.inherit('ExtendedClass', {
                    foo: function () {
                        return returnValue;
                    },
                    bar: function () {
                        var args = Array.prototype.slice.call(arguments);
                        if(args.length !== parameters.length){
                            return false;
                        }
                        var parameter;
                        for(var i = 0; i < args.length; i++){
                            parameter = parameters[i];
                            parameter = parameter === "null" ? null : parameter;
                            if(parameter && parameter.replace){
                                parameter = parameter.replace(/'/gi,"");
                            }
                            if(args[i] !== parameter){
                                return false;
                            }
                        }
                        return true;
                    },
                    foobar: function (a,b) {
                        return a === parStr && b === parNum;
                    },

                    // MOCK FUNCTION
                    getScopeForFncName: function (name) {
                        if (this[name]) {
                            return this;
                        }
                        return null;
                    },
                    // MOCK FUNCTION
                    getScopeForKey: function (name) {
                        if (this.$[name]) {
                            return this;
                        }
                        return null;
                    }
                });
{'fraction_non_alphanumeric': 0.10692225772097977, 'fraction_numerical': 0.002981895633652822, 'mean_word_length': 0.834375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '191969', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1010, 'n_words': 213}