summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback')
-rwxr-xr-xtest/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint0
-rwxr-xr-xtest/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js0
-rw-r--r--test/command_callback/test_sass_sasslint_command_callback.vader43
-rw-r--r--test/command_callback/test_sasslint_command_callback.vader11
-rw-r--r--test/command_callback/test_scss_sasslint_command_callback.vader43
5 files changed, 86 insertions, 11 deletions
diff --git a/test/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint b/test/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/sasslint-test-files/with-bin/node_modules/.bin/sass-lint
diff --git a/test/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js b/test/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js
diff --git a/test/command_callback/test_sass_sasslint_command_callback.vader b/test/command_callback/test_sass_sasslint_command_callback.vader
new file mode 100644
index 00000000..9b9bf906
--- /dev/null
+++ b/test/command_callback/test_sass_sasslint_command_callback.vader
@@ -0,0 +1,43 @@
+Before:
+ call ale#assert#SetUpLinterTest('sass', 'sasslint')
+ call ale#test#SetFilename('test.sass')
+ unlet! b:executable
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(should default to source, bin/sass-lint.js):
+ call ale#test#SetFilename('sasslint-test-files/with-source/test.sass')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js'
+ \)
+
+ AssertLinter b:executable,
+ \ (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(b:executable)
+ \ . ' -v -q -f compact %t'
+
+Execute(should fallback to bin, .bin/sass-lint):
+ call ale#test#SetFilename('sasslint-test-files/with-bin/test.sass')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-bin/node_modules/.bin/sass-lint'
+ \)
+
+ AssertLinter b:executable, ale#Escape(b:executable) . ' -v -q -f compact %t'
+
+Execute(should fallback to global bin):
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' -v -q -f compact %t'
+
+Execute(The global executable should be configurable):
+ let b:ale_sass_sasslint_executable = 'foo'
+
+ AssertLinter 'foo', ale#Escape('foo') . ' -v -q -f compact %t'
+
+Execute(The options should be configurable):
+ let b:ale_sass_sasslint_options = '--bar'
+
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' --bar -v -q -f compact %t'
diff --git a/test/command_callback/test_sasslint_command_callback.vader b/test/command_callback/test_sasslint_command_callback.vader
deleted file mode 100644
index 9142c441..00000000
--- a/test/command_callback/test_sasslint_command_callback.vader
+++ /dev/null
@@ -1,11 +0,0 @@
-Before:
- call ale#assert#SetUpLinterTest('sass', 'sasslint')
- call ale#test#SetFilename('test.sass')
-
-After:
- call ale#assert#TearDownLinterTest()
-
-Execute(The default sasslint command should be correct):
- AssertLinter 'sass-lint',
- \ ale#path#CdString(expand('%:p:h'))
- \ . ale#Escape('sass-lint') . ' -v -q -f compact %t'
diff --git a/test/command_callback/test_scss_sasslint_command_callback.vader b/test/command_callback/test_scss_sasslint_command_callback.vader
new file mode 100644
index 00000000..1695190a
--- /dev/null
+++ b/test/command_callback/test_scss_sasslint_command_callback.vader
@@ -0,0 +1,43 @@
+Before:
+ call ale#assert#SetUpLinterTest('scss', 'sasslint')
+ call ale#test#SetFilename('test.scss')
+ unlet! b:executable
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(should default to source, bin/sass-lint.js):
+ call ale#test#SetFilename('sasslint-test-files/with-source/test.scss')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js'
+ \)
+
+ AssertLinter b:executable,
+ \ (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(b:executable)
+ \ . ' -v -q -f compact %t'
+
+Execute(should fallback to bin, .bin/sass-lint):
+ call ale#test#SetFilename('sasslint-test-files/with-bin/test.scss')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/sasslint-test-files/with-bin/node_modules/.bin/sass-lint'
+ \)
+
+ AssertLinter b:executable, ale#Escape(b:executable) . ' -v -q -f compact %t'
+
+Execute(should fallback to global bin):
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' -v -q -f compact %t'
+
+Execute(The global executable should be configurable):
+ let b:ale_scss_sasslint_executable = 'foo'
+
+ AssertLinter 'foo', ale#Escape('foo') . ' -v -q -f compact %t'
+
+Execute(The options should be configurable):
+ let b:ale_scss_sasslint_options = '--bar'
+
+ AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' --bar -v -q -f compact %t'