head	1.7;
access;
symbols
	core-8-5-9:1.6
	core-8-5-8:1.6
	macosx-cocoa-merge:1.7
	macosx-cocoa-premerge:1.7
	macosx-carbon-freeze:1.7
	core-8-5-7:1.6
	core-8-5-6:1.6
	core-8-6-b1:1.7
	core-8-6-a3:1.7
	core-8-5-5:1.6
	core-8-6-a2:1.6
	core-8-5-4:1.6
	core-8-5-3:1.6
	core-8-6-a1:1.6
	core-8-4-19:1.4
	core-8-5-branch:1.6.0.4
	core-8-5-2:1.6
	core-8-4-18:1.4
	core-8-5-1:1.6
	core-8-4-17:1.4
	core-8-5-0:1.6
	core-8-5-b3:1.6
	core-8-5-b2:1.6
	core-8-4-16:1.4
	core-8-5-b1:1.6
	core-stablilizer-merge:1.6
	core-stabilizer-branch:1.6.0.2
	core-stabilizer-merge:1.6
	core-8-4-15:1.4
	core-8-5-a6:1.6
	core-8-5-a5:1.6
	core-8-4-14:1.4
	core-8-5-a4:1.6
	core-8-4-13:1.4
	core-8-4-12:1.4
	core-8-4-11:1.4
	core-8-5-a3:1.6
	core-8-4-10:1.4
	core-8-4-9-branch:1.4.0.4
	core-8-5-a2:1.6
	core-8-4-9:1.4
	core-8-4-8:1.4
	core-8-4-7:1.4
	core-8-5-a1:1.5
	core-8-4-6:1.4
	core-8-4-5:1.4
	mistachkin-dev-branch:1.5.0.2
	core-8-4-4:1.4
	core-8-4-3:1.4
	core-8-4-branch:1.4.0.2
	core-8-4-2:1.4
	core-8-4-1:1.4
	core-8-3-5:1.3
	core-8-4-0:1.4
	macosx-8-4-merge-2002-08-31-trunk:1.4
	macosx-8-4-premerge-2002-08-31-branch:1.3.18.1
	macosx-8-4-premerge-2002-08-31-trunk:1.4
	macosx-8-4-merge-2002-08-30-branch:1.3.18.1
	macosx-8-4-merge-2002-08-30-trunk:1.4
	macosx-8-4-merge-2002-08-20-branch:1.3.18.1
	macosx-8-4-merge-2002-08-20-trunk:1.4
	core-8-4-b2:1.4
	core-8-4-b1:1.3
	macosx-premerge-6-9-02:1.3
	core-8-4-a4:1.3
	core-8-3-4:1.3
	macosx-8-4-branch:1.3.0.18
	macosx-8-4-branchpoint:1.3
	core-8-4-a3:1.3
	core-8-3-3:1.3
	dgp-privates-into-namespace:1.3.0.16
	tclpro-1-5-0:1.3
	core-8-4-win-speedup:1.3.0.14
	core-8-4-a2:1.3
	tclpro-1-4-1:1.3
	tclpro-1-4-0:1.3
	core-8-3-2:1.3
	ajuba-ajuba2-2-1-base:1.3
	ajuba-ajuba2-2-0:1.3
	core-8-4-a1:1.3
	core-8-3-1-branch:1.3.0.12
	core-8-3-1:1.3
	scriptics-sc-2-0-b5:1.3
	scriptics-sc-2-0-fixed:1.3
	scriptics-sc-2-0-b2:1.3
	scriptics-sc-2-0-b1:1.3
	core-8-3-0:1.3
	core-8-3-b2:1.3
	core-8-3-b1:1.3
	scriptics-sc-1-1:1.3
	scriptics-sc-1-1-b1:1.3
	core-8-2-3:1.3
	scriptics-sc-1-1-branch:1.3.0.10
	scriptics-sc-1-1-base:1.3
	scriptics-sc-1-0:1.3
	scriptics-sc-1-0-branch:1.3.0.8
	scriptics-sc-1-0-base:1.3
	core-8-2-2:1.3
	core-8-2-1:1.3
	scriptics-bc-1-0-b1:1.3
	core-8-2-1-branch:1.3.0.6
	scriptics-tclpro-1-3-0:1.3
	core-8-2-0:1.3
	core-8-2-b3-branch:1.3.0.4
	core-8-2-b3-base:1.3
	scriptics-tclpro-1-3-b4:1.3
	core-8-2-b2:1.3
	scriptics-tclpro-1-3-b3:1.3
	core-8-2-b1:1.3
	scriptics-tclpro-1-3-b2:1.3
	merge-to-mainline-5/21/99:1.3
	scriptics-tclpro-1-3-b2-branch:1.3.0.2
	core-8-1-1:1.3
	scriptics-tclpro-1-3-b1:1.3
	core-8-1-1-base:1.3
	core-8-1-0:1.3
	merge-to-mainline-4-29-99:1.3
	merge-to-mainline-4-23-99:1.3
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.5
	core-8-1-b2:1.1.4.2
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@# @;


