summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAsko Nõmm <asko@bien.ee>2022-04-19 17:50:19 +0300
committerAsko Nõmm <asko@bien.ee>2022-04-19 17:50:19 +0300
commit52203a49aa544b2c11c96445d8732893160c436b (patch)
tree84d7b0e9af92770647643bdf7ddbb898663bd7b8 /test
parent059bfa7bd9bfdde0c75646bf1dfc20d23da8a02c (diff)
WIP #16
Pretty much done. Needs more testing. And new documentation.
Diffstat (limited to 'test')
-rw-r--r--test/clarktown/matchers/empty_block_test.clj9
-rw-r--r--test/clarktown/matchers/horizontal_line_block_test.clj14
-rw-r--r--test/clarktown/matchers/quote_block_test.clj11
-rw-r--r--test/clarktown/parsers/empty_block_test.clj14
-rw-r--r--test/clarktown/parsers/horizontal_line_block_test.clj21
-rw-r--r--test/clarktown/parsers/quote_block_test.clj15
-rw-r--r--test/clarktown/renderers/bold_test.clj (renamed from test/clarktown/parsers/bold_test.clj)6
-rw-r--r--test/clarktown/renderers/code_block_test.clj (renamed from test/clarktown/parsers/code_block_test.clj)6
-rw-r--r--test/clarktown/renderers/empty_block_test.clj10
-rw-r--r--test/clarktown/renderers/heading_block_test.clj (renamed from test/clarktown/parsers/heading_block_test.clj)8
-rw-r--r--test/clarktown/renderers/horizontal_line_block_test.clj13
-rw-r--r--test/clarktown/renderers/inline_code_test.clj (renamed from test/clarktown/parsers/inline_code_test.clj)6
-rw-r--r--test/clarktown/renderers/italic_test.clj (renamed from test/clarktown/parsers/italic_test.clj)6
-rw-r--r--test/clarktown/renderers/link_and_image_test.clj (renamed from test/clarktown/parsers/link_and_image_test.clj)6
-rw-r--r--test/clarktown/renderers/quote_block_test.clj10
-rw-r--r--test/clarktown/renderers/strikethrough_test.clj (renamed from test/clarktown/parsers/strikethrough_test.clj)6
16 files changed, 89 insertions, 72 deletions
diff --git a/test/clarktown/matchers/empty_block_test.clj b/test/clarktown/matchers/empty_block_test.clj
new file mode 100644
index 0000000..8fe83e4
--- /dev/null
+++ b/test/clarktown/matchers/empty_block_test.clj
@@ -0,0 +1,9 @@
+(ns clarktown.matchers.empty-block-test
+ (:require
+ [clojure.test :refer [deftest testing is]]
+ [clarktown.matchers.empty-block :as empty-block]))
+
+(deftest empty-block-matcher-test
+ (testing "Checking an empty block"
+ (is (true? (empty-block/match? "")))
+ (is (true? (empty-block/match? " "))))) \ No newline at end of file
diff --git a/test/clarktown/matchers/horizontal_line_block_test.clj b/test/clarktown/matchers/horizontal_line_block_test.clj
new file mode 100644
index 0000000..c3402d2
--- /dev/null
+++ b/test/clarktown/matchers/horizontal_line_block_test.clj
@@ -0,0 +1,14 @@
+(ns clarktown.matchers.horizontal-line-block-test
+ (:require
+ [clojure.test :refer [deftest testing is]]
+ [clarktown.matchers.horizontal-line-block :as horizontal-line-block]))
+
+
+(deftest horizontal-line-block-matcher-test
+ (testing "Is a horizontal line block"
+ (is (true? (horizontal-line-block/match? "***")))
+ (is (true? (horizontal-line-block/match? " ***")))
+ (is (false? (horizontal-line-block/match? "Test *** 123")))
+ (is (true? (horizontal-line-block/match? "---")))
+ (is (true? (horizontal-line-block/match? " ---")))
+ (is (false? (horizontal-line-block/match? "Test --- 123"))))) \ No newline at end of file
diff --git a/test/clarktown/matchers/quote_block_test.clj b/test/clarktown/matchers/quote_block_test.clj
new file mode 100644
index 0000000..05288d6
--- /dev/null
+++ b/test/clarktown/matchers/quote_block_test.clj
@@ -0,0 +1,11 @@
+(ns clarktown.matchers.quote-block-test
+ (:require
+ [clojure.test :refer [deftest testing is]]
+ [clarktown.matchers.quote-block :as quote-block]))
+
+
+(deftest quote-block-block-matcher-test
+ (testing "Checking a quote block"
+ (is (true? (quote-block/match? "> Test")))
+ (is (true? (quote-block/match? " > Test")))
+ (is (true? (quote-block/match? ">"))))) \ No newline at end of file
diff --git a/test/clarktown/parsers/empty_block_test.clj b/test/clarktown/parsers/empty_block_test.clj
deleted file mode 100644
index a8d89c4..0000000
--- a/test/clarktown/parsers/empty_block_test.clj
+++ /dev/null
@@ -1,14 +0,0 @@
-(ns clarktown.parsers.empty-block-test
- (:require
- [clojure.test :refer [deftest testing is]]
- [clarktown.parsers.empty-block :as empty-block]))
-
-
-(deftest empty-block-test
- (testing "Rendering an empty block"
- (is (= (empty-block/render "" nil)
- "")))
-
- (testing "Checking an empty block"
- (is (true? (empty-block/is? "")))
- (is (true? (empty-block/is? " ")))))
diff --git a/test/clarktown/parsers/horizontal_line_block_test.clj b/test/clarktown/parsers/horizontal_line_block_test.clj
deleted file mode 100644
index 21617b6..0000000
--- a/test/clarktown/parsers/horizontal_line_block_test.clj
+++ /dev/null
@@ -1,21 +0,0 @@
-(ns clarktown.parsers.horizontal-line-block-test
- (:require
- [clojure.test :refer [deftest testing is]]
- [clarktown.parsers.horizontal-line-block :as horizontal-line-block]))
-
-
-(deftest horizontal-line-block-test
- (testing "Creating a horizontal line"
- (is (= "<hr>"
- (horizontal-line-block/render "***" nil)))
-
- (is (= "<hr>"
- (horizontal-line-block/render "---" nil))))
-
- (testing "Is a horizontal line block"
- (is (true? (horizontal-line-block/is? "***")))
- (is (true? (horizontal-line-block/is? " ***")))
- (is (false? (horizontal-line-block/is? "Test *** 123")))
- (is (true? (horizontal-line-block/is? "---")))
- (is (true? (horizontal-line-block/is? " ---")))
- (is (false? (horizontal-line-block/is? "Test --- 123"))))) \ No newline at end of file
diff --git a/test/clarktown/parsers/quote_block_test.clj b/test/clarktown/parsers/quote_block_test.clj
deleted file mode 100644
index 94553cf..0000000
--- a/test/clarktown/parsers/quote_block_test.clj
+++ /dev/null
@@ -1,15 +0,0 @@
-(ns clarktown.parsers.quote-block-test
- (:require
- [clojure.test :refer [deftest testing is]]
- [clarktown.parsers.quote-block :as quote-block]))
-
-
-(deftest quote-block-block-test
- (testing "Creating a quote block line"
- (is (= (quote-block/render "> First line\n> second line" nil)
- "<blockquote>First line\nsecond line</blockquote>")))
-
- (testing "Checking a quote block"
- (is (true? (quote-block/is? "> Test")))
- (is (true? (quote-block/is? " > Test")))
- (is (true? (quote-block/is? ">"))))) \ No newline at end of file
diff --git a/test/clarktown/parsers/bold_test.clj b/test/clarktown/renderers/bold_test.clj
index a082d41..fba0ea6 100644
--- a/test/clarktown/parsers/bold_test.clj
+++ b/test/clarktown/renderers/bold_test.clj
@@ -1,10 +1,10 @@
-(ns clarktown.parsers.bold-test
+(ns clarktown.renderers.bold-test
(:require
[clojure.test :refer [deftest testing is]]
- [clarktown.parsers.bold :as bold]))
+ [clarktown.renderers.bold :as bold]))
-(deftest bold-test
+(deftest bold-renderer-test
(testing "Creating bold text with two surrounding asterisk characters"
(is (= "<strong>This is bold.</strong>"
(bold/render "**This is bold.**" nil))))
diff --git a/test/clarktown/parsers/code_block_test.clj b/test/clarktown/renderers/code_block_test.clj
index 8b1113d..37c701b 100644
--- a/test/clarktown/parsers/code_block_test.clj
+++ b/test/clarktown/renderers/code_block_test.clj
@@ -1,11 +1,11 @@
-(ns clarktown.parsers.code-block-test
+(ns clarktown.renderers.code-block-test
(:require
[clojure.test :refer [deftest testing is]]
[clojure.java.io :as io]
- [clarktown.parsers.code-block :as code-block]))
+ [clarktown.renderers.code-block :as code-block]))
-(deftest code-block-test
+(deftest code-block-renderer-test
(testing "Code block with language specification"
(is (= (slurp (io/file (io/resource "test/parsers/code_block_result.html")))
(code-block/render (slurp (io/file (io/resource "test/parsers/code_block.md"))) nil))))
diff --git a/test/clarktown/renderers/empty_block_test.clj b/test/clarktown/renderers/empty_block_test.clj
new file mode 100644
index 0000000..35fb902
--- /dev/null
+++ b/test/clarktown/renderers/empty_block_test.clj
@@ -0,0 +1,10 @@
+(ns clarktown.renderers.empty-block-test
+ (:require
+ [clojure.test :refer [deftest testing is]]
+ [clarktown.renderers.empty-block :as empty-block]))
+
+
+(deftest empty-block-renderer-test
+ (testing "Rendering an empty block"
+ (is (= (empty-block/render "" nil)
+ ""))))
diff --git a/test/clarktown/parsers/heading_block_test.clj b/test/clarktown/renderers/heading_block_test.clj
index 9bfff4f..9c3386f 100644
--- a/test/clarktown/parsers/heading_block_test.clj
+++ b/test/clarktown/renderers/heading_block_test.clj
@@ -1,10 +1,10 @@
-(ns clarktown.parsers.heading-block-test
+(ns clarktown.renderers.heading-block-test
(:require
[clojure.test :refer [deftest testing is]]
- [clarktown.parsers.heading-block :as heading-block]))
+ [clarktown.renderers.heading-block :as heading-block]))
-(deftest hashbang-heading-test
+(deftest atx-heading-renderer-test
(testing "Hashbang heading block that's a H1"
(is (= "<h1>This is a heading block.</h1>"
(heading-block/render "# This is a heading block." nil))))
@@ -26,7 +26,7 @@
(heading-block/render "##### This is a heading block." nil)))))
-(deftest settext-heading-text
+(deftest settext-heading-renderer-text
(testing "Settext heading block that's a H1"
(is (= "<h1>This is a heading block.</h1>"
(heading-block/render "This is a heading block.\n=========" nil))))
diff --git a/test/clarktown/renderers/horizontal_line_block_test.clj b/test/clarktown/renderers/horizontal_line_block_test.clj
new file mode 100644
index 0000000..db72682
--- /dev/null
+++ b/test/clarktown/renderers/horizontal_line_block_test.clj
@@ -0,0 +1,13 @@
+(ns clarktown.renderers.horizontal-line-block-test
+ (:require
+ [clojure.test :refer [deftest testing is]]
+ [clarktown.renderers.horizontal-line-block :as horizontal-line-block]))
+
+
+(deftest horizontal-line-block-renderer-test
+ (testing "Creating a horizontal line"
+ (is (= (horizontal-line-block/render "***" nil)
+ "<hr>"))
+
+ (is (= (horizontal-line-block/render "---" nil)
+ "<hr>"))))
diff --git a/test/clarktown/parsers/inline_code_test.clj b/test/clarktown/renderers/inline_code_test.clj
index 028c4b7..2071b7f 100644
--- a/test/clarktown/parsers/inline_code_test.clj
+++ b/test/clarktown/renderers/inline_code_test.clj
@@ -1,10 +1,10 @@
-(ns clarktown.parsers.inline-code-test
+(ns clarktown.renderers.inline-code-test
(:require
[clojure.test :refer [deftest testing is]]
- [clarktown.parsers.inline-code :as inline-code]))
+ [clarktown.renderers.inline-code :as inline-code]))
-(deftest inline-code-test
+(deftest inline-code-renderer-test
(testing "Creating inline code text"
(is (= "<code>This is inline code.</code>"
(inline-code/render "`This is inline code.`" nil))))
diff --git a/test/clarktown/parsers/italic_test.clj b/test/clarktown/renderers/italic_test.clj
index 8ab1369..29e7811 100644
--- a/test/clarktown/parsers/italic_test.clj
+++ b/test/clarktown/renderers/italic_test.clj
@@ -1,10 +1,10 @@
-(ns clarktown.parsers.italic-test
+(ns clarktown.renderers.italic-test
(:require
[clojure.test :refer [deftest testing is]]
- [clarktown.parsers.italic :as italic]))
+ [clarktown.renderers.italic :as italic]))
-(deftest italic-test
+(deftest italic-renderer-test
(testing "Creating italic text with one surrounding asterisk character"
(is (= "<em>This is italic.</em>"
(italic/render "*This is italic.*" nil))))
diff --git a/test/clarktown/parsers/link_and_image_test.clj b/test/clarktown/renderers/link_and_image_test.clj
index 348a8f9..aa821e3 100644
--- a/test/clarktown/parsers/link_and_image_test.clj
+++ b/test/clarktown/renderers/link_and_image_test.clj
@@ -1,10 +1,10 @@
-(ns clarktown.parsers.link-and-image-test
+(ns clarktown.renderers.link-and-image-test
(:require
[clojure.test :refer [deftest testing is]]
- [clarktown.parsers.link-and-image :as link-and-image]))
+ [clarktown.renderers.link-and-image :as link-and-image]))
-(deftest link-test
+(deftest link-renderer-test
(testing "Creating a link"
(is (= (link-and-image/render "[This is a link](https://example.com)" nil)
"<a href=\"https://example.com\">This is a link</a>"))
diff --git a/test/clarktown/renderers/quote_block_test.clj b/test/clarktown/renderers/quote_block_test.clj
new file mode 100644
index 0000000..33a7495
--- /dev/null
+++ b/test/clarktown/renderers/quote_block_test.clj
@@ -0,0 +1,10 @@
+(ns clarktown.renderers.quote-block-test
+ (:require
+ [clojure.test :refer [deftest testing is]]
+ [clarktown.renderers.quote-block :as quote-block]))
+
+
+(deftest quote-block-block-renderer-test
+ (testing "Creating a quote block line"
+ (is (= (quote-block/render "> First line\n> second line" nil)
+ "<blockquote>First line\nsecond line</blockquote>")))) \ No newline at end of file
diff --git a/test/clarktown/parsers/strikethrough_test.clj b/test/clarktown/renderers/strikethrough_test.clj
index fdf6188..55493e0 100644
--- a/test/clarktown/parsers/strikethrough_test.clj
+++ b/test/clarktown/renderers/strikethrough_test.clj
@@ -1,10 +1,10 @@
-(ns clarktown.parsers.strikethrough-test
+(ns clarktown.renderers.strikethrough-test
(:require
[clojure.test :refer [deftest testing is]]
- [clarktown.parsers.strikethrough :as strikethrough]))
+ [clarktown.renderers.strikethrough :as strikethrough]))
-(deftest strikethrough-test
+(deftest strikethrough-renderer-test
(testing "Creating strikethrough text"
(is (= (strikethrough/render "~~This is strikethrough text.~~" nil)
"<del>This is strikethrough text.</del>")))