Changeset 1409 for trunk/lang
- Timestamp:
- Apr 21, 2009, 11:40:07 AM (16 years ago)
- Location:
- trunk/lang/tcl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lang/tcl/src/RpEncodeTclInterface.cc
r1384 r1409 146 146 *flagsPtr = RPENC_Z; 147 147 } else { 148 Tcl_AppendResult(interp, "bad order \"", string, 149 "\": should be breadthfirst, inorder, preorder, or postorder", 150 (char *)NULL); 148 Tcl_AppendResult(interp, "bad value \"", string, 149 "\": should be b64, zb64, or z", (char *)NULL); 151 150 return TCL_ERROR; 152 151 } … … 239 238 {SWITCH_CUSTOM, "-as", "z|b64|zb64", 240 239 offsetof(DecodeSwitches, flags), 0, 0, &asSwitch}, 241 {SWITCH_BITMASK, "- raw", "",240 {SWITCH_BITMASK, "-noheader", "", 242 241 offsetof(DecodeSwitches, flags), 0, RPENC_RAW}, 243 242 {SWITCH_END} -
trunk/lang/tcl/tests/encode.test
r1264 r1409 47 47 test is-1.2.0 {Rappture::encoding::is, 1 invalid subcommand} { 48 48 list [catch {Rappture::encoding::is binaryy "hi"} msg] $msg 49 } {1 {bad option "binaryy": should be one of binary,encoded}}49 } {1 {bad option "binaryy": should be binary or encoded}} 50 50 51 51 test is-1.2.1 {Rappture::encoding::is, too many arguments} { … … 118 118 test encode-2.0.0 {Rappture::encoding::encode, 0 arguments} { 119 119 list [catch {Rappture::encoding::encode} msg] $msg 120 } {1 {wrong # args: should be "Rappture::encoding::encode ?-as z|b64|zb64? ?-no -header? ?--? <string>"}}120 } {1 {wrong # args: should be "Rappture::encoding::encode ?-as z|b64|zb64? ?-noheader? ?--? string"}} 121 121 122 122 test encode-2.1.0 {Rappture::encoding::encode, ascii string argument} { … … 134 134 }} 135 135 136 test encode-2.2.0 {Rappture::encoding::encode, -as flag blankvalue} {136 test encode-2.2.0 {Rappture::encoding::encode, -as flag no value} { 137 137 list [catch {Rappture::encoding::encode -as} msg] $msg 138 } {1 { bad value "": should be one of z, b64, zb64}}138 } {1 {value for "-as" missing}} 139 139 140 140 test encode-2.2.1 {Rappture::encoding::encode, -as flag bad value } { 141 141 list [catch {Rappture::encoding::encode -as zz} msg] $msg 142 } {1 {bad value "zz": should be one of z, b64, zb64}}142 } {1 {bad value "zz": should be b64, zb64, or z}} 143 143 144 144 test encode-2.2.2 {Rappture::encoding::encode, -as flag correct value z} { 145 145 list [catch {Rappture::encoding::encode -as z} msg] $msg 146 } {1 {wrong # args: should be "Rappture::encoding::encode ?-as z|b64|zb64? ?-no -header? ?--? <string>"}}146 } {1 {wrong # args: should be "Rappture::encoding::encode ?-as z|b64|zb64? ?-noheader? ?--? string"}} 147 147 148 148 test encode-2.2.3 {Rappture::encoding::encode, -as z w/ string} { … … 158 158 test encode-2.2.5 {Rappture::encoding::encode with --} { 159 159 list [catch {Rappture::encoding::encode -hi} msg] $msg 160 } {1 {bad option "-hi": should be -as, -no-header, --}} 160 } {1 {unknown switch "-hi" 161 following switches are available: 162 -as z|b64|zb64 163 -noheader }} 161 164 162 165 test encode-2.2.6 {Rappture::encoding::encode with --} { … … 174 177 test decode-3.0.0 {Rappture::encoding::decode, 0 arguments} { 175 178 list [catch {Rappture::encoding::decode} msg] $msg 176 } {1 {wrong # args: should be "Rappture::encoding::decode ?-as z|b64|zb64? ?--? <string>"}}179 } {1 {wrong # args: should be "Rappture::encoding::decode ?-as z|b64|zb64? ?--? string"}} 177 180 178 181 test decode-3.1.0 {Rappture::encoding::decode, 1 arg, b64 encoded} { … … 188 191 test decode-3.1.2 {Rappture::encoding::decode, 2 args} { 189 192 list [catch {Rappture::encoding::decode "hi" "bye"} msg] $msg 190 } {1 {wrong # args: should be "Rappture::encoding::decode ?-as z|b64|zb64? ?--? <string>"}}193 } {1 {wrong # args: should be "Rappture::encoding::decode ?-as z|b64|zb64? ?--? string"}} 191 194 192 195 test decode-3.2.0 {Rappture::encoding::decode, -as flag, no value} { 193 196 list [catch {Rappture::encoding::decode -as} msg] $msg 194 } {1 { bad value "": should be one of z, b64, zb64}}197 } {1 {value for "-as" missing}} 195 198 196 199 test decode-3.2.1 {Rappture::encoding::decode, -as flag, bad value} { 197 200 list [catch {Rappture::encoding::decode -as zz} msg] $msg 198 } {1 {bad value "zz": should be one of z, b64, zb64}} 201 } {1 {bad value "zz": should be b64, zb64, or z}} 202 203 # This test is wrong. The -as z flag should either 1) be ignored and return 204 # "hi" (using the header) or 2) override the header and return an error when 205 # attempting to decompress the bogus string (see 3.2.2b) 199 206 200 207 test decode-3.2.2 {Rappture::encoding::decode, -as flag, zb64 w/ string} { … … 203 210 } {0 {@@RP-ENC:zb64 204 211 H4sIAAAAAAAAA8vIBACsKpPYAgAAAA==}} 212 213 test decode-3.2.2b {Rappture::encoding::decode, -as -noheader, zb64 w/ string} { 214 set h "@@RP-ENC:zb64\nH4sIAAAAAAAAA8vIBACsKpPYAgAAAA==" 215 list [catch {Rappture::encoding::decode -as z -noheader $h} msg] $msg 216 } {1 {Rappture::Buffer::do_decompress() 217 : 218 memory error while inflating data 219 Rappture::Buffer::do_decompress() 220 }} 205 221 206 222 test decode-3.2.3 {Rappture::encoding::decode, -as flag, b64 w/ string} { … … 216 232 test encode-3.2.5 {Rappture::encoding::decode with --} { 217 233 list [catch {Rappture::encoding::decode -hi} msg] $msg 218 } {1 {bad option "-hi": should be -as, --}} 234 } {1 {unknown switch "-hi" 235 following switches are available: 236 -as z|b64|zb64 237 -noheader }} 238 219 239 220 240 test encode-3.2.6 {Rappture::encoding::decode with --} {
Note: See TracChangeset
for help on using the changeset viewer.