summaryrefslogtreecommitdiffstats
path: root/tests/option.test
diff options
context:
space:
mode:
authorandreask <andreask>2013-01-22 19:30:43 (GMT)
committerandreask <andreask>2013-01-22 19:30:43 (GMT)
commit48c9fcb7281cc6aa076113db874c7ae0e105795d (patch)
tree7187940ff056462bfa41705a2ce04d0ed07d424e /tests/option.test
parent41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff)
downloadtk-48c9fcb7281cc6aa076113db874c7ae0e105795d.zip
tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.gz
tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.bz2
Contribution by Patrick Fradin <patrick.fradin@planar.com>contrib_patrick_fradin_code_cleanup
Quoting his mail: <pre> ========================================================== Hi Jeff, I spent some of my time to contribute to the TclTk community ! I'm in late for Christmas gift but like we said in French : "Mieux vaut tard que jamais". ;-) I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and Tk library directories (library, tools and tests) to correct a lot of warnings and few errors. (encapsulate some expr, use 'chan xxx' instead of fconfigure, fileevent...) I've made some improvements too : Examples : - Use 'lassign' instead of many 'lindex' of 'foreach/break' loop. - Use 'in' or 'ni' operators instead of 'lsearch -exact' or to factorise some eq/ne && / || tests. - Use 'eq' or 'ne' to tests strings instead of '==' or '!='. - Use 'unset -nocomplain' to avoid 'catch {unset...}'. - Remove some useless catch around 'destroy' calls. - Use expand {*} instead of 'eval'. Don't touch a lot of code because I don't know all structs and lists. I think it could be a greater improvement to reduce 'eval' calls. Due to previous experience, I dot not change any indentation ! ;-) ========================================================== </pre>
Diffstat (limited to 'tests/option.test')
-rw-r--r--tests/option.test18
1 files changed, 3 insertions, 15 deletions
diff --git a/tests/option.test b/tests/option.test
index 66df70c..4fdb08a 100644
--- a/tests/option.test
+++ b/tests/option.test
@@ -58,7 +58,6 @@ 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
@@ -78,7 +77,6 @@ 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
@@ -98,7 +96,6 @@ 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
@@ -118,7 +115,6 @@ 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
@@ -138,7 +134,6 @@ 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
@@ -158,7 +153,6 @@ 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
@@ -203,7 +197,6 @@ 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
@@ -223,7 +216,6 @@ 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
@@ -243,7 +235,6 @@ 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
@@ -263,7 +254,6 @@ 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
@@ -358,7 +348,6 @@ 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
@@ -397,13 +386,12 @@ test option-15.9 {database files} -body {
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
+ chan configure $file -translation crlf
+ chan puts $file "*x7: true\n*x8: false"
+ chan close $file
option read $option3 userDefault
list [option get . x7 color] [option get . x8 color]
} -cleanup {