summaryrefslogtreecommitdiff
path: root/test/test_ale_info.vader
blob: 5f5936d605723fba43d34bccdb2bd998b9123449 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
Before:
  Save g:ale_buffer_info
  Save g:ale_cache_executable_check_failures
  Save g:ale_change_sign_column_color
  Save g:ale_command_wrapper
  Save g:ale_completion_delay
  Save g:ale_completion_enabled
  Save g:ale_completion_max_suggestions
  Save g:ale_disable_lsp
  Save g:ale_echo_cursor
  Save g:ale_echo_msg_error_str
  Save g:ale_echo_msg_format
  Save g:ale_echo_msg_info_str
  Save g:ale_echo_msg_warning_str
  Save g:ale_fix_on_save
  Save g:ale_fixers
  Save g:ale_history_enabled
  Save g:ale_history_log_output
  Save g:ale_info_default_mode
  Save g:ale_keep_list_window_open
  Save g:ale_lint_delay
  Save g:ale_lint_on_enter
  Save g:ale_lint_on_filetype_changed
  Save g:ale_lint_on_insert_leave
  Save g:ale_lint_on_save
  Save g:ale_lint_on_text_changed
  Save g:ale_linters
  Save g:ale_linters_explicit
  Save g:ale_linters_ignore
  Save g:ale_list_vertical
  Save g:ale_list_window_size
  Save g:ale_loclist_msg_format
  Save g:ale_lsp_error_messages
  Save g:ale_max_buffer_history_size
  Save g:ale_max_signs
  Save g:ale_maximum_file_size
  Save g:ale_open_list
  Save g:ale_pattern_options
  Save g:ale_pattern_options_enabled
  Save g:ale_root
  Save g:ale_set_balloons
  Save g:ale_set_highlights
  Save g:ale_set_loclist
  Save g:ale_set_quickfix
  Save g:ale_set_signs
  Save g:ale_sign_column_always
  Save g:ale_sign_error
  Save g:ale_sign_info
  Save g:ale_sign_offset
  Save g:ale_sign_style_error
  Save g:ale_sign_style_warning
  Save g:ale_sign_warning
  Save g:ale_sign_highlight_linenrs
  Save g:ale_type_map
  Save g:ale_use_neovim_diagnostics_api
  Save g:ale_use_global_executables
  Save g:ale_virtualtext_cursor
  Save g:ale_warn_about_trailing_blank_lines
  Save g:ale_warn_about_trailing_whitespace

  unlet! b:ale_history

  let g:ale_buffer_info = {}
  let g:ale_cache_executable_check_failures = 0
  let g:ale_change_sign_column_color = 0
  let g:ale_command_wrapper = ''
  let g:ale_completion_delay = 100
  let g:ale_completion_enabled = 0
  let g:ale_completion_max_suggestions = 50
  let g:ale_disable_lsp = 0
  let g:ale_echo_cursor = 1
  let g:ale_echo_msg_error_str = 'Error'
  let g:ale_echo_msg_format = '%code: %%s'
  let g:ale_echo_msg_info_str = 'Info'
  let g:ale_echo_msg_warning_str = 'Warning'
  let g:ale_fix_on_save = 0
  let g:ale_history_enabled = 1
  let g:ale_history_log_output = 1
  " This needs to be set to echo for this series of tests.
  let g:ale_info_default_mode = 'echo'
  let g:ale_keep_list_window_open = 0
  let g:ale_lint_delay = 200
  let g:ale_lint_on_enter = 1
  let g:ale_lint_on_filetype_changed = 1
  let g:ale_lint_on_insert_leave = 1
  let g:ale_lint_on_save = 1
  let g:ale_lint_on_text_changed = 'normal'
  let g:ale_linters_explicit = 0
  let g:ale_linters_ignore = {'python': ['pyright']}
  let g:ale_list_vertical = 0
  let g:ale_list_window_size = 10
  let g:ale_loclist_msg_format = '%code: %%s'
  let g:ale_lsp_error_messages = {}
  let g:ale_max_buffer_history_size = 20
  let g:ale_max_signs = -1
  let g:ale_maximum_file_size = 0
  let g:ale_open_list = 0
  let g:ale_pattern_options = {}
  let g:ale_pattern_options_enabled = 0
  let g:ale_root = {}
  let g:ale_set_balloons = 0
  let g:ale_set_highlights = 1
  let g:ale_set_loclist = 1
  let g:ale_set_quickfix = 0
  let g:ale_set_signs = 1
  let g:ale_sign_column_always = 0
  let g:ale_sign_error = '>>'
  let g:ale_sign_info = '--'
  let g:ale_sign_offset = 1000000
  let g:ale_sign_style_error = '>>'
  let g:ale_sign_style_warning = '--'
  let g:ale_sign_warning = '--'
  let g:ale_sign_highlight_linenrs = 0
  let g:ale_type_map = {}
  let g:ale_use_neovim_diagnostics_api = 0
  let g:ale_use_global_executables = v:null
  let g:ale_virtualtext_cursor = 'disabled'
  let g:ale_warn_about_trailing_blank_lines = 1
  let g:ale_warn_about_trailing_whitespace = 1

  let g:testlinter1 = {'name': 'testlinter1', 'executable': 'testlinter1', 'command': 'testlinter1', 'callback': 'testCB1', 'output_stream': 'stdout'}
  let g:testlinter2 = {'name': 'testlinter2', 'executable': 'testlinter2', 'command': 'testlinter2', 'callback': 'testCB2', 'output_stream': 'stdout'}

  call ale#engine#ResetExecutableCache()
  call ale#linter#Reset()
  call ale#linter#PreventLoading('testft')
  let g:ale_linters = {}
  let g:ale_fixers = {}
  let g:ale_linter_aliases = {}
  let g:ale_buffer_info = {}
  let g:fixer_lines = [
  \ ' Suggested Fixers:',
  \ '  ''foo'' - Fix things the foo way',
  \ ' ',
  \]
  let g:globals_lines = [
  \ ' Global Variables:',
  \ 'let g:ale_cache_executable_check_failures = 0',
  \ 'let g:ale_change_sign_column_color = 0',
  \ 'let g:ale_command_wrapper = ''''',
  \ 'let g:ale_completion_delay = 100',
  \ 'let g:ale_completion_enabled = 0',
  \ 'let g:ale_completion_max_suggestions = 50',
  \ 'let g:ale_disable_lsp = 0',
  \ 'let g:ale_echo_cursor = 1',
  \ 'let g:ale_echo_msg_error_str = ''Error''',
  \ 'let g:ale_echo_msg_format = ''%code: %%s''',
  \ 'let g:ale_echo_msg_info_str = ''Info''',
  \ 'let g:ale_echo_msg_warning_str = ''Warning''',
  \ 'let g:ale_enabled = 1',
  \ 'let g:ale_fix_on_save = 0',
  \ 'let g:ale_fixers = {}',
  \ 'let g:ale_history_enabled = 1',
  \ 'let g:ale_info_default_mode = ''echo''',
  \ 'let g:ale_history_log_output = 1',
  \ 'let g:ale_keep_list_window_open = 0',
  \ 'let g:ale_lint_delay = 200',
  \ 'let g:ale_lint_on_enter = 1',
  \ 'let g:ale_lint_on_filetype_changed = 1',
  \ 'let g:ale_lint_on_insert_leave = 1',
  \ 'let g:ale_lint_on_save = 1',
  \ 'let g:ale_lint_on_text_changed = ''normal''',
  \ 'let g:ale_linter_aliases = {}',
  \ 'let g:ale_linters = {}',
  \ 'let g:ale_linters_explicit = 0',
  \ 'let g:ale_linters_ignore = {''python'': [''pyright'']}',
  \ 'let g:ale_list_vertical = 0',
  \ 'let g:ale_list_window_size = 10',
  \ 'let g:ale_loclist_msg_format = ''%code: %%s''',
  \ 'let g:ale_max_buffer_history_size = 20',
  \ 'let g:ale_max_signs = -1',
  \ 'let g:ale_maximum_file_size = 0',
  \ 'let g:ale_open_list = 0',
  \ 'let g:ale_pattern_options = {}',
  \ 'let g:ale_pattern_options_enabled = 0',
  \ 'let g:ale_root = {}',
  \ 'let g:ale_set_balloons = 0',
  \ 'let g:ale_set_highlights = 1',
  \ 'let g:ale_set_loclist = 1',
  \ 'let g:ale_set_quickfix = 0',
  \ 'let g:ale_set_signs = 1',
  \ 'let g:ale_sign_column_always = 0',
  \ 'let g:ale_sign_error = ''>>''',
  \ 'let g:ale_sign_info = ''--''',
  \ 'let g:ale_sign_offset = 1000000',
  \ 'let g:ale_sign_style_error = ''>>''',
  \ 'let g:ale_sign_style_warning = ''--''',
  \ 'let g:ale_sign_warning = ''--''',
  \ 'let g:ale_sign_highlight_linenrs = 0',
  \ 'let g:ale_type_map = {}',
  \ 'let g:ale_use_neovim_diagnostics_api = 0',
  \ 'let g:ale_use_global_executables = v:null',
  \ 'let g:ale_virtualtext_cursor = ''disabled''',
  \ 'let g:ale_warn_about_trailing_blank_lines = 1',
  \ 'let g:ale_warn_about_trailing_whitespace = 1',
  \ ' ',
  \]
  let g:command_header = [
  \ '  Command History:',
  \]

  function CheckInfo(expected_list) abort
    let l:output = ''

    redir => l:output
      noautocmd silent ALEInfo
    redir END

    AssertEqual a:expected_list, split(l:output, "\n")
  endfunction

  call ale#test#SetDirectory('/testplugin/test')

  call ale#fix#registry#Clear()
  call ale#fix#registry#Add('foo', 'x', [], 'Fix things the foo way')

