diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-01 13:07:11 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-02 10:39:45 +0100 |
| commit | 072e7c710c763904ad3ee72cfb05252f9f0d3929 (patch) | |
| tree | dd2ffa3f4a086ef823a9a0776dddeda5777c7b14 /tests/typ | |
| parent | 8ccb7d6f15a2fbb44247c143b3dd821e44e0d6eb (diff) | |
Reduce namespace pollution
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/code/call.typ | 2 | ||||
| -rw-r--r-- | tests/typ/code/spread.typ | 10 | ||||
| -rw-r--r-- | tests/typ/elements/square.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/font.typ | 28 | ||||
| -rw-r--r-- | tests/typ/utility/color.typ | 2 |
5 files changed, 26 insertions, 18 deletions
diff --git a/tests/typ/code/call.typ b/tests/typ/code/call.typ index 5ab0252c..2c16af1c 100644 --- a/tests/typ/code/call.typ +++ b/tests/typ/code/call.typ @@ -5,7 +5,7 @@ // Ref: true // Ommitted space. -[#font(weight:bold)Bold] +[#font(weight:"bold")Bold] // Call return value of function with body. #let f(x, body) = (y) => [#x] + body + [#y] diff --git a/tests/typ/code/spread.typ b/tests/typ/code/spread.typ index 4e7e0ad8..8a9491d0 100644 --- a/tests/typ/code/spread.typ +++ b/tests/typ/code/spread.typ @@ -4,14 +4,14 @@ --- // Test standard argument overriding. { - let font(style: normal, weight: regular) = { - "(style: " + repr(style) + ", weight: " + repr(weight) + ")" + let font(style: "normal", weight: "regular") = { + "(style: " + style + ", weight: " + weight + ")" } - let myfont(..args) = font(weight: bold, ..args) + let myfont(..args) = font(weight: "bold", ..args) test(myfont(), "(style: normal, weight: bold)") - test(myfont(weight: 100), "(style: normal, weight: 100)") - test(myfont(style: italic), "(style: italic, weight: bold)") + test(myfont(weight: "black"), "(style: normal, weight: black)") + test(myfont(style: "italic"), "(style: italic, weight: bold)") } --- diff --git a/tests/typ/elements/square.typ b/tests/typ/elements/square.typ index 0e9c3c55..3686debb 100644 --- a/tests/typ/elements/square.typ +++ b/tests/typ/elements/square.typ @@ -8,7 +8,7 @@ --- // Test auto-sized square. #square(fill: eastern)[ - #font(fill: white, weight: bold) + #font(fill: white, weight: "bold") #align(center) #pad(5pt)[Typst] ] diff --git a/tests/typ/text/font.typ b/tests/typ/text/font.typ index 3c8fcaf1..5c97d367 100644 --- a/tests/typ/text/font.typ +++ b/tests/typ/text/font.typ @@ -10,10 +10,10 @@ #font()[Normal] // Set style (is available). -#font(style: italic)[Italic] +#font(style: "italic")[Italic] // Set weight (is available). -#font(weight: bold)[Bold] +#font(weight: "bold")[Bold] // Set stretch (not available, matching closest). #font(stretch: 50%)[Condensed] @@ -52,14 +52,14 @@ Emoji: 🐪, 🌋, 🏞 #font(size: 8pt) #let try(top, bottom) = rect(fill: conifer)[ - #font(top-edge: top, bottom-edge: bottom) - `From `#top` to `#bottom + #font(monospace, top-edge: top, bottom-edge: bottom) + From #top to #bottom ] -#try(ascender, descender) -#try(ascender, baseline) -#try(cap-height, baseline) -#try(x-height, baseline) +#try("ascender", "descender") +#try("ascender", "baseline") +#try("cap-height", "baseline") +#try("x-height", "baseline") #try(4pt, -2pt) #try(1pt + 27%, -18%) @@ -68,8 +68,16 @@ Emoji: 🐪, 🌋, 🏞 #font(false) --- -// Error: 14-18 expected font style, found font weight -#font(style: bold, weight: "thin") +// Error: 14-20 expected "normal", "italic" or "oblique" +#font(style: "bold", weight: "thin") + +--- +// Error: 17-19 expected linear or string, found array +#font(top-edge: ()) + +--- +// Error: 17-19 unknown font metric +#font(top-edge: "") --- // Error: 14-15 expected string or array of strings, found integer diff --git a/tests/typ/utility/color.typ b/tests/typ/utility/color.typ index 54316a37..759672ff 100644 --- a/tests/typ/utility/color.typ +++ b/tests/typ/utility/color.typ @@ -19,7 +19,7 @@ #test(rgb(0.1, 0.2, 0.3, -0.1)) --- -// Error: 6-11 invalid color +// Error: 6-11 invalid hex string #rgb("lol") --- |
