Back

includes? (clj)

(source)

function

(includes? s substr)
True if s includes substr.

Examples

clojure
(ns clojure.test-clojure.string
  (:require [clojure.string :as s])
  (:use clojure.test))

(deftest t-includes?
  (let [sb (StringBuffer. "Clojure Applied Book")]
    (is (s/includes? sb "Applied"))
    (is (not (s/includes? sb "Living")))))
clojure
(ns clojure.test-clojure.repl.deps
  (:use clojure.test)
  (:require [clojure.string :as str]
            [clojure.repl.deps :as deps]
            [clojure.main :as main]))

;(deftest test-no-add-libs-outside-repl
;  (try
;    (deps/add-lib 'org.clojure/data.json {:mvn/version "2.4.0"})
;    (is false "add-libs outside repl should throw")
;    (catch Throwable t (str/includes? (ex-message t) "add-libs")))
;
;  (with-dynamic-loader
;    (binding [*repl* true]
;      (is (some #{'org.clojure/data.json} (deps/add-lib 'org.clojure/data.json {:mvn/version "2.4.0"})))))
;  )
metabase/metabase
(ns metabase.sync.interface
  "Schemas and constants used by the sync code."
  (:require
   [clojure.string :as str]
   [metabase.lib.schema.common :as lib.schema.common]
   [metabase.util.malli.registry :as mr]
   [metabase.util.malli.schema :as ms]))

(mr/def ::no-kebab-case-keys
  [:fn
   {:error/message "Map should not contain any kebab-case keys"}
   (fn [m]
     (every? (fn [k]
               (not (str/includes? k "-")))
             (keys m)))])
squint-cljs/squint
(ns squint.resource
  (:require [clojure.edn :as edn]
            [clojure.java.io :as io]
            [clojure.string :as str]))

(defmacro version []
  (->> (slurp "package.json")
       (str/split-lines)
       (some #(when (str/includes? % "version") %))
       (re-find #"\d+\.\d+\.\d+")))
BrunoBonacci/mulog
(ns perf
  (:require [com.brunobonacci.mulog :as u]
            [com.brunobonacci.mulog.utils :as ut]
            [com.brunobonacci.mulog.flakes :as f]
            [amalloy.ring-buffer :refer [ring-buffer]]
            [criterium.core :refer [bench quick-bench]]
            [clj-async-profiler.core :as prof]
            [jmh.core :as jmh]
            [clojure.edn :as edn]
            [clojure.string :as str])
  (:import com.brunobonacci.mulog.core.Flake))


  (->> (jmh/run
       (merge
         (clojure.edn/read-string (slurp "./perf/benchmarks.edn"))
         {:selectors {:one (comp #(str/includes? % "context") name :fn)}})
       {:type  :quick
        :status true
        :pprint true
        :select :one
        })
    (prn-str)
    (spit (format "./temp/mulog-perf-run-%d.edn" (System/currentTimeMillis))))
slagyr/speclj
(ns speclj.tags-spec
  (#?(:clj :require :cljs :require-macros)
   [speclj.core :refer [around context describe it should= tags]])
  (:require [clojure.string :as str]
            [speclj.config :refer [*runner* *reporters*]]
            [speclj.report.silent :refer [new-silent-reporter]]
            [speclj.run.standard :refer [new-standard-runner run-specs]]
            [speclj.tags :refer [tag-sets-for pass-includes? pass-excludes? pass-tag-filter? describe-filter]]))

  (it "filters included tags"
    (should= true (pass-includes? #{} [:one]))
    (should= true (pass-includes? #{} [:two]))
    (should= true (pass-includes? #{:one} [:one]))
    (should= false (pass-includes? #{:one} [:two]))
    (should= true (pass-includes? #{:one :two} [:one :two]))
    (should= false (pass-includes? #{:one :two} [:one]))
    (should= true (pass-includes? #{:one :two} [:one :two :three]))
    (should= true (pass-includes? #{} [:one :two :three])))
nasa/Common-Metadata-Repository
(ns cmr.indexer.data.concept-parser
  "Contains helper functions to parse a concept for indexing."
  (:require 
   [cheshire.core :as json]
   [clojure.edn :as edn]
   [clojure.string :as string]
   [cmr.common.concepts :as concepts]
   [cmr.umm-spec.umm-spec-core :as umm]
   [cmr.umm-spec.legacy :as umm-legacy]))

(doseq [concept-type concepts/get-draft-concept-types-array]
  (defmethod parse-concept concept-type
    [context concept]
    ;; If the draft record is a json record, then parse it,
    ;; otherwise figure out what the draft record concept type is
    ;; and let the parsing code parse it to umm-c.
    (if (string/includes? (:format concept) "json")
      (json/parse-string (:metadata concept) true)
      (let [concept-type (:concept-type concept)]
        (if (concepts/is-draft-concept? concept-type)
          (let [draft-concept-type (concepts/get-concept-type-of-draft concept-type)
                concept (assoc concept :concept-type draft-concept-type)]
            (umm/parse-metadata context concept))
          (umm/parse-metadata context concept))))))