After:
  Restore

  if exists('g:info_test_file') && filereadable(g:info_test_file)
    call delete(g:info_test_file)
  endif

  unlet! g:testlinter1
  unlet! g:testlinter2
  unlet! b:ale_history
  unlet! b:ale_linters
  unlet! g:output
  unlet! g:fixer_lines
  unlet! g:variables_lines
  unlet! g:globals_string
  unlet! g:command_header
  unlet! g:ale_testft_testlinter1_foo
  unlet! g:ale_testft_testlinter1_bar
  unlet! g:ale_testft2_testlinter2_foo
  unlet! b:ale_testft2_testlinter2_foo
  unlet! g:ale_testft2_testlinter2_bar
  unlet! g:info_test_file
  unlet! g:ale_testft_build_dir_names
  unlet! g:ale_testft_testlinter2_option
  delfunction CheckInfo

  call ale#test#RestoreDirectory()
  call ale#fix#registry#ResetToDefaults()

Given nolintersft (Empty buffer with no linters):
Execute (ALEInfo with no linters should return the right output):
  call CheckInfo(
  \ [
  \   ' Current Filetype: nolintersft',
  \   'Available Linters: []',
  \   '  Enabled Linters: []',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given (Empty buffer with no filetype):
Execute (ALEInfo should return buffer-local global ALE settings):
  let b:ale_linters = {'x': ['y']}

  call insert(
  \ g:globals_lines,
  \ 'let b:ale_linters = {''x'': [''y'']}',
  \ index(g:globals_lines, 'let g:ale_linters = {}') + 1
  \)

  call CheckInfo(
  \ [
  \   ' Current Filetype: ',
  \   'Available Linters: []',
  \   '  Enabled Linters: []',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given (Empty buffer with no filetype):
Execute (ALEInfo with no filetype should return the right output):
  call CheckInfo(
  \ [
  \   ' Current Filetype: ',
  \   'Available Linters: []',
  \   '  Enabled Linters: []',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft (Empty buffer):
Execute (ALEInfo with a single linter should return the right output):
  call ale#linter#Define('testft', g:testlinter1)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft',
  \   'Available Linters: [''testlinter1'']',
  \   '  Enabled Linters: [''testlinter1'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft (Empty buffer):
Execute (ALEInfo with two linters should return the right output):
  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft (Empty buffer):
Execute (ALEInfo should calculate enabled linters correctly):
  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft', g:testlinter2)
  let g:ale_linters = {'testft': ['testlinter2']}

  let g:globals_lines[index(g:globals_lines, 'let g:ale_linters = {}')]
  \ = 'let g:ale_linters = {''testft'': [''testlinter2'']}'

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft (Empty buffer):
Execute (ALEInfo should only return linters for current filetype):
  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft',
  \   'Available Linters: [''testlinter1'']',
  \   '  Enabled Linters: [''testlinter1'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo with compound filetypes should return linters for both of them):
  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo should return appropriately named global variables):
  let g:ale_testft_testlinter1_foo = 'abc'
  let g:ale_testft_testlinter1_bar = ['abc']
  let g:ale_testft2_testlinter2_foo = 123
  let g:ale_testft2_testlinter2_bar = {'x': 'y'}

  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + [
  \   ' Linter Variables:',
  \   'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}',
  \   'let g:ale_testft2_testlinter2_foo = 123',
  \   'let g:ale_testft_testlinter1_bar = [''abc'']',
  \   'let g:ale_testft_testlinter1_foo = ''abc''',
  \   ' ',
  \ ]
  \ + g:globals_lines
  \ + g:command_header
  \)

Execute (ALEInfoToFile should write to a file correctly):
  let g:ale_testft_testlinter1_foo = 'abc'
  let g:ale_testft_testlinter1_bar = ['abc']
  let g:ale_testft2_testlinter2_foo = 123
  let g:ale_testft2_testlinter2_bar = {'x': 'y'}

  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  let g:info_test_file = tempname()
  execute 'ALEInfoToFile ' . fnameescape(g:info_test_file)

  AssertEqual
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + [
  \   ' Linter Variables:',
  \   'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}',
  \   'let g:ale_testft2_testlinter2_foo = 123',
  \   'let g:ale_testft_testlinter1_bar = [''abc'']',
  \   'let g:ale_testft_testlinter1_foo = ''abc''',
  \   ' ',
  \ ]
  \ + g:globals_lines
  \ + g:command_header,
  \ readfile(g:info_test_file)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo should buffer-local linter variables):
  let g:ale_testft2_testlinter2_foo = 123
  let b:ale_testft2_testlinter2_foo = 456

  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + [
  \   ' Linter Variables:',
  \   'let g:ale_testft2_testlinter2_foo = 123',
  \   'let b:ale_testft2_testlinter2_foo = 456',
  \   ' ',
  \ ]
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo should output linter aliases):
  let g:testlinter1.aliases = ['testftalias1', 'testftalias2']
  let g:testlinter2.aliases = ['testftalias3', 'testftalias4']

  let g:ale_testft2_testlinter2_foo = 123
  let b:ale_testft2_testlinter2_foo = 456

  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '   Linter Aliases:',
  \   '''testlinter1'' -> [''testftalias1'', ''testftalias2'']',
  \   '''testlinter2'' -> [''testftalias3'', ''testftalias4'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + [
  \   ' Linter Variables:',
  \   'let g:ale_testft2_testlinter2_foo = 123',
  \   'let b:ale_testft2_testlinter2_foo = 456',
  \   ' ',
  \ ]
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo should return command history):
  let b:ale_history = [
  \ {'status': 'started', 'job_id': 347, 'command': 'first command'},
  \ {'status': 'started', 'job_id': 347, 'command': ['/bin/bash', '\c', 'last command']},
  \]

  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \ + [
  \   '',
  \   '(started) ''first command''',
  \   '(started) [''/bin/bash'', ''\c'', ''last command'']',
  \ ]
  \)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo command history should print exit codes correctly):
  let b:ale_history = [
  \ {'status': 'finished', 'exit_code': 0, 'job_id': 347, 'command': 'first command'},
  \ {'status': 'finished', 'exit_code': 1, 'job_id': 347, 'command': ['/bin/bash', '\c', 'last command']},
  \]

  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \ + [
  \   '',
  \   '(finished - exit code 0) ''first command''',
  \   '(finished - exit code 1) [''/bin/bash'', ''\c'', ''last command'']',
  \ ]
  \)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo command history should print command output if logging is on):
  let g:ale_history_log_output = 1

  let b:ale_history = [
  \ {
  \   'status': 'finished',
  \   'exit_code': 0,
  \   'job_id': 347,
  \   'command': 'first command',
  \   'output': ['some', 'first command output'],
  \ },
  \ {
  \   'status': 'finished',
  \   'exit_code': 1,
  \   'job_id': 347,
  \   'command': ['/bin/bash', '\c', 'last command'],
  \   'output': ['different second command output'],
  \ },
  \ {
  \   'status': 'finished',
  \   'exit_code': 0,
  \   'job_id': 347,
  \   'command': 'command with no output',
  \   'output': [],
  \ },
  \]

  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \ + [
  \   '',
  \   '(finished - exit code 0) ''first command''',
  \   '',
  \   '<<<OUTPUT STARTS>>>',
  \   'some',
  \   'first command output',
  \   '<<<OUTPUT ENDS>>>',
  \   '',
  \   '(finished - exit code 1) [''/bin/bash'', ''\c'', ''last command'']',
  \   '',
  \   '<<<OUTPUT STARTS>>>',
  \   'different second command output',
  \   '<<<OUTPUT ENDS>>>',
  \   '',
  \   '(finished - exit code 0) ''command with no output''',
  \   '',
  \   '<<<NO OUTPUT RETURNED>>>',
  \ ]
  \)

Execute (ALEInfo should include executable checks in the history):
  call ale#linter#Define('testft', g:testlinter1)
  call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo')
  call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo')
  call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable')
  call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable')

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'']',
  \   '  Enabled Linters: [''testlinter1'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \ + [
  \   '',
  \   '(executable check - success) ' . (has('win32') ? 'cmd' : 'echo'),
  \   '(executable check - failure) TheresNoWayThisIsExecutable',
  \   '(executable check - failure) TheresNoWayThisIsExecutable',
  \ ]
  \)

Execute (The option for caching failing executable checks should work):
  let g:ale_cache_executable_check_failures = 1
  " Replace output for the variable we have to modify above.
  call map(g:globals_lines, {
  \  _, val -> val =~ 'ale_cache_executable_check_failures' ? 'let g:ale_cache_executable_check_failures = 1' : val
  \})

  call ale#linter#Define('testft', g:testlinter1)

  call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo')
  call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo')
  call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable')
  call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable')

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'']',
  \   '  Enabled Linters: [''testlinter1'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \ + [
  \   '',
  \   '(executable check - success) ' . (has('win32') ? 'cmd' : 'echo'),
  \   '(executable check - failure) TheresNoWayThisIsExecutable',
  \ ]
  \)

Given testft (Empty buffer):
Execute (LSP errors for a linter should be outputted):
  let g:ale_lsp_error_messages = {'testlinter1': ['foo', 'bar']}
  call ale#linter#Define('testft', g:testlinter1)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft',
  \   'Available Linters: [''testlinter1'']',
  \   '  Enabled Linters: [''testlinter1'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + [
  \   ' LSP Error Messages:',
  \   '',
  \   '(Errors for testlinter1)',
  \   'foo',
  \   'bar',
  \ ]
  \ + g:command_header
  \)

