Search in sources :

Example 1 with RefMerge

use of net.morimekta.test.providence.config.RefMerge in project providence by morimekta.

the class ProvidenceConfigParserTest method testInternalReference.

@Test
public void testInternalReference() throws IOException {
    File a = writeContentTo("config.RefMerge {\n" + "  ref1 & first = {\n" + "    bool_value & boo = false\n" + "    msg_value & db {\n" + "      driver = \"Driver\"\n" + "    }\n" + "  }\n" + "  ref1_1 = first {\n" + "    i16_value = 12345\n" + "    msg_value & db2 = db {\n" + "      uri = \"someuri\"\n" + "    }\n" + "  }\n" + "  ref2 {\n" + "    bool_value = boo" + "    msg_value = db2\n" + "  }\n" + "}\n", temp.newFile("a.cfg"));
    try {
        ProvidenceConfigParser config = new ProvidenceConfigParser(registry, false);
        RefMerge merged = config.parseConfig(a.toPath(), (RefMerge) null).first;
        assertThat(debugString(merged), is("{\n" + "  ref1 = {\n" + "    bool_value = false\n" + "    msg_value = {\n" + "      driver = \"Driver\"\n" + "    }\n" + "  }\n" + "  ref1_1 = {\n" + "    bool_value = false\n" + "    i16_value = 12345\n" + "    msg_value = {\n" + "      uri = \"someuri\"\n" + "      driver = \"Driver\"\n" + "    }\n" + "  }\n" + "  ref2 = {\n" + "    bool_value = false\n" + "    msg_value = {\n" + "      uri = \"someuri\"\n" + "      driver = \"Driver\"\n" + "    }\n" + "  }\n" + "}"));
    } catch (ProvidenceConfigException e) {
        System.err.println(e.asString());
        throw e;
    }
}
Also used : RefMerge(net.morimekta.test.providence.config.RefMerge) File(java.io.File) ProvidenceConfigException(net.morimekta.providence.config.ProvidenceConfigException) Test(org.junit.Test)

Aggregations

File (java.io.File)1 ProvidenceConfigException (net.morimekta.providence.config.ProvidenceConfigException)1 RefMerge (net.morimekta.test.providence.config.RefMerge)1 Test (org.junit.Test)1