blob: 72465f4fda06225c63d9cb5b3109306060872665 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
Before:
call ale#assert#SetUpFixerTest('swift', 'apple-swift-format')
After:
call ale#assert#TearDownFixerTest()
Execute(The swiftformat callback should return the correct default values):
call ale#test#SetFilename('../test-files/swift/dummy.swift')
let g:ale_swift_appleswiftformat_executable = 'xxxinvalid'
let g:ale_swift_appleswiftformat_use_swiftpm = 0
AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_swift_appleswiftformat_executable)
\ . ' format --in-place %t',
\ },
\ ale#fixers#appleswiftformat#Fix(bufnr(''))
Execute(The swiftformat callback should return the correct default values and located configuration):
call ale#test#SetDirectory('/testplugin/test/test-files/swift/swift-package-project-with-config')
call ale#test#SetFilename('src/folder/dummy.swift')
let g:ale_swift_appleswiftformat_executable = 'xxxinvalid'
let g:ale_swift_appleswiftformat_use_swiftpm = 0
AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_swift_appleswiftformat_executable)
\ . ' format --in-place %t --configuration ' . glob(g:dir . '/.swift-format'),
\ },
\ ale#fixers#appleswiftformat#Fix(bufnr(''))
call ale#test#RestoreDirectory()
Execute(The swiftformat callback should use swiftpm is use_swiftpm is set to 1):
call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift')
let g:ale_swift_appleswiftformat_use_swiftpm = 1
AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape('swift')
\ . ' run swift-format format --in-place %t',
\ },
\ ale#fixers#appleswiftformat#Fix(bufnr(''))
|