Given testft (Empty buffer):
Execute (LSP errors for other linters shouldn't appear):
  let g:ale_lsp_error_messages = {'testlinter2': ['foo']}
  call ale#linter#Define('testft', g:testlinter1)

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft',
  \   'Available Linters: [''testlinter1'']',
  \   '  Enabled Linters: [''testlinter1'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo should include linter global options):
  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft2', g:testlinter2)

  " eg: like g:c_build_dir_names
  let g:ale_testft_build_dir_names = ['build', 'bin']

  let g:variables_lines = [
  \ ' Linter Variables:',
  \ 'let g:ale_testft_build_dir_names = [''build'', ''bin'']',
  \ ' ',
  \]

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft.testft2',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:variables_lines
  \ + g:globals_lines
  \ + g:command_header
  \)

Given testft (Empty buffer with two filetypes):
Execute (ALEInfo should include linter global options for enabled linters):
  call ale#linter#Define('testft', g:testlinter1)
  call ale#linter#Define('testft', g:testlinter2)

  let g:ale_linters = {'testft': ['testlinter1']}

  " should not appear, since not enabled
  let g:ale_testft_testlinter2_option = 'test'

  let g:globals_lines[index(g:globals_lines, 'let g:ale_linters = {}')]
  \ = 'let g:ale_linters = {''testft'': [''testlinter1'']}'

  call CheckInfo(
  \ [
  \   ' Current Filetype: testft',
  \   'Available Linters: [''testlinter1'', ''testlinter2'']',
  \   '  Enabled Linters: [''testlinter1'']',
  \   '  Ignored Linters: []',
  \ ]
  \ + g:fixer_lines
  \ + g:globals_lines
  \ + g:command_header
  \)