gdb/testsuite: add simavr.exp board
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-template.exp
index 5aff73df6240b04b53bb9907e4d26d567fa24c83..b5dc044ed4df54eace7f2a15a75bd0fcc7827e08 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2012 Free Software Foundation, Inc.
+# Copyright (C) 2008-2020 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [skip_cplus_tests] } { continue }
 standard_testfile .cc
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
          {debug c++}] != "" } {
-    untested "Couldn't compile ${srcfile}"
+    untested "failed to compile"
     return -1
 }
 
@@ -48,12 +48,18 @@ proc test_template_arg {exefile type} {
        return
     }
     # There is no executable code in main(), so we are where we want to be
-    gdb_test "print foo" ".*"
-    gdb_test_no_output "python foo = gdb.history(0)"
+    gdb_test "print (foo)" ".*" \
+       "print (foo) in template test of $type"
+    gdb_test_no_output "python foo = gdb.history(0)" \
+       "fetch foo from gdb.history(0) in template test of $type"
 
     # Replace '*' with '\*' in regex.
     regsub -all {\*} $type {\*} t
-    gdb_test "python print foo.type.template_argument(0)" $t $type
+    gdb_test "python print (foo.type.template_argument(0))" $t $type
+
+    gdb_test "python print(foo.type.template_argument(-1))" \
+       "Template argument number must be non-negative\r\nError while executing Python code." \
+       "negative template argument number in template test of $type"
 }
 
 test_template_arg "${binfile}-ci" "const int"
This page took 0.024232 seconds and 4 git commands to generate.