<commit_before>// Print types of elements too, because e.g. true and Boolean(true) print
// out the same normally ("true").  Also print non-existent properties
// explicitly.

function printArray(t) {
    var tmp = [];

    for (i = 0; i < t.length; i++) {
        var exists = t.hasOwnProperty(String(i));
        if (exists) { 
            tmp.push(typeof t[i] + ':' + t[i]);
        } else {
            tmp.push('nonexistent');
        }
    }

    print(typeof t + ' ' + t.length + ' ' + tmp.join(','));
}

/*===
basic
TypeError
TypeError
TypeError
TypeError
object 5 boolean:true,number:1,number:2,string:foo,string:bar
object 5 boolean:false,number:1,number:2,string:foo,string:bar
object 5 number:123,number:1,number:2,string:foo,string:bar
object 5 string:foo,number:1,number:2,string:foo,string:bar
object 6 number:1,number:2,number:1,number:2,string:foo,string:bar
object 5 object:[object Object],number:1,number:2,string:foo,string:bar
object 4 number:1,number:2,number:3,number:4
object 101 1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3
object 101 4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6
object 202 number:1,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:2,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:3,number:4,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:5,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:6
object 101 [object Object]
object 101 [object Object]
object 2 object:[object Object],object:[object Object]
object 4 boolean:true,number:1,number:2,number:3
object 4 object:[object Object],number:1,number:2,number:3
object 4 object:[object Object],number:1,number:2,number:3
object 5 string:foo,string:bar,number:1,number:2,number:3
object 4 nonexistent,nonexistent,nonexistent,string:elem
object 5 number:1,nonexistent,nonexistent,nonexistent,string:elem
object 4 string:foo,string:bar,nonexistent,nonexistent
object 8 number:1,number:1,number:2,string:foo,string:bar,nonexistent,nonexistent,number:4
object 4 string:foo,string:bar,nonexistent,nonexistent
object 5 number:1,number:1,number:2,string:foo,string:bar
===*/

print('basic');

function basicTest() {
    var t1, t2;

    function test(this_value, args) {
        var t;

        try {
            if (args.length == 0) {
                t = Array.prototype.concat.call(this_value);
            } else if (args.length == 1) {
                t = Array.prototype.concat.call(this_value, args[0]);
            } else if (args.length == 2) {
                t = Array.prototype.concat.call(this_value, args[0], args[1]);
            } else if (args.length == 3) {
                t = Array.prototype.concat.call(this_value, args[0], args[1], args[2]);
            } else {
                t = Array.prototype.concat.call(this_value, args[0], args[1], args[2], args[3]);
            }

            printArray(t);
        } catch (e) {
            print(e.name);
        }
    }

    // actual number of call arguments matter; undefined is treated
    // differently from an argument not given at all

    test(undefined, []);

    test(undefined, [ undefined ]);

    // basic types test

    test(undefined, [ 1, 2, [ 'foo', 'bar' ] ]);
    test(null, [ 1, 2, [ 'foo', 'bar' ] ]);
    test(true, [ 1, 2, [ 'foo', 'bar' ] ]);
    test(false, [ 1, 2, [ 'foo', 'bar' ] ]);<commit_msg>fix Array.prototype.concat() test case; this binding is always coerced with ToObject()<commit_after>// Print types of elements too, because e.g. true and Boolean(true) print
// out the same normally ("true").  Also print non-existent properties
// explicitly.

function printArray(t) {
    var tmp = [];

    for (i = 0; i < t.length; i++) {
        var exists = t.hasOwnProperty(String(i));
        if (exists) { 
            tmp.push(typeof t[i] + ':' + t[i]);
        } else {
            tmp.push('nonexistent');
        }
    }

    print(typeof t + ' ' + t.length + ' ' + tmp.join(','));
}

/*===
basic
TypeError
TypeError
TypeError
TypeError
object 5 object:true,number:1,number:2,string:foo,string:bar
object 5 object:false,number:1,number:2,string:foo,string:bar
object 5 object:123,number:1,number:2,string:foo,string:bar
object 5 object:foo,number:1,number:2,string:foo,string:bar
object 6 number:1,number:2,number:1,number:2,string:foo,string:bar
object 5 object:[object Object],number:1,number:2,string:foo,string:bar
object 4 number:1,number:2,number:3,number:4
object 101 1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3
object 101 4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6
object 202 number:1,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:2,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:3,number:4,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:5,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,nonexistent,number:6
object 101 [object Object]
object 101 [object Object]
object 2 object:[object Object],object:[object Object]
object 4 object:true,number:1,number:2,number:3
object 4 object:[object Object],number:1,number:2,number:3
object 4 object:[object Object],number:1,number:2,number:3
object 5 string:foo,string:bar,number:1,number:2,number:3
object 4 nonexistent,nonexistent,nonexistent,string:elem
object 5 number:1,nonexistent,nonexistent,nonexistent,string:elem
object 4 string:foo,string:bar,nonexistent,nonexistent
object 8 number:1,number:1,number:2,string:foo,string:bar,nonexistent,nonexistent,number:4
object 4 string:foo,string:bar,nonexistent,nonexistent
object 5 number:1,number:1,number:2,string:foo,string:bar
===*/

print('basic');

function basicTest() {
    var t1, t2;

    function test(this_value, args) {
        var t;

        try {
            if (args.length == 0) {
                t = Array.prototype.concat.call(this_value);
            } else if (args.length == 1) {
                t = Array.prototype.concat.call(this_value, args[0]);
            } else if (args.length == 2) {
                t = Array.prototype.concat.call(this_value, args[0], args[1]);
            } else if (args.length == 3) {
                t = Array.prototype.concat.call(this_value, args[0], args[1], args[2]);
            } else {
                t = Array.prototype.concat.call(this_value, args[0], args[1], args[2], args[3]);
            }

            printArray(t);
        } catch (e) {
            print(e.name);
        }
    }

    // actual number of call arguments matter; undefined is treated
    // differently from an argument not given at all

    test(undefined, []);

    test(undefined, [ undefined ]);

    // basic types test
    // (note that 'this' argument is always ToObject() coerced, even for
    // strict functions)

    test(undefined, [ 1, 2, [ 'foo', 'bar' ] ]);
    test(null, [ 1, 2, [ 'foo', 'bar' ] ]);
    test(true, [ 1, 2, [ 'foo', 'bar' ] ]);
    test(false, [ 1, 2, [ 'foo', 'bar' ] ]);
{'fraction_non_alphanumeric': 0.1537782485875706, 'fraction_numerical': 0.019597457627118644, 'mean_word_length': 7.029057406094968, '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': '7049612', 'n_tokens_mistral': 3764, 'n_tokens_neox': 3619, 'n_words': 466}