summaryrefslogtreecommitdiff
path: root/support/arara/source/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'support/arara/source/src/test')
-rw-r--r--support/arara/source/src/test/java/com/github/cereda/arara/tests/LocalizationTest.java115
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileHandlingUtilsTest.kt62
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileSearchingUtilsTest.kt58
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageCoverageTest.kt102
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageReport.kt143
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageTest.kt20
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt76
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/CommonUtilsTest.kt33
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExecutionTest.kt139
-rw-r--r--support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExtensionTest.kt23
-rw-r--r--support/arara/source/src/test/resources/executiontests/changes/arara.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/changes/arararc.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/changes/changes.tex3
-rw-r--r--support/arara/source/src/test/resources/executiontests/changes/echoone.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/conditionals/arararc.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/conditionals/conditionals.tex6
-rw-r--r--support/arara/source/src/test/resources/executiontests/conditionals/echofour.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/conditionals/echoone.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/conditionals/echothree.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/conditionals/echotwo.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/directive-with-options/arararc.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/directive-with-options/directive-with-options.tex6
-rw-r--r--support/arara/source/src/test/resources/executiontests/directive-with-options/echoone.yaml36
-rw-r--r--support/arara/source/src/test/resources/executiontests/foreign-extension/arararc.yaml6
-rw-r--r--support/arara/source/src/test/resources/executiontests/foreign-extension/echoone.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.my3
-rw-r--r--support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.xy3
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt-error/arararc.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt-error/echoone.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt-error/echotwo.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt-error/halt-error.tex5
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt-error/halt.yaml16
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt/arararc.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt/echoone.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt/echotwo.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt/halt.tex5
-rw-r--r--support/arara/source/src/test/resources/executiontests/halt/halt.yaml19
-rw-r--r--support/arara/source/src/test/resources/executiontests/invalid-config/arararc.yaml2
-rw-r--r--support/arara/source/src/test/resources/executiontests/invalid-config/invalid-config.tex3
-rw-r--r--support/arara/source/src/test/resources/executiontests/known-extension/arararc.yaml5
-rw-r--r--support/arara/source/src/test/resources/executiontests/known-extension/echoone.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/known-extension/known-extension.tex3
-rw-r--r--support/arara/source/src/test/resources/executiontests/sessions/arararc.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/sessions/sessionrule.yaml16
-rw-r--r--support/arara/source/src/test/resources/executiontests/sessions/sessions.tex3
-rw-r--r--support/arara/source/src/test/resources/executiontests/simple-directive/arararc.yaml3
-rw-r--r--support/arara/source/src/test/resources/executiontests/simple-directive/echoone.yaml10
-rw-r--r--support/arara/source/src/test/resources/executiontests/simple-directive/simple-directive.tex3
48 files changed, 943 insertions, 115 deletions
diff --git a/support/arara/source/src/test/java/com/github/cereda/arara/tests/LocalizationTest.java b/support/arara/source/src/test/java/com/github/cereda/arara/tests/LocalizationTest.java
deleted file mode 100644
index ab5978265d..0000000000
--- a/support/arara/source/src/test/java/com/github/cereda/arara/tests/LocalizationTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Arara, the cool TeX automation tool
- * Copyright (c) 2012, Paulo Roberto Massa Cereda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the project's author nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package com.github.cereda.arara.tests;
-
-import ch.qos.cal10n.verifier.Cal10nError;
-import ch.qos.cal10n.verifier.IMessageKeyVerifier;
-import ch.qos.cal10n.verifier.MessageKeyVerifier;
-import com.github.cereda.arara.model.Messages;
-import java.util.List;
-import java.util.Locale;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-/**
- * Tests the localizated messages, checking if all keys are set.
- * @author Paulo Roberto Massa Cereda
- * @version 4.0
- * @since 4.0
- */
-public class LocalizationTest {
-
- /**
- * Helper method, checks the provided locale.
- * @param locale The locale.
- * @return The size of the error list.
- */
- private int check(Locale locale) {
- IMessageKeyVerifier verifier = new MessageKeyVerifier(Messages.class);
- List<Cal10nError> errors = verifier.verify(locale);
- for(Cal10nError error : errors) {
- System.err.println(error);
- }
- return errors.size();
- }
-
- /**
- * Verifies the English localization (provided by Paulo).
- */
- @Test
- public void verifyEnglish() {
- assertEquals(0, check(new Locale("en")));
- }
-
- /**
- * Verifies the German localization (provided by Marco).
- */
- @Test
- public void verifyGerman() {
- assertEquals(0, check(new Locale("de")));
- }
-
- /**
- * Verifies the Broad Norfolk localization (provided by Nicola).
- */
- @Test
- public void verifyBroadNorfolk() {
- assertEquals(0, check(new Locale("en", "QN")));
- }
-
- /**
- * Verifies the Dutch localization (provided by Marijn).
- */
- @Test
- public void verifyDutch() {
- assertEquals(0, check(new Locale("nl")));
- }
-
- /**
- * Verifies the Brazilian Portuguese localization (provided by Paulo).
- */
- @Test
- public void verifyBrazilianPortuguese() {
- assertEquals(0, check(new Locale("pt", "BR")));
- }
-
- /**
- * Verifies the Italian localization (provided by Enrico).
- */
- @Test
- public void verifyItalian() {
- assertEquals(0, check(new Locale("it")));
- }
-
-}
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileHandlingUtilsTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileHandlingUtilsTest.kt
new file mode 100644
index 0000000000..55b13a8fe5
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileHandlingUtilsTest.kt
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.filehandling
+
+import io.kotlintest.shouldBe
+import io.kotlintest.shouldThrow
+import io.kotlintest.specs.ShouldSpec
+import java.io.File
+import java.nio.file.Files
+import org.islandoftex.arara.Arara
+import org.islandoftex.arara.configuration.AraraSpec
+import org.islandoftex.arara.model.AraraException
+
+class FileHandlingUtilsTest : ShouldSpec({
+ should("fail generating CRC sums on inexistent files") {
+ shouldThrow<AraraException> {
+ FileHandlingUtils.calculateHash(File("QUACK"))
+ }
+ }
+ should("generate correct CRC sums") {
+ FileHandlingUtils.calculateHash(File("../LICENSE")) shouldBe "2396b4e2"
+ FileHandlingUtils.calculateHash(File("../CODE_OF_CONDUCT.md")) shouldBe "536c426f"
+ }
+
+ should("find correct extension") {
+ FileHandlingUtils.getFileExtension(File("QUACK")) shouldBe ""
+ FileHandlingUtils.getFileExtension(File("a.tex")) shouldBe "tex"
+ FileHandlingUtils.getFileExtension(File(".tex")) shouldBe "tex"
+ }
+ should("find correct basename") {
+ FileHandlingUtils.getBasename(File("QUACK")) shouldBe "QUACK"
+ FileHandlingUtils.getBasename(File("a.tex")) shouldBe "a"
+ FileHandlingUtils.getBasename(File(".tex")) shouldBe ""
+ }
+
+ should("get subdirecotry relationship right") {
+ FileHandlingUtils.isSubDirectory(File("../docs"), File("..")) shouldBe true
+ FileHandlingUtils.isSubDirectory(File(".."), File("../docs")) shouldBe false
+ shouldThrow<AraraException> {
+ FileHandlingUtils.isSubDirectory(File("../LICENSE"), File(".."))
+ }
+ shouldThrow<AraraException> {
+ FileHandlingUtils.isSubDirectory(File(".."), File("../LICENSE"))
+ }
+ }
+
+ should("detect changes on file") {
+ val file = Files.createTempFile(null, null).toFile()
+ val referenceBackup = Arara.config[AraraSpec.Execution.reference]
+ Arara.config[AraraSpec.Execution.reference] = file.parentFile.resolve("reference")
+ FileHandlingUtils.hasChanged(file) shouldBe true
+ FileHandlingUtils.hasChanged(file) shouldBe false
+ file.writeText("QUACK")
+ FileHandlingUtils.hasChanged(file) shouldBe true
+ FileHandlingUtils.hasChanged(file) shouldBe false
+ file.writeText("QUACK2")
+ FileHandlingUtils.hasChanged(file) shouldBe true
+ file.delete()
+ FileHandlingUtils.hasChanged(file) shouldBe true
+ FileHandlingUtils.hasChanged(file) shouldBe false
+ Arara.config[AraraSpec.Execution.reference] = referenceBackup
+ }
+})
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileSearchingUtilsTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileSearchingUtilsTest.kt
new file mode 100644
index 0000000000..47f9916c43
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/filehandling/FileSearchingUtilsTest.kt
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.filehandling
+
+import io.kotlintest.shouldBe
+import io.kotlintest.specs.ShouldSpec
+import java.nio.file.Files
+import java.nio.file.Path
+import kotlin.reflect.full.declaredMemberFunctions
+import kotlin.reflect.jvm.isAccessible
+
+class FileSearchingUtilsTest : ShouldSpec({
+ // TODO: test implicit extensions
+
+ fun prepareFileSystem(): Path {
+ val tempDir = Files.createTempDirectory(System.nanoTime().toString())
+ tempDir.resolve("quack/quack").toFile().mkdirs()
+ listOf("quack", "quack/quack", "quack/quack/quack").forEach {
+ tempDir.resolve("$it.tex").toFile().writeText(" ")
+ tempDir.resolve("$it.txt").toFile().writeText(" ")
+ }
+ return tempDir
+ }
+
+ should("fail looking up inexistent file") {
+ val lookupFile = FileSearchingUtils::class.declaredMemberFunctions
+ .first { it.name == "lookupFile" }
+ lookupFile.isAccessible = true
+ lookupFile.call(FileSearchingUtils, "QUACK") shouldBe null
+ }
+
+ should("fail on existing directory") {
+ val lookupFile = FileSearchingUtils::class.declaredMemberFunctions
+ .first { it.name == "lookupFile" }
+ lookupFile.isAccessible = true
+ lookupFile.call(FileSearchingUtils, "../buildSrc") shouldBe null
+ }
+
+ should("find file by extension") {
+ val tempDir = prepareFileSystem()
+ FileSearchingUtils.listFilesByExtensions(tempDir.toFile(),
+ listOf("tex"), false).toSet() shouldBe
+ setOf(tempDir.resolve("quack.tex").toFile())
+ FileSearchingUtils.listFilesByExtensions(tempDir.toFile(),
+ listOf("tex"), true).toSet() shouldBe
+ listOf("quack", "quack/quack", "quack/quack/quack")
+ .map { tempDir.resolve("$it.tex").toFile() }.toSet()
+ }
+ should("find file by pattern") {
+ val tempDir = prepareFileSystem()
+ FileSearchingUtils.listFilesByPatterns(tempDir.toFile(),
+ listOf("*q*.txt"), false).toSet() shouldBe
+ setOf(tempDir.resolve("quack.txt").toFile())
+ FileSearchingUtils.listFilesByPatterns(tempDir.toFile(),
+ listOf("q*.txt"), true).toSet() shouldBe
+ listOf("quack", "quack/quack", "quack/quack/quack")
+ .map { tempDir.resolve("$it.txt").toFile() }.toSet()
+ }
+})
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageCoverageTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageCoverageTest.kt
new file mode 100644
index 0000000000..704d3e319d
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageCoverageTest.kt
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.localization
+
+import ch.qos.cal10n.verifier.MessageKeyVerifier
+import io.kotlintest.inspectors.forAll
+import io.kotlintest.matchers.collections.shouldNotBeEmpty
+import io.kotlintest.shouldBe
+import io.kotlintest.shouldThrow
+import io.kotlintest.specs.ShouldSpec
+import java.io.File
+import java.io.IOException
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.Paths
+import java.util.Locale
+import java.util.stream.Collectors
+import org.islandoftex.arara.model.AraraException
+
+class LanguageCoverageTest : ShouldSpec({
+ "locale definitions" {
+ /**
+ * Helper method, checks the provided locale (all keys set?).
+ *
+ * @param locale The locale.
+ * @return The size of the error list.
+ */
+ fun check(locale: Locale): Int {
+ val errors = MessageKeyVerifier(Messages::class.java).verify(locale)
+ errors.forEach(System.err::println)
+ return errors.size
+ }
+
+ should("succeed instantiating known locale") {
+ Language("en").locale.language shouldBe "en"
+ }
+ should("throw on unknown locale instantiation") {
+ shouldThrow<AraraException> {
+ Language("quack")
+ }
+ }
+
+ should("not error on known localizations") {
+ listOf("en", "de", "nl", "it").forAll {
+ check(Locale(it)) shouldBe 0
+ }
+ check(Locale("en", "QN")) shouldBe 0
+ check(Locale("pt", "BR")) shouldBe 0
+ }
+ }
+ "language coverage" {
+ /*
+ * Tests the localized messages, checking if all messages are properly
+ * quoted (but not necessarily whether they are loadable).
+ */
+ should("get all strings from every language") {
+ // get all files
+ val files = Files.list(
+ Paths.get("src/main/resources/org/islandoftex/arara/localization"))
+ .map { p: Path ->
+ val f = p.toFile()
+ if (f.name.endsWith("properties") && !f.isDirectory) f
+ else null
+ }
+ .collect(Collectors.toList())
+ .toList()
+ .filterNotNull()
+ files.shouldNotBeEmpty()
+
+ // for each report, print
+ // the corresponding entry
+ files.map { file: File ->
+ try {
+ LanguageReport.analyze(file)
+ } catch (exception: IOException) {
+ throw AssertionError(
+ "Fatal exception: an error was raised while " +
+ "trying to read one of the languages. Please " +
+ "make sure all languages in the provided " +
+ "directory have read permission.")
+ }
+ }.forEach { report ->
+ // debug output
+ println(report.reference.name +
+ "\t" + String.format(" %2.2f%%", report.coverage))
+
+ // if there are problematic lines,
+ // add the current language report
+ if (report.lines.isNotEmpty()) {
+ // legend: S = Simple message, single quotes should not be doubled
+ // P = Parametrized message, single quotes must be doubled
+
+ // build the beginning of the line
+ println(report.reference.name)
+ // print error lines
+ println(report.lines)
+ }
+
+ report.coverage shouldBe 100.0f
+ }
+ }
+ }
+})
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageReport.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageReport.kt
new file mode 100644
index 0000000000..addcd0262c
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageReport.kt
@@ -0,0 +1,143 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.localization
+
+import java.io.File
+
+/**
+ * Implements the language report model.
+ *
+ * @author Island of TeX
+ * @version 5.0
+ * @since 5.0
+ */
+data class LanguageReport(
+ /**
+ * The file reference.
+ */
+ val reference: File,
+ /**
+ * Total of checked lines.
+ */
+ val total: Int,
+ /**
+ * List of problematic lines and their corresponding error types.
+ */
+ val lines: Map<Int, Char>
+) {
+ /**
+ * Language coverage of the file.
+ */
+ val coverage: Float
+ get() = if (lines.isEmpty()) {
+ 100f
+ } else {
+ (1f - lines.size.toFloat() / total) * 100f
+ }
+
+ companion object {
+ /**
+ * Analyzes the list of lines.
+ *
+ * @param file The file to read.
+ * @return The language report.
+ */
+ internal fun analyze(file: File): LanguageReport {
+ // holds the current line number
+ var number = 1
+ // holds the number of checked lines
+ var checked = 0
+
+ // flag that holds the
+ // current analysis
+ var check: Int
+
+ val reportLines = mutableMapOf<Int, Char>()
+
+ // check every line of the language file
+ file.forEachLine { line ->
+ // let's only analyze lines
+ // that are not comments
+ if (!line.trim().startsWith("#")) {
+ // increment the checked
+ // line counter
+ checked++
+
+ // line is a parametrized message
+ check = if (line.contains("{0}")) {
+ // check the corresponding pattern
+ checkParametrizedMessage(line)
+ } else {
+ // check the corresponding pattern
+ checkMessage(line)
+ }
+
+ // we found an error,
+ // report it
+ if (check != 0) {
+ // add line and error type to the report
+ reportLines[number] = if (check == 1) 'P' else 'S'
+ }
+ }
+
+ // let's move to the next line
+ number++
+ }
+
+ // return the language report
+ return LanguageReport(
+ reference = file,
+ total = checked,
+ lines = reportLines)
+ }
+
+ /**
+ * Checks if the provided message follows the simple format.
+ *
+ * @param text Message.
+ * @return An integer value.
+ */
+ private fun checkMessage(text: String): Int {
+ var i = 0
+ var c: Char
+ for (element in text) {
+ c = element
+ i = if (c == '\'') {
+ if (i == 1) {
+ return 2
+ } else {
+ 1
+ }
+ } else {
+ 0
+ }
+ }
+ return 0
+ }
+
+ /**
+ * Checks if the provided message follows the parametrized format.
+ *
+ * @param text Message.
+ * @return An integer value.
+ */
+ private fun checkParametrizedMessage(text: String): Int {
+ var i = 0
+ var c: Char
+ for (element in text) {
+ c = element
+ if (c == '\'') {
+ i += 1
+ } else {
+ if (i != 0) {
+ if (i != 2) {
+ return 1
+ } else {
+ i = 0
+ }
+ }
+ }
+ }
+ return 0
+ }
+ }
+}
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageTest.kt
new file mode 100644
index 0000000000..92d38ebc9b
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/localization/LanguageTest.kt
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.localization
+
+import io.kotlintest.shouldBe
+import io.kotlintest.shouldThrow
+import io.kotlintest.specs.ShouldSpec
+import java.util.Locale
+import org.islandoftex.arara.model.AraraException
+
+class LanguageTest : ShouldSpec({
+ should("instantiate with known code") {
+ Language("en").locale shouldBe Locale.ENGLISH
+ }
+
+ should("throw on unknown language") {
+ shouldThrow<AraraException> {
+ Language("quack")
+ }
+ }
+})
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt
new file mode 100644
index 0000000000..7580d8c81e
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.model
+
+import io.kotlintest.shouldBe
+import io.kotlintest.shouldNotThrow
+import io.kotlintest.shouldThrow
+import io.kotlintest.specs.ShouldSpec
+
+class SessionTest : ShouldSpec({
+ should("include all environment variables") {
+ Session.clear()
+ Session.updateEnvironmentVariables()
+ Session.contains("environment:PATH") shouldBe true
+ }
+
+ should("properly check existence") {
+ Session.clear()
+ Session.put("A", "B")
+ Session.contains("A") shouldBe true
+ Session.contains("C") shouldBe false
+ }
+
+ should("support insertion") {
+ Session.clear()
+ Session.put("A", "B")
+ Session.contains("A") shouldBe true
+ }
+
+ should("support get") {
+ Session.clear()
+ Session.put("A", "B")
+ Session["A"] shouldBe "B"
+ }
+
+ should("support removal") {
+ Session.clear()
+ Session.put("A", "B")
+ Session.put("C", "D")
+ Session.contains("A") shouldBe true
+ Session.contains("C") shouldBe true
+ Session.remove("A")
+ Session.contains("A") shouldBe false
+ Session.contains("C") shouldBe true
+ }
+
+ should("clear itself") {
+ Session.clear()
+ Session.put("A", "B")
+ Session.put("C", "D")
+ Session.contains("A") shouldBe true
+ Session.contains("C") shouldBe true
+ Session.clear()
+ Session.contains("A") shouldBe false
+ Session.contains("C") shouldBe false
+ }
+
+ should("throw on unknown removal") {
+ Session.clear()
+ Session.put("A", "B")
+ shouldNotThrow<AraraException> {
+ Session.remove("A")
+ }
+ shouldThrow<AraraException> {
+ Session.remove("C")
+ }
+ }
+
+ should("throw on unknown getter") {
+ Session.clear()
+ Session.put("A", "B")
+ Session["A"] shouldBe "B"
+ shouldThrow<AraraException> {
+ Session["C"]
+ }
+ }
+})
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/CommonUtilsTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/CommonUtilsTest.kt
new file mode 100644
index 0000000000..b77b901ef6
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/CommonUtilsTest.kt
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.utils
+
+import io.kotlintest.shouldBe
+import io.kotlintest.specs.ShouldSpec
+import org.islandoftex.arara.Arara
+import org.islandoftex.arara.configuration.AraraSpec
+import org.islandoftex.arara.localization.Language
+
+class CommonUtilsTest : ShouldSpec({
+ should("format bytes correctly") {
+ Arara.config[AraraSpec.Execution.language] = Language("en")
+ mapOf(800 to "800 B",
+ 1000 to "1.0 kB",
+ 1024 to "1.0 kB",
+ 1000000 to "1.0 MB").forEach { (key, value) ->
+ CommonUtils.byteSizeToString(key.toLong()) shouldBe value
+ }
+ }
+
+ should("find system utils") {
+ CommonUtils.isOnPath("echo") shouldBe true
+ }
+ should("not find utils with fantasy name") {
+ // hopefully no one will have such a command in the path…
+ CommonUtils.isOnPath("echoQuackForArara") shouldBe false
+ }
+
+ should("flatten lists correctly") {
+ CommonUtils.flatten(listOf(1, 2, listOf(3, 4, listOf(5, 6))))
+ .toSet() shouldBe (setOf(1, 2, 3, 4, 5, 6) as Set<Any>)
+ }
+})
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExecutionTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExecutionTest.kt
new file mode 100644
index 0000000000..a0cc52145a
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExecutionTest.kt
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.utils
+
+import io.kotlintest.DoNotParallelize
+import io.kotlintest.matchers.string.shouldContain
+import io.kotlintest.matchers.string.shouldNotContain
+import io.kotlintest.shouldBe
+import io.kotlintest.shouldNotBe
+import io.kotlintest.shouldThrow
+import io.kotlintest.specs.ShouldSpec
+import java.io.ByteArrayOutputStream
+import java.io.File
+import java.io.PrintStream
+import java.nio.file.Paths
+import kotlin.time.ExperimentalTime
+import org.islandoftex.arara.Arara
+import org.islandoftex.arara.configuration.AraraSpec
+import org.islandoftex.arara.configuration.Configuration
+import org.islandoftex.arara.filehandling.FileSearchingUtils
+import org.islandoftex.arara.model.AraraException
+import org.islandoftex.arara.model.Extractor
+import org.islandoftex.arara.model.Interpreter
+import org.islandoftex.arara.ruleset.DirectiveUtils
+
+@ExperimentalTime
+@DoNotParallelize
+class ExecutionTest : ShouldSpec({
+ fun getPathForTest(name: String): String = "src/test/resources/executiontests/$name"
+ fun outputForTest(testName: String, fileName: String = "$testName.tex"):
+ String {
+ val sysout = System.out
+ val output = ByteArrayOutputStream()
+ try {
+ System.setOut(PrintStream(output))
+ Arara.config[AraraSpec.Execution.workingDirectory] =
+ Paths.get(getPathForTest(testName))
+ Configuration.load()
+ Arara.config[AraraSpec.Execution.verbose] = true
+ FileSearchingUtils.discoverFile(fileName)
+ val directives = DirectiveUtils.process(Extractor.extract(
+ File("${getPathForTest(testName)}/$fileName")))
+ Interpreter(directives).execute()
+ return output.toByteArray().toString(Charsets.UTF_8)
+ } catch (ex: Exception) {
+ throw ex
+ } finally {
+ System.setOut(sysout)
+ output.close()
+ }
+ }
+
+ should("be able to store variables sessions") {
+ outputForTest("sessions") shouldContain "MeowQuack"
+ }
+
+ should("honor falsy existence test") {
+ val file = File(getPathForTest("conditionals") + "/conditionals.quack")
+ if (file.exists()) file.delete()
+ val output = outputForTest("conditionals")
+ output shouldContain "QuackOne"
+ output shouldContain "QuackFour"
+ output shouldNotContain "QuackTwo"
+ output shouldNotContain "QuackThree"
+ }
+ should("honor truthy existence (falsy contains) test") {
+ val file = File(getPathForTest("conditionals") + "/conditionals.quack")
+ file.writeText("Meow")
+ val output = outputForTest("conditionals")
+ file.delete()
+ output shouldContain "QuackOne"
+ output shouldContain "QuackFour"
+ output shouldContain "QuackTwo"
+ output shouldNotContain "QuackThree"
+ }
+ should("honor truthy contains test") {
+ val file = File(getPathForTest("conditionals") + "/conditionals.quack")
+ file.writeText("Duck")
+ val output = outputForTest("conditionals")
+ file.delete()
+ output shouldContain "QuackOne"
+ output shouldContain "QuackFour"
+ output shouldContain "QuackTwo"
+ output shouldContain "QuackThree"
+ }
+
+ should("track changes") {
+ val file = File(getPathForTest("changes") + "/arara.yaml")
+ if (file.exists()) file.delete()
+ outputForTest("changes") shouldContain "QuackOne"
+ outputForTest("changes") shouldNotContain "QuackOne"
+ }
+
+ should("gracefully halt on halt rule") {
+ val output = outputForTest("halt")
+ output shouldContain "QuackOne"
+ output shouldNotContain "QuackTwo"
+ CommonUtils.exitStatus shouldBe 0
+ }
+ should("forcefully halt on halt error rule") {
+ val output = outputForTest("halt-error")
+ output shouldContain "QuackOne"
+ output shouldNotContain "QuackTwo"
+ CommonUtils.exitStatus shouldNotBe 0
+ }
+
+ should("fail on invalid config") {
+ val exception = shouldThrow<AraraException> {
+ outputForTest("invalid-config")
+ }
+ exception.message shouldContain "could not parse the configuration"
+ }
+
+ should("read foreign extension") {
+ val output = outputForTest("foreign-extension", "foreign-extension.my")
+ output shouldContain "QuackOne"
+ }
+ should("fail on unknown extension") {
+ shouldThrow<AraraException> {
+ outputForTest("foreign-extension", "foreign-extension.xy")
+ }
+ }
+ should("accept empty pattern on known extension") {
+ val output = outputForTest("known-extension")
+ output shouldContain "QuackOne"
+ }
+
+ should("execute option-less directives") {
+ val output = outputForTest("simple-directive")
+ output shouldContain "The echoer"
+ output shouldContain "SUCCESS"
+ }
+ should("execute directive with options") {
+ val output = outputForTest("directive-with-options")
+ output shouldContain "The echoer"
+ output shouldContain "batchmode"
+ output shouldContain "SUCCESS"
+ output shouldNotContain "FAILURE"
+ }
+})
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExtensionTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExtensionTest.kt
new file mode 100644
index 0000000000..cd41545ee9
--- /dev/null
+++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/utils/ExtensionTest.kt
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.utils
+
+import io.kotlintest.shouldBe
+import io.kotlintest.shouldThrow
+import io.kotlintest.specs.ShouldSpec
+
+class ExtensionTest : ShouldSpec({
+ should("abbreviate strings correctly") {
+ "Quack quack".abbreviate(6) shouldBe "Quack…"
+ "Quack Quack".abbreviate(80) shouldBe "Quack Quack"
+ shouldThrow<IllegalArgumentException> { "Quack".abbreviate(1) }
+ }
+
+ should("center strings correctly") {
+ "Quack".center(3, '-') shouldBe "Quack"
+ "Quack".center(9, '-') shouldBe "--Quack--"
+ }
+
+ should("wrap strings correctly") {
+ "This text should be wrapped".wrap(10) shouldBe "This text\nshould be\nwrapped"
+ }
+})
diff --git a/support/arara/source/src/test/resources/executiontests/changes/arara.yaml b/support/arara/source/src/test/resources/executiontests/changes/arara.yaml
new file mode 100644
index 0000000000..3014ff9662
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/changes/arara.yaml
@@ -0,0 +1,3 @@
+!database
+map:
+ "/home/paulo/Projetos/arara/application/src/test/resources/executiontests/changes/changes.tex": "404aaef6" \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/changes/arararc.yaml b/support/arara/source/src/test/resources/executiontests/changes/arararc.yaml
new file mode 100644
index 0000000000..54afa4c5fc
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/changes/arararc.yaml
@@ -0,0 +1,3 @@
+!config
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/changes/changes.tex b/support/arara/source/src/test/resources/executiontests/changes/changes.tex
new file mode 100644
index 0000000000..10646cc412
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/changes/changes.tex
@@ -0,0 +1,3 @@
+% arara: echoone if changed('tex')
+Quack
+\bye
diff --git a/support/arara/source/src/test/resources/executiontests/changes/echoone.yaml b/support/arara/source/src/test/resources/executiontests/changes/echoone.yaml
new file mode 100644
index 0000000000..7c304b991f
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/changes/echoone.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/conditionals/arararc.yaml b/support/arara/source/src/test/resources/executiontests/conditionals/arararc.yaml
new file mode 100644
index 0000000000..54afa4c5fc
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/conditionals/arararc.yaml
@@ -0,0 +1,3 @@
+!config
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/conditionals/conditionals.tex b/support/arara/source/src/test/resources/executiontests/conditionals/conditionals.tex
new file mode 100644
index 0000000000..35a3208e12
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/conditionals/conditionals.tex
@@ -0,0 +1,6 @@
+% arara: echoone
+% arara: echotwo if exists('quack')
+% arara: echothree if (exists('quack') && found('quack', 'Duck'))
+% arara: echofour
+Quack
+\bye
diff --git a/support/arara/source/src/test/resources/executiontests/conditionals/echofour.yaml b/support/arara/source/src/test/resources/executiontests/conditionals/echofour.yaml
new file mode 100644
index 0000000000..17db18947c
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/conditionals/echofour.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echofour
+name: Test rule for conditionals 4
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackFour');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/conditionals/echoone.yaml b/support/arara/source/src/test/resources/executiontests/conditionals/echoone.yaml
new file mode 100644
index 0000000000..7c304b991f
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/conditionals/echoone.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/conditionals/echothree.yaml b/support/arara/source/src/test/resources/executiontests/conditionals/echothree.yaml
new file mode 100644
index 0000000000..4f71872321
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/conditionals/echothree.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echothree
+name: Test rule for conditionals 3
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackThree');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/conditionals/echotwo.yaml b/support/arara/source/src/test/resources/executiontests/conditionals/echotwo.yaml
new file mode 100644
index 0000000000..61915393b5
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/conditionals/echotwo.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echotwo
+name: Test rule for conditionals 2
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackTwo');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/directive-with-options/arararc.yaml b/support/arara/source/src/test/resources/executiontests/directive-with-options/arararc.yaml
new file mode 100644
index 0000000000..54afa4c5fc
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/directive-with-options/arararc.yaml
@@ -0,0 +1,3 @@
+!config
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/directive-with-options/directive-with-options.tex b/support/arara/source/src/test/resources/executiontests/directive-with-options/directive-with-options.tex
new file mode 100644
index 0000000000..db521b5ce1
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/directive-with-options/directive-with-options.tex
@@ -0,0 +1,6 @@
+% arara: echoone: { interaction: batchmode }
+% arara: echoone: { synctex: 1 }
+% arara: echoone: { synctex: yes }
+% arara: echoone: { extensions: [aux, log, pdf] }
+Quack
+\bye
diff --git a/support/arara/source/src/test/resources/executiontests/directive-with-options/echoone.yaml b/support/arara/source/src/test/resources/executiontests/directive-with-options/echoone.yaml
new file mode 100644
index 0000000000..825edea9bb
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/directive-with-options/echoone.yaml
@@ -0,0 +1,36 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne', interaction, synctex);
+ }
+arguments:
+- identifier: interaction
+ flag: >
+ @{
+ if ([ 'batchmode', 'nonstopmode', 'scrollmode',
+ 'errorstopmode' ].contains(parameters.interaction)) {
+ return '--interaction='.concat(parameters.interaction);
+ }
+ else {
+ throwError('The provided interaction value is not valid.');
+ }
+ }
+- identifier: synctex
+ flag: >
+ @{
+ isTrue(parameters.synctex, '--synctex=1', '--synctex=0')
+ }
+- identifier: extensions
+ flag: >
+ @{
+ if (isList(parameters.extensions)) {
+ return parameters.extensions;
+ }
+ else {
+ throwError('I was expecting a list of extensions.');
+ }
+ }
diff --git a/support/arara/source/src/test/resources/executiontests/foreign-extension/arararc.yaml b/support/arara/source/src/test/resources/executiontests/foreign-extension/arararc.yaml
new file mode 100644
index 0000000000..f1b78d5861
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/foreign-extension/arararc.yaml
@@ -0,0 +1,6 @@
+!config
+paths:
+ - './'
+filetypes:
+ - extension: my
+ pattern: ^\s*%\s+ \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/foreign-extension/echoone.yaml b/support/arara/source/src/test/resources/executiontests/foreign-extension/echoone.yaml
new file mode 100644
index 0000000000..7c304b991f
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/foreign-extension/echoone.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.my b/support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.my
new file mode 100644
index 0000000000..9947e30964
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.my
@@ -0,0 +1,3 @@
+% arara: echoone
+Quack
+\bye \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.xy b/support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.xy
new file mode 100644
index 0000000000..9947e30964
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/foreign-extension/foreign-extension.xy
@@ -0,0 +1,3 @@
+% arara: echoone
+Quack
+\bye \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/halt-error/arararc.yaml b/support/arara/source/src/test/resources/executiontests/halt-error/arararc.yaml
new file mode 100644
index 0000000000..54afa4c5fc
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt-error/arararc.yaml
@@ -0,0 +1,3 @@
+!config
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/halt-error/echoone.yaml b/support/arara/source/src/test/resources/executiontests/halt-error/echoone.yaml
new file mode 100644
index 0000000000..7c304b991f
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt-error/echoone.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/halt-error/echotwo.yaml b/support/arara/source/src/test/resources/executiontests/halt-error/echotwo.yaml
new file mode 100644
index 0000000000..61915393b5
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt-error/echotwo.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echotwo
+name: Test rule for conditionals 2
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackTwo');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/halt-error/halt-error.tex b/support/arara/source/src/test/resources/executiontests/halt-error/halt-error.tex
new file mode 100644
index 0000000000..cf8d291ccf
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt-error/halt-error.tex
@@ -0,0 +1,5 @@
+% arara: echoone
+% arara: halt
+% arara: echotwo
+Quack
+\bye \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/halt-error/halt.yaml b/support/arara/source/src/test/resources/executiontests/halt-error/halt.yaml
new file mode 100644
index 0000000000..53df1a295b
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt-error/halt.yaml
@@ -0,0 +1,16 @@
+!config
+# Arara, the cool TeX automation tool
+# Copyright (c) 2018, Paulo Roberto Massa Cereda
+# All rights reserved.
+#
+# This rule is part of arara.
+identifier: halt
+name: Halt
+commands:
+ - name: The halt trigger
+ command: >
+ @{
+ halt(1);
+ return true;
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/halt/arararc.yaml b/support/arara/source/src/test/resources/executiontests/halt/arararc.yaml
new file mode 100644
index 0000000000..54afa4c5fc
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt/arararc.yaml
@@ -0,0 +1,3 @@
+!config
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/halt/echoone.yaml b/support/arara/source/src/test/resources/executiontests/halt/echoone.yaml
new file mode 100644
index 0000000000..7c304b991f
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt/echoone.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/halt/echotwo.yaml b/support/arara/source/src/test/resources/executiontests/halt/echotwo.yaml
new file mode 100644
index 0000000000..61915393b5
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt/echotwo.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echotwo
+name: Test rule for conditionals 2
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackTwo');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/halt/halt.tex b/support/arara/source/src/test/resources/executiontests/halt/halt.tex
new file mode 100644
index 0000000000..cf8d291ccf
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt/halt.tex
@@ -0,0 +1,5 @@
+% arara: echoone
+% arara: halt
+% arara: echotwo
+Quack
+\bye \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/halt/halt.yaml b/support/arara/source/src/test/resources/executiontests/halt/halt.yaml
new file mode 100644
index 0000000000..1c14644bcb
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/halt/halt.yaml
@@ -0,0 +1,19 @@
+!config
+# Arara, the cool TeX automation tool
+# Copyright (c) 2020, Island of TeX
+# All rights reserved.
+#
+# This rule is part of arara.
+identifier: halt
+name: Halt
+authors:
+- Heiko Oberdiek
+- Island of TeX
+commands:
+- name: The halt trigger
+ command: >
+ @{
+ halt(0);
+ return true;
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/invalid-config/arararc.yaml b/support/arara/source/src/test/resources/executiontests/invalid-config/arararc.yaml
new file mode 100644
index 0000000000..e6edd71dba
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/invalid-config/arararc.yaml
@@ -0,0 +1,2 @@
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/invalid-config/invalid-config.tex b/support/arara/source/src/test/resources/executiontests/invalid-config/invalid-config.tex
new file mode 100644
index 0000000000..24b11d5eb3
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/invalid-config/invalid-config.tex
@@ -0,0 +1,3 @@
+% arara: pdftex
+Quack
+\bye \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/known-extension/arararc.yaml b/support/arara/source/src/test/resources/executiontests/known-extension/arararc.yaml
new file mode 100644
index 0000000000..5342ec007e
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/known-extension/arararc.yaml
@@ -0,0 +1,5 @@
+!config
+paths:
+ - './'
+filetypes:
+ - extension: tex \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/known-extension/echoone.yaml b/support/arara/source/src/test/resources/executiontests/known-extension/echoone.yaml
new file mode 100644
index 0000000000..7c304b991f
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/known-extension/echoone.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/known-extension/known-extension.tex b/support/arara/source/src/test/resources/executiontests/known-extension/known-extension.tex
new file mode 100644
index 0000000000..9947e30964
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/known-extension/known-extension.tex
@@ -0,0 +1,3 @@
+% arara: echoone
+Quack
+\bye \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/sessions/arararc.yaml b/support/arara/source/src/test/resources/executiontests/sessions/arararc.yaml
new file mode 100644
index 0000000000..54afa4c5fc
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/sessions/arararc.yaml
@@ -0,0 +1,3 @@
+!config
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/sessions/sessionrule.yaml b/support/arara/source/src/test/resources/executiontests/sessions/sessionrule.yaml
new file mode 100644
index 0000000000..9b26f740d7
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/sessions/sessionrule.yaml
@@ -0,0 +1,16 @@
+!config
+identifier: sessionrule
+name: Test rule for sessions
+commands:
+ - name: The echoer
+ command: >
+ @{
+ getSession().put('quack', 'Quack');
+ return getCommand('echo', 'Quack');
+ }
+ - name: The echoer mark II
+ command: >
+ @{
+ return getCommand('echo', 'Meow' + getSession().get('quack'));
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/sessions/sessions.tex b/support/arara/source/src/test/resources/executiontests/sessions/sessions.tex
new file mode 100644
index 0000000000..9cfb354cdf
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/sessions/sessions.tex
@@ -0,0 +1,3 @@
+% arara: sessionrule
+Quack
+\bye \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/simple-directive/arararc.yaml b/support/arara/source/src/test/resources/executiontests/simple-directive/arararc.yaml
new file mode 100644
index 0000000000..54afa4c5fc
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/simple-directive/arararc.yaml
@@ -0,0 +1,3 @@
+!config
+paths:
+ - './' \ No newline at end of file
diff --git a/support/arara/source/src/test/resources/executiontests/simple-directive/echoone.yaml b/support/arara/source/src/test/resources/executiontests/simple-directive/echoone.yaml
new file mode 100644
index 0000000000..7c304b991f
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/simple-directive/echoone.yaml
@@ -0,0 +1,10 @@
+!config
+identifier: echoone
+name: Test rule for conditionals 1
+commands:
+ - name: The echoer
+ command: >
+ @{
+ return getCommand('echo', 'QuackOne');
+ }
+arguments: []
diff --git a/support/arara/source/src/test/resources/executiontests/simple-directive/simple-directive.tex b/support/arara/source/src/test/resources/executiontests/simple-directive/simple-directive.tex
new file mode 100644
index 0000000000..8d8f2cf697
--- /dev/null
+++ b/support/arara/source/src/test/resources/executiontests/simple-directive/simple-directive.tex
@@ -0,0 +1,3 @@
+% arara: echoone
+Quack
+\bye