#
# readdir.test
#
# Tests for the readdir command.
#---------------------------------------------------------------------------
# Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies.  Karl Lehenbauer and
# Mark Diekhans make no representations about the suitability of this
# software for any purpose.  It is provided "as is" without express or
# implied warranty.
#------------------------------------------------------------------------------
# $Id: readdir.test,v 1.2 2002/04/02 02:29:43 hobbs Exp $
#------------------------------------------------------------------------------
#

if {[cequal [info procs Test] {}]} {
    source [file join [file dirname [info script]] testlib.tcl]
}

catch {eval file delete [glob -nocomplain READDIR.TMP/*]}
catch {file delete READDIR.TMP}

Test readdir-1.1 {readdir tests} {
    readdir
} 1 {wrong # args: readdir ?-hidden? dirPath}

Test readdir-1.1.1 {readdir tests} {
    readdir -hidden x y
} 1 {wrong # args: readdir ?-hidden? dirPath}

Test readdir-1.2 {readdir tests} {
    readdir -x y
} 1 {expected option of "-hidden", got "-x"}

TestTouch READDIR.TMP/AAA
TestTouch READDIR.TMP/BBB
TestTouch READDIR.TMP/CCC
TestTouch READDIR.TMP/DDD

Test readdir-1.3 {readdir tests} {
    lsort [readdir READDIR.TMP]
} 0 {AAA BBB CCC DDD}

Test readdir-1.4 {readdir tests} {
    lsort [readdir -hidden READDIR.TMP]
} 0 {AAA BBB CCC DDD}

catch {eval file delete [glob -nocomplain READDIR.TMP/*]}
catch {file delete READDIR.TMP}


# cleanup
::tcltest::cleanupTests
return
