tests: Fix yang if-feature enum test
The original idea was that enum_ doesn't have a deafult constructor, so
I use lambda to assign a value to it. Lambdas are cool and all, but
SECTION doesn't work inside a lambda like that. Found via code coverage.
Change-Id: I363040ad894bb2fc537b6f3dc9f543ead2501d71
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 9419051..dd7a031 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -688,18 +688,16 @@
node.first = "example-schema";
node.second = "activePort";
- yang::Enum enums = [&ys]() {
- SECTION("weird ports disabled")
- {
- return createEnum({"utf2", "utf3"});
- }
- SECTION("weird ports enabled")
- {
- ys.enableFeature("example-schema", "weirdPortNames");
- return createEnum({"WEIRD", "utf2", "utf3"});
- }
- __builtin_unreachable();
- }();
+ yang::Enum enums({});
+ SECTION("weird ports disabled")
+ {
+ enums = createEnum({"utf2", "utf3"});
+ }
+ SECTION("weird ports enabled")
+ {
+ ys.enableFeature("example-schema", "weirdPortNames");
+ enums = createEnum({"WEIRD", "utf2", "utf3"});
+ }
type = yang::Union{{
yang::TypeInfo{createEnum({"wlan0", "wlan1"})},