|
6 | 6 | [cider.nrepl.middleware.info-test :as info-test] |
7 | 7 | [cider.test-helpers :refer :all] |
8 | 8 | [clojure.edn :as edn] |
9 | | - [clojure.string :as string] |
| 9 | + [clojure.string :as str] |
10 | 10 | [clojure.test :refer :all] |
11 | 11 | [orchard.java] |
12 | 12 | [orchard.inspect] |
|
468 | 468 |
|
469 | 469 | (deftest max-atom-length-integration-test |
470 | 470 | (let [max-len (:max-atom-length @#'orchard.inspect/default-inspector-config) |
471 | | - xs #(string/join (repeat % "x")) |
| 471 | + xs #(str/join (repeat % "x")) |
472 | 472 | fits (pr-str [(xs (- max-len 10))]) ;; 140 |
473 | 473 | too-long (pr-str [(xs (* max-len 2))]) ;; 300 |
474 | 474 | x-pattern #(str "\"" (xs %1) %2 "\\\"") |
475 | 475 | extract-text #(-> % :value first)] |
476 | 476 |
|
477 | 477 | (testing "max atom length can be set for the eval op" |
478 | | - (is (string/includes? (-> (session/message {:op "eval" |
479 | | - :inspect "true" |
480 | | - :code fits}) |
| 478 | + (is (str/includes? (-> (session/message {:op "eval" |
| 479 | + :inspect "true" |
| 480 | + :code fits}) |
481 | 481 | extract-text) |
482 | 482 | (x-pattern (- max-len 10) ""))) |
483 | | - (is (string/includes? (-> (session/message {:op "eval" |
484 | | - :inspect "true" |
485 | | - :code too-long}) |
| 483 | + (is (str/includes? (-> (session/message {:op "eval" |
| 484 | + :inspect "true" |
| 485 | + :code too-long}) |
486 | 486 | extract-text) |
487 | 487 | (x-pattern max-len "..."))) |
488 | | - (is (string/includes? (-> (session/message {:op "eval" |
489 | | - :inspect "true" |
490 | | - :code too-long |
491 | | - :max-atom-length 10}) |
| 488 | + (is (str/includes? (-> (session/message {:op "eval" |
| 489 | + :inspect "true" |
| 490 | + :code too-long |
| 491 | + :max-atom-length 10}) |
492 | 492 | extract-text) |
493 | 493 | (x-pattern 10 "...")))) |
494 | 494 |
|
495 | 495 | (testing "max atom length can be changed without re-eval'ing last form" |
496 | 496 | (session/message {:op "inspect-clear"}) |
497 | | - (is (string/includes? (-> (session/message {:op "eval" |
498 | | - :inspect "true" |
499 | | - :code too-long}) |
| 497 | + (is (str/includes? (-> (session/message {:op "eval" |
| 498 | + :inspect "true" |
| 499 | + :code too-long}) |
500 | 500 | extract-text) |
501 | 501 | (x-pattern max-len "..."))) |
502 | | - (is (string/includes? (-> (session/message {:op "inspect-refresh" |
503 | | - :max-atom-length 10}) |
| 502 | + (is (str/includes? (-> (session/message {:op "inspect-refresh" |
| 503 | + :max-atom-length 10}) |
504 | 504 | extract-text) |
505 | 505 | (x-pattern 10 "..."))) |
506 | | - (is (string/includes? (-> (session/message {:op "inspect-refresh" |
507 | | - :max-atom-length 20}) |
| 506 | + (is (str/includes? (-> (session/message {:op "inspect-refresh" |
| 507 | + :max-atom-length 20}) |
508 | 508 | extract-text) |
509 | 509 | (x-pattern 20 "...")))))) |
510 | 510 |
|
|
535 | 535 | big-coll (format "[(range %d)]" big-size) |
536 | 536 | coll-pattern (fn [len & [truncate]] |
537 | 537 | (re-pattern (format "\\(%s%s\\)" |
538 | | - (string/join " " (range len)) |
| 538 | + (str/join " " (range len)) |
539 | 539 | (if truncate " ..." "")))) |
540 | 540 | extract-text #(-> % :value first)] |
541 | 541 |
|
|
591 | 591 | :inspect "true" |
592 | 592 | :code nested-coll |
593 | 593 | :max-nested-depth 5})] |
594 | | - (is (string/includes? (extract-text default) |
| 594 | + (is (str/includes? (extract-text default) |
595 | 595 | "\"[[[[[[[[[[1]]]]]]]]]]\"")) |
596 | | - (is (string/includes? (extract-text limited) |
| 596 | + (is (str/includes? (extract-text limited) |
597 | 597 | "\"[[[[[[...]]]]]]\"")))) |
598 | 598 |
|
599 | 599 | (testing "max nested depth can be changed without re-eval'ing last form" |
|
603 | 603 | :code nested-coll}) |
604 | 604 | limited (session/message {:op "inspect-refresh" |
605 | 605 | :max-nested-depth 5})] |
606 | | - (is (string/includes? (extract-text default) |
| 606 | + (is (str/includes? (extract-text default) |
607 | 607 | "\"[[[[[[[[[[1]]]]]]]]]]\"")) |
608 | | - (is (string/includes? (extract-text limited) |
| 608 | + (is (str/includes? (extract-text limited) |
609 | 609 | "\"[[[[[[...]]]]]]\"")))))) |
610 | 610 |
|
611 | 611 | (def normal-mode-prefix |
|
0 commit comments