diff --git a/tests/fixtures/commands/rename/nested-scope-conflict-1.input.ts b/tests/fixtures/commands/rename/nested-scope-conflict-1.input.ts new file mode 100644 index 0000000..68f0214 --- /dev/null +++ b/tests/fixtures/commands/rename/nested-scope-conflict-1.input.ts @@ -0,0 +1,16 @@ +/** + * @description Renaming x to y should cause a name conflict with inner y + * @command refakts rename "[nested-scope-conflict-1.input.ts 7:9-7:10]" --to "y" + */ + +function f() { + const x = 1; + { + const y = 2; + { + return x; + } + } +} + +expect(f()).toBe(1); diff --git a/tests/fixtures/commands/rename/nested-scope-conflict-2.input.ts b/tests/fixtures/commands/rename/nested-scope-conflict-2.input.ts new file mode 100644 index 0000000..c9a7010 --- /dev/null +++ b/tests/fixtures/commands/rename/nested-scope-conflict-2.input.ts @@ -0,0 +1,16 @@ +/** + * @description Renaming y to x should cause a name conflict with outer x + * @command refakts rename "[nested-scope-conflict-2.input.ts 9:9-9:10]" --to "x" + */ + +function f() { + const x = 1; + { + const y = 2; + { + return x; + } + } +} + +expect(f()).toBe(1);