]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.chill/string.exp
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.chill / string.exp
CommitLineData
fa5864d5 1# Copyright (C) 1995, 1997 Free Software Foundation, Inc.
34410e95
PB
2
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 2 of the License, or
6# (at your option) any later version.
7#
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.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
fa5864d5 15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34410e95
PB
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20if $tracelevel then {
21 strace $tracelevel
22}
23
782445c7
FF
24if [skip_chill_tests] then { continue }
25
26set testfile "string"
27set srcfile ${srcdir}/$subdir/${testfile}.ch
28set binfile ${objdir}/${subdir}/${testfile}.exe
29if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
30 perror "Couldn't compile ${srcfile}"
31 return -1
32}
33
34410e95 34proc do_tests {} {
85fbaa74 35 global prms_id bug_id subdir objdir srcdir binfile gdb_prompt
34410e95
PB
36
37 set prms_id 0
38 set bug_id 0
39
40 # Start with a fresh gdb.
41
42 gdb_exit
43 gdb_start
44 gdb_reinitialize_dir $srcdir/$subdir
782445c7 45 gdb_load $binfile
34410e95 46
8e88a522 47 gdb_test "set language chill" ""
34410e95
PB
48
49 # These tests based on Cygnus PR chill/5696.
6cec39dc 50 runto string.ch:22
a59f104e
JK
51 gdb_test "p s20" { = "Moser Wilfried"} "print simple vstring"
52 gdb_test "p s20(1)" { = 'o'} "print vstring element"
53 gdb_test "p s20(1:3)" { = "ose"} "print vstring slice (:)"
54 gdb_test "p s20(2 up 3)" { = "ser"} "print vstring slice (up)"
55 gdb_test "p s10" { = "1234567890"} "print simple string"
56 gdb_test "p s10(1)" { = '2'} "print string element"
57 gdb_test "p s10(1:3)" { = "234"} "print string slice (:)"
58 gdb_test "p s10(2 up 3)" { = "345"} "print string slice (up)"
a055dacb
PB
59
60 gdb_test "p length(s10)" { = 10} "print string length"
61 gdb_test "p length(s20)" { = 14} "print varying string length"
62 gdb_test "p lower(s10)" { = 0} "print string lower"
63 gdb_test "p upper(s10)" { = 9} "print string upper"
64 gdb_test "p lower(s20)" { = 0} "print varying string lower"
65 gdb_test "p upper(s20)" { = 19} "print varying string upper"
6cec39dc
PB
66
67 # These tests are based on Cygnus PR chill/9078.
68 gdb_test "print foo // bar" { = "Moser Wilfried"}
69 gdb_test "print foo // bar1" { = "Moser abcde"}
70 gdb_test "print foo1 // bar1" { = "12345abcde"}
34410e95
PB
71}
72
782445c7 73do_tests