-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package nl.hannahsten.texifyidea.run | ||
|
||
import com.intellij.testFramework.fixtures.BasePlatformTestCase | ||
import nl.hannahsten.texifyidea.run.latex.LatexOutputPath | ||
import nl.hannahsten.texifyidea.run.latex.LatexRunConfiguration | ||
import nl.hannahsten.texifyidea.run.latex.LatexRunConfigurationProducer | ||
|
||
class LatexOutputPathTest : BasePlatformTestCase() { | ||
|
||
fun testOutputPathCreate() { | ||
val mainFile = myFixture.addFileToProject("main.tex", """ | ||
\documentclass{article} | ||
\begin{document} | ||
main | ||
\end{document} | ||
""".trimIndent()) | ||
val runConfig = LatexRunConfiguration(myFixture.project, LatexRunConfigurationProducer().configurationFactory, "Test run config") | ||
runConfig.psiFile = mainFile | ||
runConfig.setMainFile("main.tex") | ||
val outPath = LatexOutputPath("out", runConfig.getMainFileContentRoot(), runConfig.mainFile, project) | ||
// Cannot mkdirs in test, so will default to src | ||
assertEquals("/src", outPath.getAndCreatePath()?.path) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
test/nl/hannahsten/texifyidea/run/LatexRunConfigurationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package nl.hannahsten.texifyidea.run | ||
|
||
import com.intellij.testFramework.fixtures.BasePlatformTestCase | ||
import nl.hannahsten.texifyidea.run.bibtex.BibtexRunConfiguration | ||
import nl.hannahsten.texifyidea.run.compiler.LatexCompiler | ||
import nl.hannahsten.texifyidea.run.latex.LatexOutputPath | ||
import nl.hannahsten.texifyidea.run.latex.LatexRunConfiguration | ||
import nl.hannahsten.texifyidea.run.latex.LatexRunConfigurationProducer | ||
import org.jdom.Element | ||
import org.jdom.Namespace | ||
|
||
class LatexRunConfigurationTest : BasePlatformTestCase() { | ||
|
||
fun testWriteRead() { | ||
val runConfig = LatexRunConfiguration(myFixture.project, LatexRunConfigurationProducer().configurationFactory, "Test run config") | ||
val element = Element("configuration", Namespace.getNamespace("", "")) | ||
runConfig.compiler = LatexCompiler.LATEXMK | ||
runConfig.outputPath.pathString = LatexOutputPath.projectDirString + "otherout" | ||
runConfig.writeExternal(element) | ||
runConfig.readExternal(element) | ||
// Not sure if this actually tests anything | ||
assertEquals(runConfig.compiler, LatexCompiler.LATEXMK) | ||
assertEquals(runConfig.outputPath.pathString, LatexOutputPath.projectDirString + "otherout") | ||
} | ||
|
||
fun testBibRunConfig() { | ||
val mainFile = myFixture.addFileToProject("main.tex", """ | ||
\documentclass{article} | ||
\begin{document} | ||
When you are not looking at it, this sentences stops citing~\cite{knuth1990,goossens1993}. | ||
\bibliography{references} | ||
\bibliographystyle{plain} | ||
\end{document} | ||
""".trimIndent()) | ||
val runConfig = LatexRunConfiguration(myFixture.project, LatexRunConfigurationProducer().configurationFactory, "Test run config") | ||
runConfig.psiFile = mainFile | ||
runConfig.setMainFile("main.tex") | ||
runConfig.generateBibRunConfig() | ||
assertTrue(runConfig.bibRunConfigs.isNotEmpty()) | ||
assertEquals(mainFile.virtualFile, (runConfig.bibRunConfigs.first().configuration as BibtexRunConfiguration).mainFile) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...exifyidea/run/BibtexOutputListenerTest.kt → ...ea/run/logtab/BibtexOutputListenerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../texifyidea/run/LatexLogFileFinderTest.kt → ...idea/run/logtab/LatexLogFileFinderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xifyidea/run/LatexMessageExtractorTest.kt → ...a/run/logtab/LatexMessageExtractorTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...texifyidea/run/LatexOutputListenerTest.kt → ...dea/run/logtab/LatexOutputListenerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ifyidea/run/LatexQuickRunLogParserTest.kt → .../run/logtab/LatexQuickRunLogParserTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters