aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2010-05-14 11:11:28 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2010-05-14 11:11:28 +0000
commit88d4aea7473bf93d98ba72a5f955f428cd365431 (patch)
treee69d248568991dfb44daad47c0c6ee6b8e8ea084 /gdb/testsuite
parentaf47dcbf0d148aba27ced058d6bfb83fd282b5c9 (diff)
downloadgdb-88d4aea7473bf93d98ba72a5f955f428cd365431.zip
gdb-88d4aea7473bf93d98ba72a5f955f428cd365431.tar.gz
gdb-88d4aea7473bf93d98ba72a5f955f428cd365431.tar.bz2
2010-05-14 Phil Muldoon <pmuldoon@redhat.com>
PR python/11482 * python/py-value.c (valpy_hash): New function. (value_object_type): Register valpy_hash. 2010-05-14 Phil Muldoon <pmuldoon@redhat.com> PR python/11482 * gdb.python/py-value.exp (test_value_hash): New function
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.python/py-value.exp18
2 files changed, 24 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index dd049b3..b6f36d7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-14 Phil Muldoon <pmuldoon@redhat.com>
+
+ PR python/11482
+
+ * gdb.python/py-value.exp (test_value_hash): New function.
+
2010-05-11 Pierre Muller <muller@ics.u-strasbg.fr>
PR exp/11530.
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index 3bfa173..67a2ff9 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -393,6 +393,23 @@ proc test_parse_and_eval {} {
"parse_and_eval type test"
}
+# Test that values are hashable.
+proc test_value_hash {} {
+ gdb_py_test_multiple "Simple Python value dictionary" \
+ "python" "" \
+ "one = gdb.Value(1)" "" \
+ "two = gdb.Value(2)" "" \
+ "three = gdb.Value(3)" "" \
+ "vdict = {one:\"one str\",two:\"two str\",three:\"three str\"}" "" \
+ "end"
+ gdb_test "python print vdict\[one\]" "one str" "Test dictionary hash"
+ gdb_test "python print vdict\[two\]" "two str" "Test dictionary hash"
+ gdb_test "python print vdict\[three\]" "three str" "Test dictionary hash"
+ gdb_test "python print one.__hash__() == hash(one)" "True" "Test inbuilt hash"
+ gdb_test "python print one.__hash__() == id(one)" "True" "Test inbuilt id"
+}
+
+
# Start with a fresh gdb.
gdb_exit
@@ -409,6 +426,7 @@ test_value_boolean
test_value_compare
test_objfiles
test_parse_and_eval
+test_value_hash
# The following tests require execution.