Search in sources :

Example 1 with StringOption

use of net.coderbot.iris.shaderpack.option.StringOption in project Iris by IrisShaders.

the class OptionDiscoverTest method testTrivialString.

private void testTrivialString(String base, String expectedOptionName, String expectedDefault, ImmutableList<String> expectedAllowed) {
    OptionAnnotatedSource source = new OptionAnnotatedSource(base);
    OptionSet options = source.getOptionSet(AbsolutePackPath.fromAbsolutePath("/<hardcoded>"), source.getBooleanDefineReferences().keySet());
    Assertions.assertEquals(options.getBooleanOptions().size(), 0, "Unexpectedly discovered a boolean option");
    if (options.getStringOptions().size() == 0) {
        Assertions.fail("No string options were discovered, diagnostics: " + source.getDiagnostics());
    }
    StringOption option = options.getStringOptions().values().iterator().next().getOption();
    Assertions.assertEquals(option.getName(), expectedOptionName);
    Assertions.assertEquals(option.getDefaultValue(), expectedDefault);
    Assertions.assertEquals(option.getAllowedValues(), expectedAllowed);
}
Also used : StringOption(net.coderbot.iris.shaderpack.option.StringOption) OptionAnnotatedSource(net.coderbot.iris.shaderpack.option.OptionAnnotatedSource) OptionSet(net.coderbot.iris.shaderpack.option.OptionSet)

Aggregations

OptionAnnotatedSource (net.coderbot.iris.shaderpack.option.OptionAnnotatedSource)1 OptionSet (net.coderbot.iris.shaderpack.option.OptionSet)1 StringOption (net.coderbot.iris.shaderpack.option.StringOption)1