Bumping selmer version to 1.12.59 (#1588)

* Bumping selmer version to 1.12.59

* Copied over resolve-arg tests to Selmer's lib test.
This commit is contained in:
didibus 2023-07-09 12:00:07 -07:00 committed by GitHub
parent af0937f060
commit b749563003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 4 deletions

View file

@ -44,7 +44,7 @@
org.clojure/core.match {:mvn/version "1.0.0"}
hiccup/hiccup {:mvn/version "2.0.0-RC1"}
rewrite-clj/rewrite-clj {:mvn/version "1.1.46"}
selmer/selmer {:mvn/version "1.12.50"}
selmer/selmer {:mvn/version "1.12.59"}
com.taoensso/timbre {:mvn/version "6.0.1"}
org.clojure/tools.logging {:mvn/version "1.1.0"}
org.clojure/data.priority-map {:mvn/version "1.1.0"}
@ -67,7 +67,7 @@
{:extra-paths ["process/src" "process/test" "test-resources/lib_tests"]
:extra-deps {org.clj-commons/clj-http-lite {:mvn/version "0.4.392"}
#_#_org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
:sha "0dec1f88cbde74a0470b454396f09a03adb4ae39"}
:sha "0dec1f88cbde74a0470b454396f09a03adb4ae39"}
lambdaisland/regal {:mvn/version "0.0.143"}
cprop/cprop {:mvn/version "0.1.16"}
comb/comb {:mvn/version "0.1.1"}

View file

@ -72,7 +72,7 @@
:feature/test-check {:source-paths ["feature-test-check"]}
:feature/spec-alpha {:source-paths ["feature-spec-alpha"]}
:feature/selmer {:source-paths ["feature-selmer"]
:dependencies [[selmer/selmer "1.12.50"]]}
:dependencies [[selmer/selmer "1.12.59"]]}
:feature/logging {:source-paths ["feature-logging"]
:dependencies [[com.taoensso/timbre "6.0.4"]
[org.clojure/tools.logging "1.1.0"]]}

View file

@ -8,7 +8,8 @@
[selmer.filters :as f]
[selmer.parser :as p :refer [render render-file render-template
parse parse-input known-variables
<< resolve-var-from-kw env-map]]
<< resolve-var-from-kw env-map
resolve-arg]]
[selmer.tags :as tags]
[clojure.set :as set])
(:import (java.io StringReader ByteArrayInputStream)
@ -1294,3 +1295,32 @@
(is (= "false" (let [y false] (<< "{{y}}")))
"<< picks up local values even if they are false"))
(deftest resolve-arg-test
(is (= "John"
(resolve-arg "{{variable}}" {:variable "John"}))
"When arg is a variable, returns it substituted by its value.")
(is (= "Hello John!"
(resolve-arg "Hello {{variable}}!" {:variable "John"}))
"When arg contains a variable, return it with the variable substituted by its value.")
(is (= "JOHN"
(resolve-arg "{{variable|upper}}" {:variable "John"}))
"When arg is a filter, returns it where the filter was applied to its value.")
(is (= "Hello JOHN!"
(resolve-arg "Hello {{variable|upper}}!" {:variable "John"}))
"When arg contains a filter, returns it where the filter was applied to its value.")
(is (= "Mr John"
(resolve-arg "{% if variable = \"John\" %}Mr {{variable}}{% endif %}" {:variable "John"}))
"When arg is a tag, returns it where the tag was rendered to its value.")
(is (= "Hello Mr John!"
(resolve-arg "Hello {% if variable = \"John\" %}Mr {{variable}}{% endif %}!" {:variable "John"}))
"When arg contains a tag, returns it where the tag was rendered to its value.")
(is (= "Hello John!"
(resolve-arg "\"Hello John!\"" {}))
"When arg is a double quoted literal string, returns it without double quoting.")
(is (= "Hello John!"
(resolve-arg "Hello John!" {}))
"When arg is a literal string, returns it as is.")
(is (= "29.99"
(resolve-arg "29.99" {}))
"When arg is a literal number, returns it as is."))