From 71ed868beba73bfef89e590b62580498f18dcccd Mon Sep 17 00:00:00 2001 From: Esko Luontola Date: Sun, 3 Dec 2023 20:15:41 +0200 Subject: [PATCH] Code reformat --- test/hiccup2/core_test.clj | 39 +++++++++++++++++++---------- test/hiccup2/optimizations_test.clj | 9 ++++--- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/test/hiccup2/core_test.clj b/test/hiccup2/core_test.clj index 0074693..e8623ac 100644 --- a/test/hiccup2/core_test.clj +++ b/test/hiccup2/core_test.clj @@ -215,12 +215,17 @@ (deftest runtime-attributes-vs-content-detection-for-void-elements (testing "runtime attributes present" - (is (= (str (html {:mode :xhtml} [:br (identity {:id 1})])) "
")) - (is (= (str (html {:mode :html} [:br (identity {:id 1})])) "
")) - (is (= (str (html {:mode :xml} [:br (identity {:id 1})])) "
")) - (is (= (str (html {:mode :sgml} [:br (identity {:id 1})])) "
"))) + (is (= (str (html {:mode :xhtml} [:br (identity {:id 1})])) + "
")) + (is (= (str (html {:mode :html} [:br (identity {:id 1})])) + "
")) + (is (= (str (html {:mode :xml} [:br (identity {:id 1})])) + "
")) + (is (= (str (html {:mode :sgml} [:br (identity {:id 1})])) + "
"))) (testing "runtime content present" - ;; it's not valid HTML to have content inside void elements, but Hiccup should still obey what the user told it to do + ;; It's not valid HTML to have content inside void elements, + ;; but Hiccup should still obey what the user told it to do. (is (= (str (html {:mode :xhtml} [:br (identity "x")])) "
x
")) (is (= (str (html {:mode :html} [:br (identity "x")])) "
x
")) (is (= (str (html {:mode :xml} [:br (identity "x")])) "
x
")) @@ -250,12 +255,20 @@ (is (= (str (html {:mode :xml} [(identity :br)])) "
")) (is (= (str (html {:mode :sgml} [(identity :br)])) "
"))) (testing "runtime tag and content" - (is (= (str (html {:mode :xhtml} [(identity :p) (identity "x")])) "

x

")) - (is (= (str (html {:mode :html} [(identity :p) (identity "x")])) "

x

")) - (is (= (str (html {:mode :xml} [(identity :p) (identity "x")])) "

x

")) - (is (= (str (html {:mode :sgml} [(identity :p) (identity "x")])) "

x

"))) + (is (= (str (html {:mode :xhtml} [(identity :p) (identity "x")])) + "

x

")) + (is (= (str (html {:mode :html} [(identity :p) (identity "x")])) + "

x

")) + (is (= (str (html {:mode :xml} [(identity :p) (identity "x")])) + "

x

")) + (is (= (str (html {:mode :sgml} [(identity :p) (identity "x")])) + "

x

"))) (testing "runtime tag and attributes" - (is (= (str (html {:mode :xhtml} [(identity :p) (identity {:id 1})])) "

")) - (is (= (str (html {:mode :html} [(identity :p) (identity {:id 1})])) "

")) - (is (= (str (html {:mode :xml} [(identity :p) (identity {:id 1})])) "

")) - (is (= (str (html {:mode :sgml} [(identity :p) (identity {:id 1})])) "

")))) + (is (= (str (html {:mode :xhtml} [(identity :p) (identity {:id 1})])) + "

")) + (is (= (str (html {:mode :html} [(identity :p) (identity {:id 1})])) + "

")) + (is (= (str (html {:mode :xml} [(identity :p) (identity {:id 1})])) + "

")) + (is (= (str (html {:mode :sgml} [(identity :p) (identity {:id 1})])) + "

")))) diff --git a/test/hiccup2/optimizations_test.clj b/test/hiccup2/optimizations_test.clj index ecf2a2c..44fef99 100644 --- a/test/hiccup2/optimizations_test.clj +++ b/test/hiccup2/optimizations_test.clj @@ -7,10 +7,11 @@ (count (filter seq? (tree-seq coll? seq data)))) (deftest method-code-size - ;; With Hiccup 2.0.0-RC2, it was easy to cause the hiccup2.core/html macro to generate so much bytecode - ;; that it would go over the 64KB limit of how much bytecode one Java method may contain. It would crash - ;; the Clojure compiler with a "Method code too large!" exception. These are a regression tests for that. - ;; See https://github.com/weavejester/hiccup/issues/205 + ;; With Hiccup 2.0.0-RC2, it was easy to cause the hiccup2.core/html macro to + ;; generate so much bytecode that it would go over the 64KB limit of how much + ;; bytecode one Java method may contain. It would crash the Clojure compiler + ;; with a "Method code too large!" exception. These are a regression tests for + ;; that. See https://github.com/weavejester/hiccup/issues/205 (testing "static elements should be concatenated to one string, also when they have dynamic sibling elements" (let [baseline (walk/macroexpand-all