]>
Commit | Line | Data |
---|---|---|
ecd75fc8 | 1 | # Copyright 2002-2014 Free Software Foundation, Inc. |
989d314b JB |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
989d314b | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
989d314b JB |
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. | |
e22f8b7c | 12 | # |
989d314b | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
989d314b | 15 | |
989d314b JB |
16 | # This file was written by Joel Brobecker. (brobecker@gnat.com), derived |
17 | # from selftest.exp, written by Rob Savoye. | |
18 | ||
c95aea6b | 19 | load_lib selftest-support.exp |
989d314b | 20 | |
c95aea6b | 21 | proc test_with_self {} { |
989d314b | 22 | # A file which contains a directory prefix |
f5b95b50 | 23 | gdb_test "print gdb_realpath (\"./xfullpath.exp\")" \ |
989d314b JB |
24 | ".\[0-9\]+ =.*\".*/xfullpath.exp\"" \ |
25 | "A filename with ./ as the directory prefix" | |
26 | ||
27 | # A file which contains a directory prefix | |
f5b95b50 | 28 | gdb_test "print gdb_realpath (\"../../defs.h\")" \ |
989d314b JB |
29 | ".\[0-9\]+ =.*\".*/defs.h\"" \ |
30 | "A filename with ../ in the directory prefix" | |
31 | ||
32 | # A one-character filename | |
f5b95b50 | 33 | gdb_test "print gdb_realpath (\"./a\")" \ |
989d314b JB |
34 | ".\[0-9\]+ =.*\".*/a\"" \ |
35 | "A one-char filename in the current directory" | |
36 | ||
37 | # A file in the root directory | |
f5b95b50 | 38 | gdb_test "print gdb_realpath (\"/root_file_which_should_exist\")" \ |
989d314b JB |
39 | ".\[0-9\]+ =.*\"/root_file_which_should_exist\"" \ |
40 | "A filename in the root directory" | |
41 | ||
42 | # A file which does not have a directory prefix | |
f5b95b50 | 43 | gdb_test "print gdb_realpath (\"xfullpath.exp\")" \ |
989d314b JB |
44 | ".\[0-9\]+ =.*\"xfullpath.exp\"" \ |
45 | "A filename without any directory prefix" | |
46 | ||
47 | # A one-char filename without any directory prefix | |
f5b95b50 | 48 | gdb_test "print gdb_realpath (\"a\")" \ |
989d314b JB |
49 | ".\[0-9\]+ =.*\"a\"" \ |
50 | "A one-char filename without any directory prefix" | |
51 | ||
52 | # An empty filename | |
f5b95b50 | 53 | gdb_test "print gdb_realpath (\"\")" \ |
989d314b JB |
54 | ".\[0-9\]+ =.*\"\"" \ |
55 | "An empty filename" | |
56 | ||
57 | return 0 | |
58 | } | |
59 | ||
c95aea6b | 60 | do_self_tests captured_main test_with_self |