From 7742673004afc257ab75255c7601347edc131c95 Mon Sep 17 00:00:00 2001 From: Paul Koning Date: Tue, 15 Nov 2011 21:17:40 +0000 Subject: [PATCH] * gdb.python/py-type.exp: New testcases for exceptions on scalar types --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.python/py-type.exp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d71e46c..b653057 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-11-15 Paul Koning + + * gdb.python/py-type.exp: New testcases for exceptions on scalar + types. + 2011-11-14 Doug Evans * gdb.base/shell.exp: New file. diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index 3578a7e..056f4e1 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -97,6 +97,16 @@ proc test_fields {lang} { gdb_test "python print \[(n, v.bitpos) for (n, v) in st.type.items()\]" {\[\('a', 0L\), \('b', 32L\)\]} "Check fields items list" gdb_test "python print 'a' in st.type" "True" "Check field name exists test" gdb_test "python print 'nosuch' in st.type" "False" "Check field name nonexists test" + gdb_test "python print not not st.type" "True" "Check conversion to bool" + + # Test rejection of mapping operations on scalar types + gdb_test "python print len (st.type\['a'\].type)" "TypeError: Type is not a structure, union, or enum type.*" + gdb_test "python print st.type\['a'\].type.has_key ('x')" "TypeError: Type is not a structure, union, or enum type.*" + gdb_test "python print st.type\['a'\].type.keys ()" "TypeError: Type is not a structure, union, or enum type.*" + gdb_test "python print st.type\['a'\].type\['x'\]" "TypeError: Type is not a structure, union, or enum type.*" + + # Test conversion to bool on scalar types + gdb_test "python print not not st.type\['a'\].type" "True" # Test regression PR python/10805 gdb_py_test_silent_cmd "print ar" "print value" 1 -- 2.7.4