summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-03 11:44:53 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-03 13:35:39 +0100
commit37a7afddfaffd44cb9bc013c9506599267e08983 (patch)
tree20e7d62d3c5418baff01a21d0406b91bf3096214 /tests
parent56342bd972a13ffe21beaf2b87ab7eb1597704b4 (diff)
Split crates
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/math/basic.typ6
-rw-r--r--tests/typeset.rs26
2 files changed, 13 insertions, 19 deletions
diff --git a/tests/typ/math/basic.typ b/tests/typ/math/basic.typ
index a1a9d32f..55a853cf 100644
--- a/tests/typ/math/basic.typ
+++ b/tests/typ/math/basic.typ
@@ -16,11 +16,5 @@ $ sum_(k=0)^n k = (n(n+1))/2 $
$ f: NN arrow RR $
---
-#set math(family: "IBM Plex Sans")
-
-// Error: 1-4 font is not suitable for math
-$a$
-
----
// Error: 1:3 expected dollar sign
$a
diff --git a/tests/typeset.rs b/tests/typeset.rs
index f3f5bfbe..7c0a6e69 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -14,16 +14,16 @@ use tiny_skia as sk;
use unscanny::Scanner;
use walkdir::WalkDir;
-use typst::diag::{FileError, FileResult};
+use typst::diag::{bail, FileError, FileResult};
use typst::font::{Font, FontBook};
use typst::frame::{Element, Frame};
use typst::geom::{Abs, RgbaColor, Sides};
-use typst::library::layout::PageNode;
-use typst::library::text::{TextNode, TextSize};
-use typst::model::{Smart, StyleMap, Value};
+use typst::model::{Smart, Value};
use typst::syntax::{Source, SourceId, SyntaxNode};
use typst::util::{Buffer, PathExt};
-use typst::{bail, Config, World};
+use typst::{Config, World};
+use typst_library::layout::PageNode;
+use typst_library::text::{TextNode, TextSize};
const TYP_DIR: &str = "./typ";
const REF_DIR: &str = "./ref";
@@ -149,7 +149,7 @@ fn config() -> Config {
// Set page width to 120pt with 10pt margins, so that the inner page is
// exactly 100pt wide. Page height is unbounded and font size is 10pt so
// that it multiplies to nice round numbers.
- let mut styles = StyleMap::new();
+ let mut styles = typst_library::styles();
styles.set(PageNode::WIDTH, Smart::Custom(Abs::pt(120.0).into()));
styles.set(PageNode::HEIGHT, Smart::Auto);
styles.set(
@@ -159,10 +159,10 @@ fn config() -> Config {
styles.set(TextNode::SIZE, TextSize(Abs::pt(10.0).into()));
// Hook up helpers into the global scope.
- let mut std = typst::library::scope();
- std.define("conifer", RgbaColor::new(0x9f, 0xEB, 0x52, 0xFF));
- std.define("forest", RgbaColor::new(0x43, 0xA1, 0x27, 0xFF));
- std.def_fn("test", move |_, args| {
+ let mut scope = typst_library::scope();
+ scope.define("conifer", RgbaColor::new(0x9f, 0xEB, 0x52, 0xFF));
+ scope.define("forest", RgbaColor::new(0x43, 0xA1, 0x27, 0xFF));
+ scope.def_fn("test", move |_, args| {
let lhs = args.expect::<Value>("left-hand side")?;
let rhs = args.expect::<Value>("right-hand side")?;
if lhs != rhs {
@@ -170,7 +170,7 @@ fn config() -> Config {
}
Ok(Value::None)
});
- std.def_fn("print", move |_, args| {
+ scope.def_fn("print", move |_, args| {
print!("> ");
for (i, value) in args.all::<Value>()?.into_iter().enumerate() {
if i > 0 {
@@ -184,9 +184,9 @@ fn config() -> Config {
Config {
root: PathBuf::new(),
- items: typst::library::items(),
- std,
+ scope,
styles,
+ items: typst_library::items(),
}
}