Skip to content

Commit 765bf96

Browse files
committed
Add specific test coverage for string requires
Fixes clojure-emacs/clj-refactor.el#476
1 parent beaa226 commit 765bf96

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

test-resources/cljsns.cljs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
[cljs.pprint :as pprint]
77
[js-literal-ns :as js-literal]
88
[keyword-ns :as kw]
9-
[clojure.set :as set])
9+
[clojure.set :as set]
10+
["react" :as react]
11+
["underscore$default" :as underscore]
12+
["react-UNUSED" :as react-unused]
13+
["underscore-UNUSEd$default" :as underscore-unused])
1014
(:require-macros [cljs.test :refer [testing]]
1115
[cljs.analyzer.macros :as am]
1216
cljs.analyzer.api)
@@ -18,6 +22,13 @@
1822
(set/intersection #{1 2} #{1})
1923
(split-lines "ok"))
2024

25+
(defn use-string-requires
26+
"Uses string requires as found in the ns declaration.
27+
28+
Does not use the stuff marked as UNUSED, which therefore should be removed."
29+
[]
30+
(react/foo underscore/bar))
31+
2132
(deftest tt
2233
(testing "whatever"
2334
(is (= 1 1))))

test-resources/cljsns_cleaned.cljs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
(ns cljsns
2-
(:require [cljs.pprint :as pprint]
2+
(:require ["react" :as react]
3+
["underscore$default" :as underscore]
4+
[cljs.pprint :as pprint]
35
[cljs.test :refer-macros [deftest is]]
46
[cljsjs.js-yaml]
57
[clojure.set :as set]

0 commit comments

Comments
 (0)