         (find-file-other-window file)
       (error "%s not found." file))))
 
-(defun js2r-chop-suffix (s suffix)
-  (s-chop-suffix suffix s))
-
 (defun guess-source-file ()
   (unless (looks-like-test-file-name (buffer-file-name))
     (error "This doesn't look like a test file."))
-  (format "%s/%s.js" (js2r-chop-suffix (guess-source-folder) "/") (guess-source-file-name)))
+  (format "%s/%s.js" (s-chop-suffix "/" (guess-source-folder)) (guess-source-file-name)))
 
 (defun guess-source-file-name ()
-  (reduce 'js2r-chop-suffix (possible-test-file-suffixes)
-          :initial-value (file-name-nondirectory (buffer-file-name))))
+  (s-chop-suffixes (possible-test-file-suffixes) (file-name-nondirectory (buffer-file-name))))
 
 (defun guess-source-folder ()
   (let ((test-dir (file-name-directory (buffer-file-name))))

(require 'cl)
(require 's)

(defun _any (pred seq)
  (< 0 (count-if pred seq)))

(defun _partial (f &rest args)
  (apply 'apply-partially (cons f args)))

(defvar js2r-path-to-tests "/test/"
  "Path to tests from a root shared with sources")

        '("Test.js" "_test.js" "-test.js")))

(defun looks-like-test-file-name (file-name)
  (!!any? (s-ends-with-p it file-name) (possible-test-file-suffixes)))

(defun jump-to-source-file-other-window (arg)
  (interactive "P")
