Skip to content

Commit

Permalink
Merge pull request #94 from darioghilardi/test-filename-conventions
Browse files Browse the repository at this point in the history
Use the _test suffix for test files and reorganise the test directory.
  • Loading branch information
yogthos committed Mar 11, 2016
2 parents 4dea2bb + e0bc915 commit d828c3f
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{:source-paths ["src/cljc" "src/cljs" "test"]
:compiler {:output-to "target/unit-test.js"
:output-dir "target"
:main mdtest.runner
:main mdrunner.test
:optimizations :whitespace}}}}
:profiles
{:dev
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/benchmark.clj → test/markdown/benchmark.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns benchmark
(ns markdown.benchmark
(:require [clojure.test :refer :all]
[markdown.core :as markdown]
[criterium.core :as criterium]))
Expand All @@ -12,4 +12,4 @@

(deftest ^:benchmark bench-file []
(criterium/bench
(markdown/md-to-html (str "test" java.io.File/separator "bench.md") (java.io.StringWriter.))))
(markdown/md-to-html (str "test/files" java.io.File/separator "bench.md") (java.io.StringWriter.))))
20 changes: 10 additions & 10 deletions test/mdtests_file.clj → test/markdown/md_file_test.clj
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
(ns mdtests-file
(ns markdown.md-file-test
(:require [markdown.core :as markdown]
[markdown.transformers :as transformers]
[markdown.tables :as tables]
[clojure.test :refer :all]))

(deftest references
(let [wrt (java.io.StringWriter.)]
(markdown/md-to-html (str "test" java.io.File/separator "references.md") wrt :reference-links? true)
(is (= (slurp (str "test" java.io.File/separator "references.html")) (.toString wrt)))))
(markdown/md-to-html (str "test/files" java.io.File/separator "references.md") wrt :reference-links? true)
(is (= (slurp (str "test/files" java.io.File/separator "references.html")) (.toString wrt)))))

(deftest footnotes
(let [wrt (java.io.StringWriter.)]
(markdown/md-to-html (str "test" java.io.File/separator "footnotes.md") wrt :footnotes? true)
(is (= (slurp (str "test" java.io.File/separator "footnotes.html")) (.toString wrt)))))
(markdown/md-to-html (str "test/files" java.io.File/separator "footnotes.md") wrt :footnotes? true)
(is (= (slurp (str "test/files" java.io.File/separator "footnotes.html")) (.toString wrt)))))

(deftest all-together
(let [wrt (java.io.StringWriter.)]
(markdown/md-to-html (str "test" java.io.File/separator "test.md") wrt)
(is (= (slurp (str "test" java.io.File/separator "test.html")) (.toString wrt)))))
(markdown/md-to-html (str "test/files" java.io.File/separator "test.md") wrt)
(is (= (slurp (str "test/files" java.io.File/separator "test.html")) (.toString wrt)))))

(deftest tables
(let [wrt (java.io.StringWriter.)]
(markdown/md-to-html (str "test" java.io.File/separator "tables.md") wrt)
(is (= (slurp (str "test" java.io.File/separator "tables.html")) (.toString wrt)))))
(markdown/md-to-html (str "test/files" java.io.File/separator "tables.md") wrt)
(is (= (slurp (str "test/files" java.io.File/separator "tables.html")) (.toString wrt)))))

(deftest md-metadata
(testing "Finds all metadata and correctly parses rest of file."
(let [md (slurp (str "test/metadata.md"))
(let [md (slurp (str "test/files/metadata.md"))
{:keys [metadata html]} (markdown/md-to-html-string-with-meta md)]
(is (= "<h1>The Document</h1>" html))
(is (= {:title ["My Document"]
Expand Down
5 changes: 5 additions & 0 deletions test/markdown/md_runner_test.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns markdown.mdrunner-test
(:require [doo.runner :refer-macros [doo-tests]]
[markdown.md-test]))

(doo-tests 'markdown.md-test)
2 changes: 1 addition & 1 deletion test/mdtests.cljc → test/markdown/md_test.cljc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns mdtests
(ns markdown.md-test
(:require [markdown.core :as markdown]
[markdown.transformers :as transformers]
[markdown.tables :as tables]
Expand Down
5 changes: 0 additions & 5 deletions test/mdtest_runner.cljs

This file was deleted.

0 comments on commit d828c3f

Please sign in to comment.