diff --git a/Cargo.toml b/Cargo.toml index 9efd886e..9db2a553 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,12 +14,15 @@ build = "build.rs" exclude = ["src/css-parsing-tests"] +[lib] +doctest = false + [dev-dependencies] rustc-serialize = "0.3" tempdir = "0.3" +encoding_rs = "0.3.2" [dependencies] -encoding = "0.2" heapsize = {version = ">=0.1.1, <0.4.0", optional = true} matches = "0.1" serde = {version = ">=0.6.6, <0.9", optional = true} diff --git a/build.rs b/build.rs index 84e36be5..30e3d8b1 100644 --- a/build.rs +++ b/build.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[macro_use] extern crate quote; +extern crate quote; extern crate syn; use std::env; diff --git a/src/css-parsing-tests/README.rst b/src/css-parsing-tests/README.rst index d54b0d8b..b3baa740 100644 --- a/src/css-parsing-tests/README.rst +++ b/src/css-parsing-tests/README.rst @@ -4,7 +4,7 @@ CSS parsing tests This repository contains implementation-independent test for CSS parsers, based on the 2013 draft of the `CSS Syntax Level 3`_ specification. -.. _CSS Syntax Level 3: http://dev.w3.org/csswg/css-syntax-3/ +.. _CSS Syntax Level 3: https://drafts.csswg.org/css-syntax-3/ The upstream repository for these tests is at https://github.com/SimonSapin/css-parsing-tests @@ -51,51 +51,51 @@ associated with the expected result. ``component_value_list.json`` Tests `Parse a list of component values - `_. + `_. The Unicode input is represented by a JSON string, the output as an array of `component values`_ as described below. ``component_value_list.json`` Tests `Parse a component value - `_. + `_. The Unicode input is represented by a JSON string, the output as a `component value`_. ``declaration_list.json`` Tests `Parse a list of declarations - `_. + `_. The Unicode input is represented by a JSON string, the output as an array of declarations_ and at-rules_. ``one_declaration.json`` Tests `Parse a declaration - `_. + `_. The Unicode input is represented by a JSON string, the output as a declaration_. ``one_rule.json`` Tests `Parse a rule - `_. + `_. The Unicode input is represented by a JSON string, the output as a `qualified rule`_ or at-rule_. ``rule_list.json`` Tests `Parse a list of rules - `_. + `_. The Unicode input is represented by a JSON string, the output as a list of `qualified rules`_ or at-rules_. ``stylesheet.json`` Tests `Parse a stylesheet - `_. + `_. The Unicode input is represented by a JSON string, the output as a list of `qualified rules`_ or at-rules_. ``stylesheet_bytes.json`` Tests `Parse a stylesheet - `_ + `_ together with `The input byte stream - `_. + `_. The input is represented as a JSON object containing: * A required ``css_bytes``, the input byte string, @@ -132,16 +132,23 @@ associated with the expected result. This file is generated by the ``make_color3_keywords.py`` Python script. ``An+B.json`` - Tests the `An+B `_ + Tests the `An+B `_ syntax defined in CSS Syntax Level 3. - This `differs `_ from the + This `differs `_ from the `nth grammar rule `_ in Selectors Level 3 only in that - ``-`` charecters and digits can be escaped in some cases. + ``-`` characters and digits can be escaped in some cases. The Unicode input is represented by a JSON string, the output as null for invalid syntax, or an array of two integers ``[A, B]``. +``urange.json`` + Tests the `urange `_ + syntax defined in CSS Syntax Level 3. + The Unicode input is represented by a JSON string, + the output as null for invalid syntax, + or an array of two integers ``[start, end]``. + Result representation ===================== @@ -228,10 +235,6 @@ Component values the value as a number, the type as the string ``"integer"`` or ``"number"``, and the unit as a string. - - Array of length 3: the string ``"unicode-range"``, - followed by the *start* and *end* integers as two numbers. - The string ``"~="``. diff --git a/src/css-parsing-tests/component_value_list.json b/src/css-parsing-tests/component_value_list.json index a3a2a8b3..42cac5fd 100644 --- a/src/css-parsing-tests/component_value_list.json +++ b/src/css-parsing-tests/component_value_list.json @@ -325,80 +325,6 @@ ["dimension", "12", 12, "integer", "rêd"] ], -"u+1 U+10 U+100 U+1000 U+10000 U+100000 U+1000000", [ - ["unicode-range", 1, 1], " ", - ["unicode-range", 16, 16], " ", - ["unicode-range", 256, 256], " ", - ["unicode-range", 4096, 4096], " ", - ["unicode-range", 65536, 65536], " ", - ["unicode-range", 1048576, 1048576], " ", - ["unicode-range", 1048576, 1048576], ["number", "0", 0, "integer"] -], - -"u+? u+1? U+10? U+100? U+1000? U+10000? U+100000?", [ - ["unicode-range", 0, 15], " ", - ["unicode-range", 16, 31], " ", - ["unicode-range", 256, 271], " ", - ["unicode-range", 4096, 4111], " ", - ["unicode-range", 65536, 65551], " ", - ["unicode-range", 1048576, 1048591], " ", - ["unicode-range", 1048576, 1048576], "?" -], - -"u+?? U+1?? U+10?? U+100?? U+1000?? U+10000??", [ - ["unicode-range", 0, 255], " ", - ["unicode-range", 256, 511], " ", - ["unicode-range", 4096, 4351], " ", - ["unicode-range", 65536, 65791], " ", - ["unicode-range", 1048576, 1048831], " ", - ["unicode-range", 1048576, 1048591], "?" -], - -"u+??? U+1??? U+10??? U+100??? U+1000???", [ - ["unicode-range", 0, 4095], " ", - ["unicode-range", 4096, 8191], " ", - ["unicode-range", 65536, 69631], " ", - ["unicode-range", 1048576, 1052671], " ", - ["unicode-range", 1048576, 1048831], "?" -], - -"u+???? U+1???? U+10???? U+100????", [ - ["unicode-range", 0, 65535], " ", - ["unicode-range", 65536, 131071], " ", - ["unicode-range", 1048576, 1114111], " ", - ["unicode-range", 1048576, 1052671], "?" -], - -"u+????? U+1????? U+10?????", [ - ["unicode-range", 0, 1048575], " ", - ["unicode-range", 1048576, 2097151], " ", - ["unicode-range", 1048576, 1114111], "?" -], - -"u+?????? U+1??????", [ - ["unicode-range", 0, 16777215], " ", - ["unicode-range", 1048576, 2097151], "?" -], - -"u+20-3F U+100000-2 U+1000000-2 U+10-200000", [ - ["unicode-range", 32, 63], " ", - ["unicode-range", 1048576, 2], " ", - ["unicode-range", 1048576, 1048576], ["number", "0", 0, "integer"], - ["number", "-2", -2, "integer"], " ", - ["unicode-range", 16, 2097152] -], - -"ù+12 Ü+12 u +12 U+ 12 U+12 - 20 U+1?2 U+1?-50 U+1- 2", [ - ["ident", "ù"], ["number", "+12", 12, "integer"], " ", - ["ident", "Ü"], ["number", "+12", 12, "integer"], " ", - ["ident", "u"], " ", ["number", "+12", 12, "integer"], " ", - ["ident", "U"], "+", " ", ["number", "12", 12, "integer"], " ", - ["unicode-range", 18, 18], " ", "-", " ", ["number", "20", 20, "integer"], " ", - ["unicode-range", 16, 31], ["number", "2", 2, "integer"], " ", - ["unicode-range", 16, 31], ["number", "-50", -50, "integer"], " ", - ["unicode-range", 1, 1], "-", " ", ["number", "2", 2, "integer"] -], - "~=|=^=$=*=|| |/**/| ~/**/=", [ "~=", "|=", "^=", "$=", "*=", "||", "