/ test / handler / test_steep_handler.vader
test_steep_handler.vader
  1  Before:
  2    runtime ale_linters/ruby/steep.vim
  3  
  4  After:
  5    call ale#linter#Reset()
  6  
  7  Execute(The steep handler should parse lines correctly):
  8    AssertEqual
  9    \ [
 10    \   {
 11    \     'lnum': 400,
 12    \     'col': 18,
 13    \     'end_col': 45,
 14    \     'text': 'Method parameters are incompatible with declaration `(untyped, untyped, *untyped, **untyped) { () -> untyped } -> untyped`',
 15    \     'code': 'Ruby::MethodArityMismatch',
 16    \     'type': 'E',
 17    \   },
 18    \   {
 19    \     'lnum': 20,
 20    \     'col': 9,
 21    \     'end_col': 17,
 22    \     'text': 'Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
 23    \     'code': 'Ruby::MethodDefinitionMissing',
 24    \     'type': 'W',
 25    \   },
 26    \   {
 27    \     'lnum': 30,
 28    \     'col': 9,
 29    \     'end_col': 17,
 30    \     'text': 'Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
 31    \     'code': 'Ruby::MethodDefinitionMissing',
 32    \     'type': 'I',
 33    \   },
 34    \   {
 35    \     'lnum': 40,
 36    \     'col': 9,
 37    \     'end_col': 17,
 38    \     'text': 'Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
 39    \     'code': 'Ruby::MethodDefinitionMissing',
 40    \     'type': 'I',
 41    \   },
 42    \ ],
 43    \ ale_linters#ruby#steep#HandleOutput(347, [
 44    \     '# Type checking files:',
 45    \     '',
 46    \     '...............................................................................................................................F..........F.F...F.',
 47    \     '',
 48    \     'lib/frobz/foobar_baz.rb:400:17: [error] Method parameters are incompatible with declaration `(untyped, untyped, *untyped, **untyped) { () -> untyped } -> untyped`',
 49    \     '│ Diagnostic ID: Ruby::MethodArityMismatch',
 50    \     '│',
 51    \     '└         def frobz(obj, suffix, *args, &block)',
 52    \     '                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~',
 53    \     '',
 54    \     'lib/frobz/foobar_baz.rb:20:8: [warning] Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
 55    \     '│ Diagnostic ID: Ruby::MethodDefinitionMissing',
 56    \     '│',
 57    \     '└   class FooBarBaz',
 58    \     '          ~~~~~~~~~',
 59    \     '',
 60    \     'lib/frobz/foobar_baz.rb:30:8: [information] Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
 61    \     '│ Diagnostic ID: Ruby::MethodDefinitionMissing',
 62    \     '│',
 63    \     '└   class FooBarBaz',
 64    \     '          ~~~~~~~~~',
 65    \     '',
 66    \     'lib/frobz/foobar_baz.rb:40:8: [hint] Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
 67    \     '│ Diagnostic ID: Ruby::MethodDefinitionMissing',
 68    \     '│',
 69    \     '└   class FooBarBaz',
 70    \     '          ~~~~~~~~~',
 71    \     '',
 72    \     'Detected 4 problems from 1 file',
 73    \ ])
 74  
 75  Execute(The steep handler should handle when files are checked and no offenses are found):
 76    AssertEqual
 77    \ [],
 78    \ ale_linters#ruby#steep#HandleOutput(347, [
 79    \     '# Type checking files:',
 80    \     '',
 81    \     '.............................................................................................................................................',
 82    \     '',
 83    \     'No type error detected. 🧉',
 84    \ ])
 85  
 86  Execute(The steep handler should handle when no files are checked):
 87    AssertEqual
 88    \ [],
 89    \ ale_linters#ruby#steep#HandleOutput(347, [
 90    \     '# Type checking files:',
 91    \     '',
 92    \     '',
 93    \     '',
 94    \     'No type error detected. 🧉',
 95    \ ])
 96  
 97  Execute(The steep handler should handle empty output):
 98    AssertEqual [], ale_linters#ruby#steep#HandleOutput(347, [''])
 99    AssertEqual [], ale_linters#ruby#steep#HandleOutput(347, [])
100