Resources spell testing library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
arspell-android
arspell-hunspell
arspell-langtool
arspell-md
arspell
gradle/wrapper
.codecov.yml
.travis.yml
LICENSE
build.gradle
gradle.properties
gradlew
gradlew.bat
readme.md
settings.gradle

readme.md

Arspell

Build Status codecov License: MIT Download

Android resource spell testing library

How to

dependencies {
    testImplementation('com.nikialeksey:arspell:3.0.1')
    testImplementation('com.nikialeksey:arspell-hunspell:3.0.1')
    testImplementation('com.nikialeksey:arspell-android:3.0.1')
}
class ResourcesTest {
    @Test
    fun enSpell() {
        val errors = DictionarySpell(
            HunspellDictionary(
                Hunspell(
                    "./src/test/assets/en_US/index.dic",
                    "./src/test/assets/en_US/index.aff"
                )
            ),
            AndroidStrings(File("./src/main/res/values-en/strings.xml"))
        ).check()
        Assert.assertTrue(ErrorMessage(errors).asString(), errors.isEmpty())
    }
}

Ignoring words and keys

class ResourcesTest {
    @Test
    fun enSpell() {
        val errors = DictionarySpell(
            HunspellDictionary(
                Hunspell(
                    "./src/test/assets/en_US/index.dic",
                    "./src/test/assets/en_US/index.aff"
                )
            ),
            IgnoreValuesStrings(
                IgnoreKeysStrings(
                    AndroidStrings(File("./src/test/res/values/dictionary.xml")),
                    setOf("ignored")
                ),
                setOf("QWE")
            )
        ).check()
        Assert.assertTrue(ErrorMessage(errors).asString(), errors.isEmpty())
    }
}

Checking every word in multiple dictionaries

class ResourcesTest {
    @Test
    fun ruEnSpell() {
        val errors = DictionarySpell(
            GroupSpell(
                listOf(
                    HunspellDictionary(
                        Hunspell(
                            "./src/test/assets/en_US/index.dic",
                            "./src/test/assets/en_US/index.aff"
                        )
                    ),
                    HunspellDictionary(
                        Hunspell(
                            "./src/test/assets/ru/index.dic",
                            "./src/test/assets/ru/index.aff"
                        )
                    )
                )
            ),
            AndroidStrings(File("./src/test/res/values/dictionary.xml"))
        ).check()
        Assert.assertTrue(ErrorMessage(errors).asString(), errors.isEmpty())
    }
}

Hunspell dictionaries

Dictionaries

Hunspell man for adding new words in any dictionary.

@todo #10:30m Write docs about language tool using

Publish

gradlew install
gradlew bintrayUpload