Kernel-Tests.deploy.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. smalltalk.StringTest);
  12. smalltalk.addMethod(
  13. '_testStreamContents',
  14. smalltalk.method({
  15. selector: 'testStreamContents',
  16. fn: function (){
  17. var self=this;
  18. 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);})])]);
  19. return self;}
  20. }),
  21. smalltalk.StringTest);
  22. smalltalk.addMethod(
  23. '_testIncludesSubString',
  24. smalltalk.method({
  25. selector: 'testIncludesSubString',
  26. fn: function (){
  27. var self=this;
  28. smalltalk.send(self, "_assert_", [smalltalk.send("jtalk", "_includesSubString_", ["alk"])]);
  29. smalltalk.send(self, "_deny_", [smalltalk.send("jtalk", "_includesSubString_", ["zork"])]);
  30. return self;}
  31. }),
  32. smalltalk.StringTest);
  33. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  34. smalltalk.addMethod(
  35. '_testPrintString',
  36. smalltalk.method({
  37. selector: 'testPrintString',
  38. fn: function (){
  39. var self=this;
  40. 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", []))]);
  41. return self;}
  42. }),
  43. smalltalk.DictionaryTest);
  44. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  45. smalltalk.addMethod(
  46. '_testLogic',
  47. smalltalk.method({
  48. selector: 'testLogic',
  49. fn: function (){
  50. var self=this;
  51. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
  52. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
  53. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
  54. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
  55. return self;}
  56. }),
  57. smalltalk.BooleanTest);