<commit_before><commit_msg>Test for ArrayBuffer index non-enumerability<commit_after>/*
 *  ArrayBuffer virtual index properties are non-standard and to avoid being
 *  serialized they're non-enumerable.  Typed array and Node.js buffer indices
 *  are enumerable.
 */

/*===
-1 undefined
0 {value:0,writable:true,enumerable:false,configurable:false}
1 {value:0,writable:true,enumerable:false,configurable:false}
2 {value:0,writable:true,enumerable:false,configurable:false}
3 {value:0,writable:true,enumerable:false,configurable:false}
4 undefined
0
1
2
3
-1 undefined
0 {value:65,writable:true,enumerable:true,configurable:false}
1 {value:66,writable:true,enumerable:true,configurable:false}
2 {value:67,writable:true,enumerable:true,configurable:false}
3 {value:68,writable:true,enumerable:true,configurable:false}
4 undefined
0
1
2
3
-1 undefined
0 {value:0,writable:true,enumerable:true,configurable:false}
1 {value:0,writable:true,enumerable:true,configurable:false}
2 {value:0,writable:true,enumerable:true,configurable:false}
3 {value:0,writable:true,enumerable:true,configurable:false}
4 undefined
===*/

function test(buf) {
    var i, k;

    for (k in buf) {
        print(k);
    }
    for (i = -1; i <= 4; i++) {
        print(i, Duktape.enc('jx', Object.getOwnPropertyDescriptor(buf, i)));
    }
}

try {
    test(new ArrayBuffer(4));
    test(new Buffer('ABCD'));
    test(new Uint8Array(4));
} catch (e) {
    print(e.stack || e);
}
{'fraction_non_alphanumeric': 0.14433701657458564, 'fraction_numerical': 0.0324585635359116, 'mean_word_length': 6.208955223880597, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4623148', 'n_tokens_mistral': 534, 'n_tokens_neox': 516, 'n_words': 101}