From ba2a33049c47fd400828cb09e8d182d21627cd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20=C5=BDia=C4=8Dik?= Date: Thu, 5 May 2016 21:29:56 +0200 Subject: [PATCH] Formatting space vs tabs tests added --- .../formattingReplaceSpacesWithTabs.ts | 35 +++++++++++++++++++ .../formattingReplaceTabsWithSpaces.ts | 27 ++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts create mode 100644 tests/cases/fourslash/formattingReplaceTabsWithSpaces.ts diff --git a/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts b/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts new file mode 100644 index 00000000000..37039c5a7ad --- /dev/null +++ b/tests/cases/fourslash/formattingReplaceSpacesWithTabs.ts @@ -0,0 +1,35 @@ +/// + +////module Foo { +/////*1*/class Test { } +/////*2*/ class Test { } +/////*3*/ class Test { } +/////*4*/ class Test { } +/////*5*/ class Test { } +/////*6*/ class Test { } +/////*7*/ class Test { } +////} + +var options = format.copyFormatOptions(); +options.ConvertTabsToSpaces = false; +var oldOptions = format.setFormatOptions(options); +try { + format.document(); + goTo.marker("1"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("2"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("3"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("4"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("5"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("6"); + verify.currentLineContentIs("\tclass Test { }") + goTo.marker("7"); + verify.currentLineContentIs("\tclass Test { }") +} +finally { + format.setFormatOptions(oldOptions); +} diff --git a/tests/cases/fourslash/formattingReplaceTabsWithSpaces.ts b/tests/cases/fourslash/formattingReplaceTabsWithSpaces.ts new file mode 100644 index 00000000000..ad5b5508c4f --- /dev/null +++ b/tests/cases/fourslash/formattingReplaceTabsWithSpaces.ts @@ -0,0 +1,27 @@ +/// + +////module Foo { +/////*1*/ class Test { } +/////*2*/ class Test { } +/////*3*/class Test { } +/////*4*/ class Test { } +/////*5*/ class Test { } +/////*6*/ class Test { } +/////*7*/ class Test { } +////} + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("2"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("3"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("4"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("5"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("6"); +verify.currentLineContentIs(" class Test { }") +goTo.marker("7"); +verify.currentLineContentIs(" class Test { }")