Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87cca67049 | ||
|
|
5e2099f019 | ||
|
|
ae92da7878 |
@@ -1,4 +1,4 @@
|
|||||||
# MC68000 Assembly Language Plugin [](https://travis-ci.com/chrisly42/mc68000-asm-plugin) [](https://coveralls.io/github/chrisly42/mc68000-asm-plugin?branch=main)
|
# MC68000 Assembly Language Plugin [](https://app.travis-ci.com/chrisly42/mc68000-asm-plugin)
|
||||||
|
|
||||||
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
|
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
|
||||||
|
|
||||||
@@ -164,6 +164,13 @@ are appreciated. It really is keeping me motivated to continue development.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### V0.9 (16-Aug-22)
|
||||||
|
|
||||||
|
- Maintenance. Updated all dependencies to the latest versions.
|
||||||
|
- Bugfix: Fixed condition code for `asr/lsr/lsl`, which is has a different behaviour for V flag than `asl`.
|
||||||
|
- Bugfix: Fixed 'Unknown op size' exception when uppercase sizes were used.
|
||||||
|
- Bugfix: Refactoring was broken for newer IDE versions, at least for me, this now works again by unknown magic.
|
||||||
|
|
||||||
### V0.8 (15-Oct-21)
|
### V0.8 (15-Oct-21)
|
||||||
|
|
||||||
- New: Support for MC68020+ addressing modes! However, MC68020+ specific instructions have not been added yet.
|
- New: Support for MC68020+ addressing modes! However, MC68020+ specific instructions have not been added yet.
|
||||||
|
|||||||
+28
-21
@@ -1,13 +1,13 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.jetbrains.intellij' version '1.1.6'
|
id 'org.jetbrains.intellij' version '1.8.0'
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.5.21'
|
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
id 'com.github.kt3k.coveralls' version '2.12.0'
|
id 'com.github.kt3k.coveralls' version '2.12.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'de.platon42'
|
group = 'de.platon42'
|
||||||
version = '0.8'
|
version = '0.9'
|
||||||
sourceCompatibility = "1.8"
|
sourceCompatibility = "1.8"
|
||||||
targetCompatibility = "1.8"
|
targetCompatibility = "1.8"
|
||||||
|
|
||||||
@@ -22,11 +22,12 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||||
testImplementation "org.assertj:assertj-core:3.21.0"
|
testImplementation 'org.assertj:assertj-core:3.23.1'
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
|
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||||
|
testImplementation 'org.junit.platform:junit-platform-launcher:1.9.0'
|
||||||
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,31 +43,30 @@ compileTestKotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
intellij {
|
intellij {
|
||||||
setVersion("2021.2.2") // LATEST-EAP-SNAPSHOT
|
setVersion("2022.2") // LATEST-EAP-SNAPSHOT
|
||||||
setUpdateSinceUntilBuild(false)
|
setUpdateSinceUntilBuild(false)
|
||||||
// setPlugins(["com.intellij.java"])
|
// setPlugins(["com.intellij.java"])
|
||||||
}
|
}
|
||||||
|
|
||||||
runPluginVerifier {
|
runPluginVerifier {
|
||||||
ideVersions = ["IC-203.6682.168", "IC-212.5457.46", // 2020.3 - 2021.2.3
|
ideVersions = ["IC-203.6682.168", "IC-222.3345.118", // 2020.3 - 2022.2
|
||||||
"CL-203.5981.166", "CL-203.8084.11", // 2020.3
|
"CL-203.8084.11", // 2020.3
|
||||||
"CL-211.6693.114", "CL-211.7628.27", // 2021.1
|
"CL-211.7628.27", // 2021.1
|
||||||
"CL-212.4746.93", "CL-212.5284.51"] // 2021.2 - 2021.2.2
|
"CL-212.5712.21", // 2021.2
|
||||||
|
"CL-213.7172.20", // 2021.3.4
|
||||||
|
"CL-221.5080.224", // 2022.1
|
||||||
|
"CL-222.3345.126"] // 2022.2
|
||||||
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier"
|
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier"
|
||||||
}
|
}
|
||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
setChangeNotes("""
|
setChangeNotes("""
|
||||||
<p>I still got zero feedback and zero <a href="https://plugins.jetbrains.com/plugin/17268-mc68000-assembly-language-support/reviews">ratings</a> :-(</p>
|
<h4>V0.9 (16-Aug-22)</h4>
|
||||||
<h4>V0.8 (15-Oct-21)</h4>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>New: Support for MC68020+ addressing modes! However, MC68020+ specific instructions have not been added yet.
|
<li>Maintenance. Updated all dependencies to the latest versions.
|
||||||
<li>New: Full support for MC68010 ISA ('movec', 'moves' and new special registers 'SFC' and 'DFC').
|
<li>Bugfix: Fixed condition code for asr/lsr/lsl, which is has a different behaviour for V flag than asl.
|
||||||
<li>Enhancement: Label documentation now also works for local labels and includes end-of-line comment for label, too.
|
<li>Bugfix: Fixed 'Unknown op size' exception when uppercase sizes were used.
|
||||||
<li>Enhancement: Symbol definition documentation now also includes comments in the same way as the label documentation does.
|
<li>Bugfix: Refactoring was broken for newer IDE versions, at least for me, this now works again by unknown magic.
|
||||||
<li>New: Macro definition / invocation documentation provider that even tries to expand macros.
|
|
||||||
<li>New: Added Language settings page with one option so far (-spaces option).
|
|
||||||
<li>New: Added some more settings for maximum parsed lines inside a macro and maximum displayed lines of code for documentation.
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p>
|
<p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p>
|
||||||
""")
|
""")
|
||||||
@@ -79,10 +79,17 @@ test {
|
|||||||
testLogging {
|
testLogging {
|
||||||
events "passed", "skipped", "failed"
|
events "passed", "skipped", "failed"
|
||||||
}
|
}
|
||||||
|
runIde {
|
||||||
|
jvmArgs '--add-exports', 'java.base/jdk.internal.vm=ALL-UNNAMED'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.coveralls {
|
||||||
|
dependsOn jacocoTestReport
|
||||||
}
|
}
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
toolVersion = '0.8.7'
|
toolVersion = '0.8.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
jacocoTestReport {
|
jacocoTestReport {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ASD_LSD_MODES = listOf(
|
private val ASL_MODES = listOf(
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
||||||
AllowedAdrMode(INDIRECT_MODES, null, size = OP_SIZE_W, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("*****")),
|
AllowedAdrMode(INDIRECT_MODES, null, size = OP_SIZE_W, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("*****")),
|
||||||
@@ -315,6 +315,14 @@ object M68kIsa {
|
|||||||
AllowedAdrMode(DREG_ONLY, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("*****"))
|
AllowedAdrMode(DREG_ONLY, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("*****"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val ASR_LSD_MODES = listOf(
|
||||||
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*")),
|
||||||
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*")),
|
||||||
|
AllowedAdrMode(INDIRECT_MODES, null, size = OP_SIZE_W, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("***0*")),
|
||||||
|
// not an official address mode, but supported by assembler (implicit #1)
|
||||||
|
AllowedAdrMode(DREG_ONLY, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("***0*"))
|
||||||
|
)
|
||||||
|
|
||||||
private val ROD_MODES = listOf(
|
private val ROD_MODES = listOf(
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
||||||
@@ -761,10 +769,10 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// Shift and Rotate Instructions
|
// Shift and Rotate Instructions
|
||||||
IsaData("asl", "Arithmetic Shift Left", modes = ASD_LSD_MODES),
|
IsaData("asl", "Arithmetic Shift Left", modes = ASL_MODES),
|
||||||
IsaData("asr", "Arithmetic Shift Right", modes = ASD_LSD_MODES),
|
IsaData("asr", "Arithmetic Shift Right", modes = ASR_LSD_MODES),
|
||||||
IsaData("lsl", "Logical Shift Left", modes = ASD_LSD_MODES),
|
IsaData("lsl", "Logical Shift Left", modes = ASR_LSD_MODES),
|
||||||
IsaData("lsr", "Logical Shift Right", modes = ASD_LSD_MODES),
|
IsaData("lsr", "Logical Shift Right", modes = ASR_LSD_MODES),
|
||||||
IsaData("rol", "Rotate Left", modes = ROD_MODES),
|
IsaData("rol", "Rotate Left", modes = ROD_MODES),
|
||||||
IsaData("ror", "Rotate Right", modes = ROD_MODES),
|
IsaData("ror", "Rotate Right", modes = ROD_MODES),
|
||||||
IsaData("roxl", "Rotate with Extend Left", modes = ROXD_MODES),
|
IsaData("roxl", "Rotate with Extend Left", modes = ROXD_MODES),
|
||||||
@@ -1066,12 +1074,14 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
|
|
||||||
IsaData("reset", "Reset External Devices", machine = ALL_MACHINES, isPrivileged = true, hasOps = false, modes = NO_OPS_UNSIZED),
|
IsaData("reset", "Reset External Devices", machine = ALL_MACHINES, isPrivileged = true, hasOps = false, modes = NO_OPS_UNSIZED),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"rte", "Return from Exception",
|
"rte", "Return from Exception",
|
||||||
machine = ALL_MACHINES, isPrivileged = true, hasOps = false,
|
machine = ALL_MACHINES, isPrivileged = true, hasOps = false,
|
||||||
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK)),
|
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK)),
|
||||||
changesControlFlow = true
|
changesControlFlow = true
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"stop", "Stop",
|
"stop", "Stop",
|
||||||
machine = ALL_MACHINES, isPrivileged = true,
|
machine = ALL_MACHINES, isPrivileged = true,
|
||||||
@@ -1087,6 +1097,7 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
|
|
||||||
IsaData("illegal", "Take Illegal Instruction Trap", machine = ALL_MACHINES, hasOps = false, modes = NO_OPS_UNSIZED, changesControlFlow = true),
|
IsaData("illegal", "Take Illegal Instruction Trap", machine = ALL_MACHINES, hasOps = false, modes = NO_OPS_UNSIZED, changesControlFlow = true),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"trap",
|
"trap",
|
||||||
"Trap",
|
"Trap",
|
||||||
@@ -1195,8 +1206,7 @@ object M68kIsa {
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
private
|
private val mnemonicLookupMap = isaData.asSequence()
|
||||||
val mnemonicLookupMap = isaData.asSequence()
|
|
||||||
.flatMap {
|
.flatMap {
|
||||||
(if (it.conditionCodes.isEmpty()) it.altMnemonics.plus(it.mnemonic) else it.altMnemonics.plus(it.conditionCodes
|
(if (it.conditionCodes.isEmpty()) it.altMnemonics.plus(it.mnemonic) else it.altMnemonics.plus(it.conditionCodes
|
||||||
.map { cc ->
|
.map { cc ->
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ class M68kUnresolvedReferenceInspection : AbstractBaseM68kLocalInspectionTool()
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitSymbolReference(symbolReference: M68kSymbolReference) {
|
override fun visitSymbolReference(symbolReference: M68kSymbolReference) {
|
||||||
val references = symbolReference.references ?: return
|
val references = symbolReference.references
|
||||||
if (references.isEmpty()) return
|
if (references.isEmpty()) return
|
||||||
val resolve = references.mapNotNull { it as? PsiPolyVariantReference }
|
val resolve = references.mapNotNull { it as? PsiPolyVariantReference }
|
||||||
.firstNotNullOfOrNull { it.multiResolve(false).ifEmpty { null } }
|
.firstNotNullOfOrNull { it.multiResolve(false).ifEmpty { null } }
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ object M68kPsiImplUtil {
|
|||||||
// OperandSize
|
// OperandSize
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getSize(element: M68kOperandSize): Int =
|
fun getSize(element: M68kOperandSize): Int =
|
||||||
when (element.text) {
|
when (element.text?.lowercase()) {
|
||||||
null -> OP_UNSIZED
|
null -> OP_UNSIZED
|
||||||
".w" -> OP_SIZE_W
|
".w" -> OP_SIZE_W
|
||||||
".l" -> OP_SIZE_L
|
".l" -> OP_SIZE_L
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.junit.jupiter.api.extension.*;
|
import org.junit.jupiter.api.extension.*;
|
||||||
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
|
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
|
||||||
import org.junit.jupiter.api.extension.ExtensionContext.Store;
|
import org.junit.jupiter.api.extension.ExtensionContext.Store;
|
||||||
|
import org.junit.runner.Description;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@@ -34,8 +35,11 @@ public class LightCodeInsightExtension implements ParameterResolver, AfterTestEx
|
|||||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
|
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
|
||||||
LightCodeInsightFixtureTestCaseWrapper testCase = getWrapper(extensionContext);
|
LightCodeInsightFixtureTestCaseWrapper testCase = getWrapper(extensionContext);
|
||||||
Parameter parameter = parameterContext.getParameter();
|
Parameter parameter = parameterContext.getParameter();
|
||||||
if (parameter.isAnnotationPresent(MyFixture.class)) return testCase.getMyFixture();
|
if (parameter.isAnnotationPresent(MyFixture.class)) {
|
||||||
else if (parameter.isAnnotationPresent(MyTestCase.class)) return testCase;
|
return testCase.getMyFixture();
|
||||||
|
} else if (parameter.isAnnotationPresent(MyTestCase.class)) {
|
||||||
|
return testCase;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,14 +72,15 @@ public class LightCodeInsightExtension implements ParameterResolver, AfterTestEx
|
|||||||
@Override
|
@Override
|
||||||
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
|
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
|
||||||
Throwable[] throwables = new Throwable[1];
|
Throwable[] throwables = new Throwable[1];
|
||||||
|
Description testDescription = Description.createTestDescription(extensionContext.getRequiredTestClass(), getWrapper(extensionContext).getName());
|
||||||
|
|
||||||
Runnable runnable = () -> {
|
Runnable runnable = () -> {
|
||||||
try {
|
try {
|
||||||
TestLoggerFactory.onTestStarted();
|
TestLoggerFactory.onTestStarted();
|
||||||
invocation.proceed();
|
invocation.proceed();
|
||||||
TestLoggerFactory.onTestFinished(true);
|
TestLoggerFactory.onTestFinished(true, testDescription);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
TestLoggerFactory.onTestFinished(false);
|
TestLoggerFactory.onTestFinished(false, testDescription);
|
||||||
throwables[0] = e;
|
throwables[0] = e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,14 +6,13 @@ import com.intellij.mock.MockProjectEx;
|
|||||||
import com.intellij.openapi.Disposable;
|
import com.intellij.openapi.Disposable;
|
||||||
import com.intellij.openapi.util.Disposer;
|
import com.intellij.openapi.util.Disposer;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.testFramework.EdtTestUtilKt;
|
|
||||||
import com.intellij.testFramework.ParsingTestCase;
|
import com.intellij.testFramework.ParsingTestCase;
|
||||||
import com.intellij.testFramework.TestLoggerFactory;
|
import com.intellij.testFramework.TestLoggerFactory;
|
||||||
import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.junit.jupiter.api.extension.*;
|
import org.junit.jupiter.api.extension.*;
|
||||||
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
|
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
|
||||||
import org.junit.jupiter.api.extension.ExtensionContext.Store;
|
import org.junit.jupiter.api.extension.ExtensionContext.Store;
|
||||||
|
import org.junit.runner.Description;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
@@ -81,37 +80,22 @@ public class ParsingTestExtension implements ParameterResolver, AfterTestExecuti
|
|||||||
@Override
|
@Override
|
||||||
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
|
public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
|
||||||
Throwable[] throwables = new Throwable[1];
|
Throwable[] throwables = new Throwable[1];
|
||||||
|
Description testDescription = Description.createTestDescription(extensionContext.getRequiredTestClass(), getWrapper(extensionContext).getName());
|
||||||
|
|
||||||
Runnable runnable = () -> {
|
try {
|
||||||
try {
|
TestLoggerFactory.onTestStarted();
|
||||||
TestLoggerFactory.onTestStarted();
|
invocation.proceed();
|
||||||
invocation.proceed();
|
TestLoggerFactory.onTestFinished(true, testDescription);
|
||||||
TestLoggerFactory.onTestFinished(true);
|
} catch (Throwable e) {
|
||||||
} catch (Throwable e) {
|
TestLoggerFactory.onTestFinished(false, testDescription);
|
||||||
TestLoggerFactory.onTestFinished(false);
|
throwables[0] = e;
|
||||||
throwables[0] = e;
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
invokeTestRunnable(runnable);
|
|
||||||
|
|
||||||
if (throwables[0] != null) {
|
if (throwables[0] != null) {
|
||||||
throw throwables[0];
|
throw throwables[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void invokeTestRunnable(@NotNull Runnable runnable) {
|
|
||||||
IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current();
|
|
||||||
if (policy != null && !policy.runInDispatchThread()) {
|
|
||||||
runnable.run();
|
|
||||||
} else {
|
|
||||||
EdtTestUtilKt.runInEdtAndWait(() -> {
|
|
||||||
runnable.run();
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IParsingTestCase {
|
public interface IParsingTestCase {
|
||||||
|
|
||||||
MockProjectEx getProject();
|
MockProjectEx getProject();
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.extension.ExtendWith
|
|||||||
abstract class AbstractDocumentationProviderTest : AbstractM68kTest() {
|
abstract class AbstractDocumentationProviderTest : AbstractM68kTest() {
|
||||||
|
|
||||||
fun generateDocumentation(myFixture: CodeInsightTestFixture): String? {
|
fun generateDocumentation(myFixture: CodeInsightTestFixture): String? {
|
||||||
|
// FIXME migrate to DocumentationTarget
|
||||||
val docElement = DocumentationManager.getInstance(myFixture.project).findTargetElement(myFixture.editor, myFixture.file)
|
val docElement = DocumentationManager.getInstance(myFixture.project).findTargetElement(myFixture.editor, myFixture.file)
|
||||||
val provider = DocumentationManager.getProviderFromElement(docElement)
|
val provider = DocumentationManager.getProviderFromElement(docElement)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ internal class M68kInspectionSuppressorTest : AbstractInspectionTest() {
|
|||||||
val quickFixPair = highlightInfos[0].quickFixActionRanges[0]
|
val quickFixPair = highlightInfos[0].quickFixActionRanges[0]
|
||||||
val intentionActionDescriptor = quickFixPair.first
|
val intentionActionDescriptor = quickFixPair.first
|
||||||
val element = myFixture.file.findElementAt(quickFixPair.second.startOffset)!!
|
val element = myFixture.file.findElementAt(quickFixPair.second.startOffset)!!
|
||||||
val suppressQuickFix = intentionActionDescriptor.getOptions(element, myFixture.editor)!!
|
val suppressQuickFix = intentionActionDescriptor.getOptions(element, myFixture.editor)
|
||||||
.first { it.text == suppressAction }
|
.first { it.text == suppressAction }
|
||||||
myFixture.launchAction(suppressQuickFix)
|
myFixture.launchAction(suppressQuickFix)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ internal class AddressingModesTest : AbstractParsingTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
internal fun register_direct(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
|
internal fun register_direct(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
|
||||||
testGoodSyntax(testCase, " move.l d0,a7\n")
|
testGoodSyntax(testCase, " MOVE.L d0,a7\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+2
-2
@@ -103,7 +103,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
|||||||
assertThat(otherfile.text).isEqualTo("; oh no!")
|
assertThat(otherfile.text).isEqualTo("; oh no!")
|
||||||
|
|
||||||
myFixture.renameElementAtCaret("foobar.asm")
|
myFixture.renameElementAtCaret("foobar.asm")
|
||||||
val files = FilenameIndex.getFilesByName(myFixture.project, "foobar.asm", GlobalSearchScope.allScope(myFixture.project))
|
val files = FilenameIndex.getVirtualFilesByName("foobar.asm", GlobalSearchScope.allScope(myFixture.project))
|
||||||
assertThat(files).hasSize(1)
|
assertThat(files).hasSize(1)
|
||||||
|
|
||||||
assertThat(file.text).isEqualToIgnoringWhitespace("include \"foobar.asm\"")
|
assertThat(file.text).isEqualToIgnoringWhitespace("include \"foobar.asm\"")
|
||||||
@@ -123,7 +123,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
|||||||
assertThat(otherfile.text).isEqualTo("; oh no!")
|
assertThat(otherfile.text).isEqualTo("; oh no!")
|
||||||
|
|
||||||
myFixture.renameElementAtCaret("foobar.asm")
|
myFixture.renameElementAtCaret("foobar.asm")
|
||||||
val files = FilenameIndex.getFilesByName(myFixture.project, "foobar.asm", GlobalSearchScope.allScope(myFixture.project))
|
val files = FilenameIndex.getVirtualFilesByName("foobar.asm", GlobalSearchScope.allScope(myFixture.project))
|
||||||
assertThat(files).hasSize(1)
|
assertThat(files).hasSize(1)
|
||||||
|
|
||||||
assertThat(file.text).isEqualToIgnoringWhitespace("include \"foobar/foobar.asm\"")
|
assertThat(file.text).isEqualToIgnoringWhitespace("include \"foobar/foobar.asm\"")
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ Assembly File: a.asm
|
|||||||
M68kStatementImpl(STATEMENT)
|
M68kStatementImpl(STATEMENT)
|
||||||
M68kAsmInstructionImpl(ASM_INSTRUCTION)
|
M68kAsmInstructionImpl(ASM_INSTRUCTION)
|
||||||
M68kAsmOpImpl(ASM_OP)
|
M68kAsmOpImpl(ASM_OP)
|
||||||
PsiElement(M68kTokenType.MNEMONIC)('move')
|
PsiElement(M68kTokenType.MNEMONIC)('MOVE')
|
||||||
M68kOperandSizeImpl(OPERAND_SIZE)
|
M68kOperandSizeImpl(OPERAND_SIZE)
|
||||||
PsiElement(M68kTokenType.OPSIZE_L)('.l')
|
PsiElement(M68kTokenType.OPSIZE_L)('.L')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
|
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
|
||||||
M68kDataRegisterImpl(DATA_REGISTER)
|
M68kDataRegisterImpl(DATA_REGISTER)
|
||||||
|
|||||||
Reference in New Issue
Block a user