diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2019-01-10 15:06:53 -0600 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2019-01-10 15:06:53 -0600 |
commit | 08d09101fd98d25957c94a7a8778e4b1ddec771c (patch) | |
tree | b4d9aef3ab6f947ed30f93e11a78dc51de77af2c | |
parent | 3507f3c21ac55d6ffe1806a1b46fcbc7113bba55 (diff) | |
download | ATCD-08d09101fd98d25957c94a7a8778e4b1ddec771c.tar.gz |
annotest_idl: Add test for #723
-rw-r--r-- | TAO/tests/IDLv4/annotations/be_init.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/TAO/tests/IDLv4/annotations/be_init.cpp b/TAO/tests/IDLv4/annotations/be_init.cpp index f2936a93376..aa8a327ca78 100644 --- a/TAO/tests/IDLv4/annotations/be_init.cpp +++ b/TAO/tests/IDLv4/annotations/be_init.cpp @@ -1026,7 +1026,7 @@ BE_post_init (char *[], long) try { idl_global->unknown_annotations_ = IDL_GlobalData::UNKNOWN_ANNOTATIONS_ERROR; - Annotation_Test t ("Optionally, Unknown Annotation Application Causes Err"); + Annotation_Test t ("Optionally, Unknown Annotation Application Causes Error"); t.last_error (UTL_Error::EIDL_LOOKUP_ERROR).error_count (1); t.run ( "struct struct10 {\n" @@ -1213,6 +1213,39 @@ BE_post_init (char *[], long) ).assert_annotation_decl ("::@annotationannotation"); } catch (Failed const &) {} + /* ------------------------------------------------------------------------- + * Struct Field Visibility Must be vis_NA + * ------------------------------------------------------------------------- + * Test for: https://github.com/DOCGroup/ACE_TAO/issues/784 + * + * In the bison file, visibility for valuetype state members (which are the + * same class as normal fields) was being passed through the bison stack. + * When adding support for annotations, the grammar was changed and it was + * broken, causing bogus data to be passed to regular struct field as their + * visibility. + * + * This is a test to assert that struct fields have vis_NA. This can't be put + * anywhere else at the moment because this is the only test that's an + * instance of the idl compiler. + */ + try { + Annotation_Test t ("Struct Field Visibility Must be vis_NA"); + AST_Decl *member_decl = t.assert_node ("struct1::member"); + AST_Field *member = AST_Field::narrow_from_decl (member_decl); + if (!member) + { + t.failed ("Could Not Get member"); + } + if (member->visibility() != AST_Field::vis_NA) + { + char buffer[100]; + ACE_OS::snprintf (&buffer[0], 100, + "struct field visibility is %u, which is not equal to vis_NA", + static_cast<unsigned> (member->visibility ())); + t.failed (&buffer[0]); + } + } catch (Failed const &) {} + // Done, Print Overall Results if (failed_test_count) { |