<commit_before>/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/*!
 * Next JS
 * Copyright (c)2011 Xenophy.CO.,LTD All rights Reserved.
 * http://www.xenophy.com
 */

// {{{ requires

require('should');
var assert = require('assert');

var T_NX = require('NX');

// }}}
// {{{ override

module.exports = {

    // {{{ test override#pattern1

    'test override#pattern1': function() {

        NX.define('NXTest.override.cls1', {
            config: {
                name: 'Awesome',
                isAwesome: true
            },
            constructor: function(config) {
                this.initConfig(config);
                return this;
            },
            applyName : function(val) {
                return "[" + val + "]";
            }
        });

        NX.override(NXTest.override.cls1, {
            config: {
                name: 'hoge',
                isAwesome: false
            },
            applyName : function(val) {
                return "("+val+")";
            }
        });

        var cls = new NXTest.override.cls1();

        cls.getName().should.equal('(hoge)');
        cls.getIsAwesome().should.equal(false);
        cls.isAwesome().should.not.be.ok;

        cls.setName('Next JS');
        cls.getName().should.equal('(Next JS)');

        cls.resetName();
        cls.getName().should.equal('(hoge)');

        cls.setConfig({
            name: 'Awesome',
            isAwesome: true
        });

        cls.getIsAwesome().should.equal(true);
        cls.isAwesome().should.be.ok;

    },

    // }}}
    // {{{ test override#pattern2

    'test override#pattern2': function() {

        NX.define('NXTest.override.cls2', {
            config: {
                name: 'Awesome',
                isAwesome: true
            },
            constructor: function(config) {
                this.initConfig(config);
                return this;
            },
            applyName : function(val) {
                return "[" + val + "]";
            }
        });

        NX.override(NXTest.override.cls2, {
            config: {
                name: 'hoge',
                isAwesome: false
            },
            applyName : function(val) {
                return "("+val+")";
            }
        });

        NX.define('NXTest.override.cls3', {
            extend: 'NXTest.override.cls2',
            constructor : function() {
                this.callParent(arguments);
            }
        });

        var cls2 = new NXTest.override.cls3();

        cls2.getName().should.equal('(hoge)');
        cls2.getIsAwesome().should.equal(false);

        cls2.setName('Next JS');
        cls2.getName().should.equal('(Next JS)');

        cls2.resetName();
        cls2.getName().should.equal('(hoge)');

    },

    // }}}
    // {{{ test override#pattern3

    'test override#pattern3': function() {

        NX.define('NXTest.override.cls4', {
            statics: {
                value: 123,
                func: function() {
                    return 'foo';
                }
            }
        });

        NX.override(NXTest.override.cls2, {
            statics: {
                value: 978,
                func: function() {
                    return 'hoge';
                }
            }
        });

        NXTest.override.cls4.value.should.equal(123);
        NXTest.override.cls4.func().should.equal('foo');

    },

    // }}}
    // {{{ test override#pattern4

    'test override#pattern4': function() {

        NX.define('NXTest.override.cls51', {
            config: {
                fee: 'baz',
                test: 'test'
            },
            foo: 'bar',
            hoge: function() {
                return 'hoge';
            }
        });

        NX.override(NXTest.override.cls51, {
            config: {
                fee: 'override',
                test: 'override'
            }
        });

        NX.define('NXTest.override.cls52', {
            config: {
                fee: 'boo'
            },
            mixins: [
                'NXTest.override.cls51'
            ]
        });

        var cls = new NXTest.override.cls52();

        cls.hoge().should.equal('hoge');
        cls.foo.should.equal('bar');
        cls.config.fee.should.equal('boo');
        cls.config.test.should.equal('override');

    }
<commit_msg>overrideテスト修正<commit_after>/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/*!
 * Next JS
 * Copyright (c)2011 Xenophy.CO.,LTD All rights Reserved.
 * http://www.xenophy.com
 */

// {{{ requires

require('should');
var assert = require('assert');

var T_NX = require('NX');

// }}}
// {{{ override

module.exports = {

    // {{{ test override#pattern1

    'test override#pattern1': function() {

        NX.define('NXTest.override.cls1', {
            config: {
                name: 'Awesome',
                isAwesome: true
            },
            constructor: function(config) {
                this.initConfig(config);
                return this;
            },
            applyName : function(val) {
                return "[" + val + "]";
            }
        });

        NX.override(NXTest.override.cls1, {
            config: {
                name: 'hoge',
                isAwesome: false
            },
            addFunc : function(val) {
                return "add func";
            },
            applyName : function(val) {
                return "("+val+")";
            }
        });

        var cls = new NXTest.override.cls1();

        cls.getName().should.equal('(hoge)');
        cls.addFunc().should.equal('add func');
        cls.getIsAwesome().should.equal(false);
        cls.isAwesome().should.not.be.ok;

        cls.setName('Next JS');
        cls.getName().should.equal('(Next JS)');

        cls.resetName();
        cls.getName().should.equal('(hoge)');
        cls.addFunc().should.equal('add func');

        cls.setConfig({
            name: 'Awesome',
            isAwesome: true
        });

        cls.getIsAwesome().should.equal(true);
        cls.isAwesome().should.be.ok;

    },

    // }}}
    // {{{ test override#pattern2

    'test override#pattern2': function() {

        NX.define('NXTest.override.cls2', {
            config: {
                name: 'Awesome',
                isAwesome: true
            },
            constructor: function(config) {
                this.initConfig(config);
                return this;
            },
            applyName : function(val) {
                return "[" + val + "]";
            }
        });

        NX.override(NXTest.override.cls2, {
            config: {
                name: 'hoge',
                isAwesome: false
            },
            addFunc : function(val) {
                return "add func";
            },
            applyName : function(val) {
                return "("+val+")";
            }
        });

        NX.define('NXTest.override.cls3', {
            extend: 'NXTest.override.cls2',
            constructor : function() {
                this.callParent(arguments);
            }
        });

        var cls2 = new NXTest.override.cls3();

        cls2.getName().should.equal('(hoge)');
        cls2.getIsAwesome().should.equal(false);
        cls2.addFunc().should.equal('add func');

        cls2.setName('Next JS');
        cls2.getName().should.equal('(Next JS)');

        cls2.resetName();
        cls2.getName().should.equal('(hoge)');
        cls2.addFunc().should.equal('add func');

    },

    // }}}
    // {{{ test override#pattern3

    'test override#pattern3': function() {

        NX.define('NXTest.override.cls4', {
            statics: {
                value: 123,
                func: function() {
                    return 'foo';
                }
            }
        });

        NX.override(NXTest.override.cls2, {
            statics: {
                value: 978,
                func: function() {
                    return 'hoge';
                }
            }
        });

        NXTest.override.cls4.value.should.equal(123);
        NXTest.override.cls4.func().should.equal('foo');

    },

    // }}}
    // {{{ test override#pattern4

    'test override#pattern4': function() {

        NX.define('NXTest.override.cls51', {
            config: {
                fee: 'baz',
                test: 'test'
            },
            foo: 'bar',
            hoge: function() {
                return 'hoge';
            }
        });

        NX.override(NXTest.override.cls51, {
            config: {
                fee: 'override',
                test: 'override'
            },
            addFunc : function(val) {
                return "add func";
            }
        });

        NX.define('NXTest.override.cls52', {
            config: {
                fee: 'boo'
            },
            mixins: [
                'NXTest.override.cls51'
            ]
        });

        var cls = new NXTest.override.cls52();

        cls.hoge().should.equal('hoge');
        cls.foo.should.equal('bar');
        cls.config.fee.should.equal('boo');
        cls.config.test.should.equal('override');
        cls.addFunc().should.equal('add func');

    }

{'fraction_non_alphanumeric': 0.151650021710812, 'fraction_numerical': 0.011723838471558836, 'mean_word_length': 1.2838373822508675, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '641366', 'n_tokens_mistral': 2827, 'n_tokens_neox': 2629, 'n_words': 393}