File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 743743
744744(defn- matching-form-index? [zloc [k indexes] context]
745745 (if (= :all indexes)
746- (and (z/list? zloc)
746+ (and (or (z/list? zloc)
747+ (= (z/tag zloc) :fn ))
747748 (form-matches-key? (z/down zloc) k context))
748749 (and (z/list? (z/up zloc))
749750 (form-matches-key? zloc k context)
750751 (contains? (set indexes) (dec (index-of zloc))))))
751752
752753(defn- matching-form? [zloc form-indexes context]
753- (and (or (z/list? zloc) (z/list? (z/up zloc)))
754+ (and (or (z/list? zloc)
755+ (= (z/tag zloc) :fn )
756+ (z/list? (z/up zloc)))
754757 (some #(matching-form-index? zloc % context) form-indexes)))
755758
756759(defn align-form-columns [form aligned-forms opts]
Original file line number Diff line number Diff line change 14221422 " (sequential? x)"
14231423 " :seq)" ]]
14241424 (is (reformats-to? form form {:remove-blank-lines-in-forms? true }))))
1425+ (testing " Handle #() function literals"
1426+ (let [form [" (defn increase [y]"
1427+ " (let [f #(cond"
1428+ " (pos? y)"
1429+ " (inc %)"
1430+ " "
1431+ " (neg? y)"
1432+ " (dec %)"
1433+ " "
1434+ " :else"
1435+ " %)]"
1436+ " (f y)))" ]]
1437+ (is (reformats-to?
1438+ form
1439+ form
1440+ {:remove-blank-lines-in-forms? true }))))
14251441 (testing (str " :blank-line-forms :all should only exempt the immediate"
14261442 " children of the form" )
14271443 (is (reformats-to?
You can’t perform that action at this time.
0 commit comments