From 9b5c9bda074f5ae68b87b514b4d5b67d9928ae28 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Mon, 15 Dec 2014 23:58:31 +0000 Subject: [PATCH] Simplifies assert checks in tests. * Also ensures `assert.equal` is always in the right order. --- test/binary-test.js | 30 +++--- test/integration-test.js | 8 +- test/module-test.js | 66 +++++++------ test/protocol-imports-test.js | 48 +++++----- test/source-map-test.js | 122 ++++++++++++------------ test/text/comments-processor-test.js | 16 ++-- test/text/expressions-processor-test.js | 16 ++-- test/text/free-text-processor-test.js | 16 ++-- test/text/urls-processor-test.js | 16 ++-- test/utils/chunker-test.js | 8 +- test/utils/quote-scanner-test.js | 48 +++++----- 11 files changed, 199 insertions(+), 195 deletions(-) diff --git a/test/binary-test.js b/test/binary-test.js index 9c3aeb11..9330af62 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -48,21 +48,21 @@ var deleteFile = function(filename) { exports.commandsSuite = vows.describe('binary commands').addBatch({ 'no options': binaryContext('', { 'should output help': function(stdout) { - assert.equal(/Usage:/.test(stdout), true); + assert.match(stdout, /Usage[:]/); } }), 'help': binaryContext('-h', { 'should output help': function(error, stdout) { - assert.equal(/Usage:/.test(stdout), true); + assert.match(stdout, /Usage[:]/); }, 'should output one file example': function(error, stdout) { - assert.equal(stdout.indexOf('cleancss -o one-min.css one.css') > -1, true); + assert.include(stdout, 'cleancss -o one-min.css one.css'); }, 'should output multiple files example': function(error, stdout) { - assert.equal(stdout.indexOf('cat one.css two.css three.css | cleancss -o merged-and-minified.css') > -1, true); + assert.include(stdout, 'cat one.css two.css three.css | cleancss -o merged-and-minified.css'); }, 'should output gzipping multiple files example': function(error, stdout) { - assert.equal(stdout.indexOf('cat one.css two.css three.css | cleancss | gzip -9 -c > merged-minified-and-gzipped.css.gz') > -1, true); + assert.include(stdout, 'cat one.css two.css three.css | cleancss | gzip -9 -c > merged-minified-and-gzipped.css.gz'); } }), 'version': binaryContext('-v', { @@ -110,7 +110,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ }), 'to output file with debug info': pipedContext('a{color: #f00;}', '-d -o debug.css', { 'should output nothing to stdout and debug info to stderr': function(error, stdout, stderr) { - assert.equal(stdout, ''); + assert.isEmpty(stdout); assert.notEqual(stderr, ''); assert.include(stderr, 'Time spent:'); assert.include(stderr, 'Original: 16 bytes'); @@ -132,7 +132,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ }), 'no relative to path': binaryContext('./test/data/partials-absolute/base.css', { 'should not be able to resolve it fully': function(error, stdout, stderr) { - assert.equal(stdout, ''); + assert.isEmpty(stdout); assert.notEqual(error, null); assert.notEqual(stderr, ''); } @@ -155,12 +155,12 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ }), 'to file': binaryContext('-o ./reset1-min.css ./test/data/reset.css', { 'should give no output': function(error, stdout) { - assert.equal(stdout, ''); + assert.isEmpty(stdout); }, 'should minimize': function() { - var minimized = readFile('./test/data/reset-min.css'); - var target = readFile('./reset1-min.css'); - assert.equal(minimized, target); + var preminified = readFile('./test/data/reset-min.css'); + var minified = readFile('./reset1-min.css'); + assert.equal(minified, preminified); }, teardown: function() { deleteFile('./reset1-min.css'); @@ -213,7 +213,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ 'complex import and url rebasing': { absolute: binaryContext('-r ./test/data/129-assets ./test/data/129-assets/assets/ui.css', { 'should rebase urls correctly': function(error, stdout) { - assert.equal(error, null); + assert.isNull(error); assert.include(stdout, 'url(/components/bootstrap/images/glyphs.gif)'); assert.include(stdout, 'url(/components/jquery-ui/images/prev.gif)'); assert.include(stdout, 'url(/components/jquery-ui/images/next.gif)'); @@ -234,7 +234,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ 'complex import and skipped url rebasing': { absolute: binaryContext('-r ./test/data/129-assets --skip-rebase ./test/data/129-assets/assets/ui.css', { 'should rebase urls correctly': function(error, stdout) { - assert.equal(error, null); + assert.isNull(error); assert.include(stdout, 'url(../images/glyphs.gif)'); assert.include(stdout, 'url(../images/prev.gif)'); assert.include(stdout, 'url(../images/next.gif)'); @@ -252,7 +252,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ }, 'of a file': binaryContext('http://127.0.0.1:31991/present.css', { succeeds: function(error, stdout) { - assert.equal(error, null); + assert.isNull(error); assert.equal(stdout, 'p{font-size:13px}'); } }), @@ -276,7 +276,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ assert.include(stderr, 'Broken @import declaration of "http://localhost:24682/timeout.css" - timeout'); }, 'should output empty response': function(error, stdout) { - assert.equal(stdout, ''); + assert.isEmpty(stdout); }, teardown: function() { this.server.close(); diff --git a/test/integration-test.js b/test/integration-test.js index 4993ed68..94c905a1 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -9,10 +9,10 @@ var lineBreak = require('os').EOL; var cssContext = function(groups, options) { var context = {}; - var clean = function(expectedCss) { - return function(css) { - var minifiedCss = new CleanCSS(options).minify(css).styles; - assert.equal(minifiedCss, expectedCss); + var clean = function (expected) { + return function (source) { + var minified = new CleanCSS(options).minify(source).styles; + assert.equal(minified, expected); }; }; diff --git a/test/module-test.js b/test/module-test.js index 14a5f868..8046c8ec 100644 --- a/test/module-test.js +++ b/test/module-test.js @@ -33,11 +33,11 @@ vows.describe('module tests').addBatch({ new CleanCSS().minify('a{color:#f00}', this.callback); }, 'should not set context': function() { - assert.equal(false, this instanceof CleanCSS); + assert.equal(this instanceof CleanCSS, false); }, 'should yield no error': function(errors, minified) { /* jshint unused: false */ - assert.equal(errors, null); + assert.isNull(errors); }, 'should yield minified data': function(errors, minified) { assert.equal(minified.styles, 'a{color:red}'); @@ -49,13 +49,13 @@ vows.describe('module tests').addBatch({ }, 'should yield no error and minify': function(errors, minified) { /* jshint unused: false */ - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); } }, 'no debug': { 'topic': new CleanCSS().minify('a{ color: #f00 }'), 'should not populate stats hash': function (error, minified) { - assert.deepEqual({}, minified.stats); + assert.isEmpty(minified.stats); } }, 'debug': { @@ -76,13 +76,16 @@ vows.describe('module tests').addBatch({ 'no warnings': { 'topic': new CleanCSS().minify('a{ color: #f00 }'), 'if no reasons given': function (error, minified) { - assert.deepEqual(minified.warnings, []); + assert.isEmpty(minified.warnings); } }, 'warnings': { 'topic': new CleanCSS({ root: 'test/data', target: 'custom-warnings.css' }).minify('a{color:red}'), + 'are an array': function (error, minified) { + assert.isArray(minified.warnings); + }, 'if both root and output used reasons given': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.match(minified.warnings[0], /Both 'root' and output file given/); } }, @@ -92,10 +95,10 @@ vows.describe('module tests').addBatch({ assert.equal(minified.styles, 'a{display:block}'); }, 'should raise no errors': function (error, minified) { - assert.equal(minified.errors.length, 0); + assert.isEmpty(minified.errors); }, 'should raise one warning': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.equal(minified.warnings[0], 'Unexpected \'}\' in \'a{display:block}}\'. Ignoring.'); } }, @@ -105,23 +108,23 @@ vows.describe('module tests').addBatch({ assert.equal(minified.styles, 'a{display:block}p{color:red}'); }, 'should raise no errors': function (error, minified) { - assert.equal(minified.errors.length, 0); + assert.isEmpty(minified.errors); }, 'should raise one warning': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.equal(minified.warnings[0], 'Unexpected content: \'color:#535353}\'. Ignoring.'); } }, 'warnings on invalid properties': { 'topic': new CleanCSS().minify('a{color:}'), 'should minify correctly': function (error, minified) { - assert.equal(minified.styles, ''); + assert.isEmpty(minified.styles); }, 'should raise no errors': function (error, minified) { - assert.equal(minified.errors.length, 0); + assert.isEmpty(minified.errors); }, 'should raise one warning': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.equal(minified.warnings[0], 'Empty property \'color\' inside \'a\' selector. Ignoring.'); } }, @@ -131,51 +134,52 @@ vows.describe('module tests').addBatch({ assert.equal(minified.styles, 'a{background:url(image/}'); }, 'should raise no errors': function (error, minified) { - assert.equal(minified.errors.length, 0); + assert.isEmpty(minified.errors.length); }, 'should raise one warning': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.equal(minified.warnings[0], 'Broken URL declaration: \'url(image/\'.'); } }, 'warnings on broken imports': { 'topic': new CleanCSS().minify('@impor'), 'should output correct content': function (error, minified) { - assert.equal(minified.styles, ''); + assert.isEmpty(minified.styles); }, 'should raise no errors': function (error, minified) { - assert.equal(minified.errors.length, 0); + assert.isEmpty(minified.errors.length); }, 'should raise one warning': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.equal(minified.warnings[0], 'Broken declaration: \'@impor\'.'); } }, 'warnings on broken comments': { 'topic': new CleanCSS().minify('a{}/* '), 'should output correct content': function (error, minified) { - assert.equal(minified.styles, ''); + assert.isEmpty(minified.styles); }, 'should raise no errors': function (error, minified) { - assert.equal(minified.errors.length, 0); + assert.isEmpty(minified.errors.length); }, 'should raise one warning': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.equal(minified.warnings[0], 'Broken comment: \'/* \'.'); } }, 'no errors': { 'topic': new CleanCSS().minify('a{color:red}'), 'if no reasons given': function (error, minified) { - assert.deepEqual(minified.errors, []); + assert.isEmpty(minified.errors); } }, 'errors': { 'topic': new CleanCSS(), 'if both root and output used reasons given': function(minifier) { - assert.doesNotThrow(function() { - minifier.minify('@import url(/some/fake/file);', function(errors) { - assert.equal(errors.length, 1); + assert.doesNotThrow(function () { + minifier.minify('@import url(/some/fake/file);', function (errors) { + assert.isArray(errors); + assert.lengthOf(errors, 1); assert.equal(errors[0], 'Broken @import declaration of "/some/fake/file"'); }); }); @@ -186,7 +190,7 @@ vows.describe('module tests').addBatch({ 'if both root and output used reasons given': function (minifier) { minifier.minify('@import url(/some/fake/file);'); minifier.minify('@import url(/some/fake/file);', function(errors) { - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); assert.equal(errors[0], 'Broken @import declaration of "/some/fake/file"'); }); } @@ -196,26 +200,26 @@ vows.describe('module tests').addBatch({ return new CleanCSS().minify(new Buffer('@import url(test/data/partials/one.css);')); }, 'should be processed correctly': function(minified) { - assert.equal('.one{color:red}', minified.styles); + assert.equal(minified.styles, '.one{color:red}'); } }, 'options': { 'advanced': { 'topic': new CleanCSS({ advanced: true }).minify('a{color:red}a{color:#fff}'), 'gets right output': function (minified) { - assert.equal('a{color:#fff}', minified.styles); + assert.equal(minified.styles, 'a{color:#fff}'); } }, 'aggressive merging': { 'topic': new CleanCSS({ aggressiveMerging: true }).minify('a{display:block;color:red;display:inline-block}'), 'gets right output': function (minified) { - assert.equal('a{color:red;display:inline-block}', minified.styles); + assert.equal(minified.styles, 'a{color:red;display:inline-block}'); } }, 'process import': { 'topic': new CleanCSS({ processImport: true }).minify('@import url(/test/data/partials/one.css);'), 'gets right output': function (minified) { - assert.equal('.one{color:red}', minified.styles); + assert.equal(minified.styles, '.one{color:red}'); } }, 'rebase': { @@ -228,7 +232,7 @@ vows.describe('module tests').addBatch({ 'source map': { 'topic': new CleanCSS({ sourceMap: true }).minify('/*! a */div[data-id=" abc "] { color:red; }'), 'should minify correctly': function (minified) { - assert.equal('/*! a */div[data-id=" abc "]{color:red}', minified.styles); + assert.equal(minified.styles, '/*! a */div[data-id=" abc "]{color:red}'); }, 'should include source map': function (minified) { assert.instanceOf(minified.sourceMap, SourceMapGenerator); diff --git a/test/protocol-imports-test.js b/test/protocol-imports-test.js index bddb0602..0bf77ecd 100644 --- a/test/protocol-imports-test.js +++ b/test/protocol-imports-test.js @@ -21,13 +21,13 @@ vows.describe('protocol imports').addBatch({ new CleanCSS().minify('@import url(http://127.0.0.1/missing.css);a{color:red}', this.callback); }, 'should raise error': function(errors, minified) { - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); }, 'should ignore @import': function(errors, minified) { assert.equal(minified.styles, '@import url(http://127.0.0.1/missing.css);a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -46,7 +46,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'p{font-size:13px}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -65,7 +65,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'p{font-size:13px}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -84,7 +84,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'p{font-size:13px}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -103,7 +103,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, '@media screen{p{font-size:13px}}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -127,8 +127,8 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'body{margin:0}div{padding:0}p{font-size:13px}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks1.isDone(), true); - assert.equal(this.reqMocks2.isDone(), true); + assert.isTrue(this.reqMocks1.isDone()); + assert.isTrue(this.reqMocks2.isDone()); nock.cleanAll(); } }, @@ -149,7 +149,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'body{margin:0}p{font-size:13px}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -164,14 +164,14 @@ vows.describe('protocol imports').addBatch({ new CleanCSS().minify('@import url(http://127.0.0.1/nested/present.css);a{color:red}', this.callback); }, 'should not raise errors': function(errors, minified) { - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); assert.equal(errors[0], 'Broken @import declaration of "http://127.0.0.1/missing.css" - error 404'); }, 'should process @import': function(errors, minified) { assert.equal(minified.styles, '@import url(http://127.0.0.1/missing.css);p{font-size:13px}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -190,7 +190,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'a{background:url(http://127.0.0.1/test.png)}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -211,7 +211,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'a{background:url(http://127.0.0.1/deeply/images/test.png)}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -232,7 +232,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'a{background:url(../images/test.png)}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -241,7 +241,7 @@ vows.describe('protocol imports').addBatch({ new CleanCSS().minify('@import url(http://notdefined.127.0.0.1/custom.css);a{color:red}', this.callback); }, 'should not raise errors': function(errors, minified) { - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); assert.include(errors[0], 'Broken @import declaration of "http://notdefined.127.0.0.1/custom.css"'); }, 'should process @import': function(errors, minified) { @@ -265,7 +265,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'body{margin:0}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -286,7 +286,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'body{margin:0}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -306,7 +306,7 @@ vows.describe('protocol imports').addBatch({ }); }, 'should raise errors': function(errors, minified) { - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); assert.equal(errors[0], 'Broken @import declaration of "http://localhost:' + port + '/timeout.css" - timeout'); }, 'should process @import': function(errors, minified) { @@ -333,7 +333,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'body{margin:0}div{padding:0}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -352,7 +352,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'div{padding:0}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -377,7 +377,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'div{padding:0}a{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -397,7 +397,7 @@ vows.describe('protocol imports').addBatch({ assert.equal(minified.styles, 'div{padding:0}.one{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -414,14 +414,14 @@ vows.describe('protocol imports').addBatch({ assert.isEmpty(minified.errors); }, 'should raise warnings': function (error, minified) { - assert.equal(minified.warnings.length, 1); + assert.lengthOf(minified.warnings, 1); assert.match(minified.warnings[0], /no callback given/); }, 'should process @import': function (error, minified) { assert.equal(minified.styles, '@import url(http://127.0.0.1/remote.css);.one{color:red}'); }, teardown: function() { - assert.equal(this.reqMocks.isDone(), false); + assert.isFalse(this.reqMocks.isDone()); nock.cleanAll(); } } diff --git a/test/source-map-test.js b/test/source-map-test.js index 2ec4afc4..684a747d 100644 --- a/test/source-map-test.js +++ b/test/source-map-test.js @@ -27,7 +27,7 @@ vows.describe('source-map') 'module #1': { 'topic': new CleanCSS({ sourceMap: true }).minify('/*! a */div[data-id=" abc "] { color:red; }'), 'should have 2 mappings': function(minified) { - assert.equal(2, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have selector mapping': function (minified) { var mapping = { @@ -38,7 +38,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have body mapping': function (minified) { var mapping = { @@ -49,13 +49,13 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); } }, 'module #2': { 'topic': new CleanCSS({ sourceMap: true }).minify('@media screen {\n@font-face \n{ \nfont-family: test; } }'), 'should have 3 mappings': function(minified) { - assert.equal(3, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 3); }, 'should have @media mapping': function (minified) { var mapping = { @@ -66,7 +66,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have @font-face mapping': function (minified) { var mapping = { @@ -77,7 +77,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); }, 'should have font-family mapping': function (minified) { var mapping = { @@ -88,13 +88,13 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[2]); + assert.deepEqual(minified.sourceMap._mappings[2], mapping); } }, 'with keepBreaks': { 'topic': new CleanCSS({ sourceMap: true, keepBreaks: true }).minify('@media screen { a{color:red} p {color:blue} }div{color:pink}'), 'should have 7 mappings': function(minified) { - assert.equal(7, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 7); }, 'should have @media mapping': function (minified) { var mapping = { @@ -105,7 +105,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _a_ mapping': function (minified) { var mapping = { @@ -116,7 +116,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); }, 'should have _color:red_ mapping': function (minified) { var mapping = { @@ -127,7 +127,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[2]); + assert.deepEqual(minified.sourceMap._mappings[2], mapping); }, 'should have _p_ mapping': function (minified) { var mapping = { @@ -138,7 +138,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[3]); + assert.deepEqual(minified.sourceMap._mappings[3], mapping); }, 'should have _color:blue_ mapping': function (minified) { var mapping = { @@ -149,7 +149,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[4]); + assert.deepEqual(minified.sourceMap._mappings[4], mapping); }, 'should have _div_ mapping': function (minified) { var mapping = { @@ -160,7 +160,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[5]); + assert.deepEqual(minified.sourceMap._mappings[5], mapping); }, 'should have _color:pink_ mapping': function (minified) { var mapping = { @@ -171,13 +171,13 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[6]); + assert.deepEqual(minified.sourceMap._mappings[6], mapping); } }, 'shorthands': { 'topic': new CleanCSS({ sourceMap: true }).minify('a{background:url(image.png);background-color:red}'), 'should have 3 mappings': function(minified) { - assert.equal(3, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 3); }, 'should have selector mapping': function (minified) { var mapping = { @@ -188,7 +188,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _background_ mapping': function (minified) { var mapping = { @@ -199,7 +199,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); }, 'should have _background-color_ mapping': function (minified) { var mapping = { @@ -210,13 +210,13 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[2]); + assert.deepEqual(minified.sourceMap._mappings[2], mapping); } }, 'keyframes': { 'topic': new CleanCSS({ sourceMap: true }).minify('@-webkit-keyframes frames {\n 0% {\n border: 1px;\n }\n 100% {\n border: 3px;\n }\n}'), 'should have 5 mappings': function(minified) { - assert.equal(5, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 5); }, 'should have _@keframes_ mapping': function (minified) { var mapping = { @@ -227,7 +227,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _0%_ mapping': function (minified) { var mapping = { @@ -238,7 +238,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); }, 'should have _border:1px_ mapping': function (minified) { var mapping = { @@ -249,7 +249,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[2]); + assert.deepEqual(minified.sourceMap._mappings[2], mapping); }, 'should have _100%_ mapping': function (minified) { var mapping = { @@ -260,7 +260,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[3]); + assert.deepEqual(minified.sourceMap._mappings[3], mapping); }, 'should have _border:3px_ mapping': function (minified) { var mapping = { @@ -271,13 +271,13 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[4]); + assert.deepEqual(minified.sourceMap._mappings[4], mapping); } }, 'double comments': { 'topic': new CleanCSS({ sourceMap: true }).minify('/* COMMENT 1 */\n/* COMMENT 2 */\ndiv{color:red}'), 'should have 2 mappings': function(minified) { - assert.equal(2, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have _div__ mapping': function (minified) { var mapping = { @@ -288,7 +288,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _color:red_ mapping': function (minified) { var mapping = { @@ -299,7 +299,7 @@ vows.describe('source-map') source: '__stdin__.css', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); } } }) @@ -307,7 +307,7 @@ vows.describe('source-map') 'input map as string': { 'topic': new CleanCSS({ sourceMap: inputMap }).minify('div > a {\n color: red;\n}'), 'should have 2 mappings': function (minified) { - assert.equal(2, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have selector mapping': function (minified) { var mapping = { @@ -318,7 +318,7 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _color:red_ mapping': function (minified) { var mapping = { @@ -329,13 +329,13 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); } }, 'input map from source': { 'topic': new CleanCSS({ sourceMap: true }).minify('div > a {\n color: red;\n}/*# sourceMappingURL=' + inputMapPath + ' */'), 'should have 2 mappings': function (minified) { - assert.equal(2, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have selector mapping': function (minified) { var mapping = { @@ -346,7 +346,7 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _color:red_ mapping': function (minified) { var mapping = { @@ -357,13 +357,13 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); } }, 'input map from source with root': { 'topic': new CleanCSS({ sourceMap: true, relativeTo: path.dirname(inputMapPath) }).minify('div > a {\n color: red;\n}/*# sourceMappingURL=styles.css.map */'), 'should have 2 mappings': function (minified) { - assert.equal(2, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have selector mapping': function (minified) { var mapping = { @@ -374,7 +374,7 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _color:red_ mapping': function (minified) { var mapping = { @@ -385,13 +385,13 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); } }, 'complex input map': { 'topic': new CleanCSS({ sourceMap: true, root: path.dirname(inputMapPath) }).minify('@import url(import.css);'), 'should have 4 mappings': function (minified) { - assert.equal(4, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 4); }, 'should have first selector mapping': function (minified) { var mapping = { @@ -402,7 +402,7 @@ vows.describe('source-map') source: 'some.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have _color:red_ mapping': function (minified) { var mapping = { @@ -413,7 +413,7 @@ vows.describe('source-map') source: 'some.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); }, 'should have second selector mapping': function (minified) { var mapping = { @@ -424,7 +424,7 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[2]); + assert.deepEqual(minified.sourceMap._mappings[2], mapping); }, 'should have _color:blue_ mapping': function (minified) { var mapping = { @@ -435,49 +435,49 @@ vows.describe('source-map') source: 'styles.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[3]); + assert.deepEqual(minified.sourceMap._mappings[3], mapping); } }, 'complex input map referenced by path': { 'topic': new CleanCSS({ sourceMap: true }).minify('@import url(test/data/source-maps/import.css);'), 'should have 4 mappings': function (minified) { - assert.equal(4, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 4); } }, 'complex but partial input map referenced by path': { 'topic': new CleanCSS({ sourceMap: true, target: process.cwd() }).minify('@import url(test/data/source-maps/no-map-import.css);'), 'should have 4 mappings': function (minified) { - assert.equal(4, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 4); }, 'should have 2 mappings to .less file': function (minified) { var fromLess = minified.sourceMap._mappings.filter(function (mapping) { return mapping.source == path.join('test', 'data', 'source-maps', 'styles.less'); }); - assert.equal(2, fromLess.length); + assert.lengthOf(fromLess, 2); }, 'should have 2 mappings to .css file': function (minified) { var fromCSS = minified.sourceMap._mappings.filter(function (mapping) { return mapping.source == path.join('test', 'data', 'source-maps', 'no-map.css'); }); - assert.equal(2, fromCSS.length); + assert.lengthOf(fromCSS, 2); } }, 'complex input map with an existing file as target': { 'topic': new CleanCSS({ sourceMap: true, target: path.join(process.cwd(), 'test', 'data', 'source-maps', 'styles.css') }).minify('@import url(test/data/source-maps/styles.css);'), 'should have 2 mappings': function (minified) { - assert.equal(2, minified.sourceMap._mappings.length); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have 2 mappings to styles.less file': function (minified) { var stylesSource = minified.sourceMap._mappings.filter(function (mapping) { return mapping.source == 'styles.less'; }); - assert.equal(2, stylesSource.length); + assert.lengthOf(stylesSource, 2); }, }, 'nested once': { 'topic': new CleanCSS({ sourceMap: true }).minify('@import url(test/data/source-maps/nested/once.css);'), 'should have 2 mappings': function (minified) { - assert.equal(minified.sourceMap._mappings.length, 2); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have "section > div a" mapping': function (minified) { var mapping = { @@ -488,7 +488,7 @@ vows.describe('source-map') source: 'once.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have "color:red" mapping': function (minified) { var mapping = { @@ -499,13 +499,13 @@ vows.describe('source-map') source: 'once.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); } }, 'nested twice': { 'topic': new CleanCSS({ sourceMap: true }).minify('@import url(test/data/source-maps/nested/twice.css);'), 'should have 2 mappings': function (minified) { - assert.equal(minified.sourceMap._mappings.length, 2); + assert.lengthOf(minified.sourceMap._mappings, 2); }, 'should have "body > nav a" mapping': function (minified) { var mapping = { @@ -516,7 +516,7 @@ vows.describe('source-map') source: 'twice.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[0]); + assert.deepEqual(minified.sourceMap._mappings[0], mapping); }, 'should have "color:red" mapping': function (minified) { var mapping = { @@ -527,7 +527,7 @@ vows.describe('source-map') source: 'twice.less', name: null }; - assert.deepEqual(mapping, minified.sourceMap._mappings[1]); + assert.deepEqual(minified.sourceMap._mappings[1], mapping); } } }) @@ -546,11 +546,11 @@ vows.describe('source-map') assert.isDefined(minified.sourceMap); }, 'raises an error': function(errors, _) { - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); assert.equal(errors[0], 'Broken source map at "http://127.0.0.1/remote.css.map" - 404'); }, teardown: function () { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -579,7 +579,7 @@ vows.describe('source-map') assert.isDefined(minified.sourceMap); }, 'raises an error': function(errors, _) { - assert.equal(errors.length, 1); + assert.lengthOf(errors, 1); assert.equal(errors[0], 'Broken source map at "http://127.0.0.1:' + port + '/remote.css.map" - timeout'); }, teardown: function () { @@ -603,7 +603,7 @@ vows.describe('source-map') assert.equal(minified.sourceMap._mappings[0].source, 'http://127.0.0.1/styles.less'); }, teardown: function () { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -621,7 +621,7 @@ vows.describe('source-map') assert.isDefined(minified.sourceMap); }, teardown: function () { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -639,7 +639,7 @@ vows.describe('source-map') assert.isDefined(minified.sourceMap); }, teardown: function () { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } }, @@ -658,7 +658,7 @@ vows.describe('source-map') assert.isDefined(minified.sourceMap); }, teardown: function () { - assert.equal(this.reqMocks.isDone(), true); + assert.isTrue(this.reqMocks.isDone()); nock.cleanAll(); } } diff --git a/test/text/comments-processor-test.js b/test/text/comments-processor-test.js index 80c0b355..e301aaae 100644 --- a/test/text/comments-processor-test.js +++ b/test/text/comments-processor-test.js @@ -8,18 +8,18 @@ var otherLineBreak = lineBreak == '\n' ? '\r\n' : '\n'; function processorContext(name, context, keepSpecialComments, keepBreaks, saveWaypoints) { var vowContext = {}; - function escaped (targetCSS) { - return function (sourceCSS) { - var result = new CommentsProcessor(null, keepSpecialComments, keepBreaks, saveWaypoints).escape(sourceCSS); - assert.equal(result, targetCSS); + function escaped (expected) { + return function (source) { + var escaped = new CommentsProcessor(null, keepSpecialComments, keepBreaks, saveWaypoints).escape(source); + assert.equal(escaped, expected); }; } - function restored (targetCSS) { - return function (sourceCSS) { + function restored (expected) { + return function (source) { var processor = new CommentsProcessor(null, keepSpecialComments, keepBreaks, saveWaypoints); - var result = processor.restore(processor.escape(sourceCSS)); - assert.equal(result, targetCSS); + var restored = processor.restore(processor.escape(source)); + assert.equal(restored, expected); }; } diff --git a/test/text/expressions-processor-test.js b/test/text/expressions-processor-test.js index 44a0eb36..22500a45 100644 --- a/test/text/expressions-processor-test.js +++ b/test/text/expressions-processor-test.js @@ -7,18 +7,18 @@ var lineBreak = require('os').EOL; function processorContext(name, context, saveWaypoints) { var vowContext = {}; - function escaped (targetCSS) { - return function (sourceCSS) { - var result = new ExpressionsProcessor(saveWaypoints).escape(sourceCSS); - assert.equal(result, targetCSS); + function escaped (expected) { + return function (source) { + var escaped = new ExpressionsProcessor(saveWaypoints).escape(source); + assert.equal(escaped, expected); }; } - function restored (targetCSS) { - return function (sourceCSS) { + function restored (expected) { + return function (source) { var processor = new ExpressionsProcessor(saveWaypoints); - var result = processor.restore(processor.escape(sourceCSS)); - assert.equal(result, targetCSS); + var restored = processor.restore(processor.escape(source)); + assert.equal(restored, expected); }; } diff --git a/test/text/free-text-processor-test.js b/test/text/free-text-processor-test.js index 1bbbe3e7..8f09e9ce 100644 --- a/test/text/free-text-processor-test.js +++ b/test/text/free-text-processor-test.js @@ -7,18 +7,18 @@ var lineBreak = require('os').EOL; function processorContext(name, context, saveWaypoints) { var vowContext = {}; - function escaped (targetCSS) { - return function (sourceCSS) { - var result = new FreeTextProcessor(saveWaypoints).escape(sourceCSS); - assert.equal(result, targetCSS); + function escaped (expected) { + return function (source) { + var escaped = new FreeTextProcessor(saveWaypoints).escape(source); + assert.equal(escaped, expected); }; } - function restored (targetCSS) { - return function (sourceCSS) { + function restored (expected) { + return function (source) { var processor = new FreeTextProcessor(saveWaypoints); - var result = processor.restore(processor.escape(sourceCSS)); - assert.equal(result, targetCSS); + var restored = processor.restore(processor.escape(source)); + assert.equal(restored, expected); }; } diff --git a/test/text/urls-processor-test.js b/test/text/urls-processor-test.js index 96282b5c..f2a75aaa 100644 --- a/test/text/urls-processor-test.js +++ b/test/text/urls-processor-test.js @@ -7,18 +7,18 @@ var lineBreak = require('os').EOL; function processorContext(name, context, saveWaypoints) { var vowContext = {}; - function escaped (targetCSS) { - return function (sourceCSS) { - var result = new UrlsProcessor(null, saveWaypoints).escape(sourceCSS); - assert.equal(result, targetCSS); + function escaped (expected) { + return function (source) { + var escaped = new UrlsProcessor(null, saveWaypoints).escape(source); + assert.equal(escaped, expected); }; } - function restored (targetCSS) { - return function (sourceCSS) { + function restored (expected) { + return function (source) { var processor = new UrlsProcessor(null, saveWaypoints); - var result = processor.restore(processor.escape(sourceCSS)); - assert.equal(result, targetCSS); + var restored = processor.restore(processor.escape(source)); + assert.equal(restored, expected); }; } diff --git a/test/utils/chunker-test.js b/test/utils/chunker-test.js index c337e0ae..1203e41b 100644 --- a/test/utils/chunker-test.js +++ b/test/utils/chunker-test.js @@ -19,10 +19,10 @@ vows.describe(Chunker) assert.isFalse(chunker.isEmpty()); }, 'breaks at first brace': function (chunker) { - assert.equal('a{color:red}', chunker.next()); + assert.equal(chunker.next(), 'a{color:red}'); }, 'breaks at second brace': function (chunker) { - assert.equal('p{}', chunker.next()); + assert.equal(chunker.next(), 'p{}'); } }, 'comments': { @@ -31,10 +31,10 @@ vows.describe(Chunker) assert.isFalse(chunker.isEmpty()); }, 'breaks at first brace': function (chunker) { - assert.equal('/* one */', chunker.next()); + assert.equal(chunker.next(), '/* one */'); }, 'breaks at second brace': function (chunker) { - assert.equal(' /* two */', chunker.next()); + assert.equal(chunker.next(), ' /* two */'); } } }) diff --git a/test/utils/quote-scanner-test.js b/test/utils/quote-scanner-test.js index ad179673..e3e5ab9f 100644 --- a/test/utils/quote-scanner-test.js +++ b/test/utils/quote-scanner-test.js @@ -10,7 +10,7 @@ vows.describe(QuoteScanner) var index = 0; new QuoteScanner(topic).each(function iterator() { index++; }); - assert.equal(0, index); + assert.equal(index, 0); } }, 'one single quote': { @@ -20,12 +20,12 @@ vows.describe(QuoteScanner) new QuoteScanner(topic).each(function iterator(match, tokensSoFar, nextStart) { index++; - assert.equal('\'one quote\'', match); - assert.deepEqual(['text with '], tokensSoFar); - assert.equal(10, nextStart); + assert.equal(match, '\'one quote\''); + assert.deepEqual(tokensSoFar, ['text with ']); + assert.equal(nextStart, 10); }); - assert.equal(1, index); + assert.equal(index, 1); } }, 'one double quote': { @@ -35,12 +35,12 @@ vows.describe(QuoteScanner) new QuoteScanner(topic).each(function iterator(match, tokensSoFar, nextStart) { index++; - assert.equal('"one quote"', match); - assert.deepEqual(['text with '], tokensSoFar); - assert.equal(10, nextStart); + assert.equal(match, '"one quote"'); + assert.deepEqual(tokensSoFar, ['text with ']); + assert.equal(nextStart, 10); }); - assert.equal(1, index); + assert.equal(index, 1); } }, 'mixed quotes': { @@ -50,12 +50,12 @@ vows.describe(QuoteScanner) new QuoteScanner(topic).each(function iterator(match, tokensSoFar, nextStart) { index++; - assert.equal('"one \'quote\'"', match); - assert.deepEqual(['text with '], tokensSoFar); - assert.equal(10, nextStart); + assert.equal(match, '"one \'quote\'"'); + assert.deepEqual(tokensSoFar, ['text with ']); + assert.equal(nextStart, 10); }); - assert.equal(1, index); + assert.equal(index, 1); } }, 'escaped quotes': { @@ -65,12 +65,12 @@ vows.describe(QuoteScanner) new QuoteScanner(topic).each(function iterator(match, tokensSoFar, nextStart) { index++; - assert.equal('"one \\"quote"', match); - assert.deepEqual(['text with '], tokensSoFar); - assert.equal(10, nextStart); + assert.equal(match, '"one \\"quote"'); + assert.deepEqual(tokensSoFar, ['text with ']); + assert.equal(nextStart, 10); }); - assert.equal(1, index); + assert.equal(index, 1); } }, 'two quotes': { @@ -81,17 +81,17 @@ vows.describe(QuoteScanner) index++; if (index == 1) { - assert.equal('"one \\"quote"', match); - assert.deepEqual(['text with '], tokensSoFar); - assert.equal(10, nextStart); + assert.equal(match, '"one \\"quote"'); + assert.deepEqual(tokensSoFar, ['text with ']); + assert.equal(nextStart, 10); } else { - assert.equal('\'another one\'', match); - assert.deepEqual(['text with ', ' and '], tokensSoFar); - assert.equal(28, nextStart); + assert.equal(match, '\'another one\''); + assert.deepEqual(tokensSoFar, ['text with ', ' and ']); + assert.equal(nextStart, 28); } }); - assert.equal(2, index); + assert.equal(index, 2); } } }) -- 2.34.1