Compare commits

..

2 Commits

Author SHA1 Message Date
CrossNox 203968960e fix listar code 3 years ago
CrossNox 6aa5442038 fix test 3 years ago
  1. 19
      src/rustint/core.clj
  2. 2
      test/rustint/core_test.clj

@ -2125,14 +2125,23 @@
(defn flistar [ilevel t nxt]
(let [
preceding_space (clojure.string/join (repeat (* ilevel 2) " ")),
bracket_prec_space (clojure.string/join (repeat (* (- ilevel 1) 2) " "))
preceding_space (clojure.string/join (repeat ilevel " ")),
bracket_prec_space (clojure.string/join (repeat (- ilevel 1) " "))
]
(cond
(string? t) (format "\"%s\" " t)
(string? t) (format "\"%s\" " (clojure.string/escape t char-escape-string))
(= t (symbol "{")) (format "\n%s{\n%s" bracket_prec_space preceding_space)
(= t (symbol "}")) (format "\n%s}" bracket_prec_space)
(= t (symbol ";")) (format ";\n%s" preceding_space)
(= t (symbol "}")) (
cond
(nil? nxt) (format "\n%s}\n" preceding_space)
(not= nxt (symbol "}")) (format "\n%s}\n%s" preceding_space preceding_space)
(= nxt (symbol "}")) (format "\n%s}" preceding_space)
)
(= t (symbol ";")) (
cond
(= nxt (symbol "}")) ";"
:else (format ";\n%s" preceding_space)
)
(and (not= nxt (symbol "{")) (not= nxt (symbol "}"))) (format "%s " t)
:else (format "%s" t)
)

@ -551,7 +551,7 @@
]
(is (=
printed
"fn main ( )\n{\n println! ( \"Hola, mundo!\" )\n}"
"fn main ( )\n{\n println! ( \"Hola, mundo!\" )\n}\n"
)
)
)

Loading…
Cancel
Save