Mine the cljs port batteries into the spec layer and delete them (their behavior is covered by spec; the unique functions they exercised are now specced). Removed test/integration/ports/ entirely. New/expanded spec coverage from the mining: - spec/exceptions-spec: try/catch/finally, throw, ex-info/ex-message/ex-data/ex-cause - doto, pr-str, keyword/symbol constructors, atom?, dynamic var binding Two rare edges filed (jolt-...): rethrow of a caught ex-info re-wraps it; var-set on a dynamic var inside binding no-ops. Core try/catch/ex-info and binding work. Test layout is now spec (22 files, ~677 cases) / integration / unit / support. conformance 218/218, jpm test green.
35 lines
2.7 KiB
Text
35 lines
2.7 KiB
Text
# Specification: strings (str + clojure.string).
|
|
(use ../support/harness)
|
|
|
|
(defspec "string / str & basics"
|
|
["str concat" "\"abc\"" "(str \"a\" \"b\" \"c\")"]
|
|
["str of numbers" "\"12\"" "(str 1 2)"]
|
|
["str nil is empty" "\"\"" "(str nil)"]
|
|
["str mixed" "\"a1:b\"" "(str \"a\" 1 :b)"]
|
|
["str of coll" "\"[1 2]\"" "(str [1 2])"]
|
|
["count" "3" "(count \"abc\")"]
|
|
["subs from" "\"bc\"" "(subs \"abc\" 1)"]
|
|
["subs range" "\"b\"" "(subs \"abc\" 1 2)"]
|
|
["string? true" "true" "(string? \"x\")"]
|
|
["pr-str vector" "\"[1 2 3]\"" "(pr-str [1 2 3])"]
|
|
["pr-str quotes str" "\"\\\"hi\\\"\"" "(pr-str \"hi\")"]
|
|
["seq of string" "[\\a \\b]" "(seq \"ab\")"])
|
|
|
|
(defspec "clojure.string"
|
|
["join" "\"a,b,c\"" "(do (require (quote [clojure.string :as s])) (s/join \",\" [\"a\" \"b\" \"c\"]))"]
|
|
["join no sep" "\"abc\"" "(do (require (quote [clojure.string :as s])) (s/join [\"a\" \"b\" \"c\"]))"]
|
|
["split" "[\"a\" \"b\"]" "(do (require (quote [clojure.string :as s])) (s/split \"a,b\" #\",\"))"]
|
|
["split-lines" "[\"a\" \"b\"]" "(do (require (quote [clojure.string :as s])) (s/split-lines \"a\\nb\"))"]
|
|
["upper-case" "\"ABC\"" "(do (require (quote [clojure.string :as s])) (s/upper-case \"abc\"))"]
|
|
["lower-case" "\"abc\"" "(do (require (quote [clojure.string :as s])) (s/lower-case \"ABC\"))"]
|
|
["capitalize" "\"Abc\"" "(do (require (quote [clojure.string :as s])) (s/capitalize \"abc\"))"]
|
|
["trim" "\"x\"" "(do (require (quote [clojure.string :as s])) (s/trim \" x \"))"]
|
|
["triml" "\"x \"" "(do (require (quote [clojure.string :as s])) (s/triml \" x \"))"]
|
|
["blank? true" "true" "(do (require (quote [clojure.string :as s])) (s/blank? \" \"))"]
|
|
["blank? false" "false" "(do (require (quote [clojure.string :as s])) (s/blank? \"x\"))"]
|
|
["includes?" "true" "(do (require (quote [clojure.string :as s])) (s/includes? \"hello\" \"ell\"))"]
|
|
["starts-with?" "true" "(do (require (quote [clojure.string :as s])) (s/starts-with? \"hello\" \"he\"))"]
|
|
["ends-with?" "true" "(do (require (quote [clojure.string :as s])) (s/ends-with? \"hello\" \"lo\"))"]
|
|
["replace" "\"hexxo\"" "(do (require (quote [clojure.string :as s])) (s/replace \"hello\" \"l\" \"x\"))"]
|
|
["reverse" "\"cba\"" "(do (require (quote [clojure.string :as s])) (s/reverse \"abc\"))"]
|
|
["index-of" "2" "(do (require (quote [clojure.string :as s])) (s/index-of \"hello\" \"l\"))"])
|