mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Move basic markup tests to integration 🚚
This commit is contained in:
parent
1cd687b681
commit
6efa6c7891
@ -10,7 +10,7 @@ use crate::syntax::*;
|
|||||||
|
|
||||||
use BinOp::*;
|
use BinOp::*;
|
||||||
use Expr::{Angle, Bool, Color, Float, Int, Length, Percent};
|
use Expr::{Angle, Bool, Color, Float, Int, Length, Percent};
|
||||||
use Node::{Emph, Linebreak, Parbreak, Space, Strong};
|
use Node::{Space, Strong};
|
||||||
use UnOp::{Neg, Pos};
|
use UnOp::{Neg, Pos};
|
||||||
|
|
||||||
macro_rules! t {
|
macro_rules! t {
|
||||||
@ -213,35 +213,6 @@ macro_rules! Let {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_simple_nodes() {
|
|
||||||
// Basics.
|
|
||||||
t!("");
|
|
||||||
t!(" " Space);
|
|
||||||
t!("hi" Text("hi"));
|
|
||||||
t!("🧽" Text("🧽"));
|
|
||||||
t!("_" Emph);
|
|
||||||
t!("*" Strong);
|
|
||||||
t!("~" Text("\u{00A0}"));
|
|
||||||
t!(r"\" Linebreak);
|
|
||||||
t!("\n\n" Parbreak);
|
|
||||||
|
|
||||||
// Multiple nodes.
|
|
||||||
t!("ab c" Text("ab"), Space, Text("c"));
|
|
||||||
t!("a`hi`\r\n\r*" Text("a"), Raw(None, &["hi"], true), Parbreak, Strong);
|
|
||||||
|
|
||||||
// Spans.
|
|
||||||
t!("*🌍*"
|
|
||||||
nodes: [S(0..1, Strong), S(1..5, Text("🌍")), S(5..6, Strong)],
|
|
||||||
spans: true);
|
|
||||||
|
|
||||||
// Errors.
|
|
||||||
t!("]}"
|
|
||||||
nodes: [],
|
|
||||||
errors: [S(0..1, "unexpected closing bracket"),
|
|
||||||
S(1..2, "unexpected closing brace")]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_raw() {
|
fn test_parse_raw() {
|
||||||
// Basic, mostly tested in tokenizer and resolver.
|
// Basic, mostly tested in tokenizer and resolver.
|
||||||
|
BIN
tests/ref/basic-markup.png
Normal file
BIN
tests/ref/basic-markup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
22
tests/typ/basic-markup.typ
Normal file
22
tests/typ/basic-markup.typ
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Test text, emph and strong.
|
||||||
|
|
||||||
|
Hello 🌏!
|
||||||
|
|
||||||
|
_Emph_ and *strong*!
|
||||||
|
|
||||||
|
---
|
||||||
|
// Test non-breaking space.
|
||||||
|
|
||||||
|
The non-breaking~space does not work.
|
||||||
|
|
||||||
|
---
|
||||||
|
// Test backslash.
|
||||||
|
|
||||||
|
// Directly after word.
|
||||||
|
Line\ Break
|
||||||
|
|
||||||
|
// Spaces around.
|
||||||
|
Line \ Break
|
||||||
|
|
||||||
|
// Directly before word does not work.
|
||||||
|
No \Break
|
@ -37,7 +37,6 @@ Fourth
|
|||||||
Sixth
|
Sixth
|
||||||
[page][Seventh and last]
|
[page][Seventh and last]
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
// Test changing the layouting directions of pages.
|
// Test changing the layouting directions of pages.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user