-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3ed475
commit 321f3fd
Showing
6 changed files
with
178 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
...roovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/CanonicalTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright 2009-2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.eclipse.jdt.groovy.core.tests.xform; | ||
|
||
import java.util.Map; | ||
|
||
import org.eclipse.jdt.groovy.core.tests.basic.GroovyCompilerTestSuite; | ||
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test cases for {@link groovy.transform.Canonical}, at al. | ||
*/ | ||
public final class CanonicalTests extends GroovyCompilerTestSuite { | ||
|
||
@Test @Ignore("https://github.com/groovy/groovy-eclipse/issues/421") | ||
public void testCanonical1() { | ||
String[] sources = { | ||
"Main.java", | ||
"public class Main {\n" + | ||
" public static void main(String... args) {\n" + | ||
" System.out.print(new Foo(\"one\", \"two\"));\n" + | ||
" }\n" + | ||
"}\n", | ||
|
||
"Foo.groovy", | ||
"@groovy.transform.Canonical\n" + | ||
"class Foo {\n" + | ||
" String bar, baz\n" + | ||
"}\n", | ||
}; | ||
|
||
runConformTest(sources, "Foo(one, two)"); | ||
} | ||
|
||
@Test | ||
public void testCanonical2() { | ||
String[] sources = { | ||
"Main.groovy", | ||
"class Main {\n" + | ||
" static void main(args) {\n" + | ||
" print(new Foo('one', 'two'))\n" + | ||
" }\n" + | ||
"}\n", | ||
|
||
"Foo.groovy", | ||
"@groovy.transform.Canonical\n" + | ||
"class Foo {\n" + | ||
" String bar, baz\n" + | ||
"}\n", | ||
}; | ||
|
||
runConformTest(sources, "Foo(one, two)"); | ||
} | ||
|
||
@Test | ||
public void testCanonical3() { | ||
String[] sources = { | ||
"Main.groovy", | ||
"class Main {\n" + | ||
" static void main(args) {\n" + | ||
" print(new Foo('one', 'two'))\n" + | ||
" }\n" + | ||
"}\n", | ||
|
||
"Foo.groovy", | ||
"import groovy.transform.Canonical\n" + | ||
"@Canonical\n" + | ||
"class Foo {\n" + | ||
" String bar, baz\n" + | ||
"}\n", | ||
}; | ||
|
||
runConformTest(sources, "Foo(one, two)"); | ||
} | ||
|
||
@Test | ||
public void testCanonical4() { | ||
Map<String, String> options = getCompilerOptions(); | ||
options.put(CompilerOptions.OPTIONG_GroovyCompilerConfigScript, createScript("config.groovy", | ||
"withConfig(configuration) {\n" + | ||
" imports {\n" + | ||
" normal 'groovy.transform.Canonical'\n" + | ||
" }\n" + | ||
"}\n" | ||
).getAbsolutePath()); | ||
|
||
String[] sources = { | ||
"Main.groovy", | ||
"class Main {\n" + | ||
" static void main(args) {\n" + | ||
" print(new Foo('one', 'two'))\n" + | ||
" }\n" + | ||
"}\n", | ||
|
||
"Foo.groovy", | ||
"@Canonical\n" + | ||
"class Foo {\n" + | ||
" String bar, baz\n" + | ||
"}\n", | ||
}; | ||
|
||
runConformTest(sources, "Foo(one, two)", options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters