babashka/test-resources/lib_tests/clarktown/parsers/code_block_test.clj
Bob 1113037b51
add Clarktown lib tests (#1247)
* add lib tests for clarktown

* add clarktown to library list

* make code block test agnostic to line separator
2022-04-17 20:11:33 +02:00

18 lines
1 KiB
Clojure

(ns clarktown.parsers.code-block-test
(:require
;; require clojure.string to accomodate line break hack below
[clojure.string :as str]
[clojure.test :refer [deftest testing is]]
[clojure.java.io :as io]
[clarktown.parsers.code-block :as code-block]))
;; BB-TEST-PATCH: change paths to match folder structure (and copy resource files)
;; BB-TEST-PATCH: use split-lines to make tests platform-agnostic
(deftest code-block-test
(testing "Code block with language specification"
(is (= (str/split-lines (slurp (io/file (io/resource "clarktown/parsers/code_block_result.html"))))
(str/split-lines (code-block/render (slurp (io/file (io/resource "clarktown/parsers/code_block.md"))) nil)))))
(testing "Code block with NO language specification"
(is (= (str/split-lines (slurp (io/file (io/resource "clarktown/parsers/code_block_no_language_result.html"))))
(str/split-lines (code-block/render (slurp (io/file (io/resource "clarktown/parsers/code_block_no_language.md"))) nil))))))