diff --git a/test/warning.test.ts b/test/warning.test.ts index be3e6a58d..0498edac3 100644 --- a/test/warning.test.ts +++ b/test/warning.test.ts @@ -85,6 +85,24 @@ test('gets range from node without end', () => { is(warning.endColumn, 2) }) +test('gets range from node with endIndex 3', () => { + let root = parse('a{}') + let warning = new Warning('text', { node: root.first, index: 0, endIndex: 3 }) + is(warning.line, 1) + is(warning.column, 1) + is(warning.endLine, 1) + is(warning.endColumn, 4) +}) + +test('gets range from node with endIndex 0', () => { + let root = parse('a{}') + let warning = new Warning('text', { node: root.first, index: 0, endIndex: 0 }) + is(warning.line, 1) + is(warning.column, 1) + is(warning.endLine, 1) + is(warning.endColumn, 2) +}) + test('gets range from word', () => { let root = parse('a b{}') let warning = new Warning('text', { node: root.first, word: 'b' })