From: Matthew Fernandez Date: Sun, 20 Feb 2022 03:53:59 +0000 (-0800) Subject: various test cases for #2185 X-Git-Tag: 3.0.0~6^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd7dfdf876c447339ae306829917fee830711127;p=graphviz various test cases for #2185 --- diff --git a/rtest/2185.gvpr b/rtest/2185.gvpr new file mode 100644 index 000000000..3e524356c --- /dev/null +++ b/rtest/2185.gvpr @@ -0,0 +1,17 @@ +BEGIN{ + int i=99; + float f=76.3; + string A, B, Z; + + void doPrnt(string errString) { + print(errString); + } + + A=" five "; + + doPrnt("one " + "two " + "three"); // yea, something works + doPrnt("one " + A + "three"); + doPrnt((string)(i)); + // try the fallback - sprintf (it fails, too) + doPrnt(sprintf("%s\n", "Constant")); +} diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 93e8e0c40..1809dfbb5 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -1356,6 +1356,126 @@ def test_2179(): assert "Warning: no hard-coded metrics for" not in stderr, \ "incorrect warning triggered" +# FIXME: this has been root caused to 84b2983edf458098bb6233368904265c92da4e65 +# but a fix has not yet been devised +@pytest.mark.xfail() +def test_2185_1(): + """ + GVPR should deal with strings correctly + https://gitlab.com/graphviz/graphviz/-/issues/2185 + """ + + # find our collocated GVPR program + script = Path(__file__).parent / "2185.gvpr" + assert script.exists(), "missing test case" + + # run this with NUL input, checking output is valid UTF-8 + _ = subprocess.check_output(["gvpr", "-f", script], + stdin=subprocess.DEVNULL, + universal_newlines=True) + +@pytest.mark.xfail() +def test_2185_2(): + """ + GVPR should deal with strings correctly + https://gitlab.com/graphviz/graphviz/-/issues/2185 + """ + + # find our collocated GVPR program + script = Path(__file__).parent / "2185.gvpr" + assert script.exists(), "missing test case" + + # run this with NUL input + out = subprocess.check_output(["gvpr", "-f", script], + stdin=subprocess.DEVNULL) + + # decode output in a separate step to gracefully cope with garbage unicode + out = out.decode("utf-8", "replace") + + # deal with Windows eccentricities + eol = "\r\n" if platform.system() == "Windows" else "\n" + expected = f"one two three{eol}" + + # check the first line is as expected + assert out.startswith(expected), "incorrect GVPR interpretation" + +# FIXME: like `test_2185_1`, it is believed that +# 84b2983edf458098bb6233368904265c92da4e65 is the root cause of this +@pytest.mark.xfail() +def test_2185_3(): + """ + GVPR should deal with strings correctly + https://gitlab.com/graphviz/graphviz/-/issues/2185 + """ + + # find our collocated GVPR program + script = Path(__file__).parent / "2185.gvpr" + assert script.exists(), "missing test case" + + # run this with NUL input + out = subprocess.check_output(["gvpr", "-f", script], + stdin=subprocess.DEVNULL) + + # decode output in a separate step to gracefully cope with garbage unicode + out = out.decode("utf-8", "replace") + + # deal with Windows eccentricities + eol = "\r\n" if platform.system() == "Windows" else "\n" + expected = f"one two three{eol}one five three{eol}" + + # check the first two lines are as expected + assert out.startswith(expected), "incorrect GVPR interpretation" + +@pytest.mark.xfail() # FIXME +def test_2185_4(): + """ + GVPR should deal with strings correctly + https://gitlab.com/graphviz/graphviz/-/issues/2185 + """ + + # find our collocated GVPR program + script = Path(__file__).parent / "2185.gvpr" + assert script.exists(), "missing test case" + + # run this with NUL input + out = subprocess.check_output(["gvpr", "-f", script], + stdin=subprocess.DEVNULL) + + # decode output in a separate step to gracefully cope with garbage unicode + out = out.decode("utf-8", "replace") + + # deal with Windows eccentricities + eol = "\r\n" if platform.system() == "Windows" else "\n" + expected = f"one two three{eol}one five three{eol}99{eol}" + + # check the first three lines are as expected + assert out.startswith(expected), "incorrect GVPR interpretation" + +@pytest.mark.xfail() # FIXME +def test_2185_5(): + """ + GVPR should deal with strings correctly + https://gitlab.com/graphviz/graphviz/-/issues/2185 + """ + + # find our collocated GVPR program + script = Path(__file__).parent / "2185.gvpr" + assert script.exists(), "missing test case" + + # run this with NUL input + out = subprocess.check_output(["gvpr", "-f", script], + stdin=subprocess.DEVNULL) + + # decode output in a separate step to gracefully cope with garbage unicode + out = out.decode("utf-8", "replace") + + # deal with Windows eccentricities + eol = "\r\n" if platform.system() == "Windows" else "\n" + expected = f"one two three{eol}one five three{eol}99{eol}Constant{eol}" + + # check the first four lines are as expected + assert out.startswith(expected), "incorrect GVPR interpretation" + @pytest.mark.xfail(strict=True) # FIXME def test_2193(): """