Support toInt, toChar and etc as CompileTimeConstants

This commit is contained in:
Natalia Ukhorskaya
2013-11-06 12:27:56 +04:00
parent f218bd1df2
commit 0b1dd2d2be
14 changed files with 297 additions and 76 deletions
@@ -0,0 +1,32 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* 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.jetbrains.jet.resolve.annotation
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.jet.InTextDirectivesUtils
import java.io.File
public abstract class AbstractAnnotationParameterTest : AbstractAnnotationDescriptorResolveTest() {
fun doTest(path: String) {
val fileText = FileUtil.loadFile(File(path))
val namespaceDescriptor = getNamespaceDescriptor(fileText)
val classDescriptor = AbstractAnnotationDescriptorResolveTest.getClassDescriptor(namespaceDescriptor, "MyClass")
val expected = InTextDirectivesUtils.findListWithPrefixes(fileText, "// EXPECTED: ").makeString(", ")
AbstractAnnotationDescriptorResolveTest.checkDescriptor(expected, classDescriptor)
}
}
@@ -0,0 +1,74 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* 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.jetbrains.jet.resolve.annotation;
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
import java.io.File;
import java.util.regex.Pattern;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.test.InnerTestClasses;
import org.jetbrains.jet.test.TestMetadata;
import org.jetbrains.jet.resolve.annotation.AbstractAnnotationParameterTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/resolveAnnotations/parameters")
public class AnnotationParameterTestGenerated extends AbstractAnnotationParameterTest {
public void testAllFilesPresentInParameters() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/resolveAnnotations/parameters"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("byte.kt")
public void testByte() throws Exception {
doTest("compiler/testData/resolveAnnotations/parameters/byte.kt");
}
@TestMetadata("char.kt")
public void testChar() throws Exception {
doTest("compiler/testData/resolveAnnotations/parameters/char.kt");
}
@TestMetadata("double.kt")
public void testDouble() throws Exception {
doTest("compiler/testData/resolveAnnotations/parameters/double.kt");
}
@TestMetadata("float.kt")
public void testFloat() throws Exception {
doTest("compiler/testData/resolveAnnotations/parameters/float.kt");
}
@TestMetadata("int.kt")
public void testInt() throws Exception {
doTest("compiler/testData/resolveAnnotations/parameters/int.kt");
}
@TestMetadata("long.kt")
public void testLong() throws Exception {
doTest("compiler/testData/resolveAnnotations/parameters/long.kt");
}
@TestMetadata("short.kt")
public void testShort() throws Exception {
doTest("compiler/testData/resolveAnnotations/parameters/short.kt");
}
}