File tree 2 files changed +24
-4
lines changed
Filter options
2 files changed +24
-4
lines changed
Original file line number Diff line number Diff line change @@ -303,10 +303,10 @@ It requires a REPL PROC for inspecting the correct type."
303
303
304
304
(defun inf-clojure--single-linify (string )
305
305
" Convert a multi-line STRING in a single-line STRING.
306
- It also reduces/adds redundant whitespace for readability. Note
307
- that this function will transform the empty string in \" \" (it
308
- adds an empty space). "
309
- (replace-regexp-in-string " [ \\ | \n ]+ " " " string ))
306
+ It also reduces redundant whitespace for readability."
307
+ ( thread-last string
308
+ ( replace-regexp-in-string " [ \\ | \n ]+ " " " )
309
+ (replace-regexp-in-string " $ " " " ) ))
310
310
311
311
(defun inf-clojure--trim-newline-right (string )
312
312
" Trim newlines (only) in STRING."
Original file line number Diff line number Diff line change 111
111
(expect (ict-bounds-string (inf-clojure-completion-bounds-of-expr-at-point))
112
112
:to-equal " deref" )))))
113
113
114
+ (describe " inf-clojure--single-linify"
115
+ (it " replaces newlines with whitespace"
116
+ (expect (inf-clojure--single-linify " (do\n (println \" hello world\" )\n )" ) :to-equal " (do (println \" hello world\" ) )" ))
117
+
118
+ (it " does not leave whitespace at the end"
119
+ (expect (inf-clojure--single-linify " (do\n (println \" hello world\" )\n )\n\n " ) :to-equal " (do (println \" hello world\" ) )" ))
120
+
121
+ (it " returns empty string in case of only newline"
122
+ (expect (inf-clojure--single-linify " \n\n\n\n " ) :to-equal " " )))
123
+
124
+ (describe " inf-clojure--sanitize-command"
125
+ (it " sanitizes the command correctly"
126
+ (expect (inf-clojure--sanitize-command " (doc println)" ) :to-equal " (doc println)\n " ))
127
+
128
+ (it " trims newline at the right of a command"
129
+ (expect (inf-clojure--sanitize-command " (doc println)\n\n\n\n " ) :to-equal " (doc println)\n " ))
130
+
131
+ (it " returns empty string when the command is empty"
132
+ (expect (inf-clojure--sanitize-command " " ) :to-equal " " )))
133
+
114
134
; ;; inf-clojure-tests.el ends here
You can’t perform that action at this time.
0 commit comments