summaryrefslogtreecommitdiff
path: root/test/org.test
blob: 20a05094a7369bac929e874c21a4b9516d864203 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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