diff options
author | Nathan <me@nathanherald.com> | 2022-01-04 13:49:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 21:49:03 +0900 |
commit | ac0495df6ef44deff556ed450f503875370f0812 (patch) | |
tree | 698e7d781c176843afaebe7b6d4a0865ca68a089 /test | |
parent | 48f68598cb49c5711f31d9ed204a4f0fdc390330 (diff) | |
download | ale-ac0495df6ef44deff556ed450f503875370f0812.zip |
Add dprint fixer (#4024)
* Add dprint fixer
* Fix windows tests
* dd dprint documentation
Diffstat (limited to 'test')
-rw-r--r-- | test/fixers/test_dprint_fixer_callback.vader | 44 | ||||
-rw-r--r-- | test/test-files/dprint/blank.ts | 0 | ||||
-rw-r--r-- | test/test-files/dprint/dprint.json | 0 |
3 files changed, 44 insertions, 0 deletions
diff --git a/test/fixers/test_dprint_fixer_callback.vader b/test/fixers/test_dprint_fixer_callback.vader new file mode 100644 index 00000000..6a9d0118 --- /dev/null +++ b/test/fixers/test_dprint_fixer_callback.vader @@ -0,0 +1,44 @@ +Before: + call ale#assert#SetUpFixerTest('typescript', 'dprint') + call ale#test#SetFilename('../test-files/dprint/blank.ts') + let g:ale_dprint_executable_override = 0 + let g:ale_dprint_executable = 'dprint' + let g:ale_dprint_config = '' + +After: + Restore + call ale#assert#TearDownFixerTest() + +Execute(The dprint callback should return 0 for a non-existent executable): + let g:ale_dprint_executable = 'foo' + AssertFixer 0 + +Execute(The dprint callback should return the correct default values): + let g:ale_dprint_executable_override = 1 + AssertFixer { + \ 'command': ale#Escape('dprint') + \ . ' fmt ' + \ . ' --stdin %s' + \ } + +Execute(The dprint callback should include config): + let g:ale_dprint_executable_override = 1 + let g:ale_dprint_config = 'dprint.json' + + AssertFixer { + \ 'command': ale#Escape('dprint') + \ . ' fmt ' + \ . ' -c ' + \ . ale#Escape((has('win32') ? 'C:\testplugin\test\test-files\dprint\dprint.json' : '/testplugin/test/test-files/dprint/dprint.json')) + \ . ' --stdin %s' + \ } + +Execute(The dprint callback should include custom options): + let g:ale_dprint_executable_override = 1 + let g:ale_dprint_options = '--verbose' + + AssertFixer { + \ 'command': ale#Escape('dprint') + \ . ' fmt ' + \ . '--verbose' . ' --stdin %s' + \ } diff --git a/test/test-files/dprint/blank.ts b/test/test-files/dprint/blank.ts new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test-files/dprint/blank.ts diff --git a/test/test-files/dprint/dprint.json b/test/test-files/dprint/dprint.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test-files/dprint/dprint.json |