From dc2a364db6d14d4afa9da9aadbccb8fdbb038fe4 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Thu, 12 May 2022 21:07:14 +0300 Subject: Add tests --- .../correctors/atx_heading_block_test.clj | 2 +- .../correctors/indented_code_block_test.clj | 30 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/clarktown/correctors/indented_code_block_test.clj (limited to 'test/clarktown/correctors') 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)))))) -- cgit v1.2.3