<NME> ElmPartialParsingTestCase.kt
<BEF> /*
 * Use of this source code is governed by the MIT license that can be
 * found in the LICENSE file.
 *
 * Originally from IntelliJ-Rust plugin.
 */

package org.elm.lang.core.parser

import com.intellij.psi.PsiFile

/*
 * Tests parser recovery (`pin` and `recoverWhile` attributes from Elm parser BNF)
 * by constructing PSI trees from syntactically invalid files.
 */
class ElmPartialParsingTestCase : ElmParsingTestCaseBase("partial") {

    // insert your test here

    override fun checkResult(targetDataName: String?, file: PsiFile) {
        check(hasError(file)) {
            "Invalid file was parsed successfully: ${file.name}"
        }
        super.checkResult(targetDataName, file)
    }

}
    fun testTypeAliasDecl() = doTest(true)
    fun testTypeAnnotations() = doTest(true)
    fun testListLiterals() = doTest(true)
    fun testRecords() = doTest(true)
    fun testTuples() = doTest(true)
    fun testNegateExpression() = doTest(true)
    fun testChars() = doTest(true)
    fun testStrings() = doTest(true)
    fun testOperators() = doTest(true)
    fun testShaders() = doTest(true)

    // The parse error recovery for case/of and let/in expressions is hard to get right
    // due to the parse rules depending on indentation. In a partial program that the
    // user is actively editing, the indentation can be screwed up. So we must test these
    // partial expressions extensively.
    fun testCaseOf() = doTest(true)
    fun testLetIn() = doTest(true)


    override fun checkResult(targetDataName: String, file: PsiFile) {
        check(hasError(file)) {
            "Invalid file was parsed successfully: ${file.name}"
        }
        super.checkResult(targetDataName, file)
    }
}

<MSG> cleaner way to handle offside-rule parsing

<DFF> @@ -13,15 +13,15 @@ import com.intellij.psi.PsiFile
  * Tests parser recovery (`pin` and `recoverWhile` attributes from Elm parser BNF)
  * by constructing PSI trees from syntactically invalid files.
  */
-class ElmPartialParsingTestCase : ElmParsingTestCaseBase("partial") {
-
-    // insert your test here
-
-    override fun checkResult(targetDataName: String?, file: PsiFile) {
-        check(hasError(file)) {
-            "Invalid file was parsed successfully: ${file.name}"
-        }
-        super.checkResult(targetDataName, file)
-    }
-
-}
+// TODO add tests
+//class ElmPartialParsingTestCase : ElmParsingTestCaseBase("partial") {
+//
+//    // insert your test here
+//
+//    override fun checkResult(targetDataName: String?, file: PsiFile) {
+//        check(hasError(file)) {
+//            "Invalid file was parsed successfully: ${file.name}"
+//        }
+//        super.checkResult(targetDataName, file)
+//    }
+//}

cleaner way to handle offside-rule parsing