Tests: indentation: Test the indent stack

The "indentation stack" is iteratively built by the `check()` function
of the indentation rule. It is important, since everything in the rule
relies on it.

This patch adds tests to make sure the stack is correctly built for some
known structures.
This commit is contained in:
Adrien Vergé
2016-02-04 21:40:32 +01:00
parent 8d38d349ac
commit 62fa4cbe39
2 changed files with 204 additions and 0 deletions

View File

@@ -155,6 +155,7 @@ CONF = {'spaces': int,
'check-multi-line-strings': bool}
ROOT, B_MAP, F_MAP, B_SEQ, F_SEQ, B_ENT, KEY, VAL = range(8)
labels = ('ROOT', 'B_MAP', 'F_MAP', 'B_SEQ', 'F_SEQ', 'B_ENT', 'KEY', 'VAL')
class Parent(object):
@@ -165,6 +166,9 @@ class Parent(object):
self.explicit_key = False
self.implicit_block_seq = False
def __repr__(self):
return '%s:%d' % (labels[self.type], self.indent)
def check_scalar_indentation(conf, token, context):
if token.start_mark.line == token.end_mark.line: