From 5aece2f2caeddba9b4b740da50e42f50c5e5c733 Mon Sep 17 00:00:00 2001 From: Lydia Duncan Date: Fri, 15 Mar 2024 10:58:09 -0700 Subject: [PATCH] Add future to lock in the bug I found with chpldoc linking behavior The documentation for a nested record can't link to symbols defined at the same level as it. This should be something it can do (and is something it can do for functions defined at the same level) ---- Signed-off-by: Lydia Duncan --- test/chpldoc/links/linkToPrev.doc.bad | 1 + test/chpldoc/links/linkToPrev.doc.chpl | 10 +++++++ test/chpldoc/links/linkToPrev.doc.chpldocopts | 1 + test/chpldoc/links/linkToPrev.doc.cleanfiles | 1 + test/chpldoc/links/linkToPrev.doc.future | 2 ++ test/chpldoc/links/linkToPrev.doc.good | 1 + test/chpldoc/links/linkToPrev.doc.prediff | 28 +++++++++++++++++++ 7 files changed, 44 insertions(+) create mode 100644 test/chpldoc/links/linkToPrev.doc.bad create mode 100644 test/chpldoc/links/linkToPrev.doc.chpl create mode 100644 test/chpldoc/links/linkToPrev.doc.chpldocopts create mode 100644 test/chpldoc/links/linkToPrev.doc.cleanfiles create mode 100644 test/chpldoc/links/linkToPrev.doc.future create mode 100644 test/chpldoc/links/linkToPrev.doc.good create mode 100755 test/chpldoc/links/linkToPrev.doc.prediff diff --git a/test/chpldoc/links/linkToPrev.doc.bad b/test/chpldoc/links/linkToPrev.doc.bad new file mode 100644 index 000000000000..6a0d93f14fc1 --- /dev/null +++ b/test/chpldoc/links/linkToPrev.doc.bad @@ -0,0 +1 @@ +Could not find link for reference '#linkToPrev.func1' diff --git a/test/chpldoc/links/linkToPrev.doc.chpl b/test/chpldoc/links/linkToPrev.doc.chpl new file mode 100644 index 000000000000..3504e830cced --- /dev/null +++ b/test/chpldoc/links/linkToPrev.doc.chpl @@ -0,0 +1,10 @@ +module linkToPrev { + record foo { + proc func1() { } + + // Seems to only be a problem for record's referring to functions at the + // same level and when they are both in another type + /* Returned by :proc:`func1` */ + record innerFoo { } + } +} diff --git a/test/chpldoc/links/linkToPrev.doc.chpldocopts b/test/chpldoc/links/linkToPrev.doc.chpldocopts new file mode 100644 index 000000000000..02dbf6292e13 --- /dev/null +++ b/test/chpldoc/links/linkToPrev.doc.chpldocopts @@ -0,0 +1 @@ +-o docs diff --git a/test/chpldoc/links/linkToPrev.doc.cleanfiles b/test/chpldoc/links/linkToPrev.doc.cleanfiles new file mode 100644 index 000000000000..d8f8d46921aa --- /dev/null +++ b/test/chpldoc/links/linkToPrev.doc.cleanfiles @@ -0,0 +1 @@ +docs diff --git a/test/chpldoc/links/linkToPrev.doc.future b/test/chpldoc/links/linkToPrev.doc.future new file mode 100644 index 000000000000..5561137a5b8c --- /dev/null +++ b/test/chpldoc/links/linkToPrev.doc.future @@ -0,0 +1,2 @@ +bug: can't link from nested type to sibling symbols +#24625 diff --git a/test/chpldoc/links/linkToPrev.doc.good b/test/chpldoc/links/linkToPrev.doc.good new file mode 100644 index 000000000000..45a12e2ad558 --- /dev/null +++ b/test/chpldoc/links/linkToPrev.doc.good @@ -0,0 +1 @@ +Found link for reference '#linkToPrev.func1' diff --git a/test/chpldoc/links/linkToPrev.doc.prediff b/test/chpldoc/links/linkToPrev.doc.prediff new file mode 100755 index 000000000000..b0a724de721d --- /dev/null +++ b/test/chpldoc/links/linkToPrev.doc.prediff @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import sys +import os +import re + +testname = sys.argv[1] +testout = sys.argv[2] + +html_file = f"docs/modules/linkToPrev.html" +if not os.path.exists(html_file): + with open(testout, "w") as f: + print(f"Could not find '{html_file}'", file=f) + exit() + +html_output = "" +with open(html_file, "r") as f: + html_output = f.read() + +output = [] + +if not re.search(f'', html_output): + output.append(f"Could not find link for reference '#linkToPrev.func1'") +else: + output.append(f"Found link for reference '#linkToPrev.func1'") + +with open(testout, "w") as f: + print("\n".join(output), file=f)