From 64ed9fb4581b290c6c64152e577ee166ff1d4dd7 Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Mon, 13 Dec 2021 17:41:19 +0530
Subject: ccwl: Escape only the double quote character in graphviz output.

* ccwl/graphviz.scm: Import (ice-9 string-fun).
(serialize): When quoting strings, escape only the double quote
character.
* tests/graphviz.scm ("do not escape backslashes"): New test case.
---
 tests/graphviz.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'tests')

diff --git a/tests/graphviz.scm b/tests/graphviz.scm
index 5853616..bb99edc 100644
--- a/tests/graphviz.scm
+++ b/tests/graphviz.scm
@@ -45,4 +45,17 @@
                                         `((label . ,(html-string "<table><tr><td>bar</td></tr></table>"))))))
        port))))
 
+(test-equal "do not escape backslashes"
+  "digraph foo {
+  bar [label=\"foo\\lbar\"];
+}
+"
+  (call-with-output-string
+    (lambda (port)
+      (graph->dot
+       (graph 'foo
+              #:nodes (list (graph-node 'bar
+                                        `((label . "foo\\lbar")))))
+       port))))
+
 (test-end "graphviz")
-- 
cgit 1.4.1