Compare commits

..

6 Commits

  1. 22
      src/rustint/core.clj
  2. 46
      test/rustint/core_test.clj

@ -2543,6 +2543,17 @@
(map last (re-seq #"\{:?(.\d+)?\}" s)) (map last (re-seq #"\{:?(.\d+)?\}" s))
) )
(defn replace-groups [string groups]
(if (empty? groups)
string
(
replace-groups
(clojure.string/replace-first string #"\{:?(.\d+)?\}" (first groups))
(rest groups)
)
)
)
(defn convertir-formato-impresion [args] (defn convertir-formato-impresion [args]
(let [clojure-fspecifiers ( (let [clojure-fspecifiers (
map map
@ -2552,16 +2563,7 @@
) )
] (if (empty? clojure-fspecifiers) ] (if (empty? clojure-fspecifiers)
args args
(cons (replace-groups (first args) clojure-fspecifiers) (rest args))
(into
(rest args)
(list (clojure.string/join
(interleave
(clojure.string/split (first args) #"\{:?(\.\d+)?\}")
(concat clojure-fspecifiers '(""))
)
))
)
) )
) )
) )

@ -389,6 +389,52 @@
) )
) )
(deftest convertir-formato-impresion-11
(testing "Test 11 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("Hola mundo! {}" ""))
'("Hola mundo! %s" "")
))
)
)
(deftest convertir-formato-impresion-12
(testing "Test 12 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("{}" ""))
'("%s" "")
))
)
)
(deftest convertir-formato-impresion-13
(testing "Test 13 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("{}{}" "1" ""))
'("%s%s" "1" "")
))
)
)
(deftest convertir-formato-impresion-14
(testing "Test 14 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("{}{}" 1 ""))
'("%d%s" 1 "")
))
)
)
(deftest convertir-formato-impresion-15
(testing "Test 15 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("{}\t{}" 1 1))
'("%d\t%d" 1 1)
))
)
)
(deftest get-rust-formatters-01 (deftest get-rust-formatters-01
(testing "Test 01 get-rust-formatters" (testing "Test 01 get-rust-formatters"
(is (= (is (=

Loading…
Cancel
Save