summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorD. Ben Knoble <ben.knoble+github@gmail.com>2021-07-19 21:02:23 -0400
committerGitHub <noreply@github.com>2021-07-20 10:02:23 +0900
commit651038b6017c2d2bd7027076ff2838e7cc4a078e (patch)
tree42188a252e3d4dcb348f0f3cd9588006ebe10200 /test
parenta6719c2d4fa0d4f5f2cdbaf8ece8de6c4faf1295 (diff)
downloadale-651038b6017c2d2bd7027076ff2838e7cc4a078e.zip
racket: support racket-langserver lsp (#3808)
* racket: support racket-langserver lsp * racket-langserver: find highest dir with init.rkt * autoload/ale/racket: re-indent to 4 spaces * racket: lint: sort supported tools * racket: lint: function! This is _not_ needed anymore, but the lint wants it. See :help E127 * racket-langserver: do not use new dict format * racket: lint: use snake_case * add tests for racket-langserver * racket-langserver tests: correct result values
Diffstat (limited to 'test')
-rw-r--r--test/linter/test_racket_langserver.vader45
-rw-r--r--test/test-files/racket/many-inits/a/b/c/foo.rkt3
-rw-r--r--test/test-files/racket/many-inits/a/b/c/init.rkt1
-rw-r--r--test/test-files/racket/many-inits/a/b/foo.rkt3
-rw-r--r--test/test-files/racket/many-inits/a/b/init.rkt1
-rw-r--r--test/test-files/racket/many-inits/a/foo.rkt3
-rw-r--r--test/test-files/racket/many-inits/a/init.rkt1
-rw-r--r--test/test-files/racket/many-inits/foo.rkt3
-rw-r--r--test/test-files/racket/many-inits/init.rkt1
-rw-r--r--test/test-files/racket/simple-script/foo.rkt3
10 files changed, 64 insertions, 0 deletions
diff --git a/test/linter/test_racket_langserver.vader b/test/linter/test_racket_langserver.vader
new file mode 100644
index 00000000..021eb565
--- /dev/null
+++ b/test/linter/test_racket_langserver.vader
@@ -0,0 +1,45 @@
+" Author: D. Ben Knoble <https://github.com/benknoble>
+" Description: Tests for racket-langserver lsp linter.
+Before:
+ call ale#assert#SetUpLinterTest('racket', 'langserver')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(command callback should return default string):
+ AssertLinter 'racket', ale#Escape('racket').' -l racket-langserver'
+
+Execute(should set racket-langserver for deep module 3):
+ call ale#test#SetFilename('../test-files/racket/many-inits/a/b/c/foo.rkt')
+ AssertLSPLanguage 'racket'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
+
+Execute(should set racket-langserver for deep module 2):
+ call ale#test#SetFilename('../test-files/racket/many-inits/a/b/foo.rkt')
+ AssertLSPLanguage 'racket'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
+
+Execute(should set racket-langserver for deep module 1):
+ call ale#test#SetFilename('../test-files/racket/many-inits/a/foo.rkt')
+ AssertLSPLanguage 'racket'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
+
+Execute(should set racket-langserver for top-level module):
+ call ale#test#SetFilename('../test-files/racket/many-inits/foo.rkt')
+ AssertLSPLanguage 'racket'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
+
+Execute(should set racket-langserver for non-package module or script):
+ call ale#test#SetFilename('../test-files/racket/simple-script/foo.rkt')
+ AssertLSPLanguage 'racket'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#test#GetFilename('../test-files/racket/simple-script')
diff --git a/test/test-files/racket/many-inits/a/b/c/foo.rkt b/test/test-files/racket/many-inits/a/b/c/foo.rkt
new file mode 100644
index 00000000..622f3eea
--- /dev/null
+++ b/test/test-files/racket/many-inits/a/b/c/foo.rkt
@@ -0,0 +1,3 @@
+#lang racket/base
+
+(displayln "foo")
diff --git a/test/test-files/racket/many-inits/a/b/c/init.rkt b/test/test-files/racket/many-inits/a/b/c/init.rkt
new file mode 100644
index 00000000..e0c94f27
--- /dev/null
+++ b/test/test-files/racket/many-inits/a/b/c/init.rkt
@@ -0,0 +1 @@
+#lang info
diff --git a/test/test-files/racket/many-inits/a/b/foo.rkt b/test/test-files/racket/many-inits/a/b/foo.rkt
new file mode 100644
index 00000000..622f3eea
--- /dev/null
+++ b/test/test-files/racket/many-inits/a/b/foo.rkt
@@ -0,0 +1,3 @@
+#lang racket/base
+
+(displayln "foo")
diff --git a/test/test-files/racket/many-inits/a/b/init.rkt b/test/test-files/racket/many-inits/a/b/init.rkt
new file mode 100644
index 00000000..e0c94f27
--- /dev/null
+++ b/test/test-files/racket/many-inits/a/b/init.rkt
@@ -0,0 +1 @@
+#lang info
diff --git a/test/test-files/racket/many-inits/a/foo.rkt b/test/test-files/racket/many-inits/a/foo.rkt
new file mode 100644
index 00000000..622f3eea
--- /dev/null
+++ b/test/test-files/racket/many-inits/a/foo.rkt
@@ -0,0 +1,3 @@
+#lang racket/base
+
+(displayln "foo")
diff --git a/test/test-files/racket/many-inits/a/init.rkt b/test/test-files/racket/many-inits/a/init.rkt
new file mode 100644
index 00000000..e0c94f27
--- /dev/null
+++ b/test/test-files/racket/many-inits/a/init.rkt
@@ -0,0 +1 @@
+#lang info
diff --git a/test/test-files/racket/many-inits/foo.rkt b/test/test-files/racket/many-inits/foo.rkt
new file mode 100644
index 00000000..622f3eea
--- /dev/null
+++ b/test/test-files/racket/many-inits/foo.rkt
@@ -0,0 +1,3 @@
+#lang racket/base
+
+(displayln "foo")
diff --git a/test/test-files/racket/many-inits/init.rkt b/test/test-files/racket/many-inits/init.rkt
new file mode 100644
index 00000000..e0c94f27
--- /dev/null
+++ b/test/test-files/racket/many-inits/init.rkt
@@ -0,0 +1 @@
+#lang info
diff --git a/test/test-files/racket/simple-script/foo.rkt b/test/test-files/racket/simple-script/foo.rkt
new file mode 100644
index 00000000..622f3eea
--- /dev/null
+++ b/test/test-files/racket/simple-script/foo.rkt
@@ -0,0 +1,3 @@
+#lang racket/base
+
+(displayln "foo")