1.7
date	2008.08.28.08.52.05;	author aniap;	state Exp;
branches;
next	1.6;

1.6
date	2004.05.23.17.34.49;	author dkf;	state Exp;
branches;
next	1.5;

1.5
date	2003.04.01.21.06.48;	author dgp;	state Exp;
branches;
next	1.4;

1.4
date	2002.07.13.20.28.35;	author dgp;	state Exp;
branches;
next	1.3;

1.3
date	99.04.16.01.51.40;	author stanton;	state Exp;
branches
	1.3.18.1;
next	1.2;

1.2
date	98.09.14.18.23.49;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.58.14;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.18.50;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	99.03.11.18.51.03;	author hershey;	state Exp;
branches;
next	1.1.4.3;

1.1.4.3
date	99.03.24.01.17.00;	author hershey;	state Exp;
branches;
next	1.1.4.4;

1.1.4.4
date	99.03.24.02.54.55;	author hershey;	state Exp;
branches;
next	1.1.4.5;

1.1.4.5
date	99.03.26.00.08.04;	author hershey;	state Exp;
branches;
next	;

1.3.18.1
date	2002.08.20.20.27.14;	author das;	state Exp;
branches;
next	;


desc
@@


1.7
log
@Update to tcltest2
@
text
@# This file is a Tcl script to test out the option-handling facilities
# of Tk.  It is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @@(#) $Id: option.test,v 1.6 2004/05/23 17:34:49 dkf Exp $

package require tcltest 2.2
namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands

testConstraint appNameIsTktest [expr {[winfo name .] eq "tktest"}]

deleteWindows
set appName [winfo name .]

# First, test basic retrievals, being sure to trigger all the various
# types of NodeElements (EXACT_LEAF_NAME, WILDCARD_NODE_CLASS, and
# everything in-between).

frame .op1 -class Class1
frame .op2 -class Class2
frame .op1.op3 -class Class1
frame .op1.op4 -class Class3
frame .op2.op5 -class Class2
frame .op1.op3.op6 -class Class4

# Configurations for tests 1.* - 12.*
option clear
option add *Color1 red
option add *x blue
option add *Class1.x yellow
option add $appName.op1.x green
option add *Class2.Color1 orange
option add $appName.op2.op5.Color2 purple
option add $appName.Class1.Class3.y brown
option add $appName*op6*Color2 black
option add $appName*Class1.op1.Color2 grey

test option-1.1 {basic option retrieval} -body {
    option get . x Color1
} -result blue
test option-1.2 {basic option retrieval} -body {
    option get . y Color1
} -result red
test option-1.3 {basic option retrieval} -body {
    option get . z Color1
} -result red
test option-1.4 {basic option retrieval} -body {
    option get . x Color2
} -result blue
test option-1.5 {basic option retrieval} -body {
    option get . y Color2
} -result {}
test option-1.6 {basic option retrieval} -body {
    option get . z Color2
} -result {}


test option-2.1 {basic option retrieval} -body {
    option get .op1 x Color1
} -result green
test option-2.2 {basic option retrieval} -body {
    option get .op1 y Color1
} -result red
test option-2.3 {basic option retrieval} -body {
    option get .op1 z Color1
} -result red
test option-2.4 {basic option retrieval} -body {
    option get .op1 x Color2
} -result green
test option-2.5 {basic option retrieval} -body {
    option get .op1 y Color2
} -result {}
test option-2.6 {basic option retrieval} -body {
    option get .op1 z Color2
} -result {}


