summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-16 15:28:03 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-16 15:39:25 +0100
commitcc5f14193c25200e254e64cc594b15e84da280f9 (patch)
tree3659be64d81dc3c0b2b4b36dd70f1d9bb949fcb1 /tests
parent51efb0f4d69943e290d977673970cd3c8ada306f (diff)
Flip test directory structure 🔃
Move full/lang/library to the top-level as that's more ergonomic to use.
Diffstat (limited to 'tests')
-rw-r--r--tests/README.md18
-rw-r--r--tests/full/ref/coma.png (renamed from tests/ref/full/coma.png)bin27418 -> 27418 bytes
-rw-r--r--tests/full/typ/coma.typ (renamed from tests/typ/full/coma.typ)0
-rw-r--r--tests/lang/ref/arrays.png (renamed from tests/ref/lang/arrays.png)bin3479 -> 3479 bytes
-rw-r--r--tests/lang/ref/basics.png (renamed from tests/ref/lang/basics.png)bin5051 -> 5051 bytes
-rw-r--r--tests/lang/ref/blocks.png (renamed from tests/ref/lang/blocks.png)bin1363 -> 1363 bytes
-rw-r--r--tests/lang/ref/bracket-call.png (renamed from tests/ref/lang/bracket-call.png)bin22257 -> 22257 bytes
-rw-r--r--tests/lang/ref/comments.png (renamed from tests/ref/lang/comments.png)bin1148 -> 1148 bytes
-rw-r--r--tests/lang/ref/dictionaries.png (renamed from tests/ref/lang/dictionaries.png)bin1769 -> 1769 bytes
-rw-r--r--tests/lang/ref/empty.png (renamed from tests/ref/lang/empty.png)bin94 -> 94 bytes
-rw-r--r--tests/lang/ref/escaping.png (renamed from tests/ref/lang/escaping.png)bin4148 -> 4148 bytes
-rw-r--r--tests/lang/ref/expressions.png (renamed from tests/ref/lang/expressions.png)bin2351 -> 2351 bytes
-rw-r--r--tests/lang/ref/headings.png (renamed from tests/ref/lang/headings.png)bin7850 -> 7850 bytes
-rw-r--r--tests/lang/ref/let.png (renamed from tests/ref/lang/let.png)bin1493 -> 1493 bytes
-rw-r--r--tests/lang/ref/raw.png (renamed from tests/ref/lang/raw.png)bin4212 -> 4212 bytes
-rw-r--r--tests/lang/ref/values.png (renamed from tests/ref/lang/values.png)bin8531 -> 8531 bytes
-rw-r--r--tests/lang/typ/arrays.typ (renamed from tests/typ/lang/arrays.typ)0
-rw-r--r--tests/lang/typ/basics.typ (renamed from tests/typ/lang/basics.typ)0
-rw-r--r--tests/lang/typ/blocks.typ (renamed from tests/typ/lang/blocks.typ)0
-rw-r--r--tests/lang/typ/bracket-call.typ (renamed from tests/typ/lang/bracket-call.typ)0
-rw-r--r--tests/lang/typ/comments.typ (renamed from tests/typ/lang/comments.typ)0
-rw-r--r--tests/lang/typ/dictionaries.typ (renamed from tests/typ/lang/dictionaries.typ)0
-rw-r--r--tests/lang/typ/empty.typ (renamed from tests/typ/lang/empty.typ)0
-rw-r--r--tests/lang/typ/escaping.typ (renamed from tests/typ/lang/escaping.typ)0
-rw-r--r--tests/lang/typ/expressions.typ (renamed from tests/typ/lang/expressions.typ)0
-rw-r--r--tests/lang/typ/headings.typ (renamed from tests/typ/lang/headings.typ)0
-rw-r--r--tests/lang/typ/let.typ (renamed from tests/typ/lang/let.typ)0
-rw-r--r--tests/lang/typ/raw.typ (renamed from tests/typ/lang/raw.typ)0
-rw-r--r--tests/lang/typ/values.typ (renamed from tests/typ/lang/values.typ)0
-rw-r--r--tests/library/ref/font.png (renamed from tests/ref/library/font.png)bin5386 -> 5386 bytes
-rw-r--r--tests/library/ref/hv.png (renamed from tests/ref/library/hv.png)bin3961 -> 3961 bytes
-rw-r--r--tests/library/ref/image.png (renamed from tests/ref/library/image.png)bin220343 -> 220343 bytes
-rw-r--r--tests/library/ref/page.png (renamed from tests/ref/library/page.png)bin8097 -> 8097 bytes
-rw-r--r--tests/library/ref/pagebreak.png (renamed from tests/ref/library/pagebreak.png)bin821 -> 821 bytes
-rw-r--r--tests/library/ref/rgb.png (renamed from tests/ref/library/rgb.png)bin2688 -> 2688 bytes
-rw-r--r--tests/library/typ/font.typ (renamed from tests/typ/library/font.typ)0
-rw-r--r--tests/library/typ/hv.typ (renamed from tests/typ/library/hv.typ)0
-rw-r--r--tests/library/typ/image.typ (renamed from tests/typ/library/image.typ)0
-rw-r--r--tests/library/typ/page.typ (renamed from tests/typ/library/page.typ)0
-rw-r--r--tests/library/typ/pagebreak.typ (renamed from tests/typ/library/pagebreak.typ)0
-rw-r--r--tests/library/typ/rgb.typ (renamed from tests/typ/library/rgb.typ)0
-rw-r--r--tests/typeset.rs17
42 files changed, 20 insertions, 15 deletions
diff --git a/tests/README.md b/tests/README.md
index 91bf8f49..efca6dd6 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -1,23 +1,23 @@
# Tests
-Directory structure:
+Top level directory structure:
+- `full`: Tests of full documents.
+- `lang`: Tests for specific language features.
+- `library`: Tests for specific library functions.
+- `res`: Resource files used by tests.
+
+Directory structure for each category:
- `typ`: Input files.
- `ref`: Reference images which the output is compared with to determine whether
a test passed or failed.
-- `res`: Resource files used by tests.
- `png`: PNG files produced by tests.
- `pdf`: PDF files produced by tests.
-The test files are split into three categories:
-- `full`: Tests of full documents.
-- `lang`: Tests for specific language features.
-- `library`: Tests for specific library functions.
-
To keep things small, please optimize the reference images:
```bash
# One image
-oxipng -o max tests/ref/image.png
+oxipng -o max path/to/image.png
# All images
-oxipng -r -o max tests/ref/*
+oxipng -r -o max tests/*/ref
```
diff --git a/tests/ref/full/coma.png b/tests/full/ref/coma.png
index 0c18b810..0c18b810 100644
--- a/tests/ref/full/coma.png
+++ b/tests/full/ref/coma.png
Binary files differ
diff --git a/tests/typ/full/coma.typ b/tests/full/typ/coma.typ
index b7863fce..b7863fce 100644
--- a/tests/typ/full/coma.typ
+++ b/tests/full/typ/coma.typ
diff --git a/tests/ref/lang/arrays.png b/tests/lang/ref/arrays.png
index 2d70a3f6..2d70a3f6 100644
--- a/tests/ref/lang/arrays.png
+++ b/tests/lang/ref/arrays.png
Binary files differ
diff --git a/tests/ref/lang/basics.png b/tests/lang/ref/basics.png
index 3c3dd7a0..3c3dd7a0 100644
--- a/tests/ref/lang/basics.png
+++ b/tests/lang/ref/basics.png
Binary files differ
diff --git a/tests/ref/lang/blocks.png b/tests/lang/ref/blocks.png
index ca826c1b..ca826c1b 100644
--- a/tests/ref/lang/blocks.png
+++ b/tests/lang/ref/blocks.png
Binary files differ
diff --git a/tests/ref/lang/bracket-call.png b/tests/lang/ref/bracket-call.png
index 16afb187..16afb187 100644
--- a/tests/ref/lang/bracket-call.png
+++ b/tests/lang/ref/bracket-call.png
Binary files differ
diff --git a/tests/ref/lang/comments.png b/tests/lang/ref/comments.png
index df5e5b9c..df5e5b9c 100644
--- a/tests/ref/lang/comments.png
+++ b/tests/lang/ref/comments.png
Binary files differ
diff --git a/tests/ref/lang/dictionaries.png b/tests/lang/ref/dictionaries.png
index aa40549e..aa40549e 100644
--- a/tests/ref/lang/dictionaries.png
+++ b/tests/lang/ref/dictionaries.png
Binary files differ
diff --git a/tests/ref/lang/empty.png b/tests/lang/ref/empty.png
index 87c06b0a..87c06b0a 100644
--- a/tests/ref/lang/empty.png
+++ b/tests/lang/ref/empty.png
Binary files differ
diff --git a/tests/ref/lang/escaping.png b/tests/lang/ref/escaping.png
index 575a4b2f..575a4b2f 100644
--- a/tests/ref/lang/escaping.png
+++ b/tests/lang/ref/escaping.png
Binary files differ
diff --git a/tests/ref/lang/expressions.png b/tests/lang/ref/expressions.png
index 309c32f1..309c32f1 100644
--- a/tests/ref/lang/expressions.png
+++ b/tests/lang/ref/expressions.png
Binary files differ
diff --git a/tests/ref/lang/headings.png b/tests/lang/ref/headings.png
index 1f374cce..1f374cce 100644
--- a/tests/ref/lang/headings.png
+++ b/tests/lang/ref/headings.png
Binary files differ
diff --git a/tests/ref/lang/let.png b/tests/lang/ref/let.png
index be9d8397..be9d8397 100644
--- a/tests/ref/lang/let.png
+++ b/tests/lang/ref/let.png
Binary files differ
diff --git a/tests/ref/lang/raw.png b/tests/lang/ref/raw.png
index f88194c0..f88194c0 100644
--- a/tests/ref/lang/raw.png
+++ b/tests/lang/ref/raw.png
Binary files differ
diff --git a/tests/ref/lang/values.png b/tests/lang/ref/values.png
index 762ad64e..762ad64e 100644
--- a/tests/ref/lang/values.png
+++ b/tests/lang/ref/values.png
Binary files differ
diff --git a/tests/typ/lang/arrays.typ b/tests/lang/typ/arrays.typ
index 0b8fb866..0b8fb866 100644
--- a/tests/typ/lang/arrays.typ
+++ b/tests/lang/typ/arrays.typ
diff --git a/tests/typ/lang/basics.typ b/tests/lang/typ/basics.typ
index 9220e376..9220e376 100644
--- a/tests/typ/lang/basics.typ
+++ b/tests/lang/typ/basics.typ
diff --git a/tests/typ/lang/blocks.typ b/tests/lang/typ/blocks.typ
index cadd30dd..cadd30dd 100644
--- a/tests/typ/lang/blocks.typ
+++ b/tests/lang/typ/blocks.typ
diff --git a/tests/typ/lang/bracket-call.typ b/tests/lang/typ/bracket-call.typ
index 79667e61..79667e61 100644
--- a/tests/typ/lang/bracket-call.typ
+++ b/tests/lang/typ/bracket-call.typ
diff --git a/tests/typ/lang/comments.typ b/tests/lang/typ/comments.typ
index c5b04967..c5b04967 100644
--- a/tests/typ/lang/comments.typ
+++ b/tests/lang/typ/comments.typ
diff --git a/tests/typ/lang/dictionaries.typ b/tests/lang/typ/dictionaries.typ
index c729b92c..c729b92c 100644
--- a/tests/typ/lang/dictionaries.typ
+++ b/tests/lang/typ/dictionaries.typ
diff --git a/tests/typ/lang/empty.typ b/tests/lang/typ/empty.typ
index e69de29b..e69de29b 100644
--- a/tests/typ/lang/empty.typ
+++ b/tests/lang/typ/empty.typ
diff --git a/tests/typ/lang/escaping.typ b/tests/lang/typ/escaping.typ
index cb663612..cb663612 100644
--- a/tests/typ/lang/escaping.typ
+++ b/tests/lang/typ/escaping.typ
diff --git a/tests/typ/lang/expressions.typ b/tests/lang/typ/expressions.typ
index 01725289..01725289 100644
--- a/tests/typ/lang/expressions.typ
+++ b/tests/lang/typ/expressions.typ
diff --git a/tests/typ/lang/headings.typ b/tests/lang/typ/headings.typ
index f62f6534..f62f6534 100644
--- a/tests/typ/lang/headings.typ
+++ b/tests/lang/typ/headings.typ
diff --git a/tests/typ/lang/let.typ b/tests/lang/typ/let.typ
index c7bba747..c7bba747 100644
--- a/tests/typ/lang/let.typ
+++ b/tests/lang/typ/let.typ
diff --git a/tests/typ/lang/raw.typ b/tests/lang/typ/raw.typ
index 22eda139..22eda139 100644
--- a/tests/typ/lang/raw.typ
+++ b/tests/lang/typ/raw.typ
diff --git a/tests/typ/lang/values.typ b/tests/lang/typ/values.typ
index ce41fc43..ce41fc43 100644
--- a/tests/typ/lang/values.typ
+++ b/tests/lang/typ/values.typ
diff --git a/tests/ref/library/font.png b/tests/library/ref/font.png
index 1e025c6f..1e025c6f 100644
--- a/tests/ref/library/font.png
+++ b/tests/library/ref/font.png
Binary files differ
diff --git a/tests/ref/library/hv.png b/tests/library/ref/hv.png
index ee649fb6..ee649fb6 100644
--- a/tests/ref/library/hv.png
+++ b/tests/library/ref/hv.png
Binary files differ
diff --git a/tests/ref/library/image.png b/tests/library/ref/image.png
index 70f263e6..70f263e6 100644
--- a/tests/ref/library/image.png
+++ b/tests/library/ref/image.png
Binary files differ
diff --git a/tests/ref/library/page.png b/tests/library/ref/page.png
index 97557437..97557437 100644
--- a/tests/ref/library/page.png
+++ b/tests/library/ref/page.png
Binary files differ
diff --git a/tests/ref/library/pagebreak.png b/tests/library/ref/pagebreak.png
index 16eae0e4..16eae0e4 100644
--- a/tests/ref/library/pagebreak.png
+++ b/tests/library/ref/pagebreak.png
Binary files differ
diff --git a/tests/ref/library/rgb.png b/tests/library/ref/rgb.png
index 3060e42c..3060e42c 100644
--- a/tests/ref/library/rgb.png
+++ b/tests/library/ref/rgb.png
Binary files differ
diff --git a/tests/typ/library/font.typ b/tests/library/typ/font.typ
index beaddd4e..beaddd4e 100644
--- a/tests/typ/library/font.typ
+++ b/tests/library/typ/font.typ
diff --git a/tests/typ/library/hv.typ b/tests/library/typ/hv.typ
index 36a6d242..36a6d242 100644
--- a/tests/typ/library/hv.typ
+++ b/tests/library/typ/hv.typ
diff --git a/tests/typ/library/image.typ b/tests/library/typ/image.typ
index 2e7b1eb5..2e7b1eb5 100644
--- a/tests/typ/library/image.typ
+++ b/tests/library/typ/image.typ
diff --git a/tests/typ/library/page.typ b/tests/library/typ/page.typ
index 9eeddc93..9eeddc93 100644
--- a/tests/typ/library/page.typ
+++ b/tests/library/typ/page.typ
diff --git a/tests/typ/library/pagebreak.typ b/tests/library/typ/pagebreak.typ
index 2f539ce0..2f539ce0 100644
--- a/tests/typ/library/pagebreak.typ
+++ b/tests/library/typ/pagebreak.typ
diff --git a/tests/typ/library/rgb.typ b/tests/library/typ/rgb.typ
index 66d63d0d..66d63d0d 100644
--- a/tests/typ/library/rgb.typ
+++ b/tests/library/typ/rgb.typ
diff --git a/tests/typeset.rs b/tests/typeset.rs
index 5777950f..10e6231e 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -38,14 +38,18 @@ fn main() {
let filter = TestFilter::new(env::args().skip(1));
let mut filtered = Vec::new();
- for entry in WalkDir::new(TYP_DIR).into_iter() {
+ for entry in WalkDir::new(".").into_iter() {
let entry = entry.unwrap();
+ if entry.depth() <= 1 {
+ continue;
+ }
+
let src_path = entry.into_path();
if src_path.extension() != Some(OsStr::new("typ")) {
continue;
}
- if filter.matches(&src_path.to_string_lossy().to_string()) {
+ if filter.matches(&src_path.to_string_lossy()) {
filtered.push(src_path);
}
}
@@ -78,10 +82,11 @@ fn main() {
let mut ok = true;
for src_path in filtered {
- let relative = src_path.strip_prefix(TYP_DIR).unwrap();
- let png_path = Path::new(PNG_DIR).join(&relative).with_extension("png");
- let pdf_path = Path::new(PDF_DIR).join(&relative).with_extension("pdf");
- let ref_path = Path::new(REF_DIR).join(&relative).with_extension("png");
+ let category = src_path.parent().unwrap().parent().unwrap();
+ let name = src_path.file_stem().unwrap();
+ let png_path = category.join(PNG_DIR).join(name).with_extension("png");
+ let pdf_path = category.join(PDF_DIR).join(name).with_extension("pdf");
+ let ref_path = category.join(REF_DIR).join(name).with_extension("png");
ok &= test(&src_path, &png_path, &pdf_path, Some(&ref_path), &mut env);
}