70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
+
-
+
+
+
+
-
+
+
|
if {$group ne $prev} {
incr test
set prev $group
puts $out ""
}
# Test case
if {[string index $name 0] ne {$}} {
set buffer [format "\ntest %s-%d.%d {%s}" $group $test [incr cases($group)] $name]
set buffer [format "\ntest %s-%d.%d {%s}" $group $test [incr cases($group)] $name]
} else {
set buffer [format "\ntest %s-%d.%d %s" $group $test [incr cases($group)] $name]
}
foreach opt [list -constraints -setup -body -cleanup -match -result -output -errorOutput -returnCodes] {
set cmd [string trim [set [string trimleft $opt "-"]]]
if {$cmd ne ""} {
if {$opt in [list -setup -body -cleanup]} {
append buffer " " $opt " \{\n"
foreach line [split $cmd ";"] {
append buffer \t [string trim $line] \n
}
append buffer " \}"
} elseif {$opt in [list -output -errorOutput]} {
append buffer " " $opt " {" $cmd \n "}"
} elseif {$opt in [list -result]} {
if {[string index $cmd 0] in [list \[ \" \{]} {
if {[string index $cmd 0] in [list \[ \" \{ \$]} {
append buffer " " $opt " " $cmd
} elseif {[string match {*[\\$]*} $cmd]} {
append buffer " " $opt " \"" [string map [list \\\\\" \\\"] [string map [list \" \\\" ] $cmd]] "\""
} else {
append buffer " " $opt " {" $cmd "}"
}
} else {
append buffer " " $opt " {" $cmd "}"
}
}
}
puts $out $buffer
} else {
# Empty line
puts $out ""
}
break
}
}
# Output clean-up commands
puts $out "\n# Cleanup\n::tcltest::cleanupTests\nreturn"
|