ale/test/handler/test_solhint_handler.vader

84 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

2017-12-04 17:23:46 +00:00
Before:
runtime ale_linters/solidity/solhint.vim
After:
call ale#linter#Reset()
Execute(The solhint handler should parse linter error messages correctly):
2017-12-04 17:23:46 +00:00
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'col': 17,
2017-12-05 19:02:15 +00:00
\ 'text': 'Compiler version must be fixed',
\ 'code': 'compiler-fixed',
2017-12-04 17:23:46 +00:00
\ 'type': 'W',
\ },
\ {
\ 'lnum': 4,
\ 'col': 8,
2017-12-05 19:02:15 +00:00
\ 'text': 'Use double quotes for string literals',
\ 'code': 'quotes',
2017-12-04 17:23:46 +00:00
\ 'type': 'E',
\ },
\ {
\ 'lnum': 5,
\ 'col': 8,
2017-12-05 19:02:15 +00:00
\ 'text': 'Use double quotes for string literals',
\ 'code': 'quotes',
2017-12-04 17:23:46 +00:00
\ 'type': 'E',
\ },
\ {
\ 'lnum': 13,
\ 'col': 3,
2017-12-05 19:02:15 +00:00
\ 'text': 'Expected indentation of 4 spaces but found 2',
\ 'code': 'indent',
2017-12-04 17:23:46 +00:00
\ 'type': 'E',
\ },
\ {
\ 'lnum': 14,
\ 'col': 3,
2017-12-05 19:02:15 +00:00
\ 'text': 'Expected indentation of 4 spaces but found 2',
\ 'code': 'indent',
2017-12-04 17:23:46 +00:00
\ 'type': 'E',
\ },
\ {
\ 'lnum': 47,
\ 'col': 3,
2017-12-05 19:02:15 +00:00
\ 'text': 'Function order is incorrect, public function can not go after internal function.',
\ 'code': 'func-order',
2017-12-04 17:23:46 +00:00
\ 'type': 'E',
\ },
\ ],
\ ale_linters#solidity#solhint#Handle(bufnr(''), [
\ 'contracts/Bounty.sol:1:17: Compiler version must be fixed [Warning/compiler-fixed]',
\ 'contracts/Bounty.sol:4:8: Use double quotes for string literals [Error/quotes]',
\ 'contracts/Bounty.sol:5:8: Use double quotes for string literals [Error/quotes]',
\ 'contracts/Bounty.sol:13:3: Expected indentation of 4 spaces but found 2 [Error/indent]',
\ 'contracts/Bounty.sol:14:3: Expected indentation of 4 spaces but found 2 [Error/indent]',
\ 'contracts/Bounty.sol:47:3: Function order is incorrect, public function can not go after internal function. [Error/func-order]',
2017-12-04 17:23:46 +00:00
\ ])
Execute(The solhint handler should parse syntax error messages correctly):
AssertEqual
\ [
\ {
\ 'lnum': 30,
\ 'col': 4,
\ 'text': "missing ';' at 'uint248'",
\ 'code': 'Parse error',
\ 'type': 'E',
\ },
\ {
\ 'lnum': 203,
\ 'col': 4,
\ 'text': "no viable alternative at input '_loserStakeMultiplier}'",
\ 'code': 'Parse error',
\ 'type': 'E',
\ },
\ ],
\ ale_linters#solidity#solhint#Handle(bufnr(''), [
\ "contracts/Bounty.sol:30:4: Parse error: missing ';' at 'uint248' [Error]",
\ "contracts/Bounty.sol:203:4: Parse error: no viable alternative at input '_loserStakeMultiplier}' [Error]",
\ ])