<commit_before>const css = require("../../src/lib/css-grammar-parser");
const fs = require("fs");
const expect = require('chai').expect;

const propDefs = fs.readFileSync("tests/css-grammar-parser/in", "utf-8").split("\n");
const propDefsOut = JSON.parse(fs.readFileSync("tests/css-grammar-parser/out.json", "utf-8"));

const results = propDefs.map(css.parsePropDefValue);
describe('Parser correctly parses grammar instances', () => {
  for(let i in results) {
    it(`parses property definition ${propDefs[i]} as expected`, () => {
      expect(results[i]).to.deep.equal(propDefsOut[i], `Parsing ${propDefs[i]} got ${JSON.stringify(results[i], null, 2)} instead of ${JSON.stringify(propDefsOut[i], null, 2)}`);
    });
  }
});
<commit_msg>Adjust CSS grammar parser tests to handle EOL CR chars on Windows<commit_after>const css = require("../../src/lib/css-grammar-parser");
const fs = require("fs");
const expect = require('chai').expect;

const propDefs = fs.readFileSync("tests/css-grammar-parser/in", "utf-8").split("\n").map(def => def.trim());
const propDefsOut = JSON.parse(fs.readFileSync("tests/css-grammar-parser/out.json", "utf-8"));

const results = propDefs.map(css.parsePropDefValue);
describe('Parser correctly parses grammar instances', () => {
  for(let i in results) {
    it(`parses property definition ${propDefs[i]} as expected`, () => {
      expect(results[i]).to.deep.equal(propDefsOut[i], `Parsing ${propDefs[i]} got ${JSON.stringify(results[i], null, 2)} instead of ${JSON.stringify(propDefsOut[i], null, 2)}`);
    });
  }
});

{'fraction_non_alphanumeric': 0.19935691318327975, 'fraction_numerical': 0.005144694533762058, 'mean_word_length': 5.224, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '5265065', 'n_tokens_mistral': 525, 'n_tokens_neox': 516, 'n_words': 106}