diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-02 19:37:10 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-02 19:37:10 +0100 |
| commit | 1c40dc42e7bc7b799b77f06d25414aca59a044ba (patch) | |
| tree | ea8bdedaebf59f5bc601346b0108236c7264a29d /tests | |
| parent | 8cad78481cd52680317032c3bb84cacda5666489 (diff) | |
Dynamic values, Types, Arrays, and Dictionaries 🚀
- Identifiers are now evaluated as variables instead of being plain values
- Constants like `left` or `bold` are stored as dynamic values containing the respective rust types
- We now distinguish between arrays and dictionaries to make things more intuitive (at the cost of a bit more complex parsing)
- Spans were removed from collections (arrays, dictionaries), function arguments still have spans for the top-level values to enable good diagnostics
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/func-rgb.png | bin | 3153 -> 2727 bytes | |||
| -rw-r--r-- | tests/typ/func-font-error.typ | 10 | ||||
| -rw-r--r-- | tests/typ/func-font-fallback.typ | 14 | ||||
| -rw-r--r-- | tests/typ/func-page-error.typ | 2 | ||||
| -rw-r--r-- | tests/typ/func-page-metrics.typ | 2 | ||||
| -rw-r--r-- | tests/typ/func-rgb.typ | 7 |
6 files changed, 20 insertions, 15 deletions
diff --git a/tests/ref/func-rgb.png b/tests/ref/func-rgb.png Binary files differindex 0f34d661..239a9e5a 100644 --- a/tests/ref/func-rgb.png +++ b/tests/ref/func-rgb.png diff --git a/tests/typ/func-font-error.typ b/tests/typ/func-font-error.typ index 492ef9df..b75a4fb7 100644 --- a/tests/typ/func-font-error.typ +++ b/tests/typ/func-font-error.typ @@ -6,12 +6,16 @@ // Wrong types. [font style: bold, weight: "thin", serif: 0] +// Weight out of range. +[font weight: 2700] + // Non-existing argument. [font something: "invalid"] // compare-ref: false // error: 4:7-4:12 unexpected argument -// error: 7:14-7:18 invalid font style +// error: 7:14-7:18 expected font style, found font weight // error: 7:28-7:34 expected font weight, found string -// error: 7:43-7:44 expected family or list of families, found integer -// error: 10:7-10:27 unexpected argument +// error: 7:43-7:44 expected font family or array of font families, found integer +// warning: 10:15-10:19 must be between 100 and 900 +// error: 13:7-13:27 unexpected argument diff --git a/tests/typ/func-font-fallback.typ b/tests/typ/func-font-fallback.typ index 9b60d46c..c6dd81f0 100644 --- a/tests/typ/func-font-fallback.typ +++ b/tests/typ/func-font-fallback.typ @@ -4,15 +4,17 @@ Emoji: 🏀 // CMU Serif + Noto Emoji. -[font "CMU Serif", "Noto Emoji"][Emoji: 🏀] +[font "CMU Serif", "Noto Emoji"][ + Emoji: 🏀 +] // Class definitions. -[font math: ("CMU Serif", "Latin Modern Math", "Noto Emoji")] -[font math][Math: ∫ α + β ➗ 3] +[font serif: ("CMU Serif", "Latin Modern Math", "Noto Emoji")] +[font serif][ + Math: ∫ α + β ➗ 3 +] -// Class redefinition. +// Class definition reused. [font sans-serif: "Noto Emoji"] [font sans-serif: ("Archivo", sans-serif)] New sans-serif. 🚀 - -// TODO: Add tests for other scripts. diff --git a/tests/typ/func-page-error.typ b/tests/typ/func-page-error.typ index 1b2db60d..21370fa8 100644 --- a/tests/typ/func-page-error.typ +++ b/tests/typ/func-page-error.typ @@ -7,5 +7,5 @@ [page main-dir: ltr] // compare-ref: false -// error: 4:7-4:18 invalid paper +// error: 4:7-4:18 unknown variable // error: 7:17-7:20 aligned axis diff --git a/tests/typ/func-page-metrics.typ b/tests/typ/func-page-metrics.typ index 7e0bc2f8..3b54d13f 100644 --- a/tests/typ/func-page-metrics.typ +++ b/tests/typ/func-page-metrics.typ @@ -22,4 +22,4 @@ [page margins: 0pt, left: 40pt][Overriden] // Flip the page. -[page a10, flip: true][Flipped] +[page "a10", flip: true][Flipped] diff --git a/tests/typ/func-rgb.typ b/tests/typ/func-rgb.typ index b47039a2..96c23ebd 100644 --- a/tests/typ/func-rgb.typ +++ b/tests/typ/func-rgb.typ @@ -1,7 +1,7 @@ // Test the `rgb` function. // Check the output. -[rgb 0.0, 0.3, 0.7] [val #004db3] +[rgb 0.0, 0.3, 0.7] // Alpha channel. [rgb 1.0, 0.0, 0.0, 0.5] @@ -15,9 +15,8 @@ // Missing all components. [rgb] -// error: 4:22-4:25 unknown function -// error: 10:6-10:9 should be between 0.0 and 1.0 -// error: 10:11-10:15 should be between 0.0 and 1.0 +// warning: 10:6-10:9 must be between 0.0 and 1.0 +// warning: 10:11-10:15 must be between 0.0 and 1.0 // error: 13:6-13:10 missing argument: blue component // error: 16:5-16:5 missing argument: red component // error: 16:5-16:5 missing argument: green component |
