Ignore:
Timestamp:
Jan 7, 2009 9:31:14 AM (14 years ago)
Author:
dkearney
Message:

fixing rp library's get() function for retrieving encoded data. if the data is encoded there is no need to do xml entity translation. adding a function rappture's encode class for checking to see if a string has a proper header encode header. adding corresponding tcl functions and tests. also adjusting some of the int declarations to size_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lang/tcl/tests/encode.test

    r1042 r1264  
    2929test is-1.0.1 {Rappture::encoding::is, 0 arguments} {
    3030    list [catch {Rappture::encoding::is} msg] $msg
    31 } {1 {wrong # args: should be "Rappture::encoding::is binary <string>"}}
     31} {1 {wrong # args: should be "Rappture::encoding::is binary|encoded <string>"}}
    3232
    3333test is-1.1.1 {Rappture::encoding::is, 1 incomplete subcommand} {
    3434    list [catch {Rappture::encoding::is binary} msg] $msg
    35 } {1 {wrong # args: should be "Rappture::encoding::is binary <string>"}}
     35} {1 {wrong # args: should be "Rappture::encoding::is binary|encoded <string>"}}
    3636
    3737test is-1.1.2 {Rappture::encoding::is, 1 subcommand w/ string} {
     
    4747test is-1.2.0 {Rappture::encoding::is, 1 invalid subcommand} {
    4848    list [catch {Rappture::encoding::is binaryy "hi"} msg] $msg
    49 } {1 {bad option "binaryy": should be binary}}
     49} {1 {bad option "binaryy": should be one of binary, encoded}}
    5050
    5151test is-1.2.1 {Rappture::encoding::is, too many arguments} {
    5252    list [catch {Rappture::encoding::is binary binary "hi"} msg] $msg
    53 } {1 {wrong # args: should be "Rappture::encoding::is binary <string>"}}
     53} {1 {wrong # args: should be "Rappture::encoding::is binary|encoded <string>"}}
    5454
    5555test is-1.2.2 {Rappture::encoding::is, with an embedded null} {
    5656    list [catch {Rappture::encoding::is binary "x\000x"} msg] $msg
     57} {0 yes}
     58
     59test is-1.3.1 {Rappture::encoding::is, encoded subcommand w/ false string} {
     60    list [catch {Rappture::encoding::is encoded "hi"} msg] $msg
     61} {0 no}
     62
     63test is-1.3.2 {Rappture::encoding::is, encoded b64 flag and extra string} {
     64    set h "@@RP-ENC:b64\nH4sIAAAAAAAAA8vIBACsKpPYAgAAAA=="
     65    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     66} {0 yes}
     67
     68test is-1.3.3 {Rappture::encoding::is, encoded zb64 flag and extra string} {
     69    set h "@@RP-ENC:zb64\nH4sIAAAAAAAAA8vIBACsKpPYAgAAAA=="
     70    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     71} {0 yes}
     72
     73test is-1.3.4 {Rappture::encoding::is, encoded z flag and extra string} {
     74    set h "@@RP-ENC:z\nH4sIAAAAAAAAA8vIBACsKpPYAgAAAA=="
     75    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     76} {0 yes}
     77
     78test is-1.3.5 {Rappture::encoding::is, encoded z flag newline no string} {
     79    set h "@@RP-ENC:z\n"
     80    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     81} {0 yes}
     82
     83test is-1.3.6 {Rappture::encoding::is, encoded b64 flag newline no string} {
     84    set h "@@RP-ENC:b64\n"
     85    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     86} {0 yes}
     87
     88test is-1.3.7 {Rappture::encoding::is, encoded zb64 flag newline no string} {
     89    set h "@@RP-ENC:zb64\n"
     90    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     91} {0 yes}
     92
     93test is-1.3.7 {Rappture::encoding::is, encoded z flag no newline no string} {
     94    set h "@@RP-ENC:zb64"
     95    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     96} {0 no}
     97
     98test is-1.3.8 {Rappture::encoding::is, encoded b64 flag no newline no string} {
     99    set h "@@RP-ENC:b64"
     100    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     101} {0 no}
     102
     103test is-1.3.9 {Rappture::encoding::is, encoded zb64 flag no newline no string} {
     104    set h "@@RP-ENC:zb64"
     105    list [catch {Rappture::encoding::is encoded $h} msg] $msg
     106} {0 no}
     107
     108test is-1.3.10 {Rappture::encoding::is, encoded with an embedded null} {
     109    list [catch {Rappture::encoding::is encoded "@@RP-ENC:zb64\nx\000x"} msg] $msg
    57110} {0 yes}
    58111
Note: See TracChangeset for help on using the changeset viewer.