test_nix_handler.vader
1 Before: 2 runtime ale_linters/nix/nix.vim 3 4 After: 5 call ale#linter#Reset() 6 7 Execute(The nix handler should parse nix-instantiate error messages correctly): 8 AssertEqual 9 \ [ 10 \ { 11 \ 'lnum': 6, 12 \ 'col': 3, 13 \ 'type': 'E', 14 \ 'text': "syntax error, unexpected ']', expecting ';'", 15 \ }, 16 \ { 17 \ 'lnum': 3, 18 \ 'col': 5, 19 \ 'type': 'E', 20 \ 'text': "undefined variable 'foo'", 21 \ }, 22 \ 23 \ ], 24 \ ale_linters#nix#nix#Handle(bufnr(''), [ 25 \ "@nix {\"line\":6,\"column\":3,\"raw_msg\":\"syntax error, unexpected ']', expecting ';'\"}", 26 \ "@nix {\"line\":3,\"column\":5,\"raw_msg\":\"undefined variable 'foo'\"}", 27 \ "@nix {\"unrelated\":\"message\"}" 28 \ ]) 29 30 Execute(The nix handler should parse message from old nix-instantiate correctly): 31 AssertEqual 32 \ [ 33 \ { 34 \ 'lnum': 23, 35 \ 'col': 14, 36 \ 'text': 'error: syntax error, unexpected IN', 37 \ 'type': 'E', 38 \ }, 39 \ { 40 \ 'lnum': 3, 41 \ 'col': 12, 42 \ 'text': 'error: syntax error, unexpected ''='', expecting '';''', 43 \ 'type': 'E', 44 \ }, 45 \ 46 \ ], 47 \ ale_linters#nix#nix#Handle(47, [ 48 \ 'This line should be ignored', 49 \ 'error: syntax error, unexpected IN, at /path/to/filename.nix:23:14', 50 \ 'error: syntax error, unexpected ''='', expecting '';'', at /path/to/filename.nix:3:12', 51 \ ]) 52 53 Execute(The nix command should not add 'log-format' option for nix version 2.3): 54 AssertEqual 55 \ 'nix-instantiate --parse -', 56 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.3.0'], '') 57 58 Execute(The nix command should add 'log-format' option for nix version 2.4): 59 AssertEqual 60 \ 'nix-instantiate --log-format internal-json --parse -', 61 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.4.1'], '') 62 63 Execute(The nix command should add 'log-format' option for nix version 2.5): 64 AssertEqual 65 \ 'nix-instantiate --log-format internal-json --parse -', 66 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.5.0pre20211206_d1aaa7e'], '') 67 68 Execute(The nix command should add 'log-format' option for nix version 2.6): 69 AssertEqual 70 \ 'nix-instantiate --log-format internal-json --parse -', 71 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.6.0pre20211206_ignored'], '') 72 73 Execute(The nix command should add 'log-format' option for nix version 2.7): 74 AssertEqual 75 \ 'nix-instantiate --log-format internal-json --parse -', 76 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.7.0pre20211206_ignored'], '') 77 78 Execute(The nix command should add 'log-format' option for nix version 2.8): 79 AssertEqual 80 \ 'nix-instantiate --log-format internal-json --parse -', 81 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.8.0pre20211206_ignored'], '') 82 83 Execute(The nix command should add 'log-format' option for nix version 2.9): 84 AssertEqual 85 \ 'nix-instantiate --log-format internal-json --parse -', 86 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.9.0pre20211206_ignored'], '') 87 88 Execute(The nix command should add 'log-format' option for nix version 2.10): 89 AssertEqual 90 \ 'nix-instantiate --log-format internal-json --parse -', 91 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.10.0pre20221221_ignored'], '') 92 93 Execute(The nix command should add 'log-format' option for nix version 2.20): 94 AssertEqual 95 \ 'nix-instantiate --log-format internal-json --parse -', 96 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.20.0pre20221221_ignored'], '') 97 98 Execute(The nix command should add 'log-format' option for nix version 3.0): 99 AssertEqual 100 \ 'nix-instantiate --log-format internal-json --parse -', 101 \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 3.0.0pre20211206_ignored'], '')