Skip to content

Commit

Permalink
[glyph::tests] add single quote xml decl without custom spacing test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissimpkins committed Aug 14, 2021
1 parent d9d2758 commit 8169c76
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/glyph/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,36 @@ fn serialize_with_custom_whitespace() {
);
}

#[test]
fn serialize_with_single_quote_style() {
let data = include_str!("../../testdata/small_lib.glif");
let glyph = parse_glyph(data.as_bytes()).unwrap();
let options = WriteOptions::default().quote_char(QuoteChar::Single);
let one_tab = glyph.encode_xml_with_options(&options).unwrap();
let one_tab = std::str::from_utf8(&one_tab).unwrap();
pretty_assertions::assert_eq!(
one_tab,
r#"<?xml version='1.0' encoding='UTF-8'?>
<glyph name="hello" format="2">
<advance width="1200"/>
<outline>
<contour>
<point x="2" y="30" type="line"/>
<point x="44" y="10" type="line"/>
</contour>
</outline>
<lib>
<dict>
<key>test.key</key>
<string>I am a creative professional :)</string>
</dict>
</lib>
<note>durp</note>
</glyph>
"#
);
}

#[test]
fn serialize_with_custom_whitespace_and_single_quote_style() {
let data = include_str!("../../testdata/small_lib.glif");
Expand Down

0 comments on commit 8169c76

Please sign in to comment.