#
# stringfil.test
#
# Tests for tcl.tlib string file I/O functions.
#---------------------------------------------------------------------------
# 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: stringfil.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]
}

set stringfileTestVar {a
b
c
d
e
f
g}

TestRemove STRINGFIL.DAT

Test stringfile-1.1 {write_file command} {
    write_file STRINGFIL.DAT $stringfileTestVar
} 0 {}

Test stringfile-2.1 {read_file command} {
    read_file STRINGFIL.DAT
} 0 "$stringfileTestVar\n"

Test stringfile-2.2 {read_file command} {
    read_file  -nonewline STRINGFIL.DAT
} 0 $stringfileTestVar

Test stringfile-2.3 {read_file command} {
    read_file STRINGFIL.DAT 3
} 0 [crange $stringfileTestVar 0 2]

Test stringfile-2.4 {read_file command} {
    read_file STRINGFIL.DAT nonewline
} 0 $stringfileTestVar

TestRemove STRINGFIL.DAT

# cleanup
::tcltest::cleanupTests
return
