From: Matthew Fernandez Date: Sun, 18 Jul 2021 19:29:50 +0000 (-0700) Subject: add a test case for #1971 X-Git-Tag: 2.49.0~50^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=058948e43629992852497bbe49c55b6b93f0d7c6;p=graphviz add a test case for #1971 --- diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 4f9b2cde7..99e52c383 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -1005,6 +1005,37 @@ def test_1931(): assert "line 3\nline 4" in xdot assert "line 5\nline 6" in xdot +@pytest.mark.skipif(shutil.which("edgepaint") is None, + reason="edgepaint not available") +@pytest.mark.xfail(strict=True) # FIXME +def test_1971(): + """ + edgepaint should reject invalid command line options + https://gitlab.com/graphviz/graphviz/-/issues/1971 + """ + + # a basic graph that edgepaint can process + input = \ + 'digraph {\n' \ + ' graph [bb="0,0,54,108"];\n' \ + ' node [label="\\N"];\n' \ + ' a [height=0.5,\n' \ + ' pos="27,90",\n' \ + ' width=0.75];\n' \ + ' b [height=0.5,\n' \ + ' pos="27,18",\n' \ + ' width=0.75];\n' \ + ' a -> b [pos="e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"];\n' \ + '}' + + # run edgepaint with an invalid option, `-rabbit`, that happens to have the + # same first character as valid options + args = ["edgepaint", "-rabbit"] + p = subprocess.Popen(args, stdin=subprocess.PIPE, universal_newlines=True) + p.communicate(input) + + assert p.returncode != 0, "edgepaint incorrectly accepted '-rabbit'" + @pytest.mark.xfail(strict=not is_ndebug_defined()) # FIXME def test_1990(): """