Kernel-Tests.deploy.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2. smalltalk.addMethod(
  3. '_testJoin',
  4. smalltalk.method({
  5. selector: 'testJoin',
  6. fn: function (){
  7. var self=this;
  8. smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
  9. return self;}
  10. ]
  11. }),
  12. smalltalk.StringTest);
  13. smalltalk.addMethod(
  14. '_testStreamContents',
  15. smalltalk.method({
  16. selector: 'testStreamContents',
  17. fn: function (){
  18. var self=this;
  19. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(smalltalk.String, "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
  20. return self;}
  21. ]
  22. }),
  23. smalltalk.StringTest);
  24. smalltalk.addMethod(
  25. '_testIncludesSubString',
  26. smalltalk.method({
  27. selector: 'testIncludesSubString',
  28. fn: function (){
  29. var self=this;
  30. smalltalk.send(self, "_assert_", [smalltalk.send("jtalk", "_includesSubString_", ["alk"])]);
  31. smalltalk.send(self, "_deny_", [smalltalk.send("jtalk", "_includesSubString_", ["zork"])]);
  32. return self;}
  33. ]
  34. }),
  35. smalltalk.StringTest);
  36. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  37. smalltalk.addMethod(
  38. '_testPrintString',
  39. smalltalk.method({
  40. selector: 'testPrintString',
  41. fn: function (){
  42. var self=this;
  43. smalltalk.send(self, "_assert_equals_", [unescape("a%20Dictionary%28%27firstname%27%20-%3E%20%27James%27%20%2C%20%27lastname%27%20-%3E%20%27Bond%27%29"), (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send(smalltalk.Dictionary, "_new", []))]);
  44. return self;}
  45. ]
  46. }),
  47. smalltalk.DictionaryTest);