Disable uses/augment statements of unsupported paths
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / YT1393Test.java
1 /*
2  * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.stmt;
9
10 import static org.junit.Assert.assertEquals;
11
12 import java.util.Set;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15
16 public class YT1393Test {
17     @Test
18     public void testUsesAugmentUnsupportedByFeatures() throws Exception {
19         final var module = StmtTestUtils.parseYangSource("/bugs/YT1393/foo.yang", Set.of())
20             .findModuleStatement(QName.create("foo", "foo"))
21             .orElseThrow();
22         assertEquals(4, module.effectiveSubstatements().size());
23     }
24
25     @Test
26     public void testUsesRefineUnsupportedByFeatures() throws Exception {
27         final var module = StmtTestUtils.parseYangSource("/bugs/YT1393/bar.yang", Set.of())
28             .findModuleStatement(QName.create("bar", "bar"))
29             .orElseThrow();
30         assertEquals(5, module.effectiveSubstatements().size());
31     }
32
33     @Test
34     public void testAugmentAugmentUnsupportedByFeatures() throws Exception {
35         final var module = StmtTestUtils.parseYangSource("/bugs/YT1393/baz.yang", Set.of())
36             .findModuleStatement(QName.create("baz", "baz"))
37             .orElseThrow();
38         assertEquals(5, module.effectiveSubstatements().size());
39     }
40 }