diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-09-04 16:27:53 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-09-04 16:29:57 +0200 |
| commit | 2f672b4e2ebb040896c7a6af5104f72b075565e0 (patch) | |
| tree | 21bc7f1a4b22a898fa1e8c23b09cd08051690a4b /tests | |
| parent | 68a25f497ec9137fc2965aaeff5a49501ede552e (diff) | |
Allow packages to specify their minimum compiler version
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/packages/future-0.1.0/lib.typ | 1 | ||||
| -rw-r--r-- | tests/packages/future-0.1.0/typst.toml | 5 | ||||
| -rw-r--r-- | tests/src/tests.rs | 7 | ||||
| -rw-r--r-- | tests/typ/compiler/packages.typ | 5 |
4 files changed, 16 insertions, 2 deletions
diff --git a/tests/packages/future-0.1.0/lib.typ b/tests/packages/future-0.1.0/lib.typ new file mode 100644 index 00000000..80406f62 --- /dev/null +++ b/tests/packages/future-0.1.0/lib.typ @@ -0,0 +1 @@ +#future diff --git a/tests/packages/future-0.1.0/typst.toml b/tests/packages/future-0.1.0/typst.toml new file mode 100644 index 00000000..f8da5406 --- /dev/null +++ b/tests/packages/future-0.1.0/typst.toml @@ -0,0 +1,5 @@ +[package] +name = "future" +version = "0.1.0" +entrypoint = "lib.typ" +compiler = "1.0.0" diff --git a/tests/src/tests.rs b/tests/src/tests.rs index 960aacd2..fee6f2b7 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -25,7 +25,7 @@ use typst::doc::{Document, Frame, FrameItem, Meta}; use typst::eval::{eco_format, func, Bytes, Datetime, Library, NoneValue, Tracer, Value}; use typst::font::{Font, FontBook}; use typst::geom::{Abs, Color, RgbaColor, Smart}; -use typst::syntax::{FileId, Source, Span, SyntaxNode, VirtualPath}; +use typst::syntax::{FileId, PackageVersion, Source, Span, SyntaxNode, VirtualPath}; use typst::{World, WorldExt}; use typst_library::layout::{Margin, PageElem}; use typst_library::text::{TextElem, TextSize}; @@ -719,7 +719,10 @@ fn parse_part_metadata(source: &Source) -> TestPartMetadata { let mut s = Scanner::new(expectation); let range = range(&mut s); let rest = if range.is_some() { s.after() } else { s.string() }; - let message = rest.trim().into(); + let message = rest + .trim() + .replace("VERSION", &PackageVersion::compiler().to_string()) + .into(); annotations.insert(Annotation { kind, range, message }); } } diff --git a/tests/typ/compiler/packages.typ b/tests/typ/compiler/packages.typ index 066a31de..0d3fda58 100644 --- a/tests/typ/compiler/packages.typ +++ b/tests/typ/compiler/packages.typ @@ -12,6 +12,11 @@ #test(add(2, 8), 10) --- +// Test too high required compiler version. +// Error: 9-29 package requires typst 1.0.0 or newer (current version is VERSION) +#import "@test/future:0.1.0": future + +--- // Error: 9-13 `@` is not a valid package namespace #import "@@": * |
