summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-13 14:07:38 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-13 14:07:38 +0100
commit60154474ba1cf4a556bbed7f80ee0947c29dbca8 (patch)
treeb864fb2503c6a49f1c6676db85d6d3397462a35b /tests/typ
parent539735e668f601058c2c71a847335e17fac107e8 (diff)
Enable multiple tests per file 🧱
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/func-font-error.typ21
-rw-r--r--tests/typ/func-font-fallback.typ20
-rw-r--r--tests/typ/func-font-properties.typ20
-rw-r--r--tests/typ/func-font.typ65
-rw-r--r--tests/typ/func-h-and-v.typ11
-rw-r--r--tests/typ/func-image-error.typ11
-rw-r--r--tests/typ/func-image-formats.typ8
-rw-r--r--tests/typ/func-image.typ (renamed from tests/typ/func-image-fit.typ)23
-rw-r--r--tests/typ/func-page-body.typ11
-rw-r--r--tests/typ/func-page-dirs.typ5
-rw-r--r--tests/typ/func-page-error.typ11
-rw-r--r--tests/typ/func-page.typ (renamed from tests/typ/func-page-metrics.typ)34
-rw-r--r--tests/typ/func-rgb.typ14
13 files changed, 136 insertions, 118 deletions
diff --git a/tests/typ/func-font-error.typ b/tests/typ/func-font-error.typ
deleted file mode 100644
index b75a4fb7..00000000
--- a/tests/typ/func-font-error.typ
+++ /dev/null
@@ -1,21 +0,0 @@
-// Test error cases of the `font` function.
-
-// Not one of the valid things for positional arguments.
-[font false]
-
-// 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 expected font style, found font weight
-// error: 7:28-7:34 expected font weight, found string
-// 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
deleted file mode 100644
index c6dd81f0..00000000
--- a/tests/typ/func-font-fallback.typ
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test font fallback.
-
-// Source Sans Pro + Segoe UI Emoji.
-Emoji: 🏀
-
-// CMU Serif + Noto Emoji.
-[font "CMU Serif", "Noto Emoji"][
- Emoji: 🏀
-]
-
-// Class definitions.
-[font serif: ("CMU Serif", "Latin Modern Math", "Noto Emoji")]
-[font serif][
- Math: ∫ α + β ➗ 3
-]
-
-// Class definition reused.
-[font sans-serif: "Noto Emoji"]
-[font sans-serif: ("Archivo", sans-serif)]
-New sans-serif. 🚀
diff --git a/tests/typ/func-font-properties.typ b/tests/typ/func-font-properties.typ
deleted file mode 100644
index af8b8891..00000000
--- a/tests/typ/func-font-properties.typ
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test configuring font properties.
-
-[font "PT Sans", 10pt]
-
-// Set same font size in three different ways.
-[font 20pt][A]
-[font 200%][A]
-[font 15pt + 50%][A]
-
-// Do nothing.
-[font][Normal]
-
-// Set style (is available).
-[font style: italic][Italic]
-
-// Set weight (is available).
-[font weight: bold][Bold]
-
-// Set stretch (not available, matching closest).
-[font stretch: ultra-condensed][Condensed]
diff --git a/tests/typ/func-font.typ b/tests/typ/func-font.typ
new file mode 100644
index 00000000..c73e3a1a
--- /dev/null
+++ b/tests/typ/func-font.typ
@@ -0,0 +1,65 @@
+// Test configuring font properties.
+
+[font "PT Sans", 10pt]
+
+// Set same font size in three different ways.
+[font 20pt][A]
+[font 200%][A]
+[font 15pt + 50%][A]
+
+// Do nothing.
+[font][Normal]
+
+// Set style (is available).
+[font style: italic][Italic]
+
+// Set weight (is available).
+[font weight: bold][Bold]
+
+// Set stretch (not available, matching closest).
+[font stretch: ultra-condensed][Condensed]
+
+---
+// Test font fallback.
+
+// Source Sans Pro + Segoe UI Emoji.
+Emoji: 🏀
+
+// CMU Serif + Noto Emoji.
+[font "CMU Serif", "Noto Emoji"][
+ Emoji: 🏀
+]
+
+// Class definitions.
+[font serif: ("CMU Serif", "Latin Modern Math", "Noto Emoji")]
+[font serif][
+ Math: ∫ α + β ➗ 3
+]
+
+// Class definition reused.
+[font sans-serif: "Noto Emoji"]
+[font sans-serif: ("Archivo", sans-serif)]
+New sans-serif. 🚀
+
+---
+// Test error cases.
+//
+// ref: false
+// error: 3:7-3:12 unexpected argument
+// error: 6:14-6:18 expected font style, found font weight
+// error: 6:28-6:34 expected font weight, found string
+// error: 6:43-6:44 expected font family or array of font families, found integer
+// warning: 9:15-9:19 must be between 100 and 900
+// error: 12:7-12:27 unexpected argument
+
+// Not one of the valid things for positional arguments.
+[font false]
+
+// Wrong types.
+[font style: bold, weight: "thin", serif: 0]
+
+// Weight out of range.
+[font weight: 2700]
+
+// Non-existing argument.
+[font something: "invalid"]
diff --git a/tests/typ/func-h-and-v.typ b/tests/typ/func-h-and-v.typ
index 0587b3ed..7b8843c8 100644
--- a/tests/typ/func-h-and-v.typ
+++ b/tests/typ/func-h-and-v.typ
@@ -12,9 +12,6 @@ Add [h 10pt] [h 10pt] up
// Relative to font size.
Relative [h 100%] spacing
-// Missing spacing.
-Totally [h] ignored
-
// Swapped axes.
[page main-dir: rtl, cross-dir: ttb][
1 [h 1cm] 2
@@ -22,4 +19,10 @@ Totally [h] ignored
3 [v 1cm] 4 [v -1cm] 5
]
-// error: 16:11-16:11 missing argument: spacing
+---
+// Test error cases.
+//
+// error: 3:11-3:11 missing argument: spacing
+
+// Missing spacing.
+Totally [h] ignored
diff --git a/tests/typ/func-image-error.typ b/tests/typ/func-image-error.typ
deleted file mode 100644
index 15553420..00000000
--- a/tests/typ/func-image-error.typ
+++ /dev/null
@@ -1,11 +0,0 @@
-// Test error cases of the `image` function.
-
-// File does not exist.
-[image "path/does/not/exist"]
-
-// File exists, but is no image.
-[image "typ/image-error.typ"]
-
-// compare-ref: false
-// error: 4:8-4:29 failed to load image
-// error: 7:8-7:29 failed to load image
diff --git a/tests/typ/func-image-formats.typ b/tests/typ/func-image-formats.typ
deleted file mode 100644
index c12e3639..00000000
--- a/tests/typ/func-image-formats.typ
+++ /dev/null
@@ -1,8 +0,0 @@
-// Test loading different image formats.
-
-// Load an RGBA PNG image.
-[image "res/rhino.png"]
-[pagebreak]
-
-// Load an RGB JPEG image.
-[image "res/tiger.jpg"]
diff --git a/tests/typ/func-image-fit.typ b/tests/typ/func-image.typ
index a9855aa4..78a644c0 100644
--- a/tests/typ/func-image-fit.typ
+++ b/tests/typ/func-image.typ
@@ -1,3 +1,13 @@
+// Test loading different image formats.
+
+// Load an RGBA PNG image.
+[image "res/rhino.png"]
+[pagebreak]
+
+// Load an RGB JPEG image.
+[image "res/tiger.jpg"]
+
+---
// Test configuring the size and fitting behaviour of images.
// Fit to width of page.
@@ -21,3 +31,16 @@
[align bottom, right][
[image "res/tiger.jpg"]
]
+
+---
+// Test error cases.
+//
+// ref: false
+// error: 3:8-3:29 failed to load image
+// error: 6:8-6:29 failed to load image
+
+// File does not exist.
+[image "path/does/not/exist"]
+
+// File exists, but is no image.
+[image "typ/image-error.typ"]
diff --git a/tests/typ/func-page-body.typ b/tests/typ/func-page-body.typ
deleted file mode 100644
index bfa9775d..00000000
--- a/tests/typ/func-page-body.typ
+++ /dev/null
@@ -1,11 +0,0 @@
-// Test a combination of pages with bodies and normal content.
-
-[page height: 50pt]
-
-[page][First]
-[page][Second]
-[pagebreak]
-Fourth
-[page][]
-Sixth
-[page][Seventh and last]
diff --git a/tests/typ/func-page-dirs.typ b/tests/typ/func-page-dirs.typ
deleted file mode 100644
index 47e8ae15..00000000
--- a/tests/typ/func-page-dirs.typ
+++ /dev/null
@@ -1,5 +0,0 @@
-// Test changing the layouting directions of pages.
-
-[page main-dir: btt, cross-dir: rtl]
-
-Right to left!
diff --git a/tests/typ/func-page-error.typ b/tests/typ/func-page-error.typ
deleted file mode 100644
index 21370fa8..00000000
--- a/tests/typ/func-page-error.typ
+++ /dev/null
@@ -1,11 +0,0 @@
-// Test error cases of the `page` function.
-
-// Invalid paper.
-[page nonexistant]
-
-// Aligned axes.
-[page main-dir: ltr]
-
-// compare-ref: false
-// 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.typ
index 3b54d13f..7f87a414 100644
--- a/tests/typ/func-page-metrics.typ
+++ b/tests/typ/func-page.typ
@@ -23,3 +23,37 @@
// Flip the page.
[page "a10", flip: true][Flipped]
+
+---
+// Test a combination of pages with bodies and normal content.
+
+[page height: 50pt]
+
+[page][First]
+[page][Second]
+[pagebreak]
+Fourth
+[page][]
+Sixth
+[page][Seventh and last]
+
+
+---
+// Test changing the layouting directions of pages.
+
+[page main-dir: btt, cross-dir: rtl]
+
+Right to left!
+
+---
+// Test error cases.
+//
+// ref: false
+// error: 3:7-3:18 unknown variable
+// error: 6:17-6:20 aligned axis
+
+// Invalid paper.
+[page nonexistant]
+
+// Aligned axes.
+[page main-dir: ltr]
diff --git a/tests/typ/func-rgb.typ b/tests/typ/func-rgb.typ
index 96c23ebd..e88b19bf 100644
--- a/tests/typ/func-rgb.typ
+++ b/tests/typ/func-rgb.typ
@@ -1,4 +1,11 @@
// Test the `rgb` function.
+//
+// warning: 9:6-9:9 must be between 0.0 and 1.0
+// warning: 9:11-9:15 must be between 0.0 and 1.0
+// error: 12:6-12:10 missing argument: blue component
+// error: 15:5-15:5 missing argument: red component
+// error: 15:5-15:5 missing argument: green component
+// error: 15:5-15:5 missing argument: blue component
// Check the output.
[rgb 0.0, 0.3, 0.7]
@@ -14,10 +21,3 @@
// Missing all components.
[rgb]
-
-// 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
-// error: 16:5-16:5 missing argument: blue component