Skip to content

Commit

Permalink
test: added integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomblin committed Jul 20, 2024
1 parent f53128a commit 39e1b75
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,25 @@ pub fn transform_xml(s: &str) -> String {
}
}
}

#[cfg(test)]
mod tests {
use crate::transform_xml;

#[test]
fn transform_xml_returns_struct() {
let xml = "<foo>hello</foo>";

let actual = transform_xml(xml);

let expected = concat!(
"#[derive(Serialize, Deserialize)]\n",
"pub struct Foo {\n",
" #[serde(rename = \"$text\")]\n",
" pub text: Option<String>,\n",
"}\n\n"
);

assert_eq!(expected, actual);
}
}

0 comments on commit 39e1b75

Please sign in to comment.