2 * Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.parser.stmt.rfc7950;
10 import static org.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.CoreMatchers.startsWith;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.stmt.AbstractYangTest;
16 public class Bug6901Test extends AbstractYangTest {
18 public void ifFeature11EnumBitTest() {
19 assertEffectiveModel("/rfc7950/bug6901/foo.yang");
23 public void ifFeatureOnDefaultValueEnumTest() {
24 assertSourceException(
25 startsWith("Leaf '(foo)enum-leaf' has default value 'two' marked with an if-feature statement."),
26 "/rfc7950/bug6901/invalid-foo-enum.yang");
30 public void ifFeatureOnDefaultValueEnumTest2() {
31 assertSourceException(
32 startsWith("Leaf '(foo)enum-leaf' has default value 'two' marked with an if-feature statement."),
33 "/rfc7950/bug6901/invalid-foo-enum-2.yang");
37 public void ifFeatureOnDefaultValueEnumTest3() {
38 assertSourceException(startsWith(
39 "Leaf '(foo)enum-leaf' has default value 'two' marked with an if-feature statement."),
40 "/rfc7950/bug6901/invalid-foo-enum-3.yang");
44 public void ifFeatureOnDefaultValueBitTest() {
45 assertSourceException(
46 startsWith("Typedef '(foo)bits-typedef-2' has default value 'two' marked with an if-feature statement."),
47 "/rfc7950/bug6901/invalid-foo-bit.yang");
51 public void ifFeatureOnDefaultValueUnionTest() {
52 assertSourceException(
53 startsWith("Leaf '(foo)union-leaf' has default value 'two' marked with an if-feature statement."),
54 "/rfc7950/bug6901/invalid-foo-union.yang");
58 public void unsupportedFeatureTest() {
59 assertSourceException(containsString("has default value 'two' marked with an if-feature statement"),
60 "/rfc7950/bug6901/invalid-foo-enum.yang");
64 public void ifFeature10EnumTest() {
65 assertInvalidSubstatementException(startsWith("IF_FEATURE is not valid for ENUM"),
66 "/rfc7950/bug6901/invalid-foo-10-enum.yang");
70 public void ifFeature10BitTest() {
71 assertInvalidSubstatementException(startsWith("IF_FEATURE is not valid for BIT"),
72 "/rfc7950/bug6901/invalid-foo-10-bit.yang");