summaryrefslogtreecommitdiff
path: root/tests/parser/trees.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-01-16 17:51:04 +0100
committerLaurenz <laurmaedje@gmail.com>2020-01-16 17:51:04 +0100
commit08b91a265fcda74f5463473938ec33873b49a7f7 (patch)
tree747ac6a0b385a14a4aa5adbc3f21ef7b9653bd78 /tests/parser/trees.rs
parent15ad30555bdad8e7b192fdcf7d4543c0d3fb18ce (diff)
Powerful parser testing 🐱‍👤
Diffstat (limited to 'tests/parser/trees.rs')
-rw-r--r--tests/parser/trees.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/parser/trees.rs b/tests/parser/trees.rs
new file mode 100644
index 00000000..442f71dd
--- /dev/null
+++ b/tests/parser/trees.rs
@@ -0,0 +1,33 @@
+p "" => []
+p "hi" => [T("hi")]
+p "hi you" => [T("hi"), S, T("you")]
+p "❤\n\n 🌍" => [T("❤"), N, T("🌍")]
+
+p "[func]" => [func!("func"; None)]
+p "[tree][hi *you*]" => [func!("tree"; Some([T("hi"), S, B, T("you"), B]))]
+
+p "from [align: left] to" => [
+ T("from"), S, func!("align", pos: [ID("left")]; None), S, T("to"),
+]
+
+p "[box: x=1.2pt, false][a b c] bye" => [
+ func!(
+ "box",
+ pos: [BOOL(false)],
+ key: ["x" => SIZE(Size::pt(1.2))];
+ Some([T("a"), S, T("b"), S, T("c")])
+ ),
+ S, T("bye"),
+]
+
+c "hi" => []
+c "[align: left][\n _body_\n]" => [
+ (0:0, 0:1, B),
+ (0:1, 0:6, FN),
+ (0:6, 0:7, CL),
+ (0:8, 0:12, ID),
+ (0:12, 0:13, B),
+ (0:13, 0:14, B),
+ (1:4, 1:10, IT),
+ (2:0, 2:2, B),
+]