<commit_before>import postcss from 'postcss';
import test    from 'ava';
import plugin  from '../';
import fs from 'fs';


function read(name) {
    function _read(ele) {
        return fs.readFileSync(`./tests/fixtures/${ele}.css`, {
            encoding: 'utf8'
        });
    }
    const input = _read(`${name}-input`);
    const output = _read(`${name}-output`);

    return { input, output };
}


function run(t, input, output, opts = { }) {
    return postcss([ plugin(opts) ]).process(input)
        .then(result => {
            t.deepEqual(result.css, output);
            t.is(result.warnings().length, 0);
        })
        .catch(function (error) {
            t.fail();
            console.error(error);
        });
}


test('text-align', t => {
    const { input, output } = read('text-align');
    return run(t, input, output, { });
});

test('float', t => {
    const { input, output } = read('float');
    return run(t, input, output, { });
});<commit_msg>replace CRLF with LF when loading fixtures<commit_after>import postcss from 'postcss';
import test    from 'ava';
import plugin  from '../';
import fs from 'fs';


function read(name) {
    function _read(ele) {
        return fs.readFileSync(`./tests/fixtures/${ele}.css`, {
            encoding: 'utf8'
        }).replace(/\r\n/g, '\n');
    }
    const input = _read(`${name}-input`);
    const output = _read(`${name}-output`);

    return { input, output };
}


function run(t, input, output, opts = { }) {
    return postcss([ plugin(opts) ]).process(input)
        .then(result => {
            t.deepEqual(result.css, output);
            t.is(result.warnings().length, 0);
        })
        .catch(function (error) {
            t.fail();
            console.error(error);
        });
}


test('text-align', t => {
    const { input, output } = read('text-align');
    return run(t, input, output, { });
});

test('float', t => {
    const { input, output } = read('float');
    return run(t, input, output, { });
});
{'fraction_non_alphanumeric': 0.18831168831168832, 'fraction_numerical': 0.001998001998001998, 'mean_word_length': 2.383445945945946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5953122', 'n_tokens_mistral': 639, 'n_tokens_neox': 631, 'n_words': 148}