diff options
-rw-r--r-- | tests/dot.rs | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/tests/dot.rs b/tests/dot.rs index 9d944a2..f0c61aa 100644 --- a/tests/dot.rs +++ b/tests/dot.rs @@ -63,6 +63,58 @@ digraph { } #[test] +fn nonreadable_ascii_id() { + let id = "\u{0}\u{1}\u{2}\u{3}\u{4}\u{5}\u{6}\u{7}\u{8}\u{9}\u{a}\u{b}\u{c}\u{d}\u{e}\u{f}\ + \u{10}\u{11}\u{12}\u{13}\u{14}\u{15}\u{16}\u{17}\u{18}\u{19}\u{1a}\u{1b}\u{1c}\u{1d}\u{1e}\ + \u{1f}"; + + let g = GraphBuilder::new_named_directed(id) + .build() + .unwrap(); + let r = test_input(g); + assert_eq!( + r.unwrap(), + "digraph \"\u{0}\u{1}\u{2}\u{3}\u{4}\u{5}\u{6}\u{7}\u{8}\u{9}\u{a}\u{b}\u{c}\u{d}\u{e}\ + \u{f}\u{10}\u{11}\u{12}\u{13}\u{14}\u{15}\u{16}\u{17}\u{18}\u{19}\u{1a}\u{1b}\u{1c}\ + \u{1d}\u{1e}\u{1f}\" { +} +" + ); +} + +#[test] +fn readable_ascii_no_alphanum_id() { + let id = r##" !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"##; + + let g = GraphBuilder::new_named_directed(id) + .build() + .unwrap(); + let r = test_input(g); + assert_eq!( + r.unwrap(), + r##"digraph " !\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~" { +} +"## + ); +} + +#[test] +fn non_ascii_alphanum_id() { + let id = "Identität"; + + let g = GraphBuilder::new_named_directed(id) + .build() + .unwrap(); + let r = test_input(g); + assert_eq!( + r.unwrap(), + r##"digraph Identität { +} +"## + ); +} + +#[test] fn quotted_id() { let quotted_id = r#"Earvin "Magic" Johnson"#; let g = GraphBuilder::new_named_directed(quotted_id) @@ -316,7 +368,7 @@ fn edge_statement_port_position() { r#"digraph edge_statement_port_position { N0 [shape=record, label="a|<port0>b"]; N1 [shape=record, label="e|<port1>f"]; - N0:port0:sw -> N1:port1:ne; + "N0:port0:sw" -> "N1:port1:ne"; } "# ); |