Changeset 85 for trunk/test
- Timestamp:
- 12/21/06 12:17:13 (2 years ago)
- Files:
-
- trunk (modified) (1 prop)
- trunk/test/test.html (modified) (2 diffs)
- trunk/test/test.js (modified) (1 diff)
- trunk/test/test_codecs.js (modified) (1 diff)
- trunk/test/test_core.js (modified) (1 diff)
- trunk/test/test_crypto.js (modified) (1 diff)
- trunk/test/test_iter.js (deleted)
- trunk/test/test_itertools.js (copied) (copied from branches/experimental/test/test_itertools.js)
- trunk/test/test_jsonrpc.js (modified) (1 diff)
- trunk/test/test_sets.js (modified) (1 diff)
- trunk/test/test_strings.js (modified) (1 diff)
- trunk/test/test_testing.js (modified) (1 diff)
- trunk/test/test_urllib.js (modified) (1 diff)
- trunk/test/test_xmlrpc.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk
- Property svn:ignore set to
build
- Property svn:ignore set to
trunk/test/test.html
r53 r85 3 3 <head> 4 4 <title>jsolait testing</title> 5 <script src="../build/jsolait/jsolait.js"></script> 6 <script>jsolait.baseURI = "../build/jsolait"</script> 7 <script src="./test.js"></script> 8 <script src="./test.js"></script> 5 <script src="../jsolait/jsolait.js"></script> 9 6 <script> 10 7 var print=function(){ … … 16 13 }; 17 14 18 var test = imprt('test'); 19 var testing = imprt("testing"); 20 test.test(testing, {log:print}); 15 jsolait.loadModule('test', function(test, err){ 16 if(err){ 17 print(err); 18 }else{ 19 test.test({log:print}); 20 } 21 22 }); 23 21 24 22 25 </script> trunk/test/test.js
r52 r85 1 Module("test", "$Revision: 44 $", function(mod){ 1 __version__ ="$Revision: 44 $"; 2 3 var moduleNames=['testing','core','sets','itertools','codecs','crypto','urllib', 'jsonrpc','xmlrpc']; 4 5 publ log(){ 6 print.apply(null, arguments); 7 }; 8 9 publ test(logger){ 10 11 12 var step=function(i){ 13 var modName= 'test_' + moduleNames[i]; 14 logger.log('loading', modName) 15 jsolait.loadModule(modName, function(m,err){ 16 if(err){ 17 logger.log(err); 18 }else{ 19 try{ 20 m.test(logger); 21 }catch(e){ 22 logger.log(e); 23 } 24 } 25 if(i<moduleNames.length-1){ 26 step(i+1); 27 } 28 }); 29 } 2 30 3 var moduleNames=['testing','core','sets','iter','codecs','crypto','urllib', 'jsonrpc','xmlrpc']; 31 step(0); 32 33 34 }; 4 35 5 mod.log=function(){ 6 print.apply(null, arguments); 7 }; 8 9 mod.test=function(t, logger){ 10 11 for(var i=0;i<moduleNames.length;i++){ 12 var modName= 'test_' + moduleNames[i]; 13 14 var m = imprt(modName); 15 try{ 16 m.test(t, logger); 17 }catch(e){ 18 logger.log(e); 19 throw(e) 20 } 21 } 22 }; 23 24 mod.__main__=function(){ 25 var testing = imprt("testing"); 26 mod.test(testing, mod); 27 }; 36 publ __main__(){ 37 test(mod); 38 }; 28 39 29 });trunk/test/test_codecs.js
r50 r85 1 Module("test_codecs", "$Revision: 44 $", function(mod){ 1 __version__ = "$Revision: 44 $"; 2 2 3 mod.test=function(testing, logger){ 4 var codecs = imprt('codecs'); 5 logger.log("testing codecs ..."); 6 7 8 testing.assertEquals('encoders', codecs.listEncoders(), ['base64','uri','lzw']); 9 testing.assertEquals('decoders', codecs.listDecoders(), ['base64','uri','lzw']); 10 11 var s=''; 12 for(var i=0;i<256;i++){ 13 s +=String.fromCharCode(i); 14 } 15 testing.assertEquals("encode uri", s.encode("uri"), "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23%24%25%26'()*%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%C2%80%C2%81%C2%82%C2%83%C2%84%C2%85%C2%86%C2%87%C2%88%C2%89%C2%8A%C2%8B%C2%8C%C2%8D%C2%8E%C2%8F%C2%90%C2%91%C2%92%C2%93%C2%94%C2%95%C2%96%C2%97%C2%98%C2%99%C2%9A%C2%9B%C2%9C%C2%9D%C2%9E%C2%9F%C2%A0%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD%C2%AE%C2%AF%C2%B0%C2%B1%C2%B2%C2%B3%C2%B4%C2%B5%C2%B6%C2%B7%C2%B8%C2%B9%C2%BA%C2%BB%C2%BC%C2%BD%C2%BE%C2%BF%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B7%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BE%C3%BF"); 16 testing.assertEquals("encode base64", s.encode("base64"), "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=="); 17 18 testing.assertEquals("decode uri", "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23%24%25%26'()*%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%C2%80%C2%81%C2%82%C2%83%C2%84%C2%85%C2%86%C2%87%C2%88%C2%89%C2%8A%C2%8B%C2%8C%C2%8D%C2%8E%C2%8F%C2%90%C2%91%C2%92%C2%93%C2%94%C2%95%C2%96%C2%97%C2%98%C2%99%C2%9A%C2%9B%C2%9C%C2%9D%C2%9E%C2%9F%C2%A0%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD%C2%AE%C2%AF%C2%B0%C2%B1%C2%B2%C2%B3%C2%B4%C2%B5%C2%B6%C2%B7%C2%B8%C2%B9%C2%BA%C2%BB%C2%BC%C2%BD%C2%BE%C2%BF%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B7%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BE%C3%BF".decode('uri'),s); 19 testing.assertEquals("decode base64", "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==".decode('base64'), s); 20 }; 3 import testing; 4 import codecs; 5 6 publ test(logger){ 7 logger.log("testing codecs ..."); 8 9 testing.assertEquals('encoders', codecs.listEncoders(), ['base64','uri','lzw']); 10 testing.assertEquals('decoders', codecs.listDecoders(), ['base64','uri','lzw']); 21 11 12 var s=''; 13 for(var i=0;i<256;i++){ 14 s +=String.fromCharCode(i); 15 } 16 testing.assertEquals("encode uri", s.encode("uri"), "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23%24%25%26'()*%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%C2%80%C2%81%C2%82%C2%83%C2%84%C2%85%C2%86%C2%87%C2%88%C2%89%C2%8A%C2%8B%C2%8C%C2%8D%C2%8E%C2%8F%C2%90%C2%91%C2%92%C2%93%C2%94%C2%95%C2%96%C2%97%C2%98%C2%99%C2%9A%C2%9B%C2%9C%C2%9D%C2%9E%C2%9F%C2%A0%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD%C2%AE%C2%AF%C2%B0%C2%B1%C2%B2%C2%B3%C2%B4%C2%B5%C2%B6%C2%B7%C2%B8%C2%B9%C2%BA%C2%BB%C2%BC%C2%BD%C2%BE%C2%BF%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B7%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BE%C3%BF"); 17 testing.assertEquals("encode base64", s.encode("base64"), "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=="); 22 18 23 mod.__main__=function(){ 24 mod.test(imprt('testing'), {log:print}) 25 }; 26 }); 19 testing.assertEquals("decode uri", "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23%24%25%26'()*%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%C2%80%C2%81%C2%82%C2%83%C2%84%C2%85%C2%86%C2%87%C2%88%C2%89%C2%8A%C2%8B%C2%8C%C2%8D%C2%8E%C2%8F%C2%90%C2%91%C2%92%C2%93%C2%94%C2%95%C2%96%C2%97%C2%98%C2%99%C2%9A%C2%9B%C2%9C%C2%9D%C2%9E%C2%9F%C2%A0%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD%C2%AE%C2%AF%C2%B0%C2%B1%C2%B2%C2%B3%C2%B4%C2%B5%C2%B6%C2%B7%C2%B8%C2%B9%C2%BA%C2%BB%C2%BC%C2%BD%C2%BE%C2%BF%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B7%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BE%C3%BF".decode('uri'),s); 20 testing.assertEquals("decode base64", "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==".decode('base64'), s); 21 }; 22 23 24 publ __main__(){ 25 test({log:print}) 26 }; trunk/test/test_core.js
r63 r85 1 Module("test_core", "0.0.1", function(mod){ 1 __version__ = "$Revision: 44 $"; 2 3 import testing; 4 5 publ test(logger){ 6 logger.log("testing core String methods ..."); 2 7 3 mod.test=function(testing,logger){ 4 logger.log("testing core String methods ..."); 5 6 testing.assertEquals("%s", "...%s...".format("abc"), "...abc..."); 7 testing.assertEquals("%s", "...%s...".format(123), "...123..."); 8 testing.assertEquals("%s", "...%s...".format(123.456), "...123.456..."); 9 testing.assertEquals("%s", "...%s...".format([1,2,3]), "..." + [1,2,3] + "..."); 10 testing.assertEquals("%s", "...%s...".format({}), "..." + {} + "..."); 11 testing.assertEquals("%s", "...%%s...".format("abc"), "...%s..."); 12 13 testing.assertEquals("%()s", "...%(a)s...%(b)s...".format({a:12, b:'cdef'}), "...12...cdef..."); 14 15 testing.assertEquals("%d", "...%d...".format(1234), "...1234..."); 16 testing.assertEquals("%010d", "...%010d...".format(1234), "...0000001234..."); 17 testing.assertEquals("%-10d", "...%-10d...".format(1234), "...1234 ..."); 18 19 20 testing.assertEquals("%f", "...%f...".format(12.34), "...12.34..."); 21 testing.assertEquals("%09.3f", "...%09.3f...".format(12.3456789), "...00012.346..."); 22 testing.assertEquals("%F", "...%F...".format(12.3456789), "...12.3456789..."); 23 24 testing.assertEquals("%b", "...%b...".format(123456), "...11110001001000000..."); 25 26 testing.assertEquals("%o", "...%o...".format(123456), "...361100..."); 27 28 testing.assertEquals("%u", "...%u...".format(-12.3456), "...-12..."); 29 30 testing.assertEquals("%x", "...%x...".format(-0x12345abcdef), "...-12345abcdef..."); 31 testing.assertEquals("%x", "...%x...".format(0x12345abcdef), "...12345abcdef..."); 32 testing.assertEquals("%X", "...%X...".format(-0x12345abcdef), "...-12345ABCDEF..."); 33 testing.assertEquals("%X", "...%X...".format(0x12345abcdef), "...12345ABCDEF..."); 34 35 testing.assertEquals("%e", "...%e...".format(12.34e56), "...1.234e+57..."); 36 testing.assertEquals("%E", "...%0.1E...".format(12.34E-56), "...1.2E-55..."); 37 38 testing.assertEquals("%c", "...%c...".format(100), "...d..."); 39 testing.assertEquals("%c", "...%c...".format('a'), "...a..."); 40 41 42 testing.assertEquals("String::indent()", " abcde\n fghij".indent(4), " abcde\n fghij"); 43 testing.assertEquals("String::mul()", "abc".mul(4), "abcabcabcabc"); 44 45 logger.log("testing core functions ..."); 46 47 testing.assertEquals("repr(String)", repr("Hello JSON, '\" \\ \n \t \r"), '"Hello JSON, \'\\" \\\\ \\n \\r"'); 48 testing.assertEquals("repr([])", repr([1,2,3,4,5]), '[1,2,3,4,5]'); 49 testing.assertEquals("repr(123)", repr(1234), '1234'); 50 testing.assertEquals("repr({a:1, b:'123', ...)", repr({a:1, b:'b', c:[1,2,3]}), '{"a":1,"b":"b","c":[1,2,3]}'); 51 52 53 testing.assertEquals("id()", id("a"), "$a"); 54 testing.assertEquals("id()", id("$a"), "$$a"); 55 testing.assertEquals("id()", id(123), "#123"); 56 testing.assertEquals("id()", id(mod), mod.__id__); 57 58 59 testing.assertTrue("isinstance('a', String)", isinstance("a", String)) 60 testing.assertTrue("isinstance([], Array)", isinstance([], Array)) 61 testing.assertTrue("isinstance(1, Number)", isinstance(1, Number)) 62 63 var f = bind({x:1}, function(){ 64 return this.x; 65 }); 66 testing.assertEquals("testing bind()", {f:f, x:123}.f(), 1); 67 68 var C=Class(Array, function(publ,priv,supr){}); 69 testing.assertEquals("Array subclassing", new C(1,2,3), [1,2,3]); 70 71 var C=Class(function(publ,priv,supr){ 72 publ.__call__=function(){ 73 return this; 74 } 75 }); 76 var o = new C(); 77 testing.assertEquals("callable()", o(), o); 78 79 testing.assertEquals("jsolait.loadURI()", str(jsolait.loadURI(mod.__sourceURI__.slice(0,-2) + "txt")), "test\n"); 80 }; 8 testing.assertEquals("%s", "...%s...".format("abc"), "...abc..."); 9 testing.assertEquals("%s", "...%s...".format(123), "...123..."); 10 testing.assertEquals("%s", "...%s...".format(123.456), "...123.456..."); 11 testing.assertEquals("%s", "...%s...".format([1,2,3]), "..." + [1,2,3] + "..."); 12 testing.assertEquals("%s", "...%s...".format({}), "..." + {} + "..."); 13 testing.assertEquals("%s", "...%%s...".format("abc"), "...%s..."); 81 14 82 mod.__main__=function(){ 83 mod.test(imprt('testing'), {log:print}) 84 }; 85 }); 15 testing.assertEquals("%()s", "...%(a)s...%(b)s...".format({a:12, b:'cdef'}), "...12...cdef..."); 16 17 testing.assertEquals("%d", "...%d...".format(1234), "...1234..."); 18 testing.assertEquals("%010d", "...%010d...".format(1234), "...0000001234..."); 19 testing.assertEquals("%-10d", "...%-10d...".format(1234), "...1234 ..."); 20 21 22 testing.assertEquals("%f", "...%f...".format(12.34), "...12.34..."); 23 testing.assertEquals("%09.3f", "...%09.3f...".format(12.3456789), "...00012.346..."); 24 testing.assertEquals("%F", "...%F...".format(12.3456789), "...12.3456789..."); 25 26 testing.assertEquals("%b", "...%b...".format(123456), "...11110001001000000..."); 27 28 testing.assertEquals("%o", "...%o...".format(123456), "...361100..."); 29 30 testing.assertEquals("%u", "...%u...".format(-12.3456), "...-12..."); 31 32 testing.assertEquals("%x", "...%x...".format(-0x12345abcdef), "...-12345abcdef..."); 33 testing.assertEquals("%x", "...%x...".format(0x12345abcdef), "...12345abcdef..."); 34 testing.assertEquals("%X", "...%X...".format(-0x12345abcdef), "...-12345ABCDEF..."); 35 testing.assertEquals("%X", "...%X...".format(0x12345abcdef), "...12345ABCDEF..."); 36 37 testing.assertEquals("%e", "...%e...".format(12.34e56), "...1.234e+57..."); 38 testing.assertEquals("%E", "...%0.1E...".format(12.34E-56), "...1.2E-55..."); 39 40 testing.assertEquals("%c", "...%c...".format(100), "...d..."); 41 testing.assertEquals("%c", "...%c...".format('a'), "...a..."); 42 43 44 testing.assertEquals("String::indent()", " abcde\n fghij".indent(4), " abcde\n fghij"); 45 testing.assertEquals("String::mul()", "abc".mul(4), "abcabcabcabc"); 46 47 logger.log("testing core functions ..."); 48 49 testing.assertEquals("repr(String)", repr("Hello JSON, '\" \\ \n \t \r"), '"Hello JSON, \'\\" \\\\ \\n \\r"'); 50 testing.assertEquals("repr([])", repr([1,2,3,4,5]), '[1,2,3,4,5]'); 51 testing.assertEquals("repr(123)", repr(1234), '1234'); 52 testing.assertEquals("repr({a:1, b:'123', ...)", repr({a:1, b:'b', c:[1,2,3]}), '{"a":1,"b":"b","c":[1,2,3]}'); 53 54 55 testing.assertEquals("id()", id("a"), "$a"); 56 testing.assertEquals("id()", id("$a"), "$$a"); 57 testing.assertEquals("id()", id(123), "#123"); 58 testing.assertEquals("id()", id(mod), __id__); 59 60 61 testing.assertTrue("isinstance('a', String)", isinstance("a", String)) 62 testing.assertTrue("isinstance([], Array)", isinstance([], Array)) 63 testing.assertTrue("isinstance(1, Number)", isinstance(1, Number)) 64 65 var f = bind({x:1}, function(){ 66 return this.x; 67 }); 68 testing.assertEquals("testing bind()", {f:f, x:123}.f(), 1); 69 70 var C=Class(Array, function(publ,priv,supr){}); 71 testing.assertEquals("Array subclassing", new C(1,2,3), [1,2,3]); 72 73 var C=Class(function(publ,priv,supr){ 74 publ __call__(){ 75 return this; 76 } 77 }); 78 var o = new C(); 79 testing.assertEquals("callable()", o(), o); 80 81 //testing.assertEquals("jsolait.loadURI()", str(jsolait.loadURI(__sourceURI__.slice(0,-2) + "txt")), "test\n"); 82 }; 83 84 publ __main__(){ 85 test({log:print}) 86 }; trunk/test/test_crypto.js
r50 r85 1 Module("test_crypto", "$Revision: 44 $", function(mod){ 1 __version__ = "$Revision: 44 $"; 2 2 3 mod.test=function(testing, logger){ 4 imprt('codecs'); 5 var crypto = imprt('crypto'); 6 7 logger.log("testing crypto ..."); 8 9 10 testing.assertEquals('encoders', crypto.listEncrypters(), ['xor','rc4']); 11 testing.assertEquals('decoders', crypto.listDecrypters(), ['xor','rc4']); 12 13 var key= "abcdefg1234567890"; 14 15 var s=''; 16 for(var i=0;i<256;i++){ 17 s +=String.fromCharCode(i); 18 } 19 testing.assertEquals('encrypt("xor")', s.encrypt("xor", key).encode("base64"), "YWNhZ2FjYTY6Oj4+Ojo2NiBwcHBwcHBwKSspLykrKScZEUNBR0FDQU8YGBgYGBgYCAgCUlZWUlJeXgsJDwkLCXd5e3MlJyUjLS8ten5+enpmZmpqZDQ0NDw8PDxtb21rVVdVW11VBwULDQ8NC1xcXERERERMTEYWGhoeHhoaT02ztbe1s72/t+nr6e/p6+m+oqKmpqKirq6o+Pj4+Pj4+JGTkZeRk5GfkZnLyc/Jy8nXgICAgICAgICAitre3trapqbz8ffx8/H/8fP7ra+tq7W3teLm5uLi7u7i4uy8vLyEhISE1dfV093f3dPV3Y+Nk5WXlZPExMTMzMzMxMTOng=="); 20 testing.assertEquals('encrypt("rc4")', s.encrypt("rc4", key).encode("base64"), "KYNkxjTbYmI0cqwd/IOCw56wFR7fhio6xn3xprldajko6/Mw13Vou0h1x80+1KiI06/aRYF0Be+sjirI1ILCTVVFJCa+YzpMa8EhdAiAvlTCZp5FE/sCyvkIAIQ6fjUtGrPnEAPJYYhU+nPq9pDch4A2nZEIcbH8sLFU2ygI61DrPeNlTkEEdqNYl0NtLucBsTsWDJT163jSAaIu48k86e/G+yOru/fxcz+YS5AE5iadak24hZvSTrDFGQ6aHtNmGzJQecihB3Ltv7zl9zzvDNP+fUpPcdgnCQYus0z63TlCmC3SnmfeQ3Aly7+dpABl0ocBZv5M21zcxWqgwbTyzQ=="); 21 22 testing.assertEquals('decrypt("xor")', "YWNhZ2FjYTY6Oj4+Ojo2NiBwcHBwcHBwKSspLykrKScZEUNBR0FDQU8YGBgYGBgYCAgCUlZWUlJeXgsJDwkLCXd5e3MlJyUjLS8ten5+enpmZmpqZDQ0NDw8PDxtb21rVVdVW11VBwULDQ8NC1xcXERERERMTEYWGhoeHhoaT02ztbe1s72/t+nr6e/p6+m+oqKmpqKirq6o+Pj4+Pj4+JGTkZeRk5GfkZnLyc/Jy8nXgICAgICAgICAitre3trapqbz8ffx8/H/8fP7ra+tq7W3teLm5uLi7u7i4uy8vLyEhISE1dfV093f3dPV3Y+Nk5WXlZPExMTMzMzMxMTOng==".decode("base64").decrypt("xor", key), s); 23 testing.assertEquals('decrypt("rc4")', "KYNkxjTbYmI0cqwd/IOCw56wFR7fhio6xn3xprldajko6/Mw13Vou0h1x80+1KiI06/aRYF0Be+sjirI1ILCTVVFJCa+YzpMa8EhdAiAvlTCZp5FE/sCyvkIAIQ6fjUtGrPnEAPJYYhU+nPq9pDch4A2nZEIcbH8sLFU2ygI61DrPeNlTkEEdqNYl0NtLucBsTsWDJT163jSAaIu48k86e/G+yOru/fxcz+YS5AE5iadak24hZvSTrDFGQ6aHtNmGzJQecihB3Ltv7zl9zzvDNP+fUpPcdgnCQYus0z63TlCmC3SnmfeQ3Aly7+dpABl0ocBZv5M21zcxWqgwbTyzQ==".decode("base64").decrypt("rc4", key), s); 24 }; 3 import testing; 4 import crypto; 5 import codecs; 6 7 publ test(logger){ 25 8 26 mod.__main__=function(){ 27 mod.test(imprt('testing'), {log:print}) 28 }; 29 }); 9 logger.log("testing crypto ..."); 10 11 12 testing.assertEquals('encoders', crypto.listEncrypters(), ['xor','rc4']); 13 testing.assertEquals('decoders', crypto.listDecrypters(), ['xor','rc4']); 14 15 var key= "abcdefg1234567890"; 16 17 var s=''; 18 for(var i=0;i<256;i++){ 19 s +=String.fromCharCode(i); 20 } 21 testing.assertEquals('encrypt("xor")', s.encrypt("xor", key).encode("base64"), "YWNhZ2FjYTY6Oj4+Ojo2NiBwcHBwcHBwKSspLykrKScZEUNBR0FDQU8YGBgYGBgYCAgCUlZWUlJeXgsJDwkLCXd5e3MlJyUjLS8ten5+enpmZmpqZDQ0NDw8PDxtb21rVVdVW11VBwULDQ8NC1xcXERERERMTEYWGhoeHhoaT02ztbe1s72/t+nr6e/p6+m+oqKmpqKirq6o+Pj4+Pj4+JGTkZeRk5GfkZnLyc/Jy8nXgICAgICAgICAitre3trapqbz8ffx8/H/8fP7ra+tq7W3teLm5uLi7u7i4uy8vLyEhISE1dfV093f3dPV3Y+Nk5WXlZPExMTMzMzMxMTOng=="); 22 testing.assertEquals('encrypt("rc4")', s.encrypt("rc4", key).encode("base64"), "KYNkxjTbYmI0cqwd/IOCw56wFR7fhio6xn3xprldajko6/Mw13Vou0h1x80+1KiI06/aRYF0Be+sjirI1ILCTVVFJCa+YzpMa8EhdAiAvlTCZp5FE/sCyvkIAIQ6fjUtGrPnEAPJYYhU+nPq9pDch4A2nZEIcbH8sLFU2ygI61DrPeNlTkEEdqNYl0NtLucBsTsWDJT163jSAaIu48k86e/G+yOru/fxcz+YS5AE5iadak24hZvSTrDFGQ6aHtNmGzJQecihB3Ltv7zl9zzvDNP+fUpPcdgnCQYus0z63TlCmC3SnmfeQ3Aly7+dpABl0ocBZv5M21zcxWqgwbTyzQ=="); 23 24 testing.assertEquals('decrypt("xor")', "YWNhZ2FjYTY6Oj4+Ojo2NiBwcHBwcHBwKSspLykrKScZEUNBR0FDQU8YGBgYGBgYCAgCUlZWUlJeXgsJDwkLCXd5e3MlJyUjLS8ten5+enpmZmpqZDQ0NDw8PDxtb21rVVdVW11VBwULDQ8NC1xcXERERERMTEYWGhoeHhoaT02ztbe1s72/t+nr6e/p6+m+oqKmpqKirq6o+Pj4+Pj4+JGTkZeRk5GfkZnLyc/Jy8nXgICAgICAgICAitre3trapqbz8ffx8/H/8fP7ra+tq7W3teLm5uLi7u7i4uy8vLyEhISE1dfV093f3dPV3Y+Nk5WXlZPExMTMzMzMxMTOng==".decode("base64").decrypt("xor", key), s); 25 testing.assertEquals('decrypt("rc4")', "KYNkxjTbYmI0cqwd/IOCw56wFR7fhio6xn3xprldajko6/Mw13Vou0h1x80+1KiI06/aRYF0Be+sjirI1ILCTVVFJCa+YzpMa8EhdAiAvlTCZp5FE/sCyvkIAIQ6fjUtGrPnEAPJYYhU+nPq9pDch4A2nZEIcbH8sLFU2ygI61DrPeNlTkEEdqNYl0NtLucBsTsWDJT163jSAaIu48k86e/G+yOru/fxcz+YS5AE5iadak24hZvSTrDFGQ6aHtNmGzJQecihB3Ltv7zl9zzvDNP+fUpPcdgnCQYus0z63TlCmC3SnmfeQ3Aly7+dpABl0ocBZv5M21zcxWqgwbTyzQ==".decode("base64").decrypt("rc4", key), s); 26 }; 27 28 publ __main__(){ 29 test({log:print}) 30 }; trunk/test/test_jsonrpc.js
r50 r85 1 Module("test_jsonrpc", "0.0.1", function(mod){ 1 __version__ = "$Revision: 44 $"; 2 3 import testing; 4 import jsonrpc; 5 6 publ test(logger){ 2 7 3 mod.test=function(testing,logger){ 4 var jsonrpc=imprt('jsonrpc'); 5 6 logger.log("testing jsonrpc ..."); 7 var s = new jsonrpc.ServiceProxy("http://jsolait.net/services/test.jsonrpc",["echo"]); 8 9 var o = [1.234, 5, {a:"Hello ' \" World", b:[12,3]}, "{ [ "]; 10 11 testing.assertEquals(jsonrpc.marshall(o),'[1.234, 5, {"a": "Hello \' \\" World", "b": [12, 3]}, "{ [ "]'); 12 var r = s.echo(o); 13 testing.assertEquals(jsonrpc.marshall(r), '[1.234, 5, {"a": "Hello \' \\" World", "b": [12, 3]}, "{ [ "]'); 14 }; 8 logger.log("testing jsonrpc ..."); 9 var s = new jsonrpc.ServiceProxy("http://jsolait.net/services/test.jsonrpc",["echo"]); 15 10 16 mod.__main__=function(){ 17 mod.test(imprt('testing'), {log:print}); 18 }; 19 }); 11 var o = [1.234, 5, {a:"Hello ' \" World", b:[12,3]}, "{ [ "]; 12 13 testing.assertEquals(jsonrpc.marshall(o),'[1.234, 5, {"a": "Hello \' \\" World", "b": [12, 3]}, "{ [ "]'); 14 var r = s.echo(o); 15 testing.assertEquals(jsonrpc.marshall(r), '[1.234, 5, {"a": "Hello \' \\" World", "b": [12, 3]}, "{ [ "]'); 16 }; 20 17 18 publ __main__(){ 19 test({log:print}); 20 }; 21 trunk/test/test_sets.js
r50 r85 1 Module("test_sets", "0.0.1", function(mod){ 2 3 mod.test=function(testing,logger){ 4 var sets = imprt('sets'); 5 var s1=new sets.Set("0123456".split("")); 6 var s2=new sets.Set("3456789".split("")); 7 logger.log("testing sets..."); 1 __version__ = "$Revision: 44 $"; 2 import testing; 3 import sets; 8 4 9 testing.assertEquals("checking %s | %s".format(s1, s2), 10 new sets.Set("0123456789".split("")), s1.union(s2)); 5 publ test(logger){ 6 var s1=new sets.Set("0123456".split("")); 7 var s2=new sets.Set("3456789".split("")); 8 logger.log("testing sets..."); 11 9 12 testing.assertEquals("checking %s | %s".format(s2, s1),13 new sets.Set("0123456789".split("")), s2.union(s1));10 testing.assertEquals("checking %s | %s".format(s1, s2), 11 new sets.Set("0123456789".split("")), s1.union(s2)); 14 12 15 testing.assertEquals("checking %s & %s".format(s1, s2),16 new sets.Set("3456".split("")), s1.intersection(s2));13 testing.assertEquals("checking %s | %s".format(s2, s1), 14 new sets.Set("0123456789".split("")), s2.union(s1)); 17 15 18 testing.assertEquals("checking %s & %s".format(s2, s1),19 new sets.Set("3456".split("")), s2.intersection(s1));16 testing.assertEquals("checking %s & %s".format(s1, s2), 17 new sets.Set("3456".split("")), s1.intersection(s2)); 20 18 21 testing.assertEquals("checking %s - %s".format(s1, s2),22 new sets.Set("012".split("")), s1.difference(s2));19 testing.assertEquals("checking %s & %s".format(s2, s1), 20 new sets.Set("3456".split("")), s2.intersection(s1)); 23 21 24 testing.assertEquals("checking %s - %s".format(s2, s1),25 new sets.Set("789".split("")), s2.difference(s1));22 testing.assertEquals("checking %s - %s".format(s1, s2), 23 new sets.Set("012".split("")), s1.difference(s2)); 26 24 27 testing.assertEquals("checking %s ^ %s".format(s1, s2),28 new sets.Set("012789".split("")),s1.symmDifference(s2));25 testing.assertEquals("checking %s - %s".format(s2, s1), 26 new sets.Set("789".split("")), s2.difference(s1)); 29 27 30 testing.assertEquals("checking %s ^ %s".format(s2, s1), 31 new sets.Set("012789".split("")),s2.symmDifference(s1)); 32 }; 33 34 mod.__main__=function(){ 35 mod.test(imprt('testing'), {log:print}) 36 }; 37 }); 28 testing.assertEquals("checking %s ^ %s".format(s1, s2), 29 new sets.Set("012789".split("")),s1.symmDifference(s2)); 30 31 testing.assertEquals("checking %s ^ %s".format(s2, s1), 32 new sets.Set("012789".split("")),s2.symmDifference(s1)); 33 }; 34 35 publ __main__(){ 36 test({log:print}) 37 }; trunk/test/test_strings.js
r64 r85 1 Module("test_strings", "$Revision: 44 $", function(mod){ 1 __version__ = "$Revision: 44 $"; 2 import testing; 3 import strings; 2 4 3 mod.test=function(testing, logger){ 4 var strings = imprt('strings'); 5 6 logger.log("testing strings"); 7 8 var tmpl =str( jsolait.loadURI(mod.__sourceURI__.slice(0,-2) + "txt")); 9 testing.assertNotEquals("template loading", tmpl, ""); 10 11 12 var rslt = tmpl.exec({name:"test", b:2}); 13 testing.assertEquals("template result", rslt, "Template (test) run at Thu Jan 1 00:00:00 UTC 1970\n\n loop 0\n\n loop 1\n\n loop 2\n\n loop 3\n\n loop 4\n\n loop 5\n\n loop 6\n\n loop 7\n\n loop 8\n\n loop 9\n\n------------\n\n b is set ? > <?\n foo\n\n------------\n0,1,2,3,4,5,6,7,8,9,\n-----------\n") 14 15 16 var a = ["jsolait 1","jsolait 11", "jsolait 2"]; 17 a.sort(strings.naturalCompare); 18 testing.assertEquals("natural compare", a.join(", "), "jsolait 1, jsolait 2, jsolait 11"); 19 }; 5 publ test( logger){ 6 7 logger.log("testing strings"); 20 8 21 mod.__main__=function(){ 22 mod.test(imprt('testing'), {log:print}) 23 }; 24 }); 9 var tmpl =str( jsolait.loadURI(__sourceURI__.slice(0,-2) + "txt")); 10 testing.assertNotEquals("template loading", tmpl, ""); 11 12 var rslt = tmpl.exec({name:"test", b:2}); 13 testing.assertEquals("template result", rslt, "Template (test) run at Thu Jan 1 00:00:00 UTC 1970\n\n loop 0\n\n loop 1\n\n loop 2\n\n loop 3\n\n loop 4\n\n loop 5\n\n loop 6\n\n loop 7\n\n loop 8\n\n loop 9\n\n------------\n\n b is set ? > <?\n foo\n\n------------\n0,1,2,3,4,5,6,7,8,9,\n-----------\n") 14 15 16 var a = ["jsolait 1","jsolait 11", "jsolait 2"]; 17 a.sort(strings.naturalCompare); 18 testing.assertEquals("natural compare", a.join(", "), "jsolait 1, jsolait 2, jsolait 11"); 19 }; 20 21 publ __main__(){ 22 test({log:print}) 23 }; trunk/test/test_testing.js
r50 r85 1 Module("test_testing", "0.0.1", function(mod){ 2 mod.test=function(testing, logger){ 3 logger.log("testing testing ..."); 4 5 testing.assert(true); 6 7 testing.assertTrue(true); 8 9 testing.assertFalse(false); 10 11 testing.assertNull(null); 12 testing.assertNotNull(undefined); 13 testing.assertNotNull(''); 14 testing.assertNotNull({}); 15 testing.assertNotNull(0); 16 17 testing.assertUndefined(undefined); 18 19 testing.assertNotUndefined(null); 20 21 testing.assertNaN(NaN); 22 23 testing.assertNotNaN(435); 24 25 testing.assertEquals(1,1); 26 testing.assertEquals("a","a"); 27 testing.assertEquals(null,null); 28 testing.assertEquals(undefined,undefined); 29 testing.assertEquals(mod,mod); 30 testing.assertEquals([1,2,3], [1,2,3]); 31 32 testing.assertNotEquals(1,2); 33 testing.assertNotEquals("1",1); 34 testing.assertNotEquals("1",1); 35 testing.assertNotEquals("", false); 36 testing.assertNotEquals(null, undefined); 37 testing.assertNotEquals([1,2,3], [2,3]); 38 39 40 testing.assertIs(mod,mod); 41 testing.assertIs(null,null); 42 testing.assertIs(undefined,undefined); 43 testing.assertIs("ab","ab"); 44 testing.assertIs(123,123); 45 var a=b=[123]; 46 testing.assertIs(a,b); 47 var a=b={}; 48 testing.assertIs(a,b); 49 50 testing.assertIsNot(null,undefined); 51 testing.assertIsNot(mod,{}); 52 testing.assertIsNot([123],[123]); 53 testing.assertIsNot({},{}); 54 55 }; 1 __version__ = "$Revision: 44 $"; 2 3 import testing; 4 5 publ test( logger){ 6 logger.log("testing testing ..."); 56 7 57 mod.__main__=function(){ 58 mod.test(imprt('testing'), {log:print}) 59 }; 60 }); 8 testing.assert(true); 9 10 testing.assertTrue(true); 11 12 testing.assertFalse(false); 13 14 testing.assertNull(null); 15 testing.assertNotNull(undefined); 16 testing.assertNotNull(''); 17 testing.assertNotNull({}); 18 testing.assertNotNull(0); 19 20 testing.assertUndefined(undefined); 21 22 testing.assertNotUndefined(null); 23 24 testing.assertNaN(NaN); 25 26 testing.assertNotNaN(435); 27 28 testing.assertEquals(1,1); 29 testing.assertEquals("a","a"); 30 testing.assertEquals(null,null); 31 testing.assertEquals(undefined,undefined); 32 testing.assertEquals(mod,mod); 33 testing.assertEquals([1,2,3], [1,2,3]); 34 35 testing.assertNotEquals(1,2); 36 testing.assertNotEquals("1",1); 37 testing.assertNotEquals("1",1); 38 testing.assertNotEquals("", false); 39 testing.assertNotEquals(null, undefined); 40 testing.assertNotEquals([1,2,3], [2,3]); 41 42 43 testing.assertIs(mod,mod); 44 testing.assertIs(null,null); 45 testing.assertIs(undefined,undefined); 46 testing.assertIs("ab","ab"); 47 testing.assertIs(123,123); 48 var a=b=[123]; 49 testing.assertIs(a,b); 50 var a=b={}; 51 testing.assertIs(a,b); 52 53 testing.assertIsNot(null,undefined); 54 testing.assertIsNot(mod,{}); 55 testing.assertIsNot([123],[123]); 56 testing.assertIsNot({},{}); 57 58 }; 59 60 publ __main__(){ 61 test({log:print}) 62 }; trunk/test/test_urllib.js
r50 r85 1 Module("test_urllib", "0.0.1", function(mod){ 1 __version__ = "$Revision: 44 $"; 2 3 import testing; 4 import urllib; 5 6 publ test(logger){ 7 logger.log("testing urllib ..."); 8 testing.assertTrue("urllib usable", urllib.isUsable()); 2 9 3 mod.test=function(testing,logger){ 4 logger.log("testing urllib ..."); 5 var urllib = imprt('urllib'); 6 testing.assertTrue("urllib usable", urllib.isUsable()); 7 8 var resp = urllib.getURL("http://jsolait.net/download/404.txt"); 9 testing.assertEquals(resp.status, 404) 10 11 var resp = urllib.getURL("http://jsolait.net/download/test.txt"); 12 testing.assertEquals(resp.responseText, "test") 13 14 }; 15 mod.__main__=function(){ 16 mod.test(imprt('testing'), {log:print}); 17 }; 18 }); 10 var resp = urllib.getURL("http://jsolait.net/download/404.txt"); 11 testing.assertEquals(resp.status, 404) 12 13 var resp = urllib.getURL("http://jsolait.net/download/test.txt"); 14 testing.assertEquals(resp.responseText, "test") 15 16 }; 17 publ __main__(){ 18 test({log:print}); 19 }; trunk/test/test_xmlrpc.js
r58 r85 1 Module("test_xmlrpc", "0.0.1", function(mod){ 1 __version__ = "$Revision: 44 $"; 2 3 import testing; 4 import xmlrpc; 5 6 publ test(logger){ 2 7 3 mod.test=function(testing,logger){ 4 var xmlrpc=imprt('xmlrpc'); 5 6 logger.log("testing xmlrpc ..."); 7 var s = new xmlrpc.ServiceProxy("http://jsolait.net/services/test.xmlrpc"); 8 9 var o = [{a:"Hello ' \" World < & >", b:[1,2,3]}, true, false, new Date(0)]; 10 11 testing.assertEquals(xmlrpc.marshall(o), "<array><data><value><struct><member><name>a</name><value><string>Hello ' \" World < & ></string></value></member><member><name>b</name><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></member></struct></value><value><boolean>1</boolean></value><value><boolean>0</boolean></value><value><dateTime.iso8601>19700101T00:00:00:000</dateTime.iso8601></value></data></array>"); 12 var r = s.echo(o); 13 testing.assertEquals(xmlrpc.marshall(r), "<array><data><value><struct><member><name>a</name><value><string>Hello ' \" World < & ></string></value></member><member><name>b</name><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></member></struct></value><value><boolean>1</boolean></value><value><boolean>0</boolean></value><value><dateTime.iso8601>19700101T00:00:00:000</dateTime.iso8601></value></data></array>"); 14 }; 8 logger.log("testing xmlrpc ..."); 9 var s = new xmlrpc.ServiceProxy("http://jsolait.net/services/test.xmlrpc"); 15 10 16 mod.__main__=function(){ 17 mod.test(imprt('testing'), {log:print}); 18 }; 19 }); 11 var o = [{a:"Hello ' \" World < & >", b:[1,2,3]}, true, false, new Date(0)]; 12 13 testing.assertEquals(xmlrpc.marshall(o), "<array><data><value><struct><member><name>a</name><value><string>Hello ' \" World < & ></string></value></member><member><name>b</name><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></member></struct></value><value><boolean>1</boolean></value><value><boolean>0</boolean></value><value><dateTime.iso8601>19700101T00:00:00:000</dateTime.iso8601></value></data></array>"); 14 var r = s.echo(o); 15 testing.assertEquals(xmlrpc.marshall(r), "<array><data><value><struct><member><name>a</name><value><string>Hello ' \" World < & ></string></value></member><member><name>b</name><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></member></struct></value><value><boolean>1</boolean></value><value><boolean>0</boolean></value><value><dateTime.iso8601>19700101T00:00:00:000</dateTime.iso8601></value></data></array>"); 16 }; 20 17 18 publ __main__(){ 19 test({log:print}); 20 }; 21
