Index: openacs-4/packages/acs-tcl/tcl/test/naviserver-api-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/Attic/naviserver-api-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/acs-tcl/tcl/test/naviserver-api-procs.tcl 4 Sep 2019 11:58:03 -0000 1.1.2.2 +++ openacs-4/packages/acs-tcl/tcl/test/naviserver-api-procs.tcl 6 Oct 2019 15:45:32 -0000 1.1.2.3 @@ -1,19 +1,31 @@ ad_library { - Procs to test Naviserver API capabilities + Procs to test NaviServer API capabilities. } aa_register_case \ -cats {api smoke} \ base64__tcl_vs_ns_decode { - Tests that decoding of md5 string using tcl base64 package - behaves the same as Naviserver implementation. + + Tests that decoding of base64 encoded strings using the tcllib + base64 package behaves the same as NaviServer implementation. + } { package require base64 - set md5 {iVBORw0KGgoAAAANSUhEUgAAAAUA + # + # base64 encoded tring with weird spaces. + # + set base64encoded {iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==} + # + # Force the result to binary to get same results as tcllib function. + # + catch {ns_base64decode} result + set flag [expr {[string match *binary* $result] ? "-binary" : ""}] + aa_log "base64::decode: [ns_md5 [base64::decode $base64encoded]]" + aa_log "ns_base64decode: [ns_md5 [ns_base64decode {*}$flag $base64encoded]]" aa_true "Decoding of md5 string is identical" \ - {[base64::decode $md5] eq [ns_base64decode $md5]} + {[ns_md5 [base64::decode $base64encoded]] eq [ns_md5 [ns_base64decode {*}$flag $base64encoded]]} } # Local variables: