PR python/10676:
	* python/py-type.c: Include bcache.h, vec.h.
	(struct type_equality_entry): New.
	(compare_strings): New function.
	(check_types_equal): Likewise.
	(check_types_worklist): Likewise.
	(typy_richcompare): Likewise.
	(type_object_type): Set tp_richcompare field.
gdb/testsuite
	PR python/10676:
	* gdb.python/py-type.exp (test_fields): Add tests for type
	equality.
This commit is contained in:
Tom Tromey
2010-08-23 20:26:10 +00:00
parent 05d0e1e74e
commit d839c8a4e8
4 changed files with 220 additions and 1 deletions

View File

@@ -81,6 +81,10 @@ proc test_fields {lang} {
gdb_test "python print len(fields)" "2" "Check number of fields"
gdb_test "python print fields\[0\].name" "c" "Check class field c name"
gdb_test "python print fields\[1\].name" "d" "Check class field d name"
gdb_test "python print c.type == gdb.parse_and_eval('d').type" "False"
gdb_test "python print c.type == gdb.parse_and_eval('d').type.fields()\[0\].type" \
"True"
}
# Test normal fields usage in structs.
@@ -102,6 +106,8 @@ proc test_fields {lang} {
".1, 2." "cast to array with one argument"
gdb_test "python print ar\[0\].cast(ar\[0\].type.array(0, 1))" \
".1, 2." "cast to array with two arguments"
gdb_test "python print ar\[0\].type == ar\[0\].type" "True"
}
proc test_base_class {} {