<commit_before>'use strict';

var csso    = require('.'),
    test    = require('tape'),
    Stream  = require('stream'),
    gutil   = require('gulp-util'),

    basestyle  = 'h1 { color: yellow; } \n h1 { font-size: 2em; }',
    optimalmin = 'h1{color:#ff0;font-size:2em}',
    nonoptimal = 'h1{color:#ff0}h1{font-size:2em}';

function fixture (contents) {
    return new gutil.File({
        contents: contents,
        cwd: __dirname,
        base: __dirname,
        path: __dirname + '/fixture.svg'
    });
}

test('should minify css with csso, performing structural optimisation', function (t) {
    t.plan(1);

    var stream = csso();

    stream.on('data', function (file) {
        t.equal(String(file.contents), optimalmin);
    });

    stream.write(fixture(new Buffer(basestyle)));
});

test('should minify css with csso, with no structural optimisation', function (t) {
    t.plan(1);

    var stream = csso(true);

    stream.on('data', function (file) {
        t.equal(String(file.contents), nonoptimal);
    });<commit_msg>Fix tests.<commit_after>'use strict';

var csso    = require('./'),
    test    = require('tape'),
    Stream  = require('stream'),
    gutil   = require('gulp-util'),

    basestyle  = 'h1 { color: yellow; } \n h1 { font-size: 2em; }',
    optimalmin = 'h1{color:#ff0;font-size:2em}',
    nonoptimal = 'h1{color:#ff0}h1{font-size:2em}';

function fixture (contents) {
    return new gutil.File({
        contents: contents,
        cwd: __dirname,
        base: __dirname,
        path: __dirname + '/test.css'
    });
}

test('should minify css with csso, performing structural optimisation', function (t) {
    t.plan(1);

    var stream = csso();

    stream.on('data', function (file) {
        t.equal(String(file.contents), optimalmin);
    });

    stream.write(fixture(new Buffer(basestyle)));
});

test('should minify css with csso, with no structural optimisation', function (t) {
    t.plan(1);

    var stream = csso(true);

    stream.on('data', function (file) {
        t.equal(String(file.contents), nonoptimal);
    });
{'fraction_non_alphanumeric': 0.16642616642616642, 'fraction_numerical': 0.011544011544011544, 'mean_word_length': 3.0310077519379846, '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': '1124622', 'n_tokens_mistral': 708, 'n_tokens_neox': 687, 'n_words': 159}