Skip to content

Commit bfa026c

Browse files
committed
configure testdata and assert files
1 parent 8c3e2d7 commit bfa026c

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed
Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,42 @@
11
(ns com.github.clojure-lsp.intellij.foo-test
22
(:require
3-
[clojure.test :refer [deftest is testing]]))
3+
[clojure.test :refer [deftest is]]
4+
[com.github.ericdallo.clj4intellij.app-manager :as app-manager]
5+
[com.github.ericdallo.clj4intellij.test :as clj4intellij.test])
6+
(:import
7+
[com.intellij.openapi.wm WindowManager]))
48

59
(set! *warn-on-reflection* true)
610

7-
(deftest foo
8-
(testing "foo"
11+
12+
(defn get-status-bar-widget [project widget-id]
13+
(let [status-bar (.. (WindowManager/getInstance) (getStatusBar project))]
14+
(.getWidget status-bar widget-id)))
15+
16+
(deftest foo-test
17+
(let [project-name "clojure.core"
18+
fixture (clj4intellij.test/setup project-name)
19+
deps-file (.createFile fixture "deps.edn" "{}")
20+
_ (.setTestDataPath fixture "testdata")
21+
clj-file (.copyFileToProject fixture "foo.clj")
22+
project (.getProject fixture)]
23+
(is (= project-name (.getName project)))
24+
(is deps-file)
25+
26+
(app-manager/write-command-action
27+
project
28+
(fn [] (.openFileInEditor fixture clj-file)))
29+
30+
(clj4intellij.test/dispatch-all)
31+
32+
@(app-manager/invoke-later!
33+
{:invoke-fn (fn []
34+
(let [widget (get-status-bar-widget project "ClojureLSPStatusBar")]
35+
(println "Widget:" widget)
36+
(is (some? widget))))})
37+
38+
(.checkResultByFile fixture "foo_expected.clj")
39+
940
(is false)))
41+
42+

testdata/foo.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(ns foo)
2+
3+
(println "Oiii")

testdata/foo_expected.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(ns foo)
2+
3+
(println "Olaa")

0 commit comments

Comments
 (0)