mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
Modernize test-case gdb.base/command-line-input.exp using clean_restart, multi_line and string_to_regexp. Tested on x86_64-linux. Approved-By: Andrew Burgess <aburgess@redhat.com>
77 lines
1.8 KiB
Plaintext
77 lines
1.8 KiB
Plaintext
# Copyright (C) 2016-2025 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/>.
|
|
|
|
# Command line input testing.
|
|
|
|
# Test issuing a command split in multiple lines with continuation
|
|
# characters.
|
|
|
|
clean_restart
|
|
|
|
set bs "\\"
|
|
set re_bs [string_to_regexp $bs]
|
|
set re_dollar [string_to_regexp $]
|
|
|
|
set re \
|
|
[multi_line \
|
|
^[string_to_regexp "print 1$bs"] \
|
|
[string_to_regexp " + 2"] \
|
|
"$re_dollar$decimal = 3" \
|
|
"$gdb_prompt $"]
|
|
gdb_test_multiple "print 1$bs\n + 2" "print 1$bs${bs}n + 2" {
|
|
-re $re {
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
set re \
|
|
[multi_line \
|
|
^[string_to_regexp "print 1$bs"] \
|
|
"2" \
|
|
"$re_dollar$decimal = 12" \
|
|
"$gdb_prompt $"]
|
|
gdb_test_multiple "print 1$bs\n2" "print 1$bs${bs}n2" {
|
|
-re $re {
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
with_test_prefix "cancel multiline" {
|
|
send_gdb "print$bs\n 1"
|
|
gdb_test_multiple "" "setup" {
|
|
-re "print$re_bs\r\n 1" {
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
send_gdb "\003"
|
|
gdb_test_multiple "" "cancel" {
|
|
-re -wrap "" {
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
# Regression test for PR cli/33063.
|
|
gdb_test_multiple "print 2" "command after cancel" {
|
|
-re -wrap " = 2" {
|
|
pass $gdb_test_name
|
|
}
|
|
-re -wrap "" {
|
|
# Avoid undefined command error.
|
|
fail $gdb_test_name
|
|
}
|
|
}
|
|
}
|