Skip to content

Commit eec46fc

Browse files
committed
Tweak tests to use a tabSize that makes sense
1 parent 64d55c5 commit eec46fc

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

src/vs/editor/test/common/model/textModelWithTokens.test.ts

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,10 @@ suite('TextModelWithTokens regression tests', () => {
572572
});
573573

574574
suite('TextModel.getLineIndentGuide', () => {
575-
function assertIndentGuides(lines: [number, number, number, number, string][]): void {
575+
function assertIndentGuides(lines: [number, number, number, number, string][], tabSize: number): void {
576576
let text = lines.map(l => l[4]).join('\n');
577577
let model = TextModel.createFromString(text);
578+
model.updateOptions({ tabSize: tabSize });
578579

579580
let actualIndents = model.getLinesIndentGuides(1, model.getLineCount());
580581

@@ -589,59 +590,59 @@ suite('TextModel.getLineIndentGuide', () => {
589590
model.dispose();
590591
}
591592

592-
test('getLineIndentGuide one level', () => {
593+
test('getLineIndentGuide one level 2', () => {
593594
assertIndentGuides([
594595
[0, 1, 1, 0, 'A'],
595596
[1, 2, 4, 1, ' A'],
596597
[1, 2, 4, 1, ' A'],
597598
[1, 2, 4, 1, ' A'],
598-
]);
599+
], 2);
599600
});
600601

601602
test('getLineIndentGuide two levels', () => {
602603
assertIndentGuides([
603604
[0, 1, 1, 0, 'A'],
604605
[1, 2, 5, 1, ' A'],
605606
[1, 2, 5, 1, ' A'],
606-
[1, 2, 5, 1, ' A'],
607-
[1, 2, 5, 1, ' A'],
608-
]);
607+
[2, 4, 5, 2, ' A'],
608+
[2, 4, 5, 2, ' A'],
609+
], 2);
609610
});
610611

611612
test('getLineIndentGuide three levels', () => {
612613
assertIndentGuides([
613614
[0, 1, 1, 0, 'A'],
614615
[1, 2, 4, 1, ' A'],
615-
[1, 2, 4, 1, ' A'],
616-
[2, 4, 4, 2, ' A'],
616+
[2, 3, 4, 2, ' A'],
617+
[3, 4, 4, 3, ' A'],
617618
[0, 5, 5, 0, 'A'],
618-
]);
619+
], 2);
619620
});
620621

621622
test('getLineIndentGuide decreasing indent', () => {
622623
assertIndentGuides([
623-
[1, 1, 2, 1, ' A'],
624+
[2, 1, 1, 2, ' A'],
624625
[1, 1, 2, 1, ' A'],
625626
[0, 3, 3, 0, 'A'],
626-
]);
627+
], 2);
627628
});
628629

629630
test('getLineIndentGuide Java', () => {
630631
assertIndentGuides([
631632
/* 1*/[0, 1, 1, 0, 'class A {'],
632633
/* 2*/[1, 2, 9, 1, ' void foo() {'],
633-
/* 3*/[1, 2, 9, 1, ' console.log(1);'],
634-
/* 4*/[1, 2, 9, 1, ' console.log(2);'],
634+
/* 3*/[2, 3, 4, 2, ' console.log(1);'],
635+
/* 4*/[2, 3, 4, 2, ' console.log(2);'],
635636
/* 5*/[1, 2, 9, 1, ' }'],
636637
/* 6*/[1, 2, 9, 1, ''],
637638
/* 7*/[1, 2, 9, 1, ' void bar() {'],
638-
/* 8*/[1, 2, 9, 1, ' console.log(3);'],
639+
/* 8*/[2, 8, 8, 2, ' console.log(3);'],
639640
/* 9*/[1, 2, 9, 1, ' }'],
640641
/*10*/[0, 10, 10, 0, '}'],
641642
/*11*/[0, 11, 11, 0, 'interface B {'],
642643
/*12*/[1, 12, 12, 1, ' void bar();'],
643644
/*13*/[0, 13, 13, 0, '}'],
644-
]);
645+
], 2);
645646
});
646647

647648
test('getLineIndentGuide Javadoc', () => {
@@ -653,20 +654,20 @@ suite('TextModel.getLineIndentGuide', () => {
653654
[1, 5, 6, 1, ' void foo() {'],
654655
[1, 5, 6, 1, ' }'],
655656
[0, 7, 7, 0, '}'],
656-
]);
657+
], 2);
657658
});
658659

659660
test('getLineIndentGuide Whitespace', () => {
660661
assertIndentGuides([
661662
[0, 1, 1, 0, 'class A {'],
662663
[1, 2, 7, 1, ''],
663664
[1, 2, 7, 1, ' void foo() {'],
664-
[1, 2, 7, 1, ' '],
665-
[2, 5, 5, 2, ' return 1;'],
665+
[2, 4, 5, 2, ' '],
666+
[3, 5, 5, 3, ' return 1;'],
666667
[1, 2, 7, 1, ' }'],
667668
[1, 2, 7, 1, ' '],
668669
[0, 8, 8, 0, '}']
669-
]);
670+
], 2);
670671
});
671672

672673
test('getLineIndentGuide Tabs', () => {
@@ -679,7 +680,7 @@ suite('TextModel.getLineIndentGuide', () => {
679680
[1, 2, 7, 1, ' \t}'],
680681
[1, 2, 7, 1, ' '],
681682
[0, 8, 8, 0, '}']
682-
]);
683+
], 4);
683684
});
684685

685686
test('getLineIndentGuide checker.ts', () => {
@@ -701,7 +702,7 @@ suite('TextModel.getLineIndentGuide', () => {
701702
/*15*/[2, 11, 15, 2, ' return node.id;'],
702703
/*16*/[1, 5, 16, 1, ' }'],
703704
/*17*/[0, 17, 17, 0, '}']
704-
]);
705+
], 4);
705706
});
706707

707708
test('issue #8425 - Missing indentation lines for first level indentation', () => {
@@ -710,7 +711,7 @@ suite('TextModel.getLineIndentGuide', () => {
710711
[2, 2, 3, 2, '\t\tindent2'],
711712
[2, 2, 3, 2, '\t\tindent2'],
712713
[1, 1, 4, 1, '\tindent1']
713-
]);
714+
], 4);
714715
});
715716

716717
test('issue #8952 - Indentation guide lines going through text on .yml file', () => {
@@ -721,7 +722,7 @@ suite('TextModel.getLineIndentGuide', () => {
721722
[2, 3, 5, 2, ' - length:'],
722723
[3, 5, 5, 3, ' max: 255'],
723724
[0, 6, 6, 0, 'getters:']
724-
]);
725+
], 4);
725726
});
726727

727728
test('issue #11892 - Indent guides look funny', () => {
@@ -734,15 +735,15 @@ suite('TextModel.getLineIndentGuide', () => {
734735
[3, 6, 6, 3, '\t\t\treturn 2;'],
735736
[1, 2, 7, 1, '\t}'],
736737
[0, 8, 8, 0, '}']
737-
]);
738+
], 4);
738739
});
739740

740741
test('issue #12398 - Problem in indent guidelines', () => {
741742
assertIndentGuides([
742743
[2, 1, 2, 2, '\t\t.bla'],
743744
[3, 2, 2, 3, '\t\t\tlabel(for)'],
744745
[0, 3, 3, 0, 'include script']
745-
]);
746+
], 4);
746747
});
747748

748749
test('issue #49173', () => {

0 commit comments

Comments
 (0)