diff --git a/test/fixture/syntax/combinator.json b/test/fixture/syntax/combinator.json index 1b1911bf..23f98af3 100644 --- a/test/fixture/syntax/combinator.json +++ b/test/fixture/syntax/combinator.json @@ -8,12 +8,10 @@ "valid": [ "foo bar" ], - "invalid:Mismatch": [ + "invalid": [ "foo", "bar", - "baz" - ], - "invalid:Uncomplete match": [ + "baz", "foo bar foo" ] }, @@ -27,10 +25,8 @@ "foo", "bar" ], - "invalid:Mismatch": [ - "baz" - ], - "invalid:Uncomplete match": [ + "invalid": [ + "baz", "foo bar" ] }, @@ -44,13 +40,11 @@ "foo bar", "bar foo" ], - "invalid:Mismatch": [ + "invalid": [ "foo", "bar", "foo foo", - "foo foo bar" - ], - "invalid:Uncomplete match": [ + "foo foo bar", "foo bar foo" ] }, @@ -65,10 +59,8 @@ "bar foo", "foo" ], - "invalid:Mismatch": [ - "bar" - ], - "invalid:Uncomplete match": [ + "invalid": [ + "bar", "foo foo", "foo foo bar", "foo bar foo" @@ -86,7 +78,7 @@ "foo", "bar" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo foo", "foo foo bar", "foo bar foo" @@ -104,11 +96,9 @@ "foo bar", "bar foo" ], - "invalid:Mismatch": [ + "invalid": [ "", - "baz" - ], - "invalid:Uncomplete match": [ + "baz", "foo foo", "foo foo bar", "foo bar foo" @@ -127,7 +117,7 @@ "bar foo", "" ], - "invalid:Uncomplete match": [ + "invalid": [ "baz", "foo foo", "foo foo bar", diff --git a/test/fixture/syntax/comma.json b/test/fixture/syntax/comma.json index 65521049..e03d9c32 100644 --- a/test/fixture/syntax/comma.json +++ b/test/fixture/syntax/comma.json @@ -8,7 +8,7 @@ "valid": [ "foo, bar" ], - "invalid:Mismatch": [ + "invalid": [ "", "foo", "foo bar", @@ -25,7 +25,7 @@ "foo, bar", "bar" ], - "invalid:Mismatch": [ + "invalid": [ "", "foo", "foo bar", @@ -42,7 +42,7 @@ "foo, bar", "foo" ], - "invalid:Mismatch": [ + "invalid": [ "", "bar", "foo bar", @@ -61,7 +61,7 @@ "foo", "bar" ], - "invalid:Mismatch": [ + "invalid": [ "foo ,", "foo bar", ", bar" @@ -83,7 +83,7 @@ "bar, baz", "foo, bar, baz" ], - "invalid:Mismatch": [ + "invalid": [ "foo ,", "foo ,,", "foo ,, bar", @@ -106,7 +106,7 @@ "foo, bar, qux", "foo, qux" ], - "invalid:Mismatch": [ + "invalid": [ "foo ,", "foo ,,", "foo ,, qux", @@ -124,7 +124,7 @@ "foo, foo", "foo, foo, foo, foo" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo ,", "foo foo" ] @@ -140,7 +140,7 @@ "foo, foo", "foo, foo, foo, foo" ], - "invalid:Mismatch": [ + "invalid": [ ", foo", "foo ," ] diff --git a/test/fixture/syntax/default.json b/test/fixture/syntax/default.json index 8760663f..44bb259d 100644 --- a/test/fixture/syntax/default.json +++ b/test/fixture/syntax/default.json @@ -4,20 +4,18 @@ "valid": [ "red", "#1e5799", - "-webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(51%,#207cca), color-stop(100%,#7db9e8))", "-moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%)", "-webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", "-o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", "linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", - "-moz-radial-gradient(center, ellipse cover, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%)", "-webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(51%,#207cca), color-stop(100%,#7db9e8))", "-webkit-radial-gradient(center, ellipse cover, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", "-o-radial-gradient(center, ellipse cover, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", "radial-gradient(ellipse at center, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)" ], - "invalid:Mismatch": [ + "invalid": [ "linear-gradient(bottom, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", "repeating-linear-gradient(bottom, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", "-webkit-linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)", @@ -83,12 +81,10 @@ "top left 10px", "left, top" ], - "invalid:Mismatch": [ + "invalid": [ "", "10", - "10 20" - ], - "invalid:Uncomplete match": [ + "10 20", "left right", "right left", "top bottom", @@ -116,7 +112,7 @@ "animation-name .1s linear infinite", "infinite infinite" ], - "invalid:Mismatch": [ + "invalid": [ "animation-name .1s 0 0 infinite", "infinite infinite infinite" ] @@ -126,7 +122,7 @@ "valid": [ "small-caps swash(test)" ], - "invalid:Mismatch": [ + "invalid": [ "small-caps swash(test) small-caps" ] } diff --git a/test/fixture/syntax/edgecases.json b/test/fixture/syntax/edgecases.json index 6e99c6b6..e4aa6848 100644 --- a/test/fixture/syntax/edgecases.json +++ b/test/fixture/syntax/edgecases.json @@ -9,7 +9,7 @@ "100", "200" ], - "invalid:Mismatch": [ + "invalid": [ "300" ] }, diff --git a/test/fixture/syntax/function.json b/test/fixture/syntax/function.json index 18d0ec02..02a443e1 100644 --- a/test/fixture/syntax/function.json +++ b/test/fixture/syntax/function.json @@ -11,7 +11,7 @@ "valid": [ "foo(bar)" ], - "invalid:Mismatch": [ + "invalid": [ "", "foo", "foo()", @@ -45,7 +45,7 @@ "valid": [ "foo(bar, baz)" ], - "invalid:Mismatch": [ + "invalid": [ "foo()", "foo(bar)", "foo(baz)", @@ -65,7 +65,7 @@ "foo(bar, baz)", "foo(bar)" ], - "invalid:Mismatch": [ + "invalid": [ "foo()", "foo(baz)", "foo(bar, qux)" @@ -90,7 +90,7 @@ "foo(bar, baz, qux)", "foo()" ], - "invalid:Mismatch": [ + "invalid": [ "foo(baz, bar)", "foo(something)" ] diff --git a/test/fixture/syntax/generic.json b/test/fixture/syntax/generic.json index f068f1ca..fd8501f9 100644 --- a/test/fixture/syntax/generic.json +++ b/test/fixture/syntax/generic.json @@ -18,7 +18,7 @@ "calc(2 * 1deg)", "0" ], - "invalid:Mismatch": [ + "invalid": [ "", "1px", "1px 2deg" @@ -38,7 +38,7 @@ "1MS", "calc(2 * 1s)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1px", "1px 2s" @@ -87,7 +87,7 @@ "0.0", "calc(2 * 1px)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1s", "1s 2px" @@ -107,7 +107,7 @@ "1kHz", "calc(2 * 1hz)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1px", "1px 2hz" @@ -129,7 +129,7 @@ "1DPPX", "calc(2 * 1dpi)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1px", "1px 2dpi" @@ -147,7 +147,7 @@ "1FR", "calc(2 * 1fr)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1px", "1px 2fr" @@ -165,7 +165,7 @@ "1dB", "calc(2 * 1db)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1px", "1px 2db" @@ -183,7 +183,7 @@ "1ST", "calc(2 * 1st)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1px", "1px 2st" @@ -200,7 +200,7 @@ "1px", "1something" ], - "invalid:Mismatch": [ + "invalid": [ "", "1 2px" ] @@ -217,9 +217,10 @@ "12.34%", "calc(2 * 1%)" ], - "invalid:Mismatch": [ + "invalid": [ "", - "1 2%" + "1 2%", + "1px" ] }, "": { @@ -235,7 +236,7 @@ ".456", "calc(2 * 1.5)" ], - "invalid:Mismatch": [ + "invalid": [ "", "foo 123" ] @@ -255,7 +256,7 @@ "1.0", "1" ], - "invalid:Mismatch": [ + "invalid": [ "-1", "1.01", "123" @@ -273,7 +274,7 @@ "1.0", "123.456" ], - "invalid:Mismatch": [ + "invalid": [ "-1", "0.01", ".999", @@ -292,7 +293,7 @@ "-123", "calc(2 * 2)" ], - "invalid:Mismatch": [ + "invalid": [ "", "123.456", "-123.456", @@ -311,7 +312,7 @@ "123", "calc(2 * 2)" ], - "invalid:Mismatch": [ + "invalid": [ "", "-123", "123.456", @@ -335,7 +336,7 @@ "#aBcDeF", "#abcdef12" ], - "invalid:Mismatch": [ + "invalid": [ "", "#a", "#ab", @@ -357,7 +358,7 @@ "element(#a123)", "element(#foo-123)" ], - "invalid:Mismatch": [ + "invalid": [ "" ] }, @@ -371,7 +372,7 @@ "valid": [ "foo" ], - "invalid:Mismatch": [ + "invalid": [ "", "123 foo" ] @@ -387,7 +388,7 @@ "\"string\"", "'string'" ], - "invalid:Mismatch": [ + "invalid": [ "", "1 'string'" ] @@ -407,7 +408,7 @@ "url(raw)", "URL(raw)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1 url('string')" ] @@ -423,7 +424,7 @@ "attr(foo)", "ATTR(foo)" ], - "invalid:Mismatch": [ + "invalid": [ "", "1 attr(foo)" ] @@ -442,7 +443,7 @@ "U+0025-00FF", "U+4??" ], - "invalid:Mismatch": [ + "invalid": [ "", "U", "u", @@ -461,7 +462,7 @@ "expression(...)", "EXPRESSION(...)" ], - "invalid:Mismatch": [ + "invalid": [ "expression", "foo()" ] @@ -480,7 +481,7 @@ "ALPHA(OPACITY=80)", "alpha(opacity=80)" ], - "invalid:Mismatch": [ + "invalid": [ "progid", "alpha", "foo()" @@ -498,7 +499,7 @@ "0 foo", "0 bar123" ], - "invalid:Mismatch": [ + "invalid": [ "", "0", "0 inherit", @@ -523,7 +524,7 @@ "-webkit-calc(1px + 1%)", "-WEBKIT-CALC(1px + 1%)" ], - "invalid:Mismatch": [ + "invalid": [ "-ms-calc(1px + 1%)", "-o-calc(1px + 1%)" ] diff --git a/test/fixture/syntax/index.js b/test/fixture/syntax/index.js index 338831a8..38f77cfd 100644 --- a/test/fixture/syntax/index.js +++ b/test/fixture/syntax/index.js @@ -12,7 +12,7 @@ function forEachTest(factory) { var lexer = file[test].syntax ? createLexer(file[test].syntax) : defaultLexer; for (var property in file[test]) { - if (property !== 'valid' && !/^invalid:/.test(property)) { + if (property !== 'valid' && property !== 'invalid') { continue; } @@ -22,7 +22,7 @@ function forEachTest(factory) { lexer, file[test].property || 'test', value, - property !== 'valid' ? property.substr(8) : false + property === 'invalid' ); }); } diff --git a/test/fixture/syntax/keyword.json b/test/fixture/syntax/keyword.json index 5637ef05..3ab7ddfb 100644 --- a/test/fixture/syntax/keyword.json +++ b/test/fixture/syntax/keyword.json @@ -9,7 +9,7 @@ "foo", "FOO" ], - "invalid:Mismatch": [ + "invalid": [ "", "bar", "-prefix-Foo" @@ -25,7 +25,7 @@ "-vendor-foo", "-VENDOR-FOO" ], - "invalid:Mismatch": [ + "invalid": [ "foo", "Foo", "-vendor-vendor-Foo", @@ -43,7 +43,7 @@ "someExample", "someexample" ], - "invalid:Mismatch": [ + "invalid": [ "foo", "-vendor-someExample", "" @@ -60,11 +60,8 @@ "foo foo", "foo foo foo foo" ], - "invalid:Uncomplete match": [ - "foo foo bar" - ], - "invalid:Mismatch": [ - "", + "invalid": [ + "foo foo bar", "" ] } diff --git a/test/fixture/syntax/multiplier.json b/test/fixture/syntax/multiplier.json index d5c9226d..a66b237d 100644 --- a/test/fixture/syntax/multiplier.json +++ b/test/fixture/syntax/multiplier.json @@ -9,7 +9,7 @@ "", "foo" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo foo", "foo bar", "bar" @@ -25,11 +25,9 @@ "foo", "foo bar" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo foo bar", - "foo bar bar" - ], - "invalid:Mismatch": [ + "foo bar bar", "", "bar" ] @@ -50,7 +48,7 @@ "bar baz", "foo bar baz" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo foo bar", "foo bar bar", "foo bar qux", @@ -74,7 +72,7 @@ "bar baz", "foo bar baz" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo foo bar" ] }, @@ -93,11 +91,9 @@ "bar baz", "foo bar baz" ], - "invalid:Mismatch": [ + "invalid": [ "", - "qux" - ], - "invalid:Uncomplete match": [ + "qux", "foo foo bar", "foo bar bar", "foo bar qux", @@ -116,7 +112,7 @@ "foo foo", "foo foo foo foo" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo bar", "bar" ] @@ -133,10 +129,8 @@ "foo bar bar", "foo bar bar bar" ], - "invalid:Uncomplete match": [ - "foo foo bar" - ], - "invalid:Mismatch": [ + "invalid": [ + "foo foo bar", "bar bar", "", "bar" @@ -153,11 +147,9 @@ "foo foo", "foo foo foo foo foo" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo foo bar", - "foo bar foo" - ], - "invalid:Mismatch": [ + "foo bar foo", "", "bar" ] @@ -171,12 +163,10 @@ "valid": [ "foo foo" ], - "invalid:Mismatch": [ + "invalid": [ "foo", "", - "bar" - ], - "invalid:Uncomplete match": [ + "bar", "foo foo foo", "foo foo bar" ] @@ -192,12 +182,10 @@ "foo foo foo", "foo foo foo foo" ], - "invalid:Mismatch": [ + "invalid": [ "foo", "", - "bar" - ], - "invalid:Uncomplete match": [ + "bar", "foo foo bar" ] }, @@ -212,12 +200,10 @@ "foo foo foo", "foo foo foo foo" ], - "invalid:Mismatch": [ + "invalid": [ "foo", "", - "bar" - ], - "invalid:Uncomplete match": [ + "bar", "foo foo bar", "foo foo foo foo bar" ] @@ -235,12 +221,10 @@ "foo , foo", "foo, foo, foo, foo, foo" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo foo", "foo, foo,", - "foo, foo, bar" - ], - "invalid:Mismatch": [ + "foo, foo, bar", ",foo, foo", "", "bar" @@ -257,11 +241,9 @@ "foo, foo", "foo, foo bar" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo, foo, bar", - "foo, foo," - ], - "invalid:Mismatch": [ + "foo, foo,", "bar" ] }, @@ -276,12 +258,10 @@ "foo,foo,foo", "foo , foo , foo , foo" ], - "invalid:Uncomplete match": [ + "invalid": [ "foo, foo, foo, foo, foo", "foo, foo,", - "foo, foo, bar" - ], - "invalid:Mismatch": [ + "foo, foo, bar", "foo foo", "foo", "", diff --git a/test/fixture/syntax/parentheses.json b/test/fixture/syntax/parentheses.json index c18d3584..cf6e4cea 100644 --- a/test/fixture/syntax/parentheses.json +++ b/test/fixture/syntax/parentheses.json @@ -12,7 +12,7 @@ "(foo)", "( foo )" ], - "invalid:Mismatch": [ + "invalid": [ "", "()", "(foo foo)", @@ -32,7 +32,7 @@ "((foo))", "( ( foo ) )" ], - "invalid:Mismatch": [ + "invalid": [ "()", "(())", "((foo foo))", @@ -52,7 +52,7 @@ "(foo)", "( foo ) (foo)" ], - "invalid:Mismatch": [ + "invalid": [ "", "()", "(foo foo)", @@ -79,7 +79,7 @@ "foo(abc, (abc / (abc / abc)))", "foo(((((abc, abc)))))" ], - "invalid:Mismatch": [ + "invalid": [ "foo()", "foo(abc / abc / abc)", "foo(((abc abc)))" diff --git a/test/fixture/syntax/property.json b/test/fixture/syntax/property.json index 0622783d..3611c0b6 100644 --- a/test/fixture/syntax/property.json +++ b/test/fixture/syntax/property.json @@ -9,7 +9,7 @@ "valid": [ "foo" ], - "invalid:Mismatch": [ + "invalid": [ "", "bar" ] @@ -26,11 +26,8 @@ "foo foo", "foo foo foo foo" ], - "invalid:Uncomplete match": [ - "foo foo bar" - ], - "invalid:Mismatch": [ - "", + "invalid": [ + "foo foo bar", "" ] } diff --git a/test/fixture/syntax/slash.json b/test/fixture/syntax/slash.json index 2e1d7359..6d5c3ba1 100644 --- a/test/fixture/syntax/slash.json +++ b/test/fixture/syntax/slash.json @@ -9,7 +9,7 @@ "foo / bar", "foo/bar" ], - "invalid:Mismatch": [ + "invalid": [ "", "/", "foo", diff --git a/test/fixture/syntax/type.json b/test/fixture/syntax/type.json index c6161d46..deacb6fc 100644 --- a/test/fixture/syntax/type.json +++ b/test/fixture/syntax/type.json @@ -11,7 +11,7 @@ "valid": [ "foo" ], - "invalid:Mismatch": [ + "invalid": [ "", "bar" ] @@ -30,11 +30,8 @@ "foo foo", "foo foo foo foo" ], - "invalid:Uncomplete match": [ - "foo foo bar" - ], - "invalid:Mismatch": [ - "", + "invalid": [ + "foo foo bar", "" ] } diff --git a/test/lexer.js b/test/lexer.js index 9c5c34fc..059ac937 100644 --- a/test/lexer.js +++ b/test/lexer.js @@ -12,7 +12,7 @@ function createMatchTest(name, syntax, property, value, error) { var match = syntax.matchDeclaration(declaration); assert.equal(match.matched, null, 'should NOT MATCH to "' + value + '"'); - assert(new RegExp('^SyntaxMatchError: Mismatch').test(match.error)); + assert.equal(match.error.name, 'SyntaxMatchError'); }); } else { it(name, function() {