forked from Imagelibrary/binutils-gdb
The top comment in gdb.python/py-source-styling.exp was completely wrong, clearly a cut&paste job from elsewhere. Write a comment that actually reflects what the test does. I've also moved the allow_python_tests check earlier in the file. And I changed some 'return -1' into just 'return'. I'm not aware that the '-1' adds any value. I also folded a 'pass $gdb_test_name' into the preceding gdb_assert, which I think is neater. There is no change in what is actually being tested after this commit. Approved-By: Tom Tromey <tom@tromey.com>
63 lines
1.9 KiB
Plaintext
63 lines
1.9 KiB
Plaintext
# Copyright (C) 2022-2024 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
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# Check that the Python pygments module can be used for source
|
|
# highlighting when GNU source highlight is not available (or is
|
|
# disabled, as is done in this test).
|
|
|
|
require allow_python_tests
|
|
|
|
load_lib gdb-python.exp
|
|
|
|
standard_testfile
|
|
|
|
with_ansi_styling_terminal {
|
|
# We need an ANSI-capable terminal to get the output, additionally
|
|
# we need to set LC_ALL so GDB knows the terminal is UTF-8
|
|
# capable, otherwise we'll get a UnicodeEncodeError trying to
|
|
# encode the output.
|
|
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
|
|
return
|
|
}
|
|
|
|
if { ![gdb_py_module_available "pygments"] } {
|
|
unsupported "pygments module not available"
|
|
return
|
|
}
|
|
|
|
if ![runto_main] {
|
|
return
|
|
}
|
|
|
|
gdb_test_no_output "maint set gnu-source-highlight enabled off"
|
|
|
|
gdb_test "maint flush source-cache" "Source cache flushed\\."
|
|
|
|
set seen_style_escape false
|
|
set line_number [gdb_get_line_number "List this line."]
|
|
gdb_test_multiple "list ${line_number}" "" {
|
|
-re "Python Exception.*" {
|
|
fail $gdb_test_name
|
|
}
|
|
-re "\033" {
|
|
set seen_style_escape true
|
|
exp_continue
|
|
}
|
|
-re "$gdb_prompt $" {
|
|
gdb_assert { $seen_style_escape } $gdb_test_name
|
|
}
|
|
}
|
|
}
|