diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-15 15:43:59 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-15 15:43:59 +0100 |
| commit | 0f0416054f263b80ccec1a463ce4ab20913bdf71 (patch) | |
| tree | 09cc642c361327c386e88e89f81f512248d59514 /src/parse | |
| parent | 469d78d610085044845f0fba462f1d8170b62cd4 (diff) | |
Move value tests + smarter number formatting 🔢
Diffstat (limited to 'src/parse')
| -rw-r--r-- | src/parse/tests.rs | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/src/parse/tests.rs b/src/parse/tests.rs index 8d52c24b..9a35f552 100644 --- a/src/parse/tests.rs +++ b/src/parse/tests.rs @@ -3,13 +3,12 @@ use std::fmt::Debug; use super::parse; -use crate::color::RgbaColor; use crate::diag::{Diag, Level, Pass}; -use crate::geom::{AngularUnit, LengthUnit}; +use crate::geom::LengthUnit; use crate::syntax::*; use BinOp::*; -use Expr::{Angle, Bool, Color, Float, Int, Length, Percent}; +use Expr::{Float, Int, Length}; use Node::{Space, Strong}; use UnOp::{Neg, Pos}; @@ -290,43 +289,3 @@ fn test_parse_expressions() { S(6..6, "expected expression"), S(10..10, "expected expression")]); } - -#[test] -fn test_parse_values() { - // Basics. - t!("{_}" Block!(Id("_"))); - t!("{name}" Block!(Id("name"))); - t!("{ke-bab}" Block!(Id("ke-bab"))); - t!("{α}" Block!(Id("α"))); - t!("{none}" Block!(Expr::None)); - t!("{true}" Block!(Bool(true))); - t!("{false}" Block!(Bool(false))); - t!("{1.0e-4}" Block!(Float(1e-4))); - t!("{3.15}" Block!(Float(3.15))); - t!("{50%}" Block!(Percent(50.0))); - t!("{4.5cm}" Block!(Length(4.5, LengthUnit::Cm))); - t!("{12e1pt}" Block!(Length(12e1, LengthUnit::Pt))); - t!("{13rad}" Block!(Angle(13.0, AngularUnit::Rad))); - t!("{45deg}" Block!(Angle(45.0, AngularUnit::Deg))); - - // Strings. - t!(r#"{"hi"}"# Block!(Str("hi"))); - t!(r#"{"a\n[]\"\u{1F680}string"}"# Block!(Str("a\n[]\"🚀string"))); - - // Colors. - t!("{#f7a20500}" Block!(Color(RgbaColor::new(0xf7, 0xa2, 0x05, 0)))); - t!("{#a5}" - nodes: [Block!(Color(RgbaColor::new(0, 0, 0, 0xff)))], - errors: [S(1..4, "invalid color")]); - - // Content. - t!("{[*Hi*]}" Block!(Template![Strong, Text("Hi"), Strong])); - - // Nested blocks. - t!("{{1}}" Block!(Block!(@Int(1)))); - - // Invalid tokens. - t!("{1u}" - nodes: [], - errors: [S(1..3, "expected expression, found invalid token")]); -} |
