<commit_before>// cases.js
// Tests each test case. See readme.txt for details.

var assert = require('assert');
var FS = require('fs');
var JSON5 = require('..');
var Path = require('path');

// Test JSON5.parse() by comparing its output for each case with either the
// native JSON.parse() or ES5 strict-mode eval(). See readme.txt for details.
// For eval(), remember to wrap the input in parentheses before eval()'ing,
// since {...} is ambiguous in JavaScript. Also ensure the parentheses are on
// lines of their own, to support inline comments.

// TODO More test cases, and ones that test specific features and edge cases.
// Mozilla's test cases are a great inspiration and reference here:
// http://mxr.mozilla.org/mozilla-central/source/js/src/tests/ecma_5/JSON/

var TYPES = ['json', 'es5'];

var dirPathBase = Path.resolve(__dirname, 'cases-');
var files = {};

function createTest(fileName, type) {
    'use strict';

    var filePath = Path.join(dirPathBase + type, fileName);
    var str = FS.readFileSync(filePath, 'utf8');

    function parseJSON5() {
        return JSON5.parse(str);
    }

    function parseType() {
        switch (type) {
            case 'json':
                return JSON.parse(str);
            case 'es5':
                return eval('(\n' + str + '\n)');<commit_msg>Removed unused variable.<commit_after>// cases.js
// Tests each test case. See readme.txt for details.

var assert = require('assert');
var FS = require('fs');
var JSON5 = require('..');
var Path = require('path');

// Test JSON5.parse() by comparing its output for each case with either the
// native JSON.parse() or ES5 strict-mode eval(). See readme.txt for details.
// For eval(), remember to wrap the input in parentheses before eval()'ing,
// since {...} is ambiguous in JavaScript. Also ensure the parentheses are on
// lines of their own, to support inline comments.

// TODO More test cases, and ones that test specific features and edge cases.
// Mozilla's test cases are a great inspiration and reference here:
// http://mxr.mozilla.org/mozilla-central/source/js/src/tests/ecma_5/JSON/

var TYPES = ['json', 'es5'];

var dirPathBase = Path.resolve(__dirname, 'cases-');

function createTest(fileName, type) {
    'use strict';

    var filePath = Path.join(dirPathBase + type, fileName);
    var str = FS.readFileSync(filePath, 'utf8');

    function parseJSON5() {
        return JSON5.parse(str);
    }

    function parseType() {
        switch (type) {
            case 'json':
                return JSON.parse(str);
            case 'es5':
                return eval('(\n' + str + '\n)');
{'fraction_non_alphanumeric': 0.13565150936186474, 'fraction_numerical': 0.006878104700038212, 'mean_word_length': 2.9546827794561934, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4350697', 'n_tokens_mistral': 777, 'n_tokens_neox': 748, 'n_words': 279}