From b4d8ec97ccba878251bb8cb021448262cce90d62 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 27 Feb 2022 18:30:35 -0800 Subject: [PATCH] tests: introduce a further variant of #2179 When working on a fix for this issue, we want to ensure we do not also affect the case that currently (correctly) does not warn. --- rtest/test_regression.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rtest/test_regression.py b/rtest/test_regression.py index a69fc73be..679d4fddc 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -1376,6 +1376,29 @@ def test_2179(): assert "Warning: no hard-coded metrics for" not in stderr, \ "incorrect warning triggered" +def test_2179_1(): + """ + processing a label with a line containing only a space should not yield a + warning + https://gitlab.com/graphviz/graphviz/-/issues/2179 + """ + + # a graph containing a label with a line containing only a space + input = 'digraph "" {\n' \ + ' 0 -> 1 [fontname="Lato",label=<
1>]\n' \ + '}' + + # run a graph with an empty label through Graphviz + with subprocess.Popen(["dot", "-Tsvg", "-o", os.devnull], + stdin=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True) as p: + _, stderr = p.communicate(input) + + assert p.returncode == 0 + + assert "Warning: no hard-coded metrics for" not in stderr, \ + "incorrect warning triggered" + def test_2185_1(): """ GVPR should deal with strings correctly -- 2.40.0