os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/pid.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/pid.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,77 @@
     1.4 +# Commands covered:  pid
     1.5 +#
     1.6 +# This file contains a collection of tests for one or more of the Tcl
     1.7 +# built-in commands.  Sourcing this file into Tcl runs the tests and
     1.8 +# generates output for errors.  No output means no errors were found.
     1.9 +#
    1.10 +# Copyright (c) 1991-1993 The Regents of the University of California.
    1.11 +# Copyright (c) 1994-1995 Sun Microsystems, Inc.
    1.12 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.13 +#
    1.14 +# See the file "license.terms" for information on usage and redistribution
    1.15 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.16 +#
    1.17 +# RCS: @(#) $Id: pid.test,v 1.8.2.2 2004/02/25 23:38:17 dgp Exp $
    1.18 +
    1.19 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.20 +    package require tcltest 2
    1.21 +    namespace import -force ::tcltest::*
    1.22 +}
    1.23 +
    1.24 +# If pid is not defined just return with no error
    1.25 +# Some platforms may not have the pid command implemented
    1.26 +if {[info commands pid] == ""} {
    1.27 +    puts "pid is not implemented for this machine"
    1.28 +    ::tcltest::cleanupTests
    1.29 +    return
    1.30 +}
    1.31 +
    1.32 +test pid-1.1 {pid command} {
    1.33 +    regexp {(^[0-9]+$)|(^0x[0-9a-fA-F]+$)} [pid]
    1.34 +} 1
    1.35 +test pid-1.2 {pid command} -constraints {unixOrPc unixExecs} -setup {
    1.36 +    set path(test1) [makeFile {} test1]
    1.37 +    file delete $path(test1)
    1.38 +} -body {
    1.39 +    set f [open |[list echo foo | cat >$path(test1)] w]
    1.40 +    set pids [pid $f]
    1.41 +    close $f
    1.42 +    list [llength $pids] [regexp {^[0-9]+$} [lindex $pids 0]] \
    1.43 +       [regexp {^[0-9]+$} [lindex $pids 1]] \
    1.44 +       [expr {[lindex $pids 0] == [lindex $pids 1]}]
    1.45 +} -cleanup {
    1.46 +    removeFile test1
    1.47 +} -result {2 1 1 0}
    1.48 +test pid-1.3 {pid command} -setup {
    1.49 +    set path(test1) [makeFile {} test1]
    1.50 +    file delete $path(test1)
    1.51 +} -body {
    1.52 +    set f [open $path(test1) w]
    1.53 +    set pids [pid $f]
    1.54 +    close $f
    1.55 +    set pids
    1.56 +} -cleanup {
    1.57 +    removeFile test1
    1.58 +} -result {}
    1.59 +test pid-1.4 {pid command} {
    1.60 +    list [catch {pid a b} msg] $msg
    1.61 +} {1 {wrong # args: should be "pid ?channelId?"}}
    1.62 +test pid-1.5 {pid command} {
    1.63 +    list [catch {pid gorp} msg] $msg
    1.64 +} {1 {can not find channel named "gorp"}}
    1.65 +
    1.66 +# cleanup
    1.67 +::tcltest::cleanupTests
    1.68 +return
    1.69 +
    1.70 +
    1.71 +
    1.72 +
    1.73 +
    1.74 +
    1.75 +
    1.76 +
    1.77 +
    1.78 +
    1.79 +
    1.80 +