Support WITH_UNSIGNED kind in diagnostics tests, add tests
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !SKIP_METADATA_VERSION_CHECK
|
||||
|
||||
const val u0 = 1u
|
||||
const val u1: UByte = 2u
|
||||
const val u2: UShort = 3u
|
||||
const val u3: UInt = 3u
|
||||
const val u4: ULong = 4u
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package
|
||||
|
||||
public const val u0: kotlin.UInt = 1.toUInt()
|
||||
public const val u1: kotlin.UByte = 2.toUByte()
|
||||
public const val u2: kotlin.UShort = 3.toUShort()
|
||||
public const val u3: kotlin.UInt = 3.toUInt()
|
||||
public const val u4: kotlin.ULong = 4.toULong()
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !SKIP_METADATA_VERSION_CHECK
|
||||
|
||||
val a0: Any = 1u
|
||||
|
||||
val n0: Number = <!CONSTANT_EXPECTED_TYPE_MISMATCH!>1u<!>
|
||||
|
||||
val c0: Comparable<*> = 1u
|
||||
val c1: Comparable<UInt> = 1u
|
||||
|
||||
val u0: UInt = 1u
|
||||
val u1: UInt? = 1u
|
||||
val u2: UInt? = u0
|
||||
val u3: UInt? = u1
|
||||
|
||||
val i0: Int = <!CONSTANT_EXPECTED_TYPE_MISMATCH!>1u<!>
|
||||
|
||||
val m0 = <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>-<!>1u
|
||||
val m1: UInt = <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>-<!>1u
|
||||
|
||||
val h1 = 0xFFu
|
||||
val h2: UShort = 0xFFu
|
||||
|
||||
val b1 = 0b11u
|
||||
val b2: UByte = 0b11u
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package
|
||||
|
||||
public val a0: kotlin.Any = 1.toUInt()
|
||||
public val b1: kotlin.UInt = 3.toUInt()
|
||||
public val b2: kotlin.UByte = 3.toUByte()
|
||||
public val c0: kotlin.Comparable<*>
|
||||
public val c1: kotlin.Comparable<kotlin.UInt>
|
||||
public val h1: kotlin.UInt = 255.toUInt()
|
||||
public val h2: kotlin.UShort = 255.toUShort()
|
||||
public val i0: kotlin.Int = 1.toUInt()
|
||||
public val m0: [ERROR : Type for -1u]
|
||||
public val m1: kotlin.UInt
|
||||
public val n0: kotlin.Number = 1.toUInt()
|
||||
public val u0: kotlin.UInt = 1.toUInt()
|
||||
public val u1: kotlin.UInt? = 1.toUInt()
|
||||
public val u2: kotlin.UInt? = 1
|
||||
public val u3: kotlin.UInt? = 1
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.checkers
|
||||
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
|
||||
abstract class AbstractDiagnosticsWithUnsignedTypes : AbstractDiagnosticsTest() {
|
||||
override fun getConfigurationKind(): ConfigurationKind {
|
||||
return ConfigurationKind.WITH_UNSIGNED_TYPES
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.checkers;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithUnsignedTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class DiagnosticsWithUnsignedTypesGenerated extends AbstractDiagnosticsWithUnsignedTypes {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTestsWithUnsignedTypes() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithUnsignedTypes"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("unsignedLiteralsInsideConstVals.kt")
|
||||
public void testUnsignedLiteralsInsideConstVals() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithUnsignedTypes/unsignedLiteralsInsideConstVals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsignedLiteralsTypeCheck.kt")
|
||||
public void testUnsignedLiteralsTypeCheck() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithUnsignedTypes/unsignedLiteralsTypeCheck.kt");
|
||||
}
|
||||
}
|
||||
@@ -106,6 +106,10 @@ fun main(args: Array<String>) {
|
||||
model("diagnostics/testsWithJava9")
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsWithUnsignedTypes> {
|
||||
model("diagnostics/testsWithUnsignedTypes")
|
||||
}
|
||||
|
||||
testClass<AbstractMultiPlatformIntegrationTest> {
|
||||
model("multiplatform", extension = null, recursive = true, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user