test option-3.1 {basic option retrieval} -body {
    option get .op1.op3 x Color1
} -result yellow
test option-3.2 {basic option retrieval} -body {
    option get .op1.op3 y Color1
} -result red
test option-3.3 {basic option retrieval} -body {
    option get .op1.op3 z Color1
} -result red
test option-3.4 {basic option retrieval} -body {
    option get .op1.op3 x Color2
} -result yellow
test option-3.5 {basic option retrieval} -body {
    option get .op1.op3 y Color2
} -result {}
test option-3.6 {basic option retrieval} -body {
    option get .op1.op3 z Color2
} -result {}


test option-4.1 {basic option retrieval} -body {
    option get .op1.op3.op6 x Color1
} -result blue
test option-4.2 {basic option retrieval} -body {
    option get .op1.op3.op6 y Color1
} -result red
test option-4.3 {basic option retrieval} -body {
    option get .op1.op3.op6 z Color1
} -result red
test option-4.4 {basic option retrieval} -body {
    option get .op1.op3.op6 x Color2
} -result black
test option-4.5 {basic option retrieval} -body {
    option get .op1.op3.op6 y Color2
} -result black
test option-4.6 {basic option retrieval} -body {
    option get .op1.op3.op6 z Color2
} -result black


test option-5.1 {basic option retrieval} -body {
    option get .op1.op4 x Color1
} -result blue
test option-5.2 {basic option retrieval} -body {
    option get .op1.op4 y Color1
} -result brown
test option-5.3 {basic option retrieval} -body {
    option get .op1.op4 z Color1
} -result red
test option-5.4 {basic option retrieval} -body {
    option get .op1.op4 x Color2
} -result blue
test option-5.5 {basic option retrieval} -body {
    option get .op1.op4 y Color2
} -result brown
test option-5.6 {basic option retrieval} -body {
    option get .op1.op4 z Color2
} -result {}


test option-6.1 {basic option retrieval} -body {
    option get .op2 x Color1
} -result orange
test option-6.2 {basic option retrieval} -body {
    option get .op2 y Color1
} -result orange
test option-6.3 {basic option retrieval} -body {
    option get .op2 z Color1
} -result orange
test option-6.4 {basic option retrieval} -body {
    option get .op2 x Color2
} -result blue
test option-6.5 {basic option retrieval} -body {
    option get .op2 y Color2
} -result {}
test option-6.6 {basic option retrieval} -body {
    option get .op2 z Color2
} -result {}


test option-7.1 {basic option retrieval} -body {
    option get .op2.op5 x Color1
} -result orange
test option-7.2 {basic option retrieval} -body {
    option get .op2.op5 y Color1
} -result orange
test option-7.3 {basic option retrieval} -body {
    option get .op2.op5 z Color1
} -result orange
test option-7.4 {basic option retrieval} -body {
    option get .op2.op5 x Color2
} -result purple
test option-7.5 {basic option retrieval} -body {
    option get .op2.op5 y Color2
} -result purple
test option-7.6 {basic option retrieval} -body {
    option get .op2.op5 z Color2
} -result purple


# Now try similar tests to above, except jump around non-hierarchically
# between windows to make sure that the option stacks are pushed and
# popped correctly.

option get . foo Foo
test option-8.1 {stack pushing/popping} -body {
    option get .op2.op5 x Color1
} -result orange
test option-8.2 {stack pushing/popping} -body {
    option get .op2.op5 y Color1
} -result orange
test option-8.3 {stack pushing/popping} -body {
    option get .op2.op5 z Color1
} -result orange
test option-8.4 {stack pushing/popping} -body {
    option get .op2.op5 x Color2
} -result purple
test option-8.5 {stack pushing/popping} -body {
    option get .op2.op5 y Color2
} -result purple
test option-8.6 {stack pushing/popping} -body {
    option get .op2.op5 z Color2
} -result purple


test option-9.1 {stack pushing/popping} -body {
    option get . x Color1
} -result blue
test option-9.2 {stack pushing/popping} -body {
    option get . y Color1
} -result red
test option-9.3 {stack pushing/popping} -body {
    option get . z Color1
} -result red
test option-9.4 {stack pushing/popping} -body {
    option get . x Color2
} -result blue
test option-9.5 {stack pushing/popping} -body {
    option get . y Color2
} -result {}
test option-9.6 {stack pushing/popping} -body {
    option get . z Color2
} -result {}


test option-10.1 {stack pushing/popping} -body {
    option get .op1.op3.op6 x Color1
} -result blue
test option-10.2 {stack pushing/popping} -body {
    option get .op1.op3.op6 y Color1
} -result red
test option-10.3 {stack pushing/popping} -body {
    option get .op1.op3.op6 z Color1
} -result red
test option-10.4 {stack pushing/popping} -body {
    option get .op1.op3.op6 x Color2
} -result black
test option-10.5 {stack pushing/popping} -body {
    option get .op1.op3.op6 y Color2
} -result black
test option-10.6 {stack pushing/popping} -body {
    option get .op1.op3.op6 z Color2
} -result black


test option-11.1 {stack pushing/popping} -body {
    option get .op1.op3 x Color1
} -result yellow
test option-11.2 {stack pushing/popping} -body {
    option get .op1.op3 y Color1
} -result red
test option-11.3 {stack pushing/popping} -body {
    option get .op1.op3 z Color1
} -result red
test option-11.4 {stack pushing/popping} -body {
    option get .op1.op3 x Color2
} -result yellow
test option-11.5 {stack pushing/popping} -body {
    option get .op1.op3 y Color2
} -result {}
test option-11.6 {stack pushing/popping} -body {
    option get .op1.op3 z Color2
} -result {}


test option-12.1 {stack pushing/popping} -body {
    option get .op1 x Color1
} -result green
test option-12.2 {stack pushing/popping} -body {
    option get .op1 y Color1
} -result red
test option-12.3 {stack pushing/popping} -body {
    option get .op1 z Color1
} -result red
test option-12.4 {stack pushing/popping} -body {
    option get .op1 x Color2
} -result green
test option-12.5 {stack pushing/popping} -body {
    option get .op1 y Color2
} -result {}
test option-12.6 {stack pushing/popping} -body {
    option get .op1 z Color2
} -result {}

# Test the major priority levels (widgetDefault, etc.)

# Configurations for tests 13.* 
option clear
option add $appName.op1.a 100 100
option add $appName.op1.A interactive interactive
option add $appName.op1.b userDefault userDefault
option add $appName.op1.B startupFile startupFile
option add $appName.op1.c widgetDefault widgetDefault
option add $appName.op1.C 0 0

test option-13.1 {priority levels} -body {
    option get .op1 a A
} -result 100
test option-13.2 {priority levels} -body {
    option get .op1 b A
} -result interactive
test option-13.3 {priority levels} -body {
    option get .op1 b B
} -result userDefault
test option-13.4 {priority levels} -body {
    option get .op1 c B
} -result startupFile
test option-13.5 {priority levels} -body {
    option get .op1 c C
} -result widgetDefault
option add $appName.op1.B file2 widget
test option-13.6 {priority levels} -body {
    option get .op1 c B
} -result startupFile
option add $appName.op1.B file2 startupFile
test option-13.7 {priority levels} -body {
    option get .op1 c B
} -result file2


# Test various error conditions

test option-14.1 {error conditions} -body {
    option
} -returnCodes error -result {wrong # args: should be "option cmd arg ?arg ...?"}
test option-14.2 {error conditions} -body {
    option x
} -returnCodes error -result {bad option "x": must be add, clear, get, or readfile}
test option-14.3 {error conditions} -body {
    option foo 3
} -returnCodes error -result {bad option "foo": must be add, clear, get, or readfile}
test option-14.4 {error conditions} -body {
    option add 3
} -returnCodes error -result {wrong # args: should be "option add pattern value ?priority?"}
test option-14.5 {error conditions} -body {
    option add . a b c
} -returnCodes error -result {wrong # args: should be "option add pattern value ?priority?"}
test option-14.6 {error conditions} -body {
    option add . a -1
} -returnCodes error -result {bad priority level "-1": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}
test option-14.7 {error conditions} -body {
    option add . a 101
} -returnCodes error -result {bad priority level "101": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}
test option-14.8 {error conditions} -body {
    option add . a gorp
} -returnCodes error -result {bad priority level "gorp": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}
test option-14.9 {error conditions} -body {
    option get 3
} -returnCodes error -result {wrong # args: should be "option get window name class"}
test option-14.10 {error conditions} -body {
    option get 3 4
} -returnCodes error -result {wrong # args: should be "option get window name class"}
test option-14.11 {error conditions} -body {
    option get 3 4 5 6
} -returnCodes error -result {wrong # args: should be "option get window name class"}
test option-14.12 {error conditions} -body {
    option get .gorp.gorp a A
} -returnCodes error -result {bad window path name ".gorp.gorp"}


set option1 [file join [testsDirectory] option.file1]
test option-15.1 {database files} -body {
    option read non-existent
} -returnCodes error -result {couldn't open "non-existent": no such file or directory}
test option-15.2 {database files} -body {
    option read $option1
    option get . x1 color
} -result blue
test option-15.3 {database files} -constraints appNameIsTktest -body {
    option read $option1
    option get . x2 color
} -result green
test option-15.4 {database files} -body {
    option read $option1
    option get . x3 color
} -result purple
test option-15.5 {database files} -body {
    option read $option1
    option get . {x 4} color
} -result brown
test option-15.6 {database files} -body {
    option read $option1
	option get . x6 color
} -result {}
test option-15.7 {database files} -body {
    option read $option1 widget foo
} -returnCodes error -result {wrong # args: should be "option readfile fileName ?priority?"}

test option-15.8 {database files} -body {
    option add *x3 burgundy
    catch {option read $option1 userDefault}
    option get . x3 color
} -result burgundy
test option-15.9 {database files} -body {
    set option2 [file join [testsDirectory] option.file2]
    option read $option2
} -returnCodes error -result {missing colon on line 2}


test option-16.1 {ReadOptionFile} -body {
    set option3 [makeFile {} option.file3]
    set file [open $option3 w]
    fconfigure $file -translation crlf
    puts $file "*x7: true\n*x8: false"
    close $file
    option read $option3 userDefault
    list [option get . x7 color] [option get . x8 color]
} -cleanup {
    removeFile $option3
} -result {true false}

deleteWindows

# cleanup
cleanupTests
return



@


1.6
log
@First step towards improving test style.  Also start using Tcl 8.5 features.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: option.test,v 1.5 2003/04/01 21:06:48 dgp Exp $
d11 2
a12 1
package require tcltest 2.1
d18 1
a18 2
catch {destroy .op1}
catch {destroy .op2}
d32 1
d44 139
a182 48
test option-1.1 {basic option retrieval} {option get . x Color1} blue
test option-1.2 {basic option retrieval} {option get . y Color1} red
test option-1.3 {basic option retrieval} {option get . z Color1} red
test option-1.4 {basic option retrieval} {option get . x Color2} blue
test option-1.5 {basic option retrieval} {option get . y Color2} {}
test option-1.6 {basic option retrieval} {option get . z Color2} {}

test option-2.1 {basic option retrieval} {option get .op1 x Color1} green
test option-2.2 {basic option retrieval} {option get .op1 y Color1} red
test option-2.3 {basic option retrieval} {option get .op1 z Color1} red
test option-2.4 {basic option retrieval} {option get .op1 x Color2} green
test option-2.5 {basic option retrieval} {option get .op1 y Color2} {}
test option-2.6 {basic option retrieval} {option get .op1 z Color2} {}

test option-3.1 {basic option retrieval} {option get .op1.op3 x Color1} yellow
test option-3.2 {basic option retrieval} {option get .op1.op3 y Color1} red
test option-3.3 {basic option retrieval} {option get .op1.op3 z Color1} red
test option-3.4 {basic option retrieval} {option get .op1.op3 x Color2} yellow
test option-3.5 {basic option retrieval} {option get .op1.op3 y Color2} {}
test option-3.6 {basic option retrieval} {option get .op1.op3 z Color2} {}

test option-4.1 {basic option retrieval} {option get .op1.op3.op6 x Color1} blue
test option-4.2 {basic option retrieval} {option get .op1.op3.op6 y Color1} red
test option-4.3 {basic option retrieval} {option get .op1.op3.op6 z Color1} red
test option-4.4 {basic option retrieval} {option get .op1.op3.op6 x Color2} black
test option-4.5 {basic option retrieval} {option get .op1.op3.op6 y Color2} black
test option-4.6 {basic option retrieval} {option get .op1.op3.op6 z Color2} black

test option-5.1 {basic option retrieval} {option get .op1.op4 x Color1} blue
test option-5.2 {basic option retrieval} {option get .op1.op4 y Color1} brown
test option-5.3 {basic option retrieval} {option get .op1.op4 z Color1} red
test option-5.4 {basic option retrieval} {option get .op1.op4 x Color2} blue
test option-5.5 {basic option retrieval} {option get .op1.op4 y Color2} brown
test option-5.6 {basic option retrieval} {option get .op1.op4 z Color2} {}

test option-6.1 {basic option retrieval} {option get .op2 x Color1} orange
test option-6.2 {basic option retrieval} {option get .op2 y Color1} orange
test option-6.3 {basic option retrieval} {option get .op2 z Color1} orange
test option-6.4 {basic option retrieval} {option get .op2 x Color2} blue
test option-6.5 {basic option retrieval} {option get .op2 y Color2} {}
test option-6.6 {basic option retrieval} {option get .op2 z Color2} {}

test option-7.1 {basic option retrieval} {option get .op2.op5 x Color1} orange
test option-7.2 {basic option retrieval} {option get .op2.op5 y Color1} orange
test option-7.3 {basic option retrieval} {option get .op2.op5 z Color1} orange
test option-7.4 {basic option retrieval} {option get .op2.op5 x Color2} purple
test option-7.5 {basic option retrieval} {option get .op2.op5 y Color2} purple
test option-7.6 {basic option retrieval} {option get .op2.op5 z Color2} purple
d189 98
a286 34
test option-8.1 {stack pushing/popping} {option get .op2.op5 x Color1} orange
test option-8.2 {stack pushing/popping} {option get .op2.op5 y Color1} orange
test option-8.3 {stack pushing/popping} {option get .op2.op5 z Color1} orange
test option-8.4 {stack pushing/popping} {option get .op2.op5 x Color2} purple
test option-8.5 {stack pushing/popping} {option get .op2.op5 y Color2} purple
test option-8.6 {stack pushing/popping} {option get .op2.op5 z Color2} purple

test option-9.1 {stack pushing/popping} {option get . x Color1} blue
test option-9.2 {stack pushing/popping} {option get . y Color1} red
test option-9.3 {stack pushing/popping} {option get . z Color1} red
test option-9.4 {stack pushing/popping} {option get . x Color2} blue
test option-9.5 {stack pushing/popping} {option get . y Color2} {}
test option-9.6 {stack pushing/popping} {option get . z Color2} {}

test option-10.1 {stack pushing/popping} {option get .op1.op3.op6 x Color1} blue
test option-10.2 {stack pushing/popping} {option get .op1.op3.op6 y Color1} red
test option-10.3 {stack pushing/popping} {option get .op1.op3.op6 z Color1} red
test option-10.4 {stack pushing/popping} {option get .op1.op3.op6 x Color2} black
test option-10.5 {stack pushing/popping} {option get .op1.op3.op6 y Color2} black
test option-10.6 {stack pushing/popping} {option get .op1.op3.op6 z Color2} black

test option-11.1 {stack pushing/popping} {option get .op1.op3 x Color1} yellow
test option-11.2 {stack pushing/popping} {option get .op1.op3 y Color1} red
test option-11.3 {stack pushing/popping} {option get .op1.op3 z Color1} red
test option-11.4 {stack pushing/popping} {option get .op1.op3 x Color2} yellow
test option-11.5 {stack pushing/popping} {option get .op1.op3 y Color2} {}
test option-11.6 {stack pushing/popping} {option get .op1.op3 z Color2} {}

test option-12.1 {stack pushing/popping} {option get .op1 x Color1} green
test option-12.2 {stack pushing/popping} {option get .op1 y Color1} red
test option-12.3 {stack pushing/popping} {option get .op1 z Color1} red
test option-12.4 {stack pushing/popping} {option get .op1 x Color2} green
test option-12.5 {stack pushing/popping} {option get .op1 y Color2} {}
test option-12.6 {stack pushing/popping} {option get .op1 z Color2} {}
d290 2
d299 15
a313 5
test option-13.1 {priority levels} {option get .op1 a A} 100
test option-13.2 {priority levels} {option get .op1 b A} interactive
test option-13.3 {priority levels} {option get .op1 b B} userDefault
test option-13.4 {priority levels} {option get .op1 c B} startupFile
test option-13.5 {priority levels} {option get .op1 c C} widgetDefault
d315 3
a317 1
test option-13.6 {priority levels} {option get .op1 c B} startupFile
d319 4
a322 1
test option-13.7 {priority levels} {option get .op1 c B} file2
d326 37
a362 36
test option-14.1 {error conditions} {
    list [catch {option} msg] $msg
} {1 {wrong # args: should be "option cmd arg ?arg ...?"}}
test option-14.2 {error conditions} {
    list [catch {option x} msg] $msg
} {1 {bad option "x": must be add, clear, get, or readfile}}
test option-14.3 {error conditions} {
    list [catch {option foo 3} msg] $msg
} {1 {bad option "foo": must be add, clear, get, or readfile}}
test option-14.4 {error conditions} {
    list [catch {option add 3} msg] $msg
} {1 {wrong # args: should be "option add pattern value ?priority?"}}
test option-14.5 {error conditions} {
    list [catch {option add . a b c} msg] $msg
} {1 {wrong # args: should be "option add pattern value ?priority?"}}
test option-14.6 {error conditions} {
    list [catch {option add . a -1} msg] $msg
} {1 {bad priority level "-1": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}}
test option-14.7 {error conditions} {
    list [catch {option add . a 101} msg] $msg
} {1 {bad priority level "101": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}}
test option-14.8 {error conditions} {
    list [catch {option add . a gorp} msg] $msg
} {1 {bad priority level "gorp": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}}
test option-14.9 {error conditions} {
    list [catch {option get 3} msg] $msg
} {1 {wrong # args: should be "option get window name class"}}
test option-14.10 {error conditions} {
    list [catch {option get 3 4} msg] $msg
} {1 {wrong # args: should be "option get window name class"}}
test option-14.11 {error conditions} {
    list [catch {option get 3 4 5 6} msg] $msg
} {1 {wrong # args: should be "option get window name class"}}
test option-14.12 {error conditions} {
    list [catch {option get .gorp.gorp a A} msg] $msg
} {1 {bad window path name ".gorp.gorp"}}
d365 36
a400 1
set option2 [file join [testsDirectory] option.file2]
a401 18
test option-15.1 {database files} {
    list [catch {option read non-existent} msg] $msg
} {1 {couldn't open "non-existent": no such file or directory}}
option read $option1
test option-15.2 {database files} {option get . x1 color} blue
test option-15.3 {database files} appNameIsTktest {option get . x2 color} green
test option-15.4 {database files} {option get . x3 color} purple
test option-15.5 {database files} {option get . {x 4} color} brown
test option-15.6 {database files} {option get . x6 color} {}
test option-15.7 {database files} {
    list [catch {option read $option1 widget foo} msg] $msg
} {1 {wrong # args: should be "option readfile fileName ?priority?"}}
option add *x3 burgundy
catch {option read $option1 userDefault}
test option-15.8 {database files} {option get . x3 color} burgundy
test option-15.9 {database files} {
    list [catch {option read $option2} msg] $msg
} {1 {missing colon on line 2}}
d403 1
a403 1
test option-16.1 {ReadOptionFile} {
d410 2
a411 1
    set result [list [option get . x7 color] [option get . x8 color]]
d413 1
a413 2
    set result
} {true false}
d415 1
a415 2
catch {destroy .op1}
catch {destroy .op2}
d420 3
@


1.5
log
@        * tests/all.tcl:                Made better use of a common
        * tests/constraints.tcl:        -loadfile to hold definitions
        * tests/*.test:                 common to all test files.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: option.test,v 1.4 2002/07/13 20:28:35 dgp Exp $
d15 2
d198 1
a198 3
if {$appName == "tktest"} {
    test option-15.3 {database files} {option get . x2 color} green
}
a229 13













@


1.4
log
@	* Converted more files to tcltest and factored out common code.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: option.test,v 1.3 1999/04/16 01:51:40 stanton Exp $
d12 1
a12 4
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
a14 3
namespace import -force tcltest::makeFile
namespace import -force tcltest::removeFile

d228 1
a228 1
::tcltest::cleanupTests
@


1.3
log
@* Merged 8.1 branch into the main trunk
@
text
@d9 1
a9 1
# RCS: @@(#) $Id$
d11 9
a19 3
if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}
d194 2
a195 3
set option1 [file join $::tcltest::testsDir option.file1]
set option2 [file join $::tcltest::testsDir option.file2]
set option3 [file join $::tcltest::testsDir option.file3]
d219 2
a220 1
    set file [open "$option3" w]
@


1.3.18.1
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@d11 3
a13 9
package require tcltest 2.1
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
tcltest::loadTestedCommands

namespace import -force tcltest::makeFile
namespace import -force tcltest::removeFile
d188 3
a190 2
set option1 [file join [testsDirectory] option.file1]
set option2 [file join [testsDirectory] option.file2]
d214 1
a214 2
    set option3 [makeFile {} option.file3]
    set file [open $option3 w]
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d6 2
a7 3
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d11 3
a13 2
if {[string compare test [info procs test]] == 1} then \
  {source defs}
d188 3
a190 9
if {$tcl_platform(os) == "Win32s"} {
    set option1 OPTION~2.FIL
    set option2 OPTION~1.FIL
    set option3 OPTION~3.FIL
} else {
    set option1 option.file1
    set option2 option.file2
    set option3 option.file3
}
d226 17
a242 1
concat {}
@


1.1
log
@Initial revision
@
text
@d10 1
a10 1
# SCCS: @@(#) option.test 1.20 97/08/07 15:54:37
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d10 1
a10 1
# RCS: @@(#) $Id: option.test,v 1.2 1998/09/14 18:23:49 stanton Exp $
@


1.1.4.2
log
@Updated the testsuite to use "test" namespace and commandline args
to control verbose  level and which tests get run.  Tests now work from
any working dir.
@
text
@a5 2
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
d7 4
a10 1
# RCS: @@(#) $Id: option.test,v 1.1.4.1 1998/09/30 02:18:50 stanton Exp $
d12 2
a13 3
if {[lsearch [namespace children] ::test] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}
d189 3
a191 3
    set option1 [file join $::test::testsDir OPTION~2.FIL]
    set option2 [file join $::test::testsDir OPTION~1.FIL]
    set option3 [file join $::test::testsDir OPTION~3.FIL]
d193 3
a195 3
    set option1 [file join $::test::testsDir option.file1]
    set option2 [file join $::test::testsDir option.file2]
    set option3 [file join $::test::testsDir option.file3]
d232 1
a232 4

# cleanup
::test::cleanupTests
return
@


1.1.4.3
log
@- changed ::test to ::tcltest
- made many tests more atomic (still more work to do here)
- defs.tcl is now identicle for tcl and tk
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: option.test,v 1.1.4.2 1999/03/11 18:51:03 hershey Exp $
d11 1
a11 1
if {[lsearch [namespace children] ::tcltest] == -1} {
d189 3
a191 3
    set option1 [file join $::tcltest::testsDir OPTION~2.FIL]
    set option2 [file join $::tcltest::testsDir OPTION~1.FIL]
    set option3 [file join $::tcltest::testsDir OPTION~3.FIL]
d193 3
a195 3
    set option1 [file join $::tcltest::testsDir option.file1]
    set option2 [file join $::tcltest::testsDir option.file2]
    set option3 [file join $::tcltest::testsDir option.file3]
d234 1
a234 1
::tcltest::cleanupTests
a235 12












@


1.1.4.4
log
@lint:  changed a tcltest namespace variable name from tmpDir to
       workingDir.
changes:  made more tests atomic.
README is now updated to match new test suite features.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: option.test,v 1.1.4.3 1999/03/24 01:17:00 hershey Exp $
a235 1

@


1.1.4.5
log
@Now all test files that skip tests by returning early (which ideally they
shouldn't do) call ::tcltest::cleanupTests before returning.  The defs.tcl
file has one hew constraint:  userInteraction, used by tests that require
user interaction.  The next putback will include an updated version of the
"visual" test file to use this mechanism.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: option.test,v 1.1.4.4 1999/03/24 02:54:55 hershey Exp $
d188 9
a196 3
set option1 [file join $::tcltest::testsDir option.file1]
set option2 [file join $::tcltest::testsDir option.file2]
set option3 [file join $::tcltest::testsDir option.file3]
@


