os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winDde.test
Update contrib.
1 # This file tests the tclWinDde.c file.
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.
7 # Copyright (c) 1999 by Scriptics Corporation.
9 # See the file "license.terms" for information on usage and redistribution
10 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 # RCS: @(#) $Id: winDde.test,v 1.13.2.2 2005/06/21 22:59:03 patthoyts Exp $
14 if {[lsearch [namespace children] ::tcltest] == -1} {
15 package require tcltest
16 namespace import -force ::tcltest::*
19 if {$tcl_platform(platform) == "windows"} {
21 set lib [lindex [glob -directory [file join [pwd] [file dirname \
22 [info nameofexecutable]]] tcldde*.dll] 0]
25 puts "WARNING: Unable to find the dde package. Skipping dde tests."
26 ::tcltest::cleanupTests
31 set scriptName script1.tcl
33 proc createChildProcess { ddeServerName } {
34 file delete -force $::scriptName
36 set f [open $::scriptName w+]
38 if {[lsearch [namespace children] ::tcltest] == -1} {
39 package require tcltest
40 namespace import -force ::tcltest::*
43 set lib [lindex [glob -directory \
44 [file join [pwd] [file dirname [info nameofexecutable]]] \
48 puts "Unable to find the dde package. Skipping dde tests."
49 ::tcltest::cleanupTests
53 puts $f [list dde servername $ddeServerName]
55 after 200 {set ready 1}
59 after 200 {set final 1}
65 set f [open |[list [interpreter] $::scriptName] r]
66 fconfigure $f -buffering line -blocking 1
71 test winDde-1.1 {Settings the server's topic name} {pcOnly} {
72 list [dde servername foobar] [dde servername] [dde servername self]
73 } {foobar foobar self}
75 test winDde-2.1 {Checking for other services} {pcOnly} {
76 expr [llength [dde services {} {}]] >= 0
79 test winDde-2.2 {Checking for existence, with service and topic specified} \
81 llength [dde services TclEval self]
84 test winDde-2.3 {Checking for existence, with only the service specified} \
86 expr [llength [dde services TclEval {}]] >= 1
89 test winDde-3.1 {DDE execute locally} {pcOnly} {
91 dde execute TclEval self {set a "foo"}
95 test winDde-3.2 {DDE execute -async locally} {pcOnly} {
97 dde execute -async TclEval self {set a "foo"}
102 test winDde-3.3 {DDE request locally} {pcOnly} {
104 dde execute TclEval self {set a "foo"}
105 dde request TclEval self a
108 test winDde-3.4 {DDE eval locally} {pcOnly} {
110 dde eval self set a "foo"
113 test winDde-3.5 {DDE request locally} {pcOnly} {
115 dde execute TclEval self {set a "foo"}
116 dde request -binary TclEval self a
119 test winDde-4.1 {DDE execute remotely} {stdio pcOnly} {
122 set child [createChildProcess child]
123 dde execute TclEval child {set a "foo"}
124 dde execute TclEval child {set done 1}
129 test winDde-4.2 {DDE execute remotely} {stdio pcOnly} {
132 set child [createChildProcess child]
133 dde execute -async TclEval child {set a "foo"}
134 after 400 {set ::_dde_forever 1} ; vwait ::_dde_forever; #update
135 dde execute TclEval child {set done 1}
140 test winDde-4.3 {DDE request locally} {stdio pcOnly} {
143 set child [createChildProcess child]
144 dde execute TclEval child {set a "foo"}
145 set a [dde request TclEval child a]
146 dde execute TclEval child {set done 1}
151 test winDde-4.4 {DDE eval locally} {stdio pcOnly} {
154 set child [createChildProcess child]
155 set a [dde eval child set a "foo"]
156 dde execute TclEval child {set done 1}
161 test winDde-5.1 {check for bad arguments} {pcOnly} {
162 catch {dde execute "" "" "" ""} result
164 } {wrong # args: should be "dde execute ?-async? serviceName topicName value"}
166 test winDde-5.2 {check for bad arguments} {pcOnly} {
167 catch {dde execute "" "" ""} result
169 } {cannot execute null data}
171 test winDde-5.3 {check for bad arguments} {pcOnly} {
172 catch {dde execute -foo "" "" ""} result
174 } {wrong # args: should be "dde execute ?-async? serviceName topicName value"}
176 test winDde-5.4 {DDE eval bad arguments} {pcOnly} {
177 list [catch {dde eval "" "foo"} msg] $msg
178 } {1 {invalid service name ""}}
181 file delete -force $::scriptName
182 ::tcltest::cleanupTests