summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAsko Nõmm <ano@ano.ee>2022-05-08 12:23:35 +0300
committerAsko Nõmm <ano@ano.ee>2022-05-08 12:23:35 +0300
commitb97891cc45b9a087a372767e25aa36788bc979bf (patch)
tree0401ef1f090575c36f9e110eaeb50412e3fd4139 /test
parentff2279150638b43aab4e65b2578a5dbd348e21d8 (diff)
Naming improvements, code block matcher test
Diffstat (limited to 'test')
-rw-r--r--test/clarktown/correctors/atx_heading_block_test.clj8
-rw-r--r--test/clarktown/correctors/fenced_code_block_test.clj (renamed from test/clarktown/correctors/code_block_test.clj)16
-rw-r--r--test/clarktown/correctors/list_block_test.clj20
-rw-r--r--test/clarktown/matchers/fenced_code_block_test.clj10
-rw-r--r--test/clarktown/matchers/quote_block_test.clj2
-rw-r--r--test/clarktown/renderers/fenced_code_block_test.clj (renamed from test/clarktown/renderers/code_block_test.clj)12
6 files changed, 39 insertions, 29 deletions
diff --git a/test/clarktown/correctors/atx_heading_block_test.clj b/test/clarktown/correctors/atx_heading_block_test.clj
index 3ece304..f363ad0 100644
--- a/test/clarktown/correctors/atx_heading_block_test.clj
+++ b/test/clarktown/correctors/atx_heading_block_test.clj
@@ -9,22 +9,22 @@
(let [line "# Hello"
lines ["Some text goes here" line]
index 1]
- (is (true? (corrector/empty-line-above? lines line index)))))
+ (is (true? (corrector/newline-above? lines line index)))))
(testing "No empty line above"
(let [line "# Hello"
lines ["Some text goes here" "\n" line]
index 2]
- (is (false? (corrector/empty-line-above? lines line index)))))
+ (is (false? (corrector/newline-above? lines line index)))))
(testing "Empty line below"
(let [line "# Hello"
lines [line "Some text goes here"]
index 0]
- (is (true? (corrector/empty-line-below? lines line index)))))
+ (is (true? (corrector/newline-below? lines line index)))))
(testing "No empty line below"
(let [line "# Hello"
lines [line "\n" "Some text goes here"]
index 0]
- (is (false? (corrector/empty-line-below? lines line index))))))
+ (is (false? (corrector/newline-below? lines line index))))))
diff --git a/test/clarktown/correctors/code_block_test.clj b/test/clarktown/correctors/fenced_code_block_test.clj
index 16711da..a0f9a41 100644
--- a/test/clarktown/correctors/code_block_test.clj
+++ b/test/clarktown/correctors/fenced_code_block_test.clj
@@ -1,37 +1,37 @@
-(ns clarktown.correctors.code-block-test
+(ns clarktown.correctors.fenced-code-block-test
(:require
[clojure.test :refer [deftest testing is]]
- [clarktown.correctors.code-block :as corrector]))
+ [clarktown.correctors.fenced-code-block :as corrector]))
-(deftest code-block-corrector
+(deftest fenced-code-block-corrector-test
(testing "Empty line above"
(let [line "```clojure"
lines ["Some text goes here" line "some code here" "```"]
index 1]
- (is (true? (corrector/empty-line-above? lines line index)))))
+ (is (true? (corrector/newline-above? lines line index)))))
(testing "No empty line above"
(let [line "```"
lines ["Some text goes here" "\n" line "some code" "```"]
index 2]
- (is (false? (corrector/empty-line-above? lines line index)))))
+ (is (false? (corrector/newline-above? lines line index)))))
(testing "Empty line below"
(let [line "```"
lines ["Some text goes here" line "some code" line "some text"]
index 3]
- (is (true? (corrector/empty-line-below? lines line index)))))
+ (is (true? (corrector/newline-below? lines line index)))))
(testing "No empty line below"
(let [line "```"
lines ["Some text goes here" line "some code" line "\n" "some text"]
index 3]
- (is (false? (corrector/empty-line-below? lines line index)))))
+ (is (false? (corrector/newline-below? lines line index)))))
(testing "No empty line below when ending with code block"
(let [line "```"
lines ["Some text goes here" line "some code" line]
index 3]
- (is (false? (corrector/empty-line-below? lines line index))))))
+ (is (false? (corrector/newline-below? lines line index))))))
diff --git a/test/clarktown/correctors/list_block_test.clj b/test/clarktown/correctors/list_block_test.clj
index d435caf..54ff94e 100644
--- a/test/clarktown/correctors/list_block_test.clj
+++ b/test/clarktown/correctors/list_block_test.clj
@@ -9,58 +9,58 @@
(let [line "1. Hello"
lines ["Some text goes here" line]
index 1]
- (is (true? (corrector/empty-line-above? lines line index)))))
+ (is (true? (corrector/newline-above? lines line index)))))
(testing "Empty line above II"
(let [line "* Hello"
lines ["Some text goes here" line]
index 1]
- (is (true? (corrector/empty-line-above? lines line index)))))
+ (is (true? (corrector/newline-above? lines line index)))))
(testing "No empty line above"
(let [line "1. Hello"
lines ["Some text goes here" "\n" line]
index 2]
- (is (false? (corrector/empty-line-above? lines line index)))))
+ (is (false? (corrector/newline-above? lines line index)))))
(testing "No empty line above II"
(let [line "* Hello"
lines ["Some text goes here" "\n" line]
index 2]
- (is (false? (corrector/empty-line-above? lines line index)))))
+ (is (false? (corrector/newline-above? lines line index)))))
(testing "No empty line above III"
(let [line "* Hello"
lines ["Some text here" "* Asd" line]
index 2]
- (is (false? (corrector/empty-line-above? lines line index)))))
+ (is (false? (corrector/newline-above? lines line index)))))
(testing "Empty line below"
(let [line "1. Hello"
lines [line "Some text goes here"]
index 0]
- (is (true? (corrector/empty-line-below? lines line index)))))
+ (is (true? (corrector/newline-below? lines line index)))))
(testing "Empty line below II"
(let [line "* Hello"
lines [line "Some text goes here"]
index 0]
- (is (true? (corrector/empty-line-below? lines line index)))))
+ (is (true? (corrector/newline-below? lines line index)))))
(testing "No empty line below"
(let [line "1. Hello"
lines [line "\n" "Some text goes here"]
index 0]
- (is (false? (corrector/empty-line-below? lines line index)))))
+ (is (false? (corrector/newline-below? lines line index)))))
(testing "No empty line below II"
(let [line "* Hello"
lines [line "\n" "Some text goes here"]
index 0]
- (is (false? (corrector/empty-line-below? lines line index)))))
+ (is (false? (corrector/newline-below? lines line index)))))
(testing "No empty line below III"
(let [line "* Hello"
lines [line "* Asd" "Some text goes here"]
index 0]
- (is (false? (corrector/empty-line-below? lines line index))))))
+ (is (false? (corrector/newline-below? lines line index))))))
diff --git a/test/clarktown/matchers/fenced_code_block_test.clj b/test/clarktown/matchers/fenced_code_block_test.clj
new file mode 100644
index 0000000..5961c6d
--- /dev/null
+++ b/test/clarktown/matchers/fenced_code_block_test.clj
@@ -0,0 +1,10 @@
+(ns clarktown.matchers.fenced-code-block-test
+ (:require
+ [clojure.test :refer [deftest testing is]]
+ [clarktown.matchers.fenced-code-block :as code-block]))
+
+
+(deftest fenced-code-block-matcher-test
+ (testing "Checking a fenced code block"
+ (is (true? (code-block/match? "```\nblabla```")))
+ (is (true? (code-block/match? "```language-spec\nblabla```")))))
diff --git a/test/clarktown/matchers/quote_block_test.clj b/test/clarktown/matchers/quote_block_test.clj
index 05288d6..d4c9067 100644
--- a/test/clarktown/matchers/quote_block_test.clj
+++ b/test/clarktown/matchers/quote_block_test.clj
@@ -4,7 +4,7 @@
[clarktown.matchers.quote-block :as quote-block]))
-(deftest quote-block-block-matcher-test
+(deftest quote-block-matcher-test
(testing "Checking a quote block"
(is (true? (quote-block/match? "> Test")))
(is (true? (quote-block/match? " > Test")))
diff --git a/test/clarktown/renderers/code_block_test.clj b/test/clarktown/renderers/fenced_code_block_test.clj
index c5779be..9a7f4cc 100644
--- a/test/clarktown/renderers/code_block_test.clj
+++ b/test/clarktown/renderers/fenced_code_block_test.clj
@@ -1,15 +1,15 @@
-(ns clarktown.renderers.code-block-test
+(ns clarktown.renderers.fenced-code-block-test
(:require
[clojure.test :refer [deftest testing is]]
[clojure.java.io :as io]
- [clarktown.renderers.code-block :as code-block]))
+ [clarktown.renderers.fenced-code-block :as code-block]))
-(deftest code-block-renderer-test
- (testing "Code block with language specification"
+(deftest fenced-code-block-renderer-test
+ (testing "Fenced 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 nil))))
- (testing "Code block with NO language specification"
+ (testing "Fenced code block with NO language specification"
(is (= (slurp (io/file (io/resource "test/parsers/code_block_no_language_result.html")))
- (code-block/render (slurp (io/file (io/resource "test/parsers/code_block_no_language.md"))) nil nil))))) \ No newline at end of file
+ (code-block/render (slurp (io/file (io/resource "test/parsers/code_block_no_language.md"))) nil nil)))))