diff options
| author | Asko Nõmm <ano@ano.ee> | 2022-05-12 21:09:38 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-12 21:09:38 +0300 |
| commit | 2ff0da12f58d17b6c1ab3736a41595073b3a534e (patch) | |
| tree | 52dab7ba9cb71ca06c334cada0b8fc2c99c3fb91 /test/clarktown | |
| parent | 94c1c0ca639f55ff9073cb1fdf2ad6015bb6bae1 (diff) | |
| parent | dc2a364db6d14d4afa9da9aadbccb8fdbb038fe4 (diff) | |
Merge pull request #31 from askonomm/7-support-indented-code-blocks
Implement indented code blocks.
Diffstat (limited to 'test/clarktown')
4 files changed, 58 insertions, 1 deletions
diff --git a/test/clarktown/correctors/atx_heading_block_test.clj b/test/clarktown/correctors/atx_heading_block_test.clj index f363ad0..9889a9e 100644 --- a/test/clarktown/correctors/atx_heading_block_test.clj +++ b/test/clarktown/correctors/atx_heading_block_test.clj @@ -4,7 +4,7 @@ [clarktown.correctors.atx-heading-block :as corrector])) -(deftest atx-heading-block-corrector +(deftest atx-heading-block-corrector-test (testing "Empty line above" (let [line "# Hello" lines ["Some text goes here" line] diff --git a/test/clarktown/correctors/indented_code_block_test.clj b/test/clarktown/correctors/indented_code_block_test.clj new file mode 100644 index 0000000..fc4bcf0 --- /dev/null +++ b/test/clarktown/correctors/indented_code_block_test.clj @@ -0,0 +1,30 @@ +(ns clarktown.correctors.indented-code-block-test + (:require + [clojure.test :refer [deftest testing is]] + [clarktown.correctors.indented-code-block :as corrector])) + + +(deftest indented-code-block-corrector-test + (testing "Empty line above" + (let [line " Test" + lines ["Some text goes here" line] + index 1] + (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/newline-above? lines line index))))) + + (testing "Empty line below" + (let [line " Hello" + lines [line "Some text goes here"] + index 0] + (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/newline-below? lines line index)))))) diff --git a/test/clarktown/matchers/indented_code_block_test.clj b/test/clarktown/matchers/indented_code_block_test.clj new file mode 100644 index 0000000..beffcaa --- /dev/null +++ b/test/clarktown/matchers/indented_code_block_test.clj @@ -0,0 +1,13 @@ +(ns clarktown.matchers.indented-code-block-test + (:require + [clojure.test :refer [deftest testing is]] + [clarktown.matchers.indented-code-block :as code-block])) + + +(deftest indented-code-block-matcher-test + (testing "Checking a indented code block" + (is (true? (code-block/match? " blabla"))) + (is (true? (code-block/match? " abc\n dfg\n blabla"))) + (is (false? (code-block/match? " abc\n asdasd"))))) + + diff --git a/test/clarktown/renderers/indented_code_block_test.clj b/test/clarktown/renderers/indented_code_block_test.clj new file mode 100644 index 0000000..879284d --- /dev/null +++ b/test/clarktown/renderers/indented_code_block_test.clj @@ -0,0 +1,14 @@ +(ns clarktown.renderers.indented-code-block-test + (:require + [clojure.test :refer [deftest testing is]] + [clarktown.renderers.indented-code-block :as indented-code-block])) + + +(deftest indented-code-block-renderer-test + (testing "Creating a single-line code block" + (is (= "<pre><code>code goes here</code></pre>" + (indented-code-block/render " code goes here" nil nil)))) + + (testing "Creating a multi-line code block" + (is (= "<pre><code>code goes here\nand here</code></pre>" + (indented-code-block/render " code goes here\n and here" nil nil)))))
\ No newline at end of file |
