[PATCH 1/2] Fix tests/pointer-deref.c regression



Hello,

When I made the change to support de-referencing expressions
evaluation when hovering[1], I introduced an artificial regression in
the test suite.  I have added a new variable to a function in the
tests/pointer-deref.cc test, but forgot to adjust the test program
tests/test-local-vars-list.cc that is debugging that file by listing
and inspecting the local variables of one of its function.

The patch below adjusts both tests/test-local-vars-list.cc and
tests/pointer-deref.cc to fix the regression.

Tested and applied to master and gtk2-branch.

[1]: http://mail.gnome.org/archives/nemiver-list/2011-September/msg00003.html

From: Dodji Seketeli <dodji seketeli org>
Date: Sun, 4 Sep 2011 10:44:39 +0200
Subject: [PATCH 1/2] Fix tests/pointer-deref.c regression

	* tests/test-local-vars-list.cc (on_stopped_signal): Acknowledge
	that we now have 4 local variables, not 3 like before.  Expect
	that the types of 4 variables got set.  Not 3 anymore.  Step
	further - until after the new variable gets instantiated - before
	querying the state of the local variables.
	(on_var_type_set): Acknowledge that we have a new local variable
	called "b".
---
 tests/pointer-deref.cc        |    3 ++-
 tests/test-local-vars-list.cc |   11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/pointer-deref.cc b/tests/pointer-deref.cc
index 76cfeb1..6e4c6ee 100644
--- a/tests/pointer-deref.cc
+++ b/tests/pointer-deref.cc
@@ -135,6 +135,7 @@ main ()
     foo *foo_ptr = new foo;
     bar *bar_ptr = new bar;
     baz *baz_ptr = new baz;
+    baz b;
 
     baz_ptr->set_a (10);
     baz_ptr->set_b (11);
@@ -157,7 +158,7 @@ main ()
         ;
     }
 
-    baz b;
+
     if (b.m_b) {
         ;
     }
diff --git a/tests/test-local-vars-list.cc b/tests/test-local-vars-list.cc
index 33b613f..ebed94a 100644
--- a/tests/test-local-vars-list.cc
+++ b/tests/test-local-vars-list.cc
@@ -34,9 +34,9 @@ on_stopped_signal (IDebugger::StopReason a_reason,
     if (a_reason == IDebugger::EXITED_NORMALLY) {
         //okay, time to get out. Let's check if the overall test
         //went like we want
-        BOOST_REQUIRE (nb_var_type_set == 3);
+        BOOST_REQUIRE (nb_var_type_set == 4);
         BOOST_REQUIRE (nb_var_value_set == 3);
-        BOOST_REQUIRE (a_var_list->get_raw_list ().size () == 3);
+        BOOST_REQUIRE (a_var_list->get_raw_list ().size () == 4);
         IDebugger::VariableSafePtr var;
         BOOST_REQUIRE (a_var_list->find_variable ("foo_ptr", var));
         BOOST_REQUIRE (var);
@@ -62,7 +62,7 @@ on_stopped_signal (IDebugger::StopReason a_reason,
         ++nb_stops;
         if (nb_stops == 1) {
             debugger->list_local_variables ();
-        } else if (nb_stops == 4) {
+        } else if (nb_stops == 6) {
             a_var_list->update_state ();
             debugger->do_continue ();
             return;
@@ -96,8 +96,9 @@ on_var_type_set (const IDebugger::VariableSafePtr &a_var)
     BOOST_REQUIRE (a_var->type () != "");
 
     if (a_var->name () == "foo_ptr"
-        ||a_var->name () == "bar_ptr"
-        ||a_var->name () == "baz_ptr") {
+        || a_var->name () == "bar_ptr"
+        || a_var->name () == "baz_ptr"
+        || a_var->name () == "b") {
         ++nb_var_type_set;
         MESSAGE ("variable type set: "
                  <<a_var->name () << ":" << a_var->type ());
-- 

		Dodji


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]