Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eval should dispatch to both repls in cljc files #1299

Closed
expez opened this issue Sep 2, 2015 · 5 comments
Closed

Eval should dispatch to both repls in cljc files #1299

expez opened this issue Sep 2, 2015 · 5 comments
Milestone

Comments

@expez
Copy link
Member

expez commented Sep 2, 2015

This used to work but I couldn't get the clj buffer to sync with the cljc file using C-c C-k.

@Malabarba
Copy link
Member

A little more context would help. :-)

How did you start the repls?
Which repl is returned by cider-current-connection?
Does it work on clj and cljs files?
Could we see some messages?

@expez
Copy link
Member Author

expez commented Sep 3, 2015

How did you start the repls?

cider-jack-in-clojurescript

Which repl is returned by cider-current-connection?

cljs repl

Does it work on clj and cljs files?

yes

Could we see some messages?

C-c C-k in the cljc file.

(--->
  op  "load-file"
  session  "c9b4b032-9913-4a19-88a8-8ab61514852e"
  file  "(ns superstring.core-test\n  #?@(:cljs [(:require\n              [cljs.test :as t :include-macros true]\n              [cljs.test.check.cljs-test :refer-macros [defspec]]\n              [cljs.test.check.generators :as gen]\n              [cljs.test.check.properties :as prop :include-macros true]\n              [cljs.test.check :refer [quick-check]]\n              [superstring.core :as str])\n             (:require-macros [superstring.test-helpers :refer [defexamples]])]\n            :clj [(:require [clojure.test :as t]\n                            [clojure.test.check\n                             [clojure-test :refer [defspec]]\n                             [generators :as gen]\n                             [properties :as prop]]\n                            [superstring.test-helpers :refer [defexamples]]\n                            [superstring.core :as str])]))\n\n(defspec length-test 100\n  (prop/for-all [s gen/string]\n    (= #?(:cljs (.-length s) :clj (.length s)) (str/length s))))\n\n(defexamples index-of-test\n  (str/index-of \"foo\" \"foo\") 0\n  (str/index-of \"foo\" \"bar\") nil)\n\n(defexamples last-index-of-test\n  (str/last-index-of \"foo\" \"bar\") nil\n  (str/last-index-of \"foofoo\" \"foo\") 3)\n\n(defspec ends-with?-finds-endings 100\n  (prop/for-all [s gen/string\n                 suffix gen/string]\n    (str/ends-with? (str s suffix) suffix)))\n\n(def string-without-german-b (gen/such-that (fn [s] (not-any? #(= % \\ß) s))\n                                            gen/string))\n\n(defspec ends-with?-can-ignore-case 100\n  (prop/for-all [s gen/string\n                 suffix string-without-german-b]\n    (str/ends-with? (str s suffix ) (str/swap-case suffix) :ignore-case)))\n\n(defexamples ends-with?\n  (str/ends-with? \"foobar\" \"foo\") nil\n  (str/ends-with? \"ß\" \"ss\" :ignore-case) nil\n  (str/ends-with? \"ß\" \"SS\" :ignore-case) nil\n  (str/ends-with? \"aß\" \"ß\" :ignore-case) \"aß\")\n\n(defexamples starts-with?\n  (str/starts-with? \"foo\" \"foobar\") nil\n  (str/starts-with? \"ß\" \"ss\" :ignore-case) nil\n  (str/starts-with? \"ß\" \"SS\" :ignore-case) nil\n  (str/starts-with? \"ßa\" \"ß\" :ignore-case) \"ßa\")\n\n(defspec starts-with?-can-ignore-case 100\n  (prop/for-all [s gen/string\n                 prefix string-without-german-b]\n    (str/starts-with? (str prefix s) (str/swap-case prefix) :ignore-case)))\n\n(defspec appending-separator-and-chomping-does-not-alter-length 100\n  (prop/for-all [s gen/string\n                 sep gen/string]\n    (let [res (str/chomp s)]\n      (= (count (str/chomp (str s sep) sep))\n         (count s)))))\n\n(defspec chomping-string-not-ending-in-seperator-does-not-alter-length 100\n  (prop/for-all\n      [[sep s] (gen/bind (gen/not-empty gen/string)\n                         (fn [sep]\n                           (gen/tuple (gen/return sep)\n                                      (gen/such-that (fn [s]\n                                                       (not (str/ends-with? s sep)))\n                                                     gen/string))))]\n    (= (count (str/chomp s sep)) (count s))))\n\n(defspec chomp-removes-newline 100\n  (prop/for-all [s gen/string]\n    (= (str/length (str/chomp (str s \"\\n\")))) (str/length s)))\n\n(defspec chomp-removes-carriage-return 100\n  (prop/for-all [s gen/string]\n    (= (str/length (str/chomp (str s \"\\r\"))) (str/length s))))\n\n(defspec chomp-removes-carriage-return-line-feed 100\n  (prop/for-all [s gen/string]\n    (= (str/length (str/chomp (str s \"\\r\\n\"))) (str/length s))))\n\n(defexamples chomp-examples\n  (str/chomp \"\" \"\") \"\"\n  (str/chomp \"foo\" \"foo\") \"\"\n  (str/chomp \"foobar\" \"bar\") \"foo\"\n  (str/chomp \"foo\\n\") \"foo\"\n  (str/chomp \"foo\\r\") \"foo\"\n  (str/chomp \"foo\\r\\n\") \"foo\"\n  (str/chomp \"foo\\n\\r\") \"foo\\n\")\n\n(defspec chop-reduces-length-by-1-without-cr 100\n  (prop/for-all [s (gen/such-that #(not (str/ends-with? % \"\\r\\n\")) gen/string)]\n    (= (str/length (str/chop s)) (max 0 (dec (str/length s))))))\n\n(defspec chop-gets-rid-of-both-chars-in-crlf 100\n  (prop/for-all [s gen/string]\n    (let [s (str s \"\\r\\n\")]\n      (= (str/length (str/chop s)) (max 0 (- (str/length s) 2))))))\n\n(t/deftest chopping-the-empty-string-is-a-no-op []\n  (t/is (= (str/chop \"\") \"\")))\n\n(defspec swap-case-does-not-change-length 100\n  (prop/for-all [s string-without-german-b]\n    (= (str/length (str/swap-case s)) (str/length s))))\n\n(defspec swap-case-changes-case 100\n  (prop/for-all [s string-without-german-b]\n    (let [count-uppers (partial reduce (fn [acc c] (if (str/upper-case? (str c))\n                                                     (inc acc) 0)) 0)\n          count-lowers (partial reduce (fn [acc c] (if (str/lower-case? (str c))\n                                                     (inc acc) 0)) 0)]\n      (and (= (count-uppers s) (count-lowers (str/swap-case s)))\n           (= (count-lowers s) (count-uppers (str/swap-case s)))))))\n\n(defexamples swap-case\n  (str/swap-case \"fOO\") \"Foo\"\n  (str/swap-case \"FOO\") \"foo\"\n  (str/swap-case \"Ååberg\") \"åÅBERG\"\n  (str/swap-case \"ÆæÅ.\") \"æÆå.\"\n  (str/swap-case \"ß\") \"SS\")\n\n(defspec slice-without-end-has-length-1 100\n  (prop/for-all [[s i] (gen/bind (gen/not-empty gen/string)\n                                 (fn [s]\n                                   (gen/tuple (gen/return s)\n                                              (gen/such-that #(< % (str/length s))\n                                                             gen/int 100))))]\n    (= (str/length (str/slice s 0)) 1)))\n\n(defspec slice-with-length-outside-string 100\n  ;; When beg + end falls outside the string we return the rest of the\n  ;; string starting from beg\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (let [beg (rand-int (str/length s))]\n      (= (str/slice s beg (+ (str/length s) beg)) (str/substring s beg)))))\n\n(defspec slices-with-index-outside-str-is-nil 100\n  (prop/for-all [[s index] (gen/bind (gen/not-empty gen/string)\n                                     (fn [s]\n                                       (gen/tuple\n                                        (gen/return s)\n                                        (gen/such-that #(> (Math/abs %) (str/length s))\n                                                       gen/int 100))))]\n    (let [len (inc (rand-int (dec (str/length s))))]\n      (nil? (str/slice s index len)))))\n\n(defspec slices-with-negative-lengths-are-nil 100\n  (prop/for-all [len (gen/such-that #(not (zero? %)) gen/neg-int)\n                 s gen/string\n                 index gen/int]\n    (nil? (str/slice s index len))))\n\n(defexamples slice\n  (str/slice \"\" 0) nil\n  (str/slice \"\" 1) nil\n  (str/slice \"12\" 1 -1) nil\n  (str/slice \"1\" 0) \"1\"\n  (str/slice \"12\" 1) \"2\"\n  (str/slice \"12\" 0 2) \"12\"\n  (str/slice \"0123456\" 3 100) \"3456\"\n  (str/slice \"0123456\" -1) \"6\"\n  (str/slice \"0123456\" -3 2) \"45\"\n  (str/slice \"0123456\" -3 100) \"456\")\n\n(defspec right-pad-results-in-strings-with-new-width 100\n  (prop/for-all\n      [vals\n       (gen/bind gen/string\n                 (fn [s]\n                   (gen/tuple (gen/return s)\n                              (gen/such-that #(> % (str/length s)) gen/pos-int 100))))]\n    (let [s (first vals)\n          width (second vals)]\n      (= (str/length (str/pad-right s width)) width))))\n\n(defexamples right-pad\n  (str/pad-right \"\" 0) \"\"\n  (str/pad-right \"\" 1) \" \"\n  (str/pad-right \"foo\" 4) \"foo \"\n  (str/pad-right \"foo\" 5) \"foo  \"\n  (str/pad-right \"foo\" 5 \".!\") \"foo.!\"\n  (str/pad-right \"foo\" 6 \".!\") \"foo.!.\")\n\n(defexamples left-pad\n  (str/pad-left \"\" 0) \"\"\n  (str/pad-left \"\" 1) \" \"\n  (str/pad-left \"foo\" 4) \" foo\"\n  (str/pad-left \"foo\" 5) \"  foo\"\n  (str/pad-left \"foo\" 5 \".!\") \".!foo\"\n  (str/pad-left \"foo\" 6 \".!\") \".!.foo\")\n\n(defspec left-pad-results-in-strings-with-new-width 100\n  (prop/for-all\n      [[s width]\n       (gen/bind gen/string\n                 (fn [s]\n                   (gen/tuple (gen/return s)\n                              (gen/such-that #(> % (str/length s)) gen/pos-int 100))))]\n    (= (str/length (str/pad-left s width)) width)))\n\n(defexamples center\n  (str/center \"\" 0) \"\"\n  (str/center \"\" 1) \" \"\n  (str/center \"foo\" 4) \"foo \"\n  (str/center \"foo\" 5) \" foo \"\n  (str/center \"foo\" 5 \".!\") \"foo.!\"\n  (str/center \"foo\" 4 \".!\") \"foo.\"\n  (str/center \"foo\" 6 \".!\") \".!foo.\"\n  (str/center \"foo\" 8 \".!\") \".!foo.!.\")\n\n(defspec center-results-in-strings-with-new-width 100\n  (prop/for-all\n      [[s width]\n       (gen/bind gen/string\n                 (fn [s]\n                   (gen/tuple (gen/return s)\n                              (gen/such-that #(> % (str/length s)) gen/pos-int 100))))]\n    (= (str/length (str/center s width)) width)))\n\n(defexamples chop-suffix\n  (str/chop-suffix \"\" \"foo\") \"\"\n  (str/chop-suffix \"foo\" \"foo\") \"\"\n  (str/chop-suffix \"foobar\" \"bar\") \"foo\"\n  (str/chop-suffix \"foo \" \" \") \"foo\"\n  (str/chop-suffix \"foo\" \"bar\") \"foo\"\n  (str/chop-suffix \"foo\" \"FOO\") \"foo\"\n  (str/chop-suffix \"foo\" \"O\") \"foo\"\n  (str/chop-suffix \"fooÅ\" \"å\") \"fooÅ\"\n  (str/chop-suffix \"foo\" \"FOO\" :ignore-case) \"\"\n  (str/chop-suffix \"foo\" \"O\" :ignore-case) \"fo\"\n  (str/chop-suffix \"fooÅ\" \"å\" :ignore-case) \"foo\")\n\n(defexamples chop-prefix\n  (str/chop-prefix \"\" \"foo\") \"\"\n  (str/chop-prefix \"foo\" \"foo\") \"\"\n  (str/chop-prefix \"foobar\" \"foo\")   \"bar\"\n  (str/chop-prefix \" foo\" \" \") \"foo\"\n  (str/chop-prefix \"foo\" \"bar\") \"foo\"\n  (str/chop-prefix \"foo\" \"FOO\") \"foo\"\n  (str/chop-prefix \"foo\" \"F\") \"foo\"\n  (str/chop-prefix \"Åfoo\" \"å\") \"Åfoo\"\n  (str/chop-prefix \"foo\" \"FOO\" :ignore-case) \"\"\n  (str/chop-prefix \"foo\" \"F\" :ignore-case) \"oo\"\n  (str/chop-prefix \"Åfoo\" \"Å\" :ignore-case) \"foo\")\n\n(defexamples contains-test?\n  (str/contains? \"\" \"\") \"\"\n  (str/contains? \"1\" \"1\") \"1\"\n  (str/contains? \"foo\" \"fo\") \"foo\"\n  (str/contains? \"foobar\" \"qux\") nil\n  (str/contains? \"foobar\" \"BAR\") nil\n  (str/contains? \"foobar\" \"BAR\" :ignore-case) \"foobar\"\n  (str/contains? \"fooß\" \"ss\" :ignore-case) nil\n  (str/contains? \"fooß\" \"SS\" :ignore-case) nil\n  (str/contains? \"ß\" \"SS\" :ignore-case) nil\n  (str/contains? \"Albert Åberg\" \"åberg\" :ignore-case) \"Albert Åberg\")\n\n(defspec contains?-finds-generated-strings 100\n  (prop/for-all [before gen/string\n                 needle (gen/not-empty gen/string)\n                 after gen/string]\n    (str/contains? (str before needle after) needle)))\n\n(defn- randomly-swapcase\n  [s]\n  (let [swapcase (fn [c]\n                   #?(:cljs (if (str/upper-case? c)\n                              (str/lower-case c)\n                              (if (str/lower-case? c)\n                                (str/upper-case c)\n                                c))\n                            :clj (if (Character/isUpperCase c)\n                                   (Character/toLowerCase c)\n                                   (if (Character/isLowerCase c)\n                                     (Character/toUpperCase c)\n                                     c))))]\n    (apply str (map #(if (> (rand-int 3) 1) (swapcase %) %) s))))\n\n\n(defspec contains?-can-ignore-case 100\n  (prop/for-all [before gen/string\n                 needle (gen/fmap randomly-swapcase (gen/not-empty gen/string))\n                 after gen/string]\n    (str/contains? (str before needle after) needle :ignore-case)))\n\n(defexamples contains-all?\n  (str/contains-all? \"\" []) \"\"\n  (str/contains-all? \"\" [\"\"]) \"\"\n  (str/contains-all? \"12\" [\"1\" \"2\"]) \"12\"\n  (str/contains-all? \"foo\" [\"fo\" \"o\"]) \"foo\"\n  (str/contains-all? \"foobar\" [\"qux\"]) nil\n  (str/contains-all? \"foobar\" [\"foo\" \"qux\"]) nil\n  (str/contains-all? \"foobar\" [\"BAR\"]) nil\n  (str/contains-all? \"foobar\" [\"BAR\" \"Foo\"] :ignore-case) \"foobar\"\n  (str/contains-all? \"Albert Åberg\" [\"åberg\" \"al\"] :ignore-case) \"Albert Åberg\")\n\n(defspec contains-any-finds-a-needle 100\n  (prop/for-all [before (gen/not-empty gen/string)\n                 needle (gen/not-empty gen/string)\n                 after (gen/not-empty gen/string)]\n    (str/contains-any? (str before needle after) [needle])))\n\n(defexamples contains-any?\n  (str/contains-any? \"foobar\" [\"foo\"]) \"foobar\"\n  (str/contains-any? \"foobar\" [\"qux\"]) nil\n  (str/contains-any? \"foobar\" [\"qux\" \"bar\"]) \"foobar\"\n  (str/contains-any? \"ß\" [\"ss\" \"SS\"] :ignore-case) nil\n  (str/contains-any? \"foobar\" [\"BAR\"] :ignore-case) \"foobar\")\n\n(defspec contains-any-can-ignore-case 100\n  (prop/for-all [before (gen/not-empty gen/string)\n                 needle (gen/not-empty string-without-german-b)\n                 after (gen/not-empty gen/string)]\n    (-> before\n        (str (randomly-swapcase needle) after)\n        (str/contains-any? [needle] :ignore-case))))\n\n(defspec truncated-strings-have-right-length 100\n  (prop/for-all [[s len] (gen/bind (gen/such-that #(> (str/length %) 3) gen/string 100)\n                                   (fn [s]\n                                     (gen/tuple\n                                      (gen/return s)\n                                      (gen/choose 3 (max 4 (- (str/length s) 3)) ))))]\n    (= (str/length (str/truncate s len)) (min (str/length s) len))))\n\n(defexamples truncate\n  (str/truncate \"\" 3) \"\"\n  (str/truncate \"123456\" 3) \"...\"\n  (str/truncate \"123456\" 6) \"123...\"\n  (str/truncate \"1\" 3) \"1\"\n  (str/truncate \"12\" 3) \"12\"\n  (str/truncate \"123\" 3) \"123\")\n\n(defexamples common-prefix\n  (str/common-prefix \"321\" \"123\") \"\"\n  (str/common-prefix \"Åffø123456\" \"Åfføo8yuidfg\") \"Åffø\"\n  (str/common-prefix \"123456\" \"123o8yuidfg\") \"123\"\n  (str/common-prefix \"Åberg\" \"åberg\") \"\"\n  (str/common-prefix \"åberg\" \"Åberg\" :ignore-case) \"Åberg\"\n  (str/common-prefix \"Åberg\" \"åberg\" :ignore-case) \"åberg\")\n\n(defspec common-prefix-finds-common-prefixes 100\n  (prop/for-all [prefix (gen/not-empty gen/string)\n                 s1 gen/string\n                 s2 gen/string]\n    (str/starts-with? (str/common-prefix (str prefix s1) (str prefix s2)) prefix)))\n\n(defexamples common-suffix\n  (str/common-suffix \"321\" \"123\") \"\"\n  (str/common-suffix \"123456Åffø\" \"o8yuidfgÅffø\") \"Åffø\"\n  (str/common-suffix \"456123\" \"o8yuidfg123\") \"123\"\n  (str/common-suffix \"åberG\" \"åberg\") \"\"\n  (str/common-suffix \"åberg\" \"åberG\" :ignore-case) \"åberG\"\n  (str/common-suffix \"Åberg\" \"åberg\" :ignore-case) \"åberg\")\n\n(defspec common-suffix-finds-common-suffixes 100\n  (prop/for-all [suffix (gen/not-empty gen/string)\n                 s1 gen/string\n                 s2 gen/string]\n    (str/ends-with? (str/common-suffix (str s1 suffix) (str s2 suffix)) suffix)))\n\n(defspec upper-case?-returns-true-on-all-upper 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (str/upper-case? (str/upper-case s))))\n\n(defspec upper-case?-returns-nil-on-all-lower 100\n  (prop/for-all [s (gen/such-that not-empty\n                                  (gen/fmap str/join (gen/vector gen/char-alpha)))]\n    (not (str/upper-case? (str/lower-case s)))))\n\n(t/deftest upper-case-test\n  (str/upper-case? \"UPPER\") \"UPPER\"\n  (str/upper-case? \"123UPPER!\") \"123UPPER!\")\n\n(defexamples lower-case-test\n  (str/lower-case? \"upper\") \"upper\"\n  (str/lower-case? \"123upper!\") \"123upper!\")\n\n(defspec lower-case?-returns-true-on-all-lower 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (str/lower-case? (str/lower-case s))))\n\n(defspec lower-case?-returns-nil-on-all-upper 100\n  (prop/for-all [s (gen/such-that not-empty\n                                  (gen/fmap str/join (gen/vector gen/char-alpha)))]\n    (not (str/lower-case? (str/upper-case s)))))\n\n(defn- word []\n  (gen/fmap #(if (< (str/length %) 10)\n               % (str/substring % 0 (rand-int (str/length %))))\n            (gen/not-empty gen/string-alphanumeric)))\n\n(defn- less-than-width-or-unbreakable [line width]\n  (or (<= (str/length line) width)\n      (not (re-find #\" \" line))))\n\n(defspec wrap-words-have-lines-no-longer-than-max-width 25\n  (prop/for-all [words (gen/bind (gen/choose 50 500)\n                                 #(gen/return (gen/sample (word) %)))\n                 width (gen/choose 8 80)]\n    (reduce (fn [acc line]\n              (and acc (less-than-width-or-unbreakable line width)))\n            true\n            (str/split-lines (str/wrap-words (str/join \" \" words) width)))))\n\n(defspec lisp-case-is-all-lower 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (str/lower-case? (str/lisp-case s))))\n\n(defexamples lisp-case-test\n  (str/lisp-case \"PascalCase\") \"pascal-case\"\n  (str/lisp-case \"setID\") \"set-id\"\n  (str/lisp-case \"HTTPRequest\") \"http-request\"\n  (str/lisp-case \"snake_case\") \"snake-case\"\n  (str/lisp-case \"SCREAMING_SNAKE_CASE\") \"screaming-snake-case\")\n\n(defexamples camel-case-test\n  (str/camel-case \"PascalCase\") \"pascalCase\"\n  (str/camel-case \"setID\") \"setId\"\n  (str/camel-case \"HTTPRequest\") \"httpRequest\"\n  (str/camel-case \"snake_case\") \"snakeCase\"\n  (str/camel-case \"SCREAMING_SNAKE_CASE\") \"screamingSnakeCase\")\n\n(defexamples pascal-case-test\n  (str/pascal-case \"PascalCase\") \"PascalCase\"\n  (str/pascal-case \"setID\") \"SetId\"\n  (str/pascal-case \"HTTPRequest\") \"HttpRequest\"\n  (str/pascal-case \"snake_case\") \"SnakeCase\"\n  (str/pascal-case \"SCREAMING_SNAKE_CASE\") \"ScreamingSnakeCase\")\n\n(defexamples snake-case-test\n  (str/snake-case \"PascalCase\") \"pascal_case\"\n  (str/snake-case \"setID\") \"set_id\"\n  (str/snake-case \"HTTPRequest\") \"http_request\"\n  (str/snake-case \"snake_case\") \"snake_case\"\n  (str/snake-case \"SCREAMING_SNAKE_CASE\") \"screaming_snake_case\")\n\n(defexamples screaming-snake-case-test\n  (str/screaming-snake-case \"PascalCase\") \"PASCAL_CASE\"\n  (str/screaming-snake-case \"setID\") \"SET_ID\"\n  (str/screaming-snake-case \"HTTPRequest\") \"HTTP_REQUEST\"\n  (str/screaming-snake-case \"snake_case\") \"SNAKE_CASE\"\n  (str/screaming-snake-case \"SCREAMING_SNAKE_CASE\") \"SCREAMING_SNAKE_CASE\")\n\n(defexamples strip-accents-test\n  (str/strip-accents \"Et ça sera sa moitié\") \"Et ca sera sa moitie\"\n  (str/strip-accents \"ąàáäâãåæăćčĉęèéëêĝĥìíïîĵľńňòóöőôõøśșšŝťțŭùúüűûñÿýçżźž\")\n  \"aaaaaaaæaccceeeeeghiiiijlnnooooooøssssttuuuuuunyyczzz\")\n\n(def string-ascii\n  (gen/fmap #(apply str %) (gen/vector gen/char-alpha)))\n\n(defspec ascii?-returns-s-on-ascii-strings 100\n  (prop/for-all [s (gen/not-empty gen/string-ascii)]\n    (= s (str/ascii? s))))\n\n(defexamples ascii?-test\n  (str/ascii? \"ascii\") \"ascii\"\n  (str/ascii? \"Et ça sera sa moitié\") nil)\n\n(defspec slug-contains-only-ascii-chars 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (str/ascii? (str/slug s))))\n\n(defspec slug-contains-no-whitespace 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (not (re-find #\"\\s+\" (str/slug s)))))\n\n(defspec slug-is-all-lower 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (str/lower-case? (str/slug s))))\n\n(defspec slug-only-contains-unreserved-characters 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (not (re-matches #\"[^A-Za-z0-9_.~-]+\" (str/slug s)))))\n\n(defexamples slug-test\n  (str/slug \"This, That & the Other! Various Outré   Considerations\")\n  \"this-that-the-other-various-outre-considerations\"\n  (str/slug \"ąćęółńśźż\") \"aceolnszz\")\n\n(def string-alpha\n  (gen/fmap #(apply str %) (gen/vector gen/char-alpha)))\n\n(defspec mixed-case-is-true-for-mixed-case-strings 100\n  (prop/for-all [s1 (gen/not-empty string-alpha)\n                 s2 (gen/not-empty string-alpha)]\n    (str/mixed-case? (str (str/upper-case s1) (str/lower-case s2)))))\n\n(defspec mixed-case-is-false-for-upper-case-strings 100\n  (prop/for-all [s string-ascii]\n    (not (str/mixed-case? (str/upper-case s)))))\n\n(defexamples mixed-case?-test\n  (str/mixed-case? \"1aB\") \"1aB\"\n  (str/mixed-case? \"1B\") nil\n  (str/mixed-case? \"1234\") nil\n  (str/mixed-case? \"FooBar\") \"FooBar\"\n  (str/mixed-case? \"foo\") nil)\n\n(def whitespace\n  (gen/fmap #(apply str %)\n            (gen/not-empty (gen/vector\n                            (gen/elements [\\tab \\newline \\return \\space])))))\n\n(defspec collapse-whitespace-collapses-whitespace 100\n  (prop/for-all [s (gen/not-empty gen/string-alphanumeric)\n                 ws1 (gen/not-empty whitespace)\n                 ws2 (gen/not-empty whitespace)]\n    (= (+ (str/length s) 2)\n       (str/length (str/collapse-whitespace (str ws1 s ws2))))))\n\n(defexamples collapse-whitespace-test\n  (str/collapse-whitespace \"foo\n\nbar          baz\") \"foo bar baz\"\n(str/collapse-whitespace \" foo bar baz \") \" foo bar baz \")\n\n(defspec levenshtein-distance-is-at-least-difference-between-string-lenghts 100\n  (prop/for-all [s1 (gen/not-empty gen/string)\n                 s2 (gen/not-empty gen/string)]\n    (>= (str/distance s1 s2)\n        (- (max (str/length s1) (str/length s2))\n           (min (str/length s1) (str/length s2))))))\n\n(defspec levenshtein-distance-is-at-most-length-of-longest-string 100\n  (prop/for-all [s1 (gen/not-empty gen/string)\n                 s2 (gen/not-empty gen/string)]\n    (<= (str/distance s1 s2)\n        (max (str/length s1) (str/length s2)))))\n\n(defspec levenshtein-distance-is-zero-for-equal-strings 100\n  (prop/for-all [s (gen/not-empty gen/string)]\n    (= 0 (str/distance s s))))\n\n(defspec levenshtein-distance-is-zero-means-equal-strings 100\n  (prop/for-all [s1 (gen/not-empty gen/string)\n                 s2 (gen/not-empty gen/string)]\n    (if (= (str/distance s1 s2) 0)\n      (= s1 s2)\n      true)))\n\n(defspec levenshtein-triangle 100\n  (prop/for-all [s1 (gen/not-empty gen/string)\n                 s2 (gen/not-empty gen/string)\n                 s3 (gen/not-empty gen/string)]\n    (<= (str/distance s1 s2)\n        (+ (str/distance s1 s3)\n           (str/distance s2 s3)))))\n\n(defexamples distance-test\n  (str/distance \"foo\" \"foo\") 0\n  (str/distance \"foo\" \"foo\" :levenshtein) 0\n  (str/distance \"foo\" \"fo\") 1\n  (str/distance \"karolin\" \"kathrin\" :hamming) 3\n  (str/distance \"karolin\" \"kerstin\" :hamming) 3\n  (str/distance \"1011101\" \"1001001\" :hamming) 2\n  (str/distance \"2173896\" \"2233796\" :hamming) 3\n  (str/distance \"foo\" \"foobar\" :hamming) 3)\n\n(t/deftest distance-throws-on-unknown\n  (t/is #?(:cljs (thrown? js/Error\n                          (str/distance \"s1\" \"s2\" :unknown-algorithm))\n                 :clj (thrown? IllegalArgumentException (str/distance :unknown-algorithm)))))\n\n(defexamples longest-common-substring\n  (str/longest-common-substring \"fooquxbar\" \"foobar\") #{\"foo\" \"bar\"}\n  (str/longest-common-substring \"FOOquxbar\" \"foobar\") #{\"bar\"}\n  (str/longest-common-substring \"foo\" \"bar\") #{})\n\n(defspec finds-common-substring 100\n  (prop/for-all [s1 (gen/such-that #(< (count %) 5) (gen/not-empty gen/string)\n                                   1000)\n                 s2 (gen/such-that #(< (count %) 5) (gen/not-empty gen/string)\n                                   1000)\n                 lcs (gen/such-that #(> (count %) 5) (gen/not-empty gen/string)\n                                    1000)]\n    (seq ((str/longest-common-substring (str s1 lcs) (str lcs s2)) lcs))))\n\n#?(:clj\n   (t/deftest added-metadata-is-removed-from-aliased-vars\n     (t/is (not (:added (meta #'str/trim))))))\n\n(defspec char-at-acts-like-char-at\n  (prop/for-all [[s i] (gen/bind (gen/not-empty gen/string)\n                                 (fn [s]\n                                   (gen/tuple\n                                    (gen/return s)\n                                    (gen/choose 0 (max 0 (dec (str/length s)))))))]\n    (= (.charAt s i) (str/char-at s i))))\n\n(defexamples re-quote\n  (re-matches (re-pattern \".foo.\") \"afoob\") \"afoob\"\n  (re-matches (re-pattern (str/re-quote \".foo.\")) \"afoob\") nil)\n\n(defexamples translate\n  (str/translate \"abba\" {\\a \\b}) \"bbbb\"\n  (str/translate \"abba\" {\\a \\b \\b \\a}) \"baab\"\n  (str/translate \"foo\" {\\a \\b }) \"foo\"\n  (str/translate \"gabba\" {\\a \\b} #{\\b}) \"gbb\")\n\n(defspec translate-deletes-all-unwanted-chars\n  (prop/for-all [s (gen/not-empty gen/string)\n                 ds (gen/vector gen/char)]\n    (t/is (not (str/contains-any? (str/translate s {} (set (map str ds)))\n                                  (map str ds))))))\n\n(t/deftest added-metadata-is-removed-from-aliased-vars\n  (t/is (not (:added (meta #'str/trim)))))\n\n#?(:cljs\n   (do\n     (enable-console-print!)\n     (set! *main-cli-fn* #(t/run-tests))))\n"
  file-path  "c:/git/superstring/test/superstring/core_test.cljc"
  file-name  "core_test.cljc"
  id  "15"
)

