Back
fresh-line (clj)
(source)function
(fresh-line)
Make a newline if *out* is not already at the beginning of the line. If *out* is
not a pretty writer (which keeps track of columns), this function always outputs a newline.
Examples
clojure/core.typed
(deftest cl-format-test
(is-tc-e #(cl-format nil "abc")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-e #(cl-format nil "abc" 'a :foo "bar")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-e #(cl-format true "abc" 'a :foo "bar")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-e #(let [so System/out
_ (assert so)
o (java.io.OutputStreamWriter. so)]
(assert o)
(cl-format (java.io.BufferedWriter. o) "abc"))
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-err #(cl-format "abc" "abc")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-err #(cl-format true true)
:requires [[clojure.pprint :refer [cl-format]]]))
(deftest fresh-line-test
(is-tc-e #(fresh-line)
:requires [[clojure.pprint :refer [fresh-line]]]))
(deftest get-pretty-writer-test
(is-tc-e #(let [so System/out
_ (assert so)
o (java.io.OutputStreamWriter. so)]
(assert o)
(get-pretty-writer o))
[-> java.io.Writer]
:requires [[clojure.pprint :refer [get-pretty-writer]]]))
typedclojure/typedclojure
(deftest cl-format-test
(is-tc-e #(cl-format nil "abc")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-e #(cl-format nil "abc" 'a :foo "bar")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-e #(cl-format true "abc" 'a :foo "bar")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-e #(let [so System/out
_ (assert so)
o (java.io.OutputStreamWriter. so)]
(assert o)
(cl-format (java.io.BufferedWriter. o) "abc"))
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-err #(cl-format "abc" "abc")
:requires [[clojure.pprint :refer [cl-format]]])
(is-tc-err #(cl-format true true)
:requires [[clojure.pprint :refer [cl-format]]]))
(deftest fresh-line-test
(is-tc-e #(fresh-line)
:requires [[clojure.pprint :refer [fresh-line]]]))
(deftest get-pretty-writer-test
(is-tc-e #(let [so System/out
_ (assert so)
o (java.io.OutputStreamWriter. so)]
(assert o)
(get-pretty-writer o))
[-> java.io.Writer]
:requires [[clojure.pprint :refer [get-pretty-writer]]]))