diff options
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/IDLv4/annotations/Annotation_Test.cpp | 62 | ||||
-rw-r--r-- | TAO/tests/IDLv4/annotations/Annotation_Test.h | 17 |
2 files changed, 38 insertions, 41 deletions
diff --git a/TAO/tests/IDLv4/annotations/Annotation_Test.cpp b/TAO/tests/IDLv4/annotations/Annotation_Test.cpp index fbc52976148..e12dc670b93 100644 --- a/TAO/tests/IDLv4/annotations/Annotation_Test.cpp +++ b/TAO/tests/IDLv4/annotations/Annotation_Test.cpp @@ -1,5 +1,6 @@ #include "Annotation_Test.h" -#include "global_extern.h" + +#include <global_extern.h> unsigned Annotation_Test::failed_test_count_ = 0; unsigned Annotation_Test::total_test_count_ = 0; @@ -80,7 +81,6 @@ Annotation_Test::last_warning (UTL_Error::ErrorCode last_warning) return *this; } - Annotation_Test & Annotation_Test::run (const std::string &idl) { @@ -194,7 +194,6 @@ Annotation_Test::assert_node (const char *name, UTL_Scope *from) return node; } - AST_Annotation_Decl * Annotation_Test::assert_annotation_decl (const char *name) { @@ -348,7 +347,6 @@ Annotation_Test::get_annotation_member ( return member; } - AST_Annotation_Member * Annotation_Test::get_annotation_member ( AST_Annotation_Appl *anno_appl, const char *name) @@ -417,7 +415,6 @@ Annotation_Test::assert_annotation_member_value ( equal = (*expected) == member_value; } - if (!equal) { char *member_name = member->name ()->get_string_copy (); @@ -492,37 +489,36 @@ Annotation_Test::results () void Annotation_Test::print_idl_with_line_numbers () { - const long last_error_line = idl_global->err ()->last_error_lineno; - const long last_warning_line = idl_global->err ()->last_warning_lineno; - const long marked_line = last_error_line != -1 ? - last_error_line : last_warning_line; - - std::string line; - long line_number = 1; - for (long i = 0; i < static_cast<long> (idl_.length ()); ++i) - { - const char c = idl_[i]; - if (c == '\n') - { - const bool mark_line = line_number == marked_line; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%C%c%4u: %C%C\n"), + static const char* start_marker = #ifndef ACE_WIN32 - mark_line ? "\x1b[31m" : + "\x1b[31m" #endif - "", - mark_line ? '>' : ' ', - line_number, line.c_str (), + ">"; + static const char* end_marker = #ifndef ACE_WIN32 - mark_line ? "\x1b[0m" : + "\x1b[0m" #endif - "")); - line = ""; - line_number++; - } - else - { - line += c; - } + ""; + const long last_error_line = idl_global->err ()->last_error_lineno; + const long marked_line = last_error_line != -1 ? + last_error_line : idl_global->err ()->last_warning_lineno; + const size_t char_count = idl_.length (); + + long line_number = 0; + for (size_t start = 0; start < char_count;) + { + ++line_number; + const size_t end = idl_.find ('\n', start); + const std::string line = idl_.substr (start, end - start); + const bool mark_line = line_number == marked_line; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%C%4u: %C%C\n"), + mark_line ? start_marker : " ", + line_number, line.c_str (), + mark_line ? end_marker : "")); + if (end == std::string::npos) { + break; + } + start = end + 1; } } diff --git a/TAO/tests/IDLv4/annotations/Annotation_Test.h b/TAO/tests/IDLv4/annotations/Annotation_Test.h index ce199391fd4..d5e351c0dd4 100644 --- a/TAO/tests/IDLv4/annotations/Annotation_Test.h +++ b/TAO/tests/IDLv4/annotations/Annotation_Test.h @@ -56,14 +56,15 @@ public: template <typename T> T *assert_node (const char *name, UTL_Scope *from = 0) { - T *cast = dynamic_cast<T*> (assert_node (name, from)); - if (!cast) { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Annotation Test Error: %C:\n") - ACE_TEXT ("assert_node: Failed to cast node to requested type!\n"), - name_)); - failed (); - } + T *cast = dynamic_cast<T *> (assert_node (name, from)); + if (!cast) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Annotation Test Error: %C:\n") + ACE_TEXT ("assert_node: Failed to cast node to requested type!\n"), + name_.c_str ())); + failed (); + } return cast; } |