From 117cfc10c6d4a0a9346a29353860d1185d1ea224 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Sep 2022 18:17:54 +0200 Subject: Add support for turning hast into swc --- tests/test_utils/hast.rs | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'tests/test_utils/hast.rs') diff --git a/tests/test_utils/hast.rs b/tests/test_utils/hast.rs index 4adf0ca..1ad8789 100644 --- a/tests/test_utils/hast.rs +++ b/tests/test_utils/hast.rs @@ -9,10 +9,11 @@ use alloc::{ string::{String, ToString}, vec::Vec, }; -use micromark::{mdast::AttributeContent, unist::Position}; +pub use micromark::mdast::{AttributeContent, AttributeValue, MdxJsxAttribute}; +use micromark::unist::Position; /// Nodes. -#[derive(Clone, PartialEq)] +#[derive(Clone, PartialEq, Eq)] pub enum Node { /// Root. Root(Root), @@ -142,7 +143,7 @@ impl Node { /// > | a /// ^ /// ``` -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct Root { // Parent. /// Content model. @@ -157,8 +158,7 @@ pub struct Root { /// > | /// ^^^^^^^^^^^^^^^ /// ``` -// To do: clone. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct Element { pub tag_name: String, pub properties: Vec<(String, PropertyValue)>, @@ -168,19 +168,12 @@ pub struct Element { pub position: Option, } -#[derive(Clone, Debug, PartialEq)] -pub enum PropertyItem { - Number(f32), - String(String), -} - -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum PropertyValue { - Number(f32), Boolean(bool), String(String), - CommaSeparated(Vec), - SpaceSeparated(Vec), + CommaSeparated(Vec), + SpaceSeparated(Vec), } /// Document type. @@ -232,7 +225,7 @@ pub struct Text { /// > | /// ^^^^^ /// ``` -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct MdxJsxElement { // Parent. /// Content model. -- cgit