[REPL] Fix syntax errors analysis and incompleteness detection
This commit is contained in:
+14
@@ -198,6 +198,20 @@ class ReplCompletionAndErrorsAnalysisTest : TestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIncompleteCode() = test {
|
||||
run {
|
||||
doErrorCheck
|
||||
|
||||
code = "fun g(): Int { return 1"
|
||||
|
||||
expect {
|
||||
addError(1, 24, 1, 24, "Expecting '}'", "ERROR")
|
||||
errors.add(ScriptDiagnostic(ScriptDiagnostic.incompleteCode, "Incomplete code"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCompletionDuplication() = test {
|
||||
for (i in 1..6) {
|
||||
|
||||
+1
-1
@@ -283,7 +283,7 @@ private suspend fun checkEvaluateInRepl(
|
||||
|
||||
checkLists(index, "completions", expectedCompletions.list, completionsRes, expectedCompletions)
|
||||
val expectedErrorsWithPath = expectedErrors.list.map {
|
||||
it.copy(sourcePath = errorsRes.firstOrNull()?.sourcePath)
|
||||
if (it.location != null) it.copy(sourcePath = errorsRes.firstOrNull()?.sourcePath) else it
|
||||
}
|
||||
checkLists(index, "errors", expectedErrorsWithPath, errorsRes, expectedErrors)
|
||||
TestCase.assertEquals("Analysis result types are different", expectedResultType, resultType)
|
||||
|
||||
Reference in New Issue
Block a user