package nl.hannahsten.texifyidea.inspections.latex.redundancy

import nl.hannahsten.texifyidea.file.LatexFileType
import nl.hannahsten.texifyidea.inspections.TexifyInspectionTestBase

class LatexDuplicateDefinitionInspectionTest : TexifyInspectionTestBase(LatexDuplicateDefinitionInspection()) {

    fun testWarning() {
        myFixture.configureByText(
            LatexFileType,
            """
            <error descr="Command '\cmdtwo' is defined multiple times">\newcommand{\cmdtwo}{a}</error>
            <error descr="Command '\cmdtwo' is defined multiple times">\newcommand{\cmdtwo}{a}</error>
            
            \providecommand{\test}{}
            <error descr="Command '\test' is defined multiple times">\newcommand{\test}{}</error>
            """.trimIndent()
        )
        myFixture.checkHighlighting()
    }

    fun testNoWarning() {
        myFixture.configureByText(
            LatexFileType,
            """
            \providecommand{\cmd}{a}
            \renewcommand{\cmd}{a}
            
            \providecommand{\provided}{}
            """.trimIndent()
        )
        myFixture.checkHighlighting()
    }
}
package nl.hannahsten.texifyidea.inspections.latex.redundancy

import nl.hannahsten.texifyidea.file.LatexFileType
import nl.hannahsten.texifyidea.inspections.TexifyInspectionTestBase

class LatexDuplicateDefinitionInspectionTest : TexifyInspectionTestBase(LatexDuplicateDefinitionInspection()) {

    fun testWarning() {
        myFixture.configureByText(
            LatexFileType,
            """
            <error descr="Command '\cmdtwo' is defined multiple times">\newcommand{\cmdtwo}{a}</error>
            <error descr="Command '\cmdtwo' is defined multiple times">\newcommand{\cmdtwo}{a}</error>
            """.trimIndent()
        )
        myFixture.checkHighlighting()
    }

    fun testNoWarning() {
        myFixture.configureByText(
            LatexFileType,
            """
            \providecommand{\cmd}{a}
            \renewcommand{\cmd}{a}
            
            \providecommand{\provided}{}
            """.trimIndent()
        )
        myFixture.checkHighlighting()
    }

    fun testNewcommand() {
        myFixture.configureByText(
            LatexFileType,
            """
            \newcommand{\foo}{}
            \renewcommand{\foo}{}
            """.trimIndent()
        )
        myFixture.checkHighlighting()
    }
}
Add test to verify the issue is solved and remove a part of another test that is now not supported as true positive anymore
Add test to verify the issue is solved and remove a part of another test that is now not supported as true positive anymore

Ruben-Sten/TeXiFy-IDEA,Ruben-Sten/TeXiFy-IDEA,Ruben-Sten/TeXiFy-IDEA,Ruben-Sten/TeXiFy-IDEA