@malchmih
Copy link

Same (probably) here. I'm starting REPLs with cider-jack-in-clojurescript too, and trying to evaluate some defn from clojure file. CIDER tries to evaluate everything in cljs REPL and fails.

@Malabarba
Copy link
Member

@malchmih Expez's problem is with cljc files. If your problem is with clj files, open a new ticket (but first, check that you're on 0.10.0-SNAPSHOT).

@malchmih
Copy link

Sure, doing now

@expez expez changed the title Eval doesn't work with dual repls Eval doesn't work as I'd like with dual repls for cljc Sep 17, 2015
@expez expez changed the title Eval doesn't work as I'd like with dual repls for cljc Eval should dispatch to both repls in cljc files Sep 17, 2015
@bbatsov bbatsov modified the milestone: v0.10 Nov 2, 2015
expez added a commit that referenced this issue Nov 6, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 6, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 6, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
@expez expez closed this as completed in cfb6f1f Nov 9, 2015
expez added a commit that referenced this issue Nov 10, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 10, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 10, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 10, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 10, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 28, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
expez added a commit that referenced this issue Nov 28, 2015
This changes the load file request to dispatch to
`cider-other-connection` in addition to `cider-current-connection`, when
the file is a cljc or cljx file.
bbatsov added a commit that referenced this issue Nov 29, 2015
[Fix #1299] Eval in both REPLs for cljc and cljx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants