From 537b657724446b1056887acbcc70240faaad6f7a Mon Sep 17 00:00:00 2001 From: Maxim Medvedev Date: Mon, 5 Oct 2009 16:33:50 +0400 Subject: [PATCH] Groovy: fix inline in GString, replaceWithExpression --- .../plugins/groovy/refactoring/inline/InlineMethodTest.java | 1 + .../plugins/groovy/refactoring/inline/InlineVariableTest.java | 2 ++ .../testdata/groovy/refactoring/inlineLocal/varInGString.test | 4 ++++ .../groovy/refactoring/inlineLocal/varInGString2.test | 4 ++++ .../groovy/refactoring/inlineMethod/inlineInGString.test | 11 +++++++++++ 5 files changed, 22 insertions(+) create mode 100644 plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString.test create mode 100644 plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString2.test create mode 100644 plugins/groovy/testdata/groovy/refactoring/inlineMethod/inlineInGString.test diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.java index 9552ca9dfa..3c9685e18b 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.java @@ -100,6 +100,7 @@ public class InlineMethodTest extends LightCodeInsightFixtureTestCase { public void testParameterIsUsedAfterCall() throws Throwable { doTest(); } public void testFieldAsParameter() throws Throwable { doTest(); } public void testWritableVariable() throws Throwable { doTest(); } + public void testInlineInGString() throws Throwable {doTest(); } public void testInlineAll() throws Throwable { doTest(new GroovyInlineHandler() { diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineVariableTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineVariableTest.java index 491426c479..f4a9473ebb 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineVariableTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineVariableTest.java @@ -39,6 +39,8 @@ public class InlineVariableTest extends LightCodeInsightFixtureTestCase { public void testVar4() throws Throwable { doTest(); } public void testVar5() throws Throwable { doTest(); } public void testVar6() throws Throwable { doTest(); } + public void testVarInGString() throws Throwable { doTest(); } + public void testVarInGString2() throws Throwable { doTest(); } protected void doTest() throws IncorrectOperationException, InvalidDataException, IOException { InlineMethodTest.doInlineTest(myFixture, getTestDataPath() + getTestName(true) + ".test", true, new GroovyInlineHandler()); diff --git a/plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString.test b/plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString.test new file mode 100644 index 0000000000..2c4c76f1a8 --- /dev/null +++ b/plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString.test @@ -0,0 +1,4 @@ +def s="$x+$y" +print "${s}wow+$s" +----- +print "$x+${y}wow+$x+$y" \ No newline at end of file diff --git a/plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString2.test b/plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString2.test new file mode 100644 index 0000000000..e499157303 --- /dev/null +++ b/plugins/groovy/testdata/groovy/refactoring/inlineLocal/varInGString2.test @@ -0,0 +1,4 @@ +def s='abc"cde'; +print "$s" +----- +print "abc\"cde" diff --git a/plugins/groovy/testdata/groovy/refactoring/inlineMethod/inlineInGString.test b/plugins/groovy/testdata/groovy/refactoring/inlineMethod/inlineInGString.test new file mode 100644 index 0000000000..4c498686ce --- /dev/null +++ b/plugins/groovy/testdata/groovy/refactoring/inlineMethod/inlineInGString.test @@ -0,0 +1,11 @@ +def foo(int x) { + return "foo(x = $x)"; +} + +print "foo(2) = ${foo(2)}"; +----- +def foo(int x) { + return "foo(x = $x)"; +} + +print "foo(2) = foo(x = 2)"; -- 2.11.4.GIT