This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(given [x y] (expect x y) | |
0 (let [i (atom 0)] | |
@i) | |
1 (let [i (atom 0)] | |
(swap! i inc) | |
@i) | |
(let [i (atom 0)] | |
(swap! i inc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(expect 0 (let [i (atom 0)] | |
@i)) | |
(expect 1 (let [i (atom 0)] | |
(swap! i inc) | |
@i)) | |
(expect 2 (let [i (atom 0)] | |
(swap! i inc) | |
(swap! i inc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(scenario | |
(let [i (atom 0)] | |
(expect 0 @i) | |
(swap! i inc) | |
(expect 1 @i) | |
(swap! i inc) | |
(expect 2 @i))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun grep-in (project-root) | |
(interactive (list (read-directory-name "Project Root: " | |
(locate-dominating-file | |
default-directory | |
"project.clj")))) | |
(er/mark-clj-word) | |
(grep (concat "grep -nH -e " | |
(buffer-substring-no-properties (region-beginning) (region-end)) | |
" -R " project-root))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun grep-in-project () | |
(interactive) | |
(er/mark-clj-word) | |
(let* ((project-root (locate-dominating-file | |
(file-name-directory (buffer-file-name)) "project.clj"))) | |
(if project-root | |
(grep (concat "grep -nH -e " | |
(buffer-substring-no-properties (region-beginning) (region-end)) | |
" -R " project-root)) | |
(message (concat "no project.clj found at or below " (buffer-file-name)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun duplicate-line () | |
(interactive) | |
(let* ((cursor-column (current-column))) | |
(move-beginning-of-line 1) | |
(kill-line) | |
(yank) | |
(open-line 1) | |
(next-line 1) | |
(yank) | |
(move-to-column cursor-column))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun src-full-path (project-root file-name) | |
(concat | |
(replace-regexp-in-string | |
(concat (expand-file-name project-root) "test/clojure/expectations") | |
(concat project-root "src/clojure") | |
(file-name-directory file-name)) | |
(replace-regexp-in-string | |
"_expectations" | |
"" | |
(file-name-nondirectory file-name)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun test-full-path (project-root test-home) | |
(concat | |
(replace-regexp-in-string | |
(concat (expand-file-name project-root) "src/clojure") | |
(concat project-root test-home) | |
(file-name-sans-extension (buffer-file-name))) | |
"_expectations.clj")) | |
(defun find-expectations () | |
(interactive) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns blog-expectations | |
(:use expectations)) | |
(expect vector? [1 2]) | |
(given [x y-fn] (expect x | |
(y-fn | |
(map-indexed vector [1 2]))) | |
[0 1] first | |
java.util.List identity) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns blog-expectations | |
(:use expectations)) | |
(expect vector? [1 2]) | |
(given [x y-fn] (expect x | |
(y-fn | |
(map-indexed vector [1 2]))) | |
[0 1] first | |
java.util.List identity) |