From 55a23d6dbb94dfc1cba99447c1edeaa51b5fbc12 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Sun, 16 Jun 2013 14:22:13 +0000 Subject: New port: devel/kyua: Kyua (pronounced Q.A.) is a testing framework for both developers and users. Kyua is different from most other testing frameworks in that it puts the end user experience before anything else. There are multiple reasons for users to run the tests themselves, and Kyua ensures that they can do so in the most convenient way. At the moment, Kyua is focused on implementing a solid foundation and a powerful command-line tool to run tests implemented with the Automated Testing Framework (ATF). Later on, Kyua will also provide a set of language bindings (C, C++ and shell, at the least) to ease the implementation of test cases in a variety of programming languages. In effect, Kyua is intended to be a replacement for ATF. WWW: https://code.google.com/p/kyua/ PR: ports/177641 Submitted by: asomers Reviewed by: Garrett Cooper --- devel/kyua/files/patch-utils-config-nodes.cpp | 88 +++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 devel/kyua/files/patch-utils-config-nodes.cpp (limited to 'devel/kyua/files/patch-utils-config-nodes.cpp') diff --git a/devel/kyua/files/patch-utils-config-nodes.cpp b/devel/kyua/files/patch-utils-config-nodes.cpp new file mode 100644 index 000000000000..7d3fac6423d0 --- /dev/null +++ b/devel/kyua/files/patch-utils-config-nodes.cpp @@ -0,0 +1,88 @@ +--- utils/config/nodes.cpp.old ++++ utils/config/nodes.cpp +@@ -112,11 +112,11 @@ config::detail::inner_node::lookup_ro(const tree_key& key, + return (*child_iter).second; + } else { + PRE(key_pos < key.size() - 1); +- try { +- const inner_node& child = dynamic_cast< const inner_node& >( +- *(*child_iter).second); +- return child.lookup_ro(key, key_pos + 1); +- } catch (const std::bad_cast& e) { ++ const inner_node* child = dynamic_cast< const inner_node* >( ++ (*child_iter).second); ++ if (child != NULL) { ++ return child->lookup_ro(key, key_pos + 1); ++ } else { + throw unknown_key_error( + key, "Cannot address incomplete configuration property '%s'"); + } +@@ -163,21 +163,19 @@ config::detail::inner_node::lookup_rw(const tree_key& key, + } + + if (key_pos == key.size() - 1) { +- try { +- leaf_node& child = dynamic_cast< leaf_node& >( +- *(*child_iter).second); +- return &child; +- } catch (const std::bad_cast& unused_error) { ++ leaf_node* child = dynamic_cast< leaf_node* >((*child_iter).second); ++ if (child != NULL) { ++ return child; ++ } else { + throw value_error(F("Invalid value for key '%s'") % + flatten_key(key)); + } + } else { + PRE(key_pos < key.size() - 1); +- try { +- inner_node& child = dynamic_cast< inner_node& >( +- *(*child_iter).second); +- return child.lookup_rw(key, key_pos + 1, new_node); +- } catch (const std::bad_cast& e) { ++ inner_node* child = dynamic_cast< inner_node* >((*child_iter).second); ++ if (child != NULL) { ++ return child->lookup_rw(key, key_pos + 1, new_node); ++ } else { + throw unknown_key_error( + key, "Cannot address incomplete configuration property '%s'"); + } +@@ -198,13 +196,14 @@ config::detail::inner_node::all_properties(properties_map& properties, + iter != _children.end(); ++iter) { + tree_key child_key = key; + child_key.push_back((*iter).first); +- try { +- leaf_node& child = dynamic_cast< leaf_node& >(*(*iter).second); +- if (child.is_set()) +- properties[flatten_key(child_key)] = child.to_string(); +- } catch (const std::bad_cast& unused_error) { +- inner_node& child = dynamic_cast< inner_node& >(*(*iter).second); +- child.all_properties(properties, child_key); ++ leaf_node* child = dynamic_cast< leaf_node* >((*iter).second); ++ if (child != NULL) { ++ if (child->is_set()) ++ properties[flatten_key(child_key)] = child->to_string(); ++ } else { ++ inner_node* child2 = dynamic_cast< inner_node* >((*iter).second); ++ INV(child2 != NULL); ++ child2->all_properties(properties, child_key); + } + } + } +@@ -261,11 +260,11 @@ config::detail::static_inner_node::define(const tree_key& key, + _children.insert(children_map::value_type(key[key_pos], child_ptr)); + child_ptr->define(key, key_pos + 1, new_node); + } else { +- try { +- static_inner_node& child = dynamic_cast< static_inner_node& >( +- *(*child_iter).second); +- child.define(key, key_pos + 1, new_node); +- } catch (const std::bad_cast& e) { ++ static_inner_node* child = dynamic_cast< static_inner_node* >( ++ (*child_iter).second); ++ if (child != NULL) { ++ child->define(key, key_pos + 1, new_node); ++ } else { + UNREACHABLE; + } + } -- cgit v1.2.3