* gdb.python/py-type.exp: New testcases for exceptions on scalar types
authorPaul Koning <pkoning@equallogic.com>
Tue, 15 Nov 2011 21:17:40 +0000 (21:17 +0000)
committerPaul Koning <pkoning@equallogic.com>
Tue, 15 Nov 2011 21:17:40 +0000 (21:17 +0000)
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-type.exp

index d71e46c..b653057 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-15  Paul Koning  <paul_koning@dell.com>
+
+       * gdb.python/py-type.exp: New testcases for exceptions on scalar
+       types.
+
 2011-11-14  Doug Evans  <dje@google.com>
 
        * gdb.base/shell.exp: New file.
index 3578a7e..056f4e1 100644 (file)
@@ -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