]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/handler/test_terraform_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 '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / test / handler / test_terraform_handler.vader
1 Before:
2   " Load the file which defines the linter.
3   runtime ale_linters/terraform/terraform.vim
4   call ale#test#SetDirectory('/testplugin/test/test-files/terraform')
5   call ale#test#SetFilename('providers.tf')
6
7 After:
8   " Unload all linters again.
9   call ale#linter#Reset()
10   call ale#test#RestoreDirectory()
11
12 Execute(The output should be correct):
13   AssertEqual
14   \ [
15   \   {
16   \     'lnum': 17,
17   \     'col': 13,
18   \     'filename': ale#path#Simplify(g:dir . '/providers.tf'),
19   \     'type': 'W',
20   \     'text': 'Terraform 0.13 and earlier allowed provider version',
21   \   },
22   \   {
23   \     'lnum': 0,
24   \     'col': 0,
25   \     'filename': ale#path#Simplify(g:dir . '/providers.tf'),
26   \     'type': 'E',
27   \     'text': 'Plugin reinitialization required. Please run "terraform"',
28   \   }
29   \ ],
30   \ ale_linters#terraform#terraform#Handle(bufnr(''), [
31   \ '{',
32   \ '"valid": false,',
33   \ '"error_count": 1,',
34   \ '"warning_count": 1,',
35   \ '"diagnostics": [',
36   \ '  {',
37   \ '    "severity": "warning",',
38   \ '    "summary": "Version constraints inside provider configuration blocks are deprecated",',
39   \ '    "detail": "Terraform 0.13 and earlier allowed provider version",',
40   \ '    "range": {',
41   \ '      "filename": "providers.tf",',
42   \ '      "start": {',
43   \ '        "line": 17,',
44   \ '        "column": 13,',
45   \ '        "byte": 669',
46   \ '      },',
47   \ '      "end": {',
48   \ '        "line": 17,',
49   \ '        "column": 24,',
50   \ '        "byte": 680',
51   \ '      }',
52   \ '    }',
53   \ '  },',
54   \ '  {',
55   \ '    "severity": "error",',
56   \ '    "summary": "Could not load plugin",',
57   \ '    "detail": "Plugin reinitialization required. Please run \"terraform\""',
58   \ '  }',
59   \ '  ]',
60   \ '}',
61   \ ])
62
63 Execute(Should use summary if detail not available):
64   AssertEqual
65   \ [
66   \   {
67   \     'lnum': 91,
68   \     'col': 41,
69   \     'filename': ale#path#Simplify(g:dir . '/main.tf'),
70   \     'type': 'E',
71   \     'text': 'storage_os_disk: required field is not set',
72   \   }
73   \ ],
74   \ ale_linters#terraform#terraform#Handle(bufnr(''), [
75   \ '{',
76   \ '  "valid": false,',
77   \ '  "error_count": 1,',
78   \ '  "warning_count": 0,',
79   \ '  "diagnostics": [',
80   \ '    {',
81   \ '      "severity": "error",',
82   \ '      "summary": "storage_os_disk: required field is not set",',
83   \ '      "range": {',
84   \ '        "filename": "main.tf",',
85   \ '        "start": {',
86   \ '          "line": 91,',
87   \ '          "column": 41,',
88   \ '          "byte": 2381',
89   \ '        },',
90   \ '        "end": {',
91   \ '          "line": 91,',
92   \ '          "column": 41,',
93   \ '          "byte": 2381',
94   \ '        }',
95   \ '      }',
96   \ '    }',
97   \ '  ]',
98   \ '}'
99   \ ])
100
101 Execute(Should use summary if detail available but empty):
102   AssertEqual
103   \ [
104   \   {
105   \     'lnum': 91,
106   \     'col': 41,
107   \     'filename': ale#path#Simplify(g:dir . '/main.tf'),
108   \     'type': 'E',
109   \     'text': 'storage_os_disk: required field is not set',
110   \   }
111   \ ],
112   \ ale_linters#terraform#terraform#Handle(bufnr(''), [
113   \ '{',
114   \ '  "valid": false,',
115   \ '  "error_count": 1,',
116   \ '  "warning_count": 0,',
117   \ '  "diagnostics": [',
118   \ '    {',
119   \ '      "severity": "error",',
120   \ '      "summary": "storage_os_disk: required field is not set",',
121   \ '      "detail": "",',
122   \ '      "range": {',
123   \ '        "filename": "main.tf",',
124   \ '        "start": {',
125   \ '          "line": 91,',
126   \ '          "column": 41,',
127   \ '          "byte": 2381',
128   \ '        },',
129   \ '        "end": {',
130   \ '          "line": 91,',
131   \ '          "column": 41,',
132   \ '          "byte": 2381',
133   \ '        }',
134   \ '      }',
135   \ '    }',
136   \ '  ]',
137   \ '}'
138   \ ])