dirname-tab.exp   [plain text]


# Copyright 2004 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 2 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

if $tracelevel then {
	strace $tracelevel
}

gdb_exit
gdb_start

set oldtimeout1 $timeout
set timeout 30

# Does 
#   file /VolumeTAB
# complete to /Volumes?
# NB: This test is lame in that it'll fail if there is random
# stuff in /, like "/Volumes-more", or somesuch.

# The FSF gdb will complete it as "/Volumes " so the user
# has to back up over the SPACE char and TAB again (only
# on the first usage; subsequent usages are fine.)

send_gdb "file /Volum\t"
sleep 1
gdb_expect {
  -re "^file /Volumes/" {
     send_gdb "\n"
     gdb_expect {
       -re "/Volumes/: No such file or directory.\[\r\n\]+$gdb_prompt $" {
         pass "correct tab completion on directory name"
       }
       -re ".*$gdb_prompt $" {
         fail "correct tab completion on directory name"
       }
       timeout {
         fail "(timeout) correct tab completion on directory name"
       }
     }
  }
  -re ".*$gdb_prompt $" {
    fail "correct tab completion on directory name (2)"
  }
  timeout {
    fail "(timeout) correct tab completion on directory name (2)"
  }
}


# The behavior is different on the second time; the completer
# chars are now pointing to the filename separators.

send_gdb "file /Volum\t"
sleep 1
gdb_expect {
  -re "^file /Volumes/" {
     send_gdb "\n"
     gdb_expect {
       -re "/Volumes/: No such file or directory.\[\r\n\]+$gdb_prompt $" {
         pass "correct tab completion on directory name 2ndtry"
       }
       -re "/Volumes/: Unknown error: 0.\[\r\n\]+$gdb_prompt $" {
         pass "correct tab completion on directory name 2ndtry"
       }
       -re ".*$gdb_prompt $" {
         fail "correct tab completion on directory name 2ndtry"
       }
       timeout {
         fail "(timeout) correct tab completion on directory name 2ndtry"
       }
     }
  }
  -re ".*$gdb_prompt $" {
    fail "correct tab completion on directory name 2ndtry (2)"
  }
  timeout {
    fail "(timeout) correct tab completion on directory 2ndtry name (2)"
  }
}

set timeout $oldtimeout1

gdb_exit
return 0