summaryrefslogtreecommitdiff
path: root/tests/dot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dot.rs')
-rw-r--r--tests/dot.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/dot.rs b/tests/dot.rs
index bf960a9..9d944a2 100644
--- a/tests/dot.rs
+++ b/tests/dot.rs
@@ -63,6 +63,36 @@ digraph {
}
#[test]
+fn quotted_id() {
+ let quotted_id = r#"Earvin "Magic" Johnson"#;
+ let g = GraphBuilder::new_named_directed(quotted_id)
+ .build()
+ .unwrap();
+ let r = test_input(g);
+ assert_eq!(
+ r.unwrap(),
+ r#"digraph "Earvin \"Magic\" Johnson" {
+}
+"#
+ );
+}
+
+#[test]
+fn id_with_space() {
+ let id = "A Graph";
+ let g = GraphBuilder::new_named_directed(id)
+ .build()
+ .unwrap();
+ let r = test_input(g);
+ assert_eq!(
+ r.unwrap(),
+ r#"digraph "A Graph" {
+}
+"#
+ );
+}
+
+#[test]
fn empty_digraph() {
let g = GraphBuilder::new_named_directed("empty_graph")
.build()
@@ -198,6 +228,28 @@ fn single_edge() {
}
#[test]
+fn format_edges() {
+ let g = GraphBuilder::new_named_directed("format_edges")
+ .add_node(Node::new(r#"Earvin "Magic" Johnson"#))
+ .add_node(Node::new("A Graph"))
+ .add_edge(Edge::new(r#"Earvin "Magic" Johnson"#, "A Graph"))
+ .build()
+ .unwrap();
+
+ let r = test_input(g);
+
+ assert_eq!(
+ r.unwrap(),
+ r#"digraph format_edges {
+ "Earvin \"Magic\" Johnson";
+ "A Graph";
+ "Earvin \"Magic\" Johnson" -> "A Graph";
+}
+"#
+ );
+}
+
+#[test]
fn single_edge_with_style() {
let edge = EdgeBuilder::new("N0", "N1")
.style(EdgeStyle::Bold)