]> granicus.if.org Git - graphviz/commitdiff
add a test case for 'gxl2gv' crash
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 22 Oct 2022 21:15:15 +0000 (14:15 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 2 Nov 2022 03:26:06 +0000 (20:26 -0700)
This is one of the variants of #2300.

Gitlab: #2300

tests/2300.gxl [new file with mode: 0644]
tests/test_regression.py

diff --git a/tests/2300.gxl b/tests/2300.gxl
new file mode 100644 (file)
index 0000000..a3cfdb7
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gxl xmlns:xlink=" http://www.w3.org/1999/xlink">
+  <graph id="foo" edgemode="directed">
+    <node id="bar">
+      <attr name="name">
+        <string>qux</string>
+      </attr>
+    </node>
+  </graph>
+</gxl>
index 3f5f9f6750d4ac27184daeffb16e4f173b87013f..efd8f0ce530fa3dd3ab78c8448f24d8e7f455753 100644 (file)
@@ -1994,3 +1994,19 @@ def test_2282():
 
   # confirm this is valid JSON
   json.loads(output)
+
+@pytest.mark.skipif(shutil.which("gxl2gv") is None,
+                    reason="gxl2gv not available")
+@pytest.mark.xfail()
+def test_2300_1():
+  """
+  translating GXL with an attribute `name` should not crash
+  https://gitlab.com/graphviz/graphviz/-/issues/2300
+  """
+
+  # locate our associated test case containing a node attribute `name`
+  input = Path(__file__).parent / "2300.gxl"
+  assert input.exists(), "unexpectedly missing test case"
+
+  # ask `gxl2gv` to process this
+  subprocess.check_call(["gxl2gv", input])