summaryrefslogtreecommitdiff
path: root/test/org.test
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
committercashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
commit4f49b16079b27d7ce633619e4cddfdf2bffbc952 (patch)
treec296c1e7f3c3e2f6859c6d3a1b1b208779b89679 /test/org.test
downloadrelic-4f49b16079b27d7ce633619e4cddfdf2bffbc952.tar.gz
initial commitHEADmaster
Diffstat (limited to 'test/org.test')
-rw-r--r--test/org.test64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/org.test b/test/org.test
new file mode 100644
index 0000000..20a0509
--- /dev/null
+++ b/test/org.test
@@ -0,0 +1,64 @@
+# Native Org renderer and Org wiki integration tests for the Copland fork.
+
+test_setup
+fossil set backoffice-disable 1
+
+write_file page.org {#+TITLE: Hidden Wiki Title
+#+AUTHOR: Ada <ada@example.test>
+#+OPTIONS: toc:2
+
+* Overview
+
+See [[wiki:Deployment Guide#Install][deployment]],
+[[file:docs/reference.org][reference]], and [[*Details][details]].
+
+** Details
+
+Unsafe [[javascript:alert(1)][scheme]] and
+[[file:../secret.org][traversal]] remain plain text.
+
+#+begin_src html
+<script>alert("escaped")</script>
+#+end_src
+}
+
+fossil test-org-render page.org
+test org-render-1 {$CODE == 0 && [regexp {class="org-document"} $RESULT]}
+test org-render-2 {![regexp {<script>} $RESULT] && [regexp {&lt;script&gt;} $RESULT]}
+
+fossil wiki create {Org Page} page.org
+test org-wiki-1 {$CODE == 0}
+fossil wiki export --html {Org Page}
+test org-wiki-2 {$CODE == 0 && [regexp {class="org-document"} $RESULT]}
+test org-wiki-3 {![regexp {class="org-title"} $RESULT]}
+test org-wiki-4 {[regexp {href="wiki\?name=Deployment\+Guide#install"} $RESULT]}
+test org-wiki-5 {[regexp {href="doc/tip/docs/reference.org"} $RESULT]}
+test org-wiki-6 {[regexp {href="#details"} $RESULT]}
+test org-wiki-7 {![regexp {href="javascript:|href="doc/tip/\.\.} $RESULT]}
+
+fossil whatis --type w {Org Page}
+regexp -line {^artifact:\s*([0-9a-f]+)$} $RESULT match artifact
+fossil artifact $artifact
+test org-wiki-8 {[regexp -line {^N text/x-org$} $RESULT]}
+
+write_file markdown.md {# Markdown title
+
+First revision.
+}
+fossil wiki create Legacy markdown.md -M markdown
+write_file markdown.md {# Markdown title
+
+Second revision.
+}
+fossil wiki commit Legacy markdown.md
+fossil wiki export --html Legacy
+test org-wiki-9 {[regexp {<h1[^>]*>Markdown title</h1>} $RESULT]}
+fossil whatis --type w Legacy
+regexp -line {^artifact:\s*([0-9a-f]+)$} $RESULT match artifact
+fossil artifact $artifact
+test org-wiki-10 {[regexp -line {^N text/x-markdown$} $RESULT]}
+
+fossil wiki create Note page.org --technote now -M org -expectError
+test org-wiki-11 {$CODE != 0 && [regexp {not tech notes} $RESULT]}
+
+test_cleanup