(ns getclojure.format-test (:require [clojure.test :refer (deftest testing is use-fixtures)] [getclojure.format :as sut] [schema.test :refer (validate-schemas)])) (use-fixtures :once validate-schemas) (deftest formatting-test (testing "It formats inputs, outputs, and values as HTML strings" (is (= "
(defn foo [x] (bar baz qux {:a 1, :b 2}))\n
\n" (sut/input "(defn foo [x] (bar baz qux {:a 1 :b 2}))"))) (is (= "
2\n
\n" (sut/value "2"))) (is (= "
2222...\n
\n" (sut/value "2222...")) "Pygmentize, but don't attempt to parse the string if it's a truncated value") (is (= "
"Hello, world!"\n
\n" (sut/output "\"Hello, world!\""))) (is (= nil (sut/output "\"\"")) "Return nothing if we have no output")))