diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-09-16 16:41:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-16 14:41:18 +0000 |
| commit | 16e67f8bea7e6891e954420e2e005976fb48a528 (patch) | |
| tree | b1de8e17f184d10894447a602da1722a71dd23a9 /tests/suite/foundations/repr.typ | |
| parent | db71a178bef7f1525d732a190ac75a1a6d56f24b (diff) | |
Shrink tests (#4967)
Diffstat (limited to 'tests/suite/foundations/repr.typ')
| -rw-r--r-- | tests/suite/foundations/repr.typ | 121 |
1 files changed, 77 insertions, 44 deletions
diff --git a/tests/suite/foundations/repr.typ b/tests/suite/foundations/repr.typ index 7f03209b..36823e98 100644 --- a/tests/suite/foundations/repr.typ +++ b/tests/suite/foundations/repr.typ @@ -1,57 +1,90 @@ --- repr --- -#test(repr(ltr), "ltr") -#test(repr((1, 2, false, )), "(1, 2, false)") +#let t(a, b) = test(repr(a), b.text) ---- repr-literals --- // Literal values. -#auto \ -#none (empty) \ -#true \ -#false +#t(auto, `auto`) +#t(true, `true`) +#t(false, `false`) ---- repr-numerical --- // Numerical values. -#1 \ -#1.0e-4 \ -#3.15 \ -#1e-10 \ -#50.368% \ -#0.0000012345pt \ -#4.5cm \ -#12e1pt \ -#2.5rad \ -#45deg \ -#1.7em \ -#(1cm + 0em) \ -#(2em + 10pt) \ -#(100% + (2em + 2pt)) \ -#(100% + 0pt) \ -#(100% - 2em + 2pt) \ -#(100% - 2pt) \ -#2.3fr - ---- repr-misc --- -// Colors and strokes. -#set text(0.8em) -#rgb("f7a205") \ -#(2pt + rgb("f7a205")) +#t(12.0, `12.0`) +#t(3.14, `3.14`) +#t(1234567890.0, `1234567890.0`) +#t(0123456789.0, `123456789.0`) +#t(0.0, `0.0`) +#t(-0.0, `-0.0`) +#t(-1.0, `-1.0`) +#t(-9876543210.0, `-9876543210.0`) +#t(-0987654321.0, `-987654321.0`) +#t(-3.14, `-3.14`) +#t(4.0 - 8.0, `-4.0`) +#t(float.inf, `float.inf`) +#t(-float.inf, `-float.inf`) +#t(float.nan, `float.nan`) // Strings and escaping. -#raw(repr("hi"), lang: "typc") -#repr("a\n[]\"\u{1F680}string") +#t("hi", `"hi"`) +#t("a\n[]\"\u{1F680}string", `"a\n[]\"🚀string"`) -// Content. -#raw(lang: "typc", repr[*Hey*]) \ -#raw(lang: "typc", repr[A _sequence_]) \ -#raw(lang: "typc", repr[A _longer_ *sequence*!]) +// Array and dictionary. +#t((1, 2, false, ), `(1, 2, false)`) +#t((a: 1, b: "2"), `(a: 1, b: "2")`) // Functions. #let f(x) = x -#f \ -#rect \ -#(() => none) +#t(f, `f`) +#t(rect , `rect`) +#t(() => none, `(..) => ..`) // Types. -#int \ -#type("hi") \ -#type((a: 1)) +#t(int, `integer`) +#t(type("hi"), `string`) +#t(type((a: 1)), `dictionary`) + +// Constants. +#t(ltr, `ltr`) +#t(left, `left`) + +// Content. +#t([*Hey*], `strong(body: [Hey])`) +#t([A _sequence_], `sequence([A], [ ], emph(body: [sequence]))`) +#t([A _longer_ *sequence*!], ``` +sequence( + [A], + [ ], + emph(body: [longer]), + [ ], + strong(body: [sequence]), + [!], +) +```) + +// Colors and strokes. +#t(rgb("f7a205"), `rgb("#f7a205")`) +#t(2pt + rgb("f7a205"), `2pt + rgb("#f7a205")`) +#t(blue, `rgb("#0074d9")`) +#t(color.linear-rgb(blue), `color.linear-rgb(0%, 17.46%, 69.39%)`) +#t(oklab(blue), `oklab(56.22%, -0.05, -0.17)`) +#t(oklch(blue), `oklch(56.22%, 0.177, 253.71deg)`) +#t(cmyk(blue), `cmyk(100%, 46.54%, 0%, 14.9%)`) +#t(color.hsl(blue), `color.hsl(207.93deg, 100%, 42.55%)`) +#t(color.hsv(blue), `color.hsv(207.93deg, 100%, 85.1%)`) +#t(luma(blue), `luma(45.53%)`) + +// Gradients. +#t( + gradient.linear(blue, red), + `gradient.linear((rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`, +) +#t( + gradient.linear(blue, red, dir: ttb), + `gradient.linear(dir: rtl, (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`, +) +#t( + gradient.linear(blue, red, relative: "self", angle: 45deg), + `gradient.linear(angle: 45deg, relative: "self", (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`, +) +#t( + gradient.linear(blue, red, space: rgb, angle: 45deg), + `gradient.linear(angle: 45deg, space: rgb, (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`, +) |
