Added tests

This commit is contained in:
Wandmalfarbe 2022-11-24 16:21:50 +01:00
parent 04e329698d
commit 87923d0468
48 changed files with 256 additions and 1 deletions

2
.gitignore vendored
View File

@ -5,6 +5,8 @@ private/
# build folder # build folder
dist/ dist/
.idea
# contains unit tests (incomplete at the moment, so don't include them) # contains unit tests (incomplete at the moment, so don't include them)
test/ test/
test/.idea/ test/.idea/

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,7 @@ containsElement () {
} }
# these examples are skipped because they don't run on travis (for now) # these examples are skipped because they don't run on travis (for now)
skippedExamples=("language-chinese" "language-japanese") skippedExamples=("language-chinese" "language-japanese", "language-persian")
# loop all files in the current folder # loop all files in the current folder
for f in *; do for f in *; do

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 KiB

After

Width:  |  Height:  |  Size: 466 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

After

Width:  |  Height:  |  Size: 265 KiB

38
tests/build-tests.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -e
echo "##"
echo "# building tests"
echo "##"
echo ""
containsElement () {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
# these examples are skipped because they don't run on travis (for now)
skippedExamples=()
# loop all files in the current folder
for f in *; do
# run only for folders
if [ -d "$f" ]; then
if containsElement "$f" "${skippedExamples[@]}"; then
echo "skipping '$f'"
echo ""
else
echo "building '$f'"
cd "$f"
echo " - running pandoc build script"
bash "$PWD/build.sh"
echo " - generating preview"
pdftoppm -r 150 -png "document.pdf" > "preview.png"
echo ""
cd ".."
fi
fi
done

1
tests/heading/build.sh Normal file
View File

@ -0,0 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings

32
tests/heading/document.md Normal file
View File

@ -0,0 +1,32 @@
---
title: "Test: Heading"
author: [Author]
date: "2022-11-24"
subject: "Markdown"
keywords: [Markdown, Example, Text, Heading]
lang: "en"
...
# Test: Heading
## Setext-style headings
level one
=========
level two
---------
## ATX-style headings
# level one
## level two
### level three
#### level four
##### level five
###### level six

BIN
tests/heading/document.pdf Normal file

Binary file not shown.

BIN
tests/heading/preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings

View File

@ -0,0 +1,28 @@
---
title: "Test: Horizontal Rule"
author: [Author]
date: "2022-11-24"
subject: "Markdown"
keywords: [Markdown, Example, Text, Horizontal Rule]
lang: "en"
...
# Test: Horizontal Rule
## Horizontal Rule with `*` (asterisk)
****
**********
## Horizontal Rule with `-` (minus)
----
----------
## Horizontal Rule with `_` (underscore)
____
__________

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -0,0 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings

View File

@ -0,0 +1,29 @@
---
title: "Test: Definition List"
author: [Author]
date: "2022-11-24"
subject: "Markdown"
keywords: [Markdown, Example, Text, List, Definition List]
lang: "en"
...
# Test: Definition List
## Definition List with single definition
Apple
: Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
Orange
: The fruit of an evergreen tree of the genus Citrus.
## Definition List with multiple definitions
Apple
: Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
: An American computer company.
Orange
: The fruit of an evergreen tree of the genus Citrus.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -0,0 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings

View File

@ -0,0 +1,43 @@
---
title: "Lists"
author: [Author]
date: "2022-11-24"
subject: "Markdown"
keywords: [Markdown, Example, Text, List, Ordered List]
lang: "en"
...
# Test: Lists
## Ordered list with number and period
2. two
3. three
4. four
## Ordered list with number and bracket
8) eight
9) nine
10) ten
## Ordered list with roman numerals
II. one
III. two
IV. three
## Ordered nested list
1. one
1) orange
2) apple
* pine
* maple
3) orange
2. two
1. sunny
II. two
III. three
IV. four
2. rainy

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

1
tests/list-task/build.sh Normal file
View File

@ -0,0 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings

View File

@ -0,0 +1,34 @@
---
title: "Test: Task List"
author: [Author]
date: "2022-11-24"
subject: "Markdown"
keywords: [Markdown, Example, Text, List, Task List]
lang: "en"
...
# Test: Task List
## Task list unchecked
- [ ] one
- [ ] two
- [ ] three
## Task list checked
- [x] one
- [x] two
- [x] three
## Task list nested
- [x] one
- [ ] orange
- [ ] apple
- [x] pine
- [x] maple
- [ ] mango
- [ ] two
- [x] sunny
- [ ] rainy

Binary file not shown.

BIN
tests/list-task/preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings

View File

@ -0,0 +1,43 @@
---
title: "List Unordered"
author: [Author]
date: "2022-11-24"
subject: "Markdown"
keywords: [Markdown, Example, Text, List, Unordered List]
lang: "en"
...
# Test: List Unordered
## Unordered list with dash
- one
- two
- three
## Unordered list with asterisk
* one
* two
* three
## Unordered list with plus sign
+ one
+ two
+ three
## Unordered nested list
- one
- orange
- apple
* pine
* maple
- orange
- two
+ sunny
* four
* five
* six
+ rainy

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB