]> granicus.if.org Git - graphviz/commitdiff
various test cases for #2185
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 20 Feb 2022 03:53:59 +0000 (19:53 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 24 Feb 2022 05:02:28 +0000 (21:02 -0800)
rtest/2185.gvpr [new file with mode: 0644]
rtest/test_regression.py

diff --git a/rtest/2185.gvpr b/rtest/2185.gvpr
new file mode 100644 (file)
index 0000000..3e52435
--- /dev/null
@@ -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"));  
+}
index 93e8e0c406bd89417ed8e855b17ba8b90acce50e..1809dfbb54021a964c23cd070deac4e3dec5c93f 100644 (file)
@@ -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():
   """