Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.python / py-source-styling.exp
blob8a22b7f4e8ca40f0b9e9f87bd40437dd7f068a1b
1 # Copyright (C) 2022-2023 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 # This file is part of the GDB testsuite.  It checks for memory leaks
17 # associated with allocating and deallocation gdb.Inferior objects.
19 load_lib gdb-python.exp
21 standard_testfile
23 save_vars { env(TERM) } {
24     # We need an ANSI-capable terminal to get the output, additionally
25     # we need to set LC_ALL so GDB knows the terminal is UTF-8
26     # capable, otherwise we'll get a UnicodeEncodeError trying to
27     # encode the output.
28     setenv TERM ansi
30     if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
31         return -1
32     }
34     if { [skip_python_tests] } { continue }
36     if { ![gdb_py_module_available "pygments"] } {
37         unsupported "pygments module not available"
38         return -1
39     }
41     if ![runto_main] {
42         return
43     }
45     gdb_test_no_output "maint set gnu-source-highlight enabled off"
47     gdb_test "maint flush source-cache" "Source cache flushed\\."
49     set seen_style_escape false
50     set line_number [gdb_get_line_number "List this line."]
51     gdb_test_multiple "list ${line_number}" "" {
52         -re "Python Exception.*" {
53             fail $gdb_test_name
54         }
55         -re "\033" {
56             set seen_style_escape true
57             exp_continue
58         }
59         -re "$gdb_prompt $" {
60             gdb_assert { $seen_style_escape }
61             pass $gdb_test_name
62         }
63     }