Beispiel #1
0
        public void ParseMultiline_nodes()
        {
            KDLDocument actual = parser.Parse(
                "title \\\n" +
                "    \"Some title\"\n" +
                "my-node 1 2 \\    // comments are ok after \\\n" +
                "        3 4\n"
                );

            KDLDocument expected = doc(
                node("title", list("Some title")),
                node("my-node", list(1, 2, 3, 4))
                );

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void ParseComments()
        {
            KDLDocument actual = parser.Parse(
                "// C style\n" +

                "/*\n" +
                "C style multiline\n" +
                "*/\n" +

                "tag /*foo=true*/ bar=false\n" +

                "/*/*\n" +
                "hello\n" +
                "*/*/"
                );

            KDLDocument expected = doc(
                node("tag", dict("bar", false))
                );

            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
        public void ParseNestedChildNodes()
        {
            KDLDocument actual = parser.Parse(
                "content { \n" +
                "    section \"First section\" {\n" +
                "        paragraph \"This is the first paragraph\"\n" +
                "        paragraph \"This is the second paragraph\"\n" +
                "    }\n" +
                "}"
                );

            KDLDocument expected = doc(
                node("content",
                     node("section", list("First section"),
                          node("paragraph", list("This is the first paragraph")),
                          node("paragraph", list("This is the second paragraph"))
                          )
                     )
                );

            Assert.AreEqual(expected, actual);
        }