]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/handler/test_steep_handler.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / handler / test_steep_handler.vader
diff --git a/.vim/bundle/ale/test/handler/test_steep_handler.vader b/.vim/bundle/ale/test/handler/test_steep_handler.vader
new file mode 100644 (file)
index 0000000..9887522
--- /dev/null
@@ -0,0 +1,100 @@
+Before:
+  runtime ale_linters/ruby/steep.vim
+
+After:
+  call ale#linter#Reset()
+
+Execute(The steep handler should parse lines correctly):
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 400,
+  \     'col': 18,
+  \     'end_col': 45,
+  \     'text': 'Method parameters are incompatible with declaration `(untyped, untyped, *untyped, **untyped) { () -> untyped } -> untyped`',
+  \     'code': 'Ruby::MethodArityMismatch',
+  \     'type': 'E',
+  \   },
+  \   {
+  \     'lnum': 20,
+  \     'col': 9,
+  \     'end_col': 17,
+  \     'text': 'Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
+  \     'code': 'Ruby::MethodDefinitionMissing',
+  \     'type': 'W',
+  \   },
+  \   {
+  \     'lnum': 30,
+  \     'col': 9,
+  \     'end_col': 17,
+  \     'text': 'Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
+  \     'code': 'Ruby::MethodDefinitionMissing',
+  \     'type': 'I',
+  \   },
+  \   {
+  \     'lnum': 40,
+  \     'col': 9,
+  \     'end_col': 17,
+  \     'text': 'Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
+  \     'code': 'Ruby::MethodDefinitionMissing',
+  \     'type': 'I',
+  \   },
+  \ ],
+  \ ale_linters#ruby#steep#HandleOutput(347, [
+  \     '# Type checking files:',
+  \     '',
+  \     '...............................................................................................................................F..........F.F...F.',
+  \     '',
+  \     'lib/frobz/foobar_baz.rb:400:17: [error] Method parameters are incompatible with declaration `(untyped, untyped, *untyped, **untyped) { () -> untyped } -> untyped`',
+  \     '│ Diagnostic ID: Ruby::MethodArityMismatch',
+  \     '│',
+  \     '└         def frobz(obj, suffix, *args, &block)',
+  \     '                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~',
+  \     '',
+  \     'lib/frobz/foobar_baz.rb:20:8: [warning] Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
+  \     '│ Diagnostic ID: Ruby::MethodDefinitionMissing',
+  \     '│',
+  \     '└   class FooBarBaz',
+  \     '          ~~~~~~~~~',
+  \     '',
+  \     'lib/frobz/foobar_baz.rb:30:8: [information] Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
+  \     '│ Diagnostic ID: Ruby::MethodDefinitionMissing',
+  \     '│',
+  \     '└   class FooBarBaz',
+  \     '          ~~~~~~~~~',
+  \     '',
+  \     'lib/frobz/foobar_baz.rb:40:8: [hint] Cannot find implementation of method `::Frobz::FooBarBaz#method_name`',
+  \     '│ Diagnostic ID: Ruby::MethodDefinitionMissing',
+  \     '│',
+  \     '└   class FooBarBaz',
+  \     '          ~~~~~~~~~',
+  \     '',
+  \     'Detected 4 problems from 1 file',
+  \ ])
+
+Execute(The steep handler should handle when files are checked and no offenses are found):
+  AssertEqual
+  \ [],
+  \ ale_linters#ruby#steep#HandleOutput(347, [
+  \     '# Type checking files:',
+  \     '',
+  \     '.............................................................................................................................................',
+  \     '',
+  \     'No type error detected. 🧉',
+  \ ])
+
+Execute(The steep handler should handle when no files are checked):
+  AssertEqual
+  \ [],
+  \ ale_linters#ruby#steep#HandleOutput(347, [
+  \     '# Type checking files:',
+  \     '',
+  \     '',
+  \     '',
+  \     'No type error detected. 🧉',
+  \ ])
+
+Execute(The steep handler should handle empty output):
+  AssertEqual [], ale_linters#ruby#steep#HandleOutput(347, [''])
+  AssertEqual [], ale_linters#ruby#steep#HandleOutput(347, [])
+