home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / SunLabs / tclTK / src / tcl7.4 / tests / pid.test < prev    next >
Encoding:
Text File  |  1995-05-20  |  1.3 KB  |  45 lines

  1. # Commands covered:  pid
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright (c) 1991-1993 The Regents of the University of California.
  8. # Copyright (c) 1994 Sun Microsystems, Inc.
  9. #
  10. # See the file "license.terms" for information on usage and redistribution
  11. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12. #
  13. # @(#) pid.test 1.3 95/05/19 16:17:10
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. catch {exec rm -f test1}
  18.  
  19. test pid-1.1 {pid command} {
  20.     regexp {^[0-9]+$} [pid]
  21. } 1
  22. test pid-1.2 {pid command} {
  23.     set f [open {| echo foo | cat > /dev/null} w]
  24.     set pids [pid $f]
  25.     close $f
  26.     list [llength $pids] [regexp {^[0-9]+$} [lindex $pids 0]] \
  27.         [regexp {^[0-9]+$} [lindex $pids 1]] \
  28.         [expr {[lindex $pids 0] == [lindex $pids 1]}]
  29. } {2 1 1 0}
  30. test pid-1.3 {pid command} {
  31.     set f [open test1 w]
  32.     set pids [pid $f]
  33.     close $f
  34.     set pids
  35. } {}
  36. test pid-1.4 {pid command} {
  37.     list [catch {pid a b} msg] $msg
  38. } {1 {wrong # args: should be "pid ?fileId?"}}
  39. test pid-1.5 {pid command} {
  40.     list [catch {pid gorp} msg] $msg
  41. } {1 {bad file identifier "gorp"}}
  42.  
  43. catch {exec rm -f test1}
  44. concat {}
  45.