Bug 2431: YangTools grammar misses unknown statement in some statements
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / impl / YangParserTest.java
index b3f408ef4e6771bb5e171405afdb0971c8f199a5..760bee4bb05bb2999a51b5f46f7a443252d8a750 100644 (file)
@@ -961,4 +961,23 @@ public class YangParserTest {
             fail("YangParseException should not be thrown");
         }
     }
+
+    @Test
+    public void unknownStatementsInStatementsTest() throws IOException, URISyntaxException {
+        File yangModule1 = new File(getClass().getResource("/yang-grammar-test/stmtsep-in-statements.yang").toURI());
+        File yangModule2 = new File(getClass().getResource("/yang-grammar-test/stmtsep-in-statements2.yang").toURI());
+        File yangSubModule = new File(getClass().getResource("/yang-grammar-test/stmtsep-in-statements-sub.yang").toURI());
+
+        List<File> yangs = new ArrayList<File>();
+        yangs.add(yangModule1);
+        yangs.add(yangModule2);
+        yangs.add(yangSubModule);
+
+        try {
+            YangParserImpl.getInstance().parseFiles(yangs);
+        } catch (YangParseException e) {
+            e.printStackTrace();
+            fail("YangParseException should not be thrown");
+        }
+    }
 }