vty: check for duplicate flags in application specific attributes
This would facilitate detecting duplicates on early development stages.
Change-Id: I4e27d6e89d3f851b5ea4f00da01e7093afa537b2
Related: SYS#4937
diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c
index b2d34ad..1608b83 100644
--- a/tests/vty/vty_test.c
+++ b/tests/vty/vty_test.c
@@ -513,11 +513,29 @@
destroy_test_vty(&test, vty);
}
+/* Application specific attributes */
+enum vty_test_attr {
+ VTY_TEST_ATTR_FOO = 0,
+ VTY_TEST_ATTR_BAR,
+ VTY_TEST_ATTR_ZOO,
+ VTY_TEST_ATTR_FOO_DUP,
+ VTY_TEST_ATTR_ZOO_DUP,
+};
+
int main(int argc, char **argv)
{
struct vty_app_info vty_info = {
.name = "VtyTest",
.version = 0,
+ .usr_attr_letters = {
+ [VTY_TEST_ATTR_FOO] = 'f',
+ [VTY_TEST_ATTR_BAR] = 'b',
+ [VTY_TEST_ATTR_ZOO] = 'z',
+
+ /* Duplicate detection check */
+ [VTY_TEST_ATTR_FOO_DUP] = 'f',
+ [VTY_TEST_ATTR_ZOO_DUP] = 'z',
+ },
};
const struct log_info_cat default_categories[] = {};
diff --git a/tests/vty/vty_test.err b/tests/vty/vty_test.err
index 8ad4fd9..25c94e6 100644
--- a/tests/vty/vty_test.err
+++ b/tests/vty/vty_test.err
@@ -1,3 +1,5 @@
+Found duplicate flag letter 'f' in application specific attributes (index 0 vs 3)! Please fix.
+Found duplicate flag letter 'z' in application specific attributes (index 2 vs 4)! Please fix.
Got VTY event: 2
Got VTY event: 2
Got VTY event: 2