aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/algorithm_spec.lua
blob: d935210406727dfd4947e11d5c7a600f01f74dd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local Runner = require('tests.indent.common').Runner
-- local XFAIL = require("tests.indent.common").XFAIL

local runner = Runner:new(it, 'tests/indent/algorithm', {
  tabstop = 4,
  shiftwidth = 4,
  softtabstop = 4,
  expandtab = true,
})

describe('test indent algorithm: ', function()
  describe('new line:', function()
    runner:new_line(
      'trailing.py',
      { on_line = 1, text = 'x: str', indent = 4 },
      'indent next line, ignore comment'
    )
    runner:new_line(
      'trailing.py',
      { on_line = 4, text = 'pass', indent = 8 },
      'indent next line, ignore comment'
    )
    runner:new_line(
      'trailing.py',
      { on_line = 6, text = 'pass', indent = 4 },
      'indent next line, ignore whitespace'
    )
    runner:new_line(
      'trailing_whitespace.html',
      { on_line = 9, text = 'x', indent = 8 },
      'not ignore @indent.end'
    )
  end)
end)