diff --git a/tests/tabWith/__snapshots__/jsfmt.spec.js.snap b/tests/tabWith/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..e583af41 --- /dev/null +++ b/tests/tabWith/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,105 @@ +exports[`test class.js 1`] = ` +"class A { + method() { + var x = 1; + while(typeof x == \"number\" || typeof x == \"string\") { + x = x + 1; + if (true) x = \"\"; + } + var z:number = x; + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class A { + method() { + var x = 1; + while (typeof x == \"number\" || typeof x == \"string\") { + x = x + 1; + if (true) + x = \"\"; + } + var z: number = x; + } +} +" +`; + +exports[`test class.js 2`] = ` +"class A { + method() { + var x = 1; + while(typeof x == \"number\" || typeof x == \"string\") { + x = x + 1; + if (true) x = \"\"; + } + var z:number = x; + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class A { + method() { + var x = 1; + while (typeof x == \"number\" || typeof x == \"string\") { + x = x + 1; + if (true) + x = \"\"; + } + var z: number = x; + } +} +" +`; + +exports[`test nested-functions.spec.js 1`] = ` +"const c = () => {}; + +function a() { + return function b() { + return () => { + return function() { + return c; + } + } + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +const c = () => {}; + +function a() { + return function b() { + return () => { + return function() { + return c; + }; + }; + }; +} +" +`; + +exports[`test nested-functions.spec.js 2`] = ` +"const c = () => {}; + +function a() { + return function b() { + return () => { + return function() { + return c; + } + } + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +const c = () => {}; + +function a() { + return function b() { + return () => { + return function() { + return c; + }; + }; + }; +} +" +`; diff --git a/tests/tabWith/class.js b/tests/tabWith/class.js new file mode 100644 index 00000000..3e07e843 --- /dev/null +++ b/tests/tabWith/class.js @@ -0,0 +1,10 @@ +class A { + method() { + var x = 1; + while(typeof x == "number" || typeof x == "string") { + x = x + 1; + if (true) x = ""; + } + var z:number = x; + } +} diff --git a/tests/tabWith/jsfmt.spec.js b/tests/tabWith/jsfmt.spec.js new file mode 100644 index 00000000..862b4296 --- /dev/null +++ b/tests/tabWith/jsfmt.spec.js @@ -0,0 +1,3 @@ +run_spec(__dirname); + +run_spec(__dirname, { tabWidth: 4 }); diff --git a/tests/tabWith/nested-functions.spec.js b/tests/tabWith/nested-functions.spec.js new file mode 100644 index 00000000..8e121b75 --- /dev/null +++ b/tests/tabWith/nested-functions.spec.js @@ -0,0 +1,11 @@ +const c = () => {}; + +function a() { + return function b() { + return () => { + return function() { + return c; + } + } + } +}