]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.chill/string.exp
* parser-defs.h (enum precedence): Added PREC_BUILTIN_FUNCTION.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.chill / string.exp
CommitLineData
34410e95
PB
1# Copyright (C) 1995 Free Software Foundation, Inc.
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
15# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
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
24proc do_tests {} {
25 global prms_id bug_id subdir objdir srcdir binfile prompt
26
27 set prms_id 0
28 set bug_id 0
29
30 # Start with a fresh gdb.
31
32 gdb_exit
33 gdb_start
34 gdb_reinitialize_dir $srcdir/$subdir
35 gdb_load $objdir/$subdir/$binfile
36
37 send "set language chill\n" ; expect -re "$prompt $"
38
39 # These tests based on Cygnus PR chill/5696.
40 runto string.ch:11
a59f104e
JK
41 gdb_test "p s20" { = "Moser Wilfried"} "print simple vstring"
42 gdb_test "p s20(1)" { = 'o'} "print vstring element"
43 gdb_test "p s20(1:3)" { = "ose"} "print vstring slice (:)"
44 gdb_test "p s20(2 up 3)" { = "ser"} "print vstring slice (up)"
45 gdb_test "p s10" { = "1234567890"} "print simple string"
46 gdb_test "p s10(1)" { = '2'} "print string element"
47 gdb_test "p s10(1:3)" { = "234"} "print string slice (:)"
48 gdb_test "p s10(2 up 3)" { = "345"} "print string slice (up)"
34410e95
PB
49}
50
51# Check to see if we have an executable to test. If not, then either we
52# haven't tried to compile one, or the compilation failed for some reason.
53# In either case, just notify the user and skip the tests in this file.
54
55set binfile "string.exe"
56set srcfile $binfile.ch
57
5e8ade23
JK
58if [skip_chill_tests] then { continue }
59
34410e95
PB
60if ![file exists $objdir/$subdir/$binfile] then {
61 warning "$binfile does not exist; tests suppressed."
62} else {
63 do_tests
64}