fixed build console
[groovy.git] / src / test / gls / scope / NameResolvingTest.groovy
blob885cfc51b67c905bac36d24f52a07c441cd375ce
1 package gls.scope
3 import gls.CompilableTestSupport
5 class NameResolvingTest extends CompilableTestSupport {
6 public void testVariableNameEqualsToAClassName() {
7 Object String = ""
8 assert String == ""
9 assert String.class == java.lang.String
12 public void testVariableNameEqualsCurrentClassName() {
13 Object NameResolvingTest = ""
14 assert NameResolvingTest == ""
15 assert NameResolvingTest.class == java.lang.String.class
18 public void testClassNoVariableInStaticMethod(){
19 assertScript """
20 static def foo() {
21 Class.forName('java.lang.Integer')
23 assert foo() == Integer
24 """
27 public void testInAsDefAllowedInPackageNames() {
28 shouldCompile """
29 package as.in.def
30 class X {}
31 """
34 public void testAssignmentToNonLocalVariableWithSameNameAsClass() {
35 shouldNotCompile """
36 String = 1
37 """
40 public void testClassUsageInSuper(){
41 shouldCompile """
42 class A {A(x){}}
43 class B extends A {
44 B(x){super(Thread)}
46 """