From b42c56555a06cdd75070fcef64587f67f09f91a9 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 13 Dec 2021 17:26:25 +0530 Subject: ccwl: Support graphviz HTML strings. * ccwl/graphviz.scm (): New type. (escape-id): Delete function. (serialize): New function. (graph->dot): Use serialize instead of escape-id. * tests/graphviz.scm: New file. ("serialize HTML strings correctly"): New test case. * Makefile.am (SCM_TESTS): Register it. --- tests/graphviz.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/graphviz.scm (limited to 'tests') diff --git a/tests/graphviz.scm b/tests/graphviz.scm new file mode 100644 index 0000000..5853616 --- /dev/null +++ b/tests/graphviz.scm @@ -0,0 +1,48 @@ +;;; ccwl --- Concise Common Workflow Language +;;; Copyright © 2021 Arun Isaac +;;; +;;; This file is part of ccwl. +;;; +;;; ccwl is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; ccwl is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with ccwl. If not, see . + +(use-modules (srfi srfi-64)) + +(define graph->dot + (@@ (ccwl graphviz) graph->dot)) + +(define graph + (@@ (ccwl graphviz) graph)) + +(define graph-node + (@@ (ccwl graphviz) graph-node)) + +(define html-string + (@@ (ccwl graphviz) html-string)) + +(test-begin "graphviz") + +(test-equal "serialize HTML strings correctly" + "digraph foo { + bar [label=<
bar
>]; +} +" + (call-with-output-string + (lambda (port) + (graph->dot + (graph 'foo + #:nodes (list (graph-node 'bar + `((label . ,(html-string "
bar
")))))) + port)))) + +(test-end "graphviz") -- cgit v1.2.3