Kernel-Tests.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. unescape('_testJoin'),
  5. smalltalk.method({
  6. selector: unescape('testJoin'),
  7. category: 'tests',
  8. fn: function (){
  9. var self=this;
  10. smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
  11. return self;},
  12. args: [],
  13. source: unescape('testJoin%0A%09self%20assert%3A%20%27hello%2Cworld%27%20equals%3A%20%28%27%2C%27%20join%3A%20%23%28%27hello%27%20%27world%27%29%29'),
  14. messageSends: ["assert:equals:", "join:"],
  15. referencedClasses: []
  16. }),
  17. smalltalk.StringTest);
  18. smalltalk.addMethod(
  19. unescape('_testStreamContents'),
  20. smalltalk.method({
  21. selector: unescape('testStreamContents'),
  22. category: 'tests',
  23. fn: function (){
  24. var self=this;
  25. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
  26. return self;},
  27. args: [],
  28. source: unescape('testStreamContents%0A%09self%20%0A%09%09assert%3A%20%27hello%20world%27%20%0A%09%09equals%3A%20%28String%20streamContents%3A%20%5B%3AaStream%7C%20aStream%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27hello%27%3B%20space%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27world%27%5D%29'),
  29. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  30. referencedClasses: ["String"]
  31. }),
  32. smalltalk.StringTest);
  33. smalltalk.addMethod(
  34. unescape('_testIncludesSubString'),
  35. smalltalk.method({
  36. selector: unescape('testIncludesSubString'),
  37. category: 'tests',
  38. fn: function (){
  39. var self=this;
  40. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  41. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  42. return self;},
  43. args: [],
  44. source: unescape('testIncludesSubString%0A%09self%20assert%3A%20%28%27amber%27%20includesSubString%3A%20%27ber%27%29.%0A%09self%20deny%3A%20%28%27amber%27%20includesSubString%3A%20%27zork%27%29.'),
  45. messageSends: ["assert:", "includesSubString:", "deny:"],
  46. referencedClasses: []
  47. }),
  48. smalltalk.StringTest);
  49. smalltalk.addMethod(
  50. unescape('_testEquality'),
  51. smalltalk.method({
  52. selector: unescape('testEquality'),
  53. category: 'tests',
  54. fn: function (){
  55. var self=this;
  56. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  57. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  58. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  59. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  60. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  61. return self;},
  62. args: [],
  63. source: unescape('testEquality%0A%09self%20assert%3A%20%27hello%27%20%3D%20%27hello%27.%0A%09self%20deny%3A%20%27hello%27%20%3D%20%27world%27.%0A%0A%09self%20assert%3A%20%27hello%27%20%20%3D%20%27hello%27%20yourself.%0A%09self%20assert%3A%20%27hello%27%20yourself%20%3D%20%27hello%27.%0A%0A%09%22test%20JS%20falsy%20value%22%0A%09self%20deny%3A%20%27%27%20%3D%200'),
  64. messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
  65. referencedClasses: []
  66. }),
  67. smalltalk.StringTest);
  68. smalltalk.addMethod(
  69. unescape('_testCopyWithoutAll'),
  70. smalltalk.method({
  71. selector: unescape('testCopyWithoutAll'),
  72. category: 'tests',
  73. fn: function (){
  74. var self=this;
  75. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(unescape("*hello*%20*world*"), "_copyWithoutAll_", [unescape("*")])]);
  76. return self;},
  77. args: [],
  78. source: unescape('testCopyWithoutAll%0A%09self%20%0A%09%09assert%3A%20%27hello%20world%27%20%0A%09%09equals%3A%20%28%27*hello*%20*world*%27%20copyWithoutAll%3A%20%27*%27%29'),
  79. messageSends: ["assert:equals:", "copyWithoutAll:"],
  80. referencedClasses: []
  81. }),
  82. smalltalk.StringTest);
  83. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  84. smalltalk.addMethod(
  85. unescape('_testPrintString'),
  86. smalltalk.method({
  87. selector: unescape('testPrintString'),
  88. category: 'tests',
  89. fn: function (){
  90. var self=this;
  91. 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 || Dictionary), "_new", []))]);
  92. return self;},
  93. args: [],
  94. source: unescape('testPrintString%0A%09self%0A%09%09assert%3A%20%27a%20Dictionary%28%27%27firstname%27%27%20-%3E%20%27%27James%27%27%20%2C%20%27%27lastname%27%27%20-%3E%20%27%27Bond%27%27%29%27%20%0A%09%09equals%3A%20%28Dictionary%20new%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09at%3A%27firstname%27%20put%3A%20%27James%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09at%3A%27lastname%27%20put%3A%20%27Bond%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09printString%29'),
  95. messageSends: ["assert:equals:", "at:put:", "printString", "new"],
  96. referencedClasses: ["Dictionary"]
  97. }),
  98. smalltalk.DictionaryTest);
  99. smalltalk.addMethod(
  100. unescape('_testEquality'),
  101. smalltalk.method({
  102. selector: unescape('testEquality'),
  103. category: 'tests',
  104. fn: function (){
  105. var self=this;
  106. var d1=nil;
  107. var d2=nil;
  108. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  109. d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  110. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  111. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  112. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  113. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  114. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  115. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  116. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);smalltalk.send($rec, "_at_put_", [(3), (4)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  117. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  118. return self;},
  119. args: [],
  120. source: unescape('testEquality%0A%09%7C%20d1%20d2%20%7C%0A%0A%09self%20assert%3A%20Dictionary%20new%20%3D%20Dictionary%20new.%0A%09%09%0A%09d1%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20yourself.%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20yourself.%0A%09self%20assert%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%203%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%202%20put%3A%202%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20at%3A%203%20put%3A%204%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.'),
  121. messageSends: ["assert:", unescape("%3D"), "new", "at:put:", "yourself", "deny:"],
  122. referencedClasses: ["Dictionary"]
  123. }),
  124. smalltalk.DictionaryTest);
  125. smalltalk.addMethod(
  126. unescape('_testDynamicDictionaries'),
  127. smalltalk.method({
  128. selector: unescape('testDynamicDictionaries'),
  129. category: 'tests',
  130. fn: function (){
  131. var self=this;
  132. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.Dictionary._fromPairs_([smalltalk.send((1), "__minus_gt", ["hello"]),smalltalk.send((2), "__minus_gt", ["world"])]), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_with_", [smalltalk.send((1), "__minus_gt", ["hello"]), smalltalk.send((2), "__minus_gt", ["world"])])])]);
  133. return self;},
  134. args: [],
  135. source: unescape('testDynamicDictionaries%0A%09self%20assert%3A%20%23%7B1%20-%3E%20%27hello%27.%202%20-%3E%20%27world%27%7D%20%3D%20%28Dictionary%20with%3A%201%20-%3E%20%27hello%27%20with%3A%202%20-%3E%20%27world%27%29'),
  136. messageSends: ["assert:", unescape("%3D"), unescape("-%3E"), "with:with:"],
  137. referencedClasses: ["Dictionary"]
  138. }),
  139. smalltalk.DictionaryTest);
  140. smalltalk.addMethod(
  141. unescape('_testAccessing'),
  142. smalltalk.method({
  143. selector: unescape('testAccessing'),
  144. category: 'tests',
  145. fn: function (){
  146. var self=this;
  147. var d=nil;
  148. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  149. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  150. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  151. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  152. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  153. smalltalk.send(d, "_at_put_", [(1), (2)]);
  154. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  155. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  156. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  157. return self;},
  158. args: [],
  159. source: unescape('testAccessing%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%0A%09d%20at%3A%20%27hello%27%20put%3A%20%27world%27.%0A%09self%20assert%3A%20%28d%20at%3A%20%27hello%27%29%20%3D%20%27world%27.%0A%09self%20assert%3A%20%28d%20at%3A%20%27hello%27%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20%27world%27.%0A%09self%20deny%3A%20%28d%20at%3A%20%27foo%27%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20%27world%27.%0A%0A%09d%20at%3A%201%20put%3A%202.%0A%09self%20assert%3A%20%28d%20at%3A%201%29%20%3D%202.%0A%0A%09d%20at%3A%201@3%20put%3A%203.%0A%09self%20assert%3A%20%28d%20at%3A%201@3%29%20%3D%203'),
  160. messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "at:", "at:ifAbsent:", "deny:", unescape("@")],
  161. referencedClasses: ["Dictionary"]
  162. }),
  163. smalltalk.DictionaryTest);
  164. smalltalk.addMethod(
  165. unescape('_testSize'),
  166. smalltalk.method({
  167. selector: unescape('testSize'),
  168. category: 'tests',
  169. fn: function (){
  170. var self=this;
  171. var d=nil;
  172. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  173. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  174. smalltalk.send(d, "_at_put_", [(1), (2)]);
  175. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  176. smalltalk.send(d, "_at_put_", [(2), (3)]);
  177. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  178. return self;},
  179. args: [],
  180. source: unescape('testSize%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09self%20assert%3A%20d%20size%20%3D%200.%0A%0A%09d%20at%3A%201%20put%3A%202.%0A%09self%20assert%3A%20d%20size%20%3D%201.%0A%0A%09d%20at%3A%202%20put%3A%203.%0A%09self%20assert%3A%20d%20size%20%3D%202.'),
  181. messageSends: ["new", "assert:", unescape("%3D"), "size", "at:put:"],
  182. referencedClasses: ["Dictionary"]
  183. }),
  184. smalltalk.DictionaryTest);
  185. smalltalk.addMethod(
  186. unescape('_testValues'),
  187. smalltalk.method({
  188. selector: unescape('testValues'),
  189. category: 'tests',
  190. fn: function (){
  191. var self=this;
  192. var d=nil;
  193. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  194. smalltalk.send(d, "_at_put_", [(1), (2)]);
  195. smalltalk.send(d, "_at_put_", [(2), (3)]);
  196. smalltalk.send(d, "_at_put_", [(3), (4)]);
  197. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  198. return self;},
  199. args: [],
  200. source: unescape('testValues%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09d%20at%3A%201%20put%3A%202.%0A%09d%20at%3A%202%20put%3A%203.%0A%09d%20at%3A%203%20put%3A%204.%0A%0A%09self%20assert%3A%20d%20values%20%3D%20%23%282%203%204%29'),
  201. messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "values"],
  202. referencedClasses: ["Dictionary"]
  203. }),
  204. smalltalk.DictionaryTest);
  205. smalltalk.addMethod(
  206. unescape('_testKeys'),
  207. smalltalk.method({
  208. selector: unescape('testKeys'),
  209. category: 'tests',
  210. fn: function (){
  211. var self=this;
  212. var d=nil;
  213. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  214. smalltalk.send(d, "_at_put_", [(1), (2)]);
  215. smalltalk.send(d, "_at_put_", [(2), (3)]);
  216. smalltalk.send(d, "_at_put_", [(3), (4)]);
  217. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  218. return self;},
  219. args: [],
  220. source: unescape('testKeys%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09d%20at%3A%201%20put%3A%202.%0A%09d%20at%3A%202%20put%3A%203.%0A%09d%20at%3A%203%20put%3A%204.%0A%0A%09self%20assert%3A%20d%20keys%20%3D%20%23%281%202%203%29'),
  221. messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "keys"],
  222. referencedClasses: ["Dictionary"]
  223. }),
  224. smalltalk.DictionaryTest);
  225. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  226. smalltalk.addMethod(
  227. unescape('_testLogic'),
  228. smalltalk.method({
  229. selector: unescape('testLogic'),
  230. category: 'not yet classified',
  231. fn: function (){
  232. var self=this;
  233. (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);
  234. (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);
  235. (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);
  236. (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);
  237. return self;},
  238. args: [],
  239. source: unescape('testLogic%0A%20%0A%09%22Trivial%20logic%20table%22%0A%09self%20assert%3A%20%28true%20%26%20true%29%3B%20deny%3A%20%28true%20%26%20false%29%3B%20deny%3A%20%28false%20%26%20true%29%3B%20deny%3A%20%28false%20%26%20false%29.%0A%09self%20assert%3A%20%28true%20%7C%20true%29%3B%20assert%3A%20%28true%20%7C%20false%29%3B%20assert%3A%20%28false%20%7C%20true%29%3B%20deny%3A%20%28false%20%7C%20false%29.%0A%20%20%20%20%20%20%20%20%22Checking%20that%20expressions%20work%20fine%20too%22%0A%09self%20assert%3A%20%28true%20%26%20%281%20%3E%200%29%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20false%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20%281%20%3E%202%29%29.%0A%20%20%20%20%20%20%20%20self%20assert%3A%20%28false%20%7C%20%281%20%3E%200%29%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20false%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20%281%20%3E%202%29%29'),
  240. messageSends: ["assert:", unescape("%26"), "deny:", unescape("%7C"), unescape("%3E")],
  241. referencedClasses: []
  242. }),
  243. smalltalk.BooleanTest);
  244. smalltalk.addMethod(
  245. unescape('_testEquality'),
  246. smalltalk.method({
  247. selector: unescape('testEquality'),
  248. category: 'not yet classified',
  249. fn: function (){
  250. var self=this;
  251. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  252. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  253. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  254. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  255. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  256. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  257. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  258. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  259. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  260. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  261. return self;},
  262. args: [],
  263. source: unescape('testEquality%0A%09%22We%27re%20on%20top%20of%20JS...just%20be%20sure%20to%20check%20the%20basics%21%22%0A%0A%09self%20deny%3A%200%20%3D%20false.%20%0A%09self%20deny%3A%20false%20%3D%200.%0A%09self%20deny%3A%20%27%27%20%3D%20false.%0A%09self%20deny%3A%20false%20%3D%20%27%27.%0A%0A%09self%20assert%3A%20true%20%3D%20true.%0A%09self%20deny%3A%20false%20%3D%20true.%0A%09self%20deny%3A%20true%20%3D%20false.%0A%09self%20assert%3A%20false%20%3D%20false.%0A%0A%09%22JS%20may%20do%20some%20type%20coercing%20after%20sending%20a%20message%22%0A%09self%20assert%3A%20true%20yourself%20%3D%20true.%0A%09self%20assert%3A%20true%20yourself%20%3D%20true%20yourself'),
  264. messageSends: ["deny:", unescape("%3D"), "assert:", "yourself"],
  265. referencedClasses: []
  266. }),
  267. smalltalk.BooleanTest);
  268. smalltalk.addMethod(
  269. unescape('_testLogicKeywords'),
  270. smalltalk.method({
  271. selector: unescape('testLogicKeywords'),
  272. category: 'not yet classified',
  273. fn: function (){
  274. var self=this;
  275. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
  276. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return true;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return false;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_or_", [(function(){return false;})])]);})(self);
  277. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return false;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return (1) > (2);})])]);})(self);
  278. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return false;})])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return (1) > (2);})])]);})(self);
  279. return self;},
  280. args: [],
  281. source: unescape('testLogicKeywords%0A%20%0A%09%22Trivial%20logic%20table%22%0A%09self%20%0A%09%09assert%3A%20%28true%20and%3A%20%5B%20true%5D%29%3B%20%0A%09%09deny%3A%20%28true%20and%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20and%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20and%3A%20%5B%20false%20%5D%29.%0A%09self%20%0A%09%09assert%3A%20%28true%20or%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09assert%3A%20%28true%20or%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09assert%3A%20%28false%20or%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20or%3A%20%5B%20false%20%5D%29.%0A%20%20%20%20%20%20%20%20%0A%09%22Checking%20that%20expressions%20work%20fine%20too%22%0A%09self%20%0A%09%09assert%3A%20%28true%20and%3A%20%5B%201%20%3E%200%20%5D%29%3B%20%0A%09%09deny%3A%20%28%281%20%3E%200%29%20and%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09deny%3A%20%28%281%20%3E%200%29%20and%3A%20%5B%201%20%3E%202%20%5D%29.%0A%20%20%20%20%20%20%20%20self%20%0A%09%09assert%3A%20%28false%20or%3A%20%5B%201%20%3E%200%20%5D%29%3B%20%0A%09%09assert%3A%20%28%281%20%3E%200%29%20or%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09assert%3A%20%28%281%20%3E%200%29%20or%3A%20%5B%201%20%3E%202%20%5D%29'),
  282. messageSends: ["assert:", "and:", "deny:", "or:", unescape("%3E")],
  283. referencedClasses: []
  284. }),
  285. smalltalk.BooleanTest);
  286. smalltalk.addMethod(
  287. unescape('_testIfTrueIfFalse'),
  288. smalltalk.method({
  289. selector: unescape('testIfTrueIfFalse'),
  290. category: 'not yet classified',
  291. fn: function (){
  292. var self=this;
  293. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  294. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  295. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  296. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  297. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  298. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  299. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  300. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  301. return self;},
  302. args: [],
  303. source: unescape('testIfTrueIfFalse%0A%20%0A%09self%20assert%3A%20%28true%20ifTrue%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20%27alternative%20block%27.%0A%09self%20assert%3A%20%28true%20ifFalse%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20nil.%0A%0A%09self%20assert%3A%20%28false%20ifTrue%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20nil.%0A%09self%20assert%3A%20%28false%20ifFalse%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20%27alternative%20block%27.%0A%0A%09self%20assert%3A%20%28false%20ifTrue%3A%20%5B%27alternative%20block%27%5D%20ifFalse%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block2%27.%0A%09self%20assert%3A%20%28false%20ifFalse%3A%20%5B%27alternative%20block%27%5D%20ifTrue%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block%27.%0A%0A%09self%20assert%3A%20%28true%20ifTrue%3A%20%5B%27alternative%20block%27%5D%20ifFalse%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block%27.%0A%09self%20assert%3A%20%28true%20ifFalse%3A%20%5B%27alternative%20block%27%5D%20ifTrue%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block2%27.'),
  304. messageSends: ["assert:", unescape("%3D"), "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  305. referencedClasses: []
  306. }),
  307. smalltalk.BooleanTest);
  308. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  309. smalltalk.addMethod(
  310. unescape('_testPrintShowingDecimalPlaces'),
  311. smalltalk.method({
  312. selector: unescape('testPrintShowingDecimalPlaces'),
  313. category: 'tests',
  314. fn: function (){
  315. var self=this;
  316. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  317. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  318. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  319. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  320. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  321. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  322. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  323. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  324. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  325. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  326. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  327. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  328. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  329. return self;},
  330. args: [],
  331. source: unescape('testPrintShowingDecimalPlaces%0A%09self%20assert%3A%20%2723.00%27%20equals%3A%20%2823%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%2723.57%27%20equals%3A%20%2823.5698%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%27-234.56700%27%20equals%3A%28%20234.567%20negated%20printShowingDecimalPlaces%3A%205%29.%0A%09self%20assert%3A%20%2723%27%20equals%3A%20%2823.4567%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%2724%27%20equals%3A%20%2823.5567%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27-23%27%20equals%3A%20%2823.4567%20negated%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27-24%27%20equals%3A%20%2823.5567%20negated%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27100000000.0%27%20equals%3A%20%28100000000%20printShowingDecimalPlaces%3A%201%29.%0A%09self%20assert%3A%20%270.98000%27%20equals%3A%20%280.98%20printShowingDecimalPlaces%3A%205%29.%0A%09self%20assert%3A%20%27-0.98%27%20equals%3A%20%280.98%20negated%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%272.57%27%20equals%3A%20%282.567%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%27-2.57%27%20equals%3A%20%28-2.567%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%270.00%27%20equals%3A%20%280%20printShowingDecimalPlaces%3A%202%29.'),
  332. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  333. referencedClasses: []
  334. }),
  335. smalltalk.NumberTest);
  336. smalltalk.addMethod(
  337. unescape('_testEquality'),
  338. smalltalk.method({
  339. selector: unescape('testEquality'),
  340. category: 'tests',
  341. fn: function (){
  342. var self=this;
  343. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  344. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  345. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  346. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  347. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  348. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  349. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  350. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  351. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  352. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  353. return self;},
  354. args: [],
  355. source: unescape('testEquality%0A%09self%20assert%3A%201%20%3D%201.%0A%09self%20assert%3A%200%20%3D%200.%0A%09self%20deny%3A%201%20%3D%200.%0A%0A%09self%20assert%3A%201%20yourself%20%3D%201.%0A%09self%20assert%3A%201%20%3D%201%20yourself.%0A%09self%20assert%3A%201%20yourself%20%3D%201%20yourself.%0A%09%0A%09self%20deny%3A%200%20%3D%20false.%0A%09self%20deny%3A%20false%20%3D%200.%0A%09self%20deny%3A%20%27%27%20%3D%200.%0A%09self%20deny%3A%200%20%3D%20%27%27'),
  356. messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
  357. referencedClasses: []
  358. }),
  359. smalltalk.NumberTest);
  360. smalltalk.addMethod(
  361. unescape('_testArithmetic'),
  362. smalltalk.method({
  363. selector: unescape('testArithmetic'),
  364. category: 'tests',
  365. fn: function (){
  366. var self=this;
  367. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  368. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  369. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  370. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  371. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  372. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  373. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  374. return self;},
  375. args: [],
  376. source: unescape('testArithmetic%0A%09%0A%09%22We%20rely%20on%20JS%20here%2C%20so%20we%20won%27t%20test%20complex%20behavior%2C%20just%20check%20if%20%0A%09message%20sends%20are%20corrects%22%0A%0A%09self%20assert%3A%201.5%20+%201%20%3D%202.5.%0A%09self%20assert%3A%202%20-%201%20%3D%201.%0A%09self%20assert%3A%20-2%20-%201%20%3D%20-3.%0A%09self%20assert%3A%2012%20/%202%20%3D%206.%0A%09self%20assert%3A%203%20*%204%20%3D%2012.%0A%0A%09%22Simple%20parenthesis%20and%20execution%20order%22%0A%0A%09self%20assert%3A%201%20+%202%20*%203%20%3D%209.%0A%09self%20assert%3A%201%20+%20%282%20*%203%29%20%3D%207'),
  377. messageSends: ["assert:", unescape("%3D"), unescape("+"), unescape("-"), unescape("/"), unescape("*")],
  378. referencedClasses: []
  379. }),
  380. smalltalk.NumberTest);
  381. smalltalk.addMethod(
  382. unescape('_testRounded'),
  383. smalltalk.method({
  384. selector: unescape('testRounded'),
  385. category: 'tests',
  386. fn: function (){
  387. var self=this;
  388. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  389. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  390. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  391. return self;},
  392. args: [],
  393. source: unescape('testRounded%0A%09%0A%09self%20assert%3A%203%20rounded%20%3D%203.%0A%09self%20assert%3A%203.212%20rounded%20%3D%203.%0A%09self%20assert%3A%203.51%20rounded%20%3D%204'),
  394. messageSends: ["assert:", unescape("%3D"), "rounded"],
  395. referencedClasses: []
  396. }),
  397. smalltalk.NumberTest);
  398. smalltalk.addMethod(
  399. unescape('_testNegated'),
  400. smalltalk.method({
  401. selector: unescape('testNegated'),
  402. category: 'tests',
  403. fn: function (){
  404. var self=this;
  405. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  406. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  407. return self;},
  408. args: [],
  409. source: unescape('testNegated%0A%09self%20assert%3A%203%20negated%20%3D%20-3.%0A%09self%20assert%3A%20-3%20negated%20%3D%203'),
  410. messageSends: ["assert:", unescape("%3D"), "negated"],
  411. referencedClasses: []
  412. }),
  413. smalltalk.NumberTest);
  414. smalltalk.addMethod(
  415. unescape('_testComparison'),
  416. smalltalk.method({
  417. selector: unescape('testComparison'),
  418. category: 'tests',
  419. fn: function (){
  420. var self=this;
  421. smalltalk.send(self, "_assert_", [(3) > (2)]);
  422. smalltalk.send(self, "_assert_", [(2) < (3)]);
  423. smalltalk.send(self, "_deny_", [(3) < (2)]);
  424. smalltalk.send(self, "_deny_", [(2) > (3)]);
  425. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  426. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  427. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  428. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  429. return self;},
  430. args: [],
  431. source: unescape('testComparison%0A%0A%09self%20assert%3A%203%20%3E%202.%0A%09self%20assert%3A%202%20%3C%203.%0A%09%0A%09self%20deny%3A%203%20%3C%202.%0A%09self%20deny%3A%202%20%3E%203.%0A%0A%09self%20assert%3A%203%20%3E%3D%203.%0A%09self%20assert%3A%203.1%20%3E%3D%203.%0A%09self%20assert%3A%203%20%3C%3D%203.%0A%09self%20assert%3A%203%20%3C%3D%203.1'),
  432. messageSends: ["assert:", unescape("%3E"), unescape("%3C"), "deny:", unescape("%3E%3D"), unescape("%3C%3D")],
  433. referencedClasses: []
  434. }),
  435. smalltalk.NumberTest);
  436. smalltalk.addMethod(
  437. unescape('_testTruncated'),
  438. smalltalk.method({
  439. selector: unescape('testTruncated'),
  440. category: 'tests',
  441. fn: function (){
  442. var self=this;
  443. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  444. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  445. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  446. return self;},
  447. args: [],
  448. source: unescape('testTruncated%0A%09%0A%09self%20assert%3A%203%20truncated%20%3D%203.%0A%09self%20assert%3A%203.212%20truncated%20%3D%203.%0A%09self%20assert%3A%203.51%20truncated%20%3D%203'),
  449. messageSends: ["assert:", unescape("%3D"), "truncated"],
  450. referencedClasses: []
  451. }),
  452. smalltalk.NumberTest);
  453. smalltalk.addMethod(
  454. unescape('_testCopying'),
  455. smalltalk.method({
  456. selector: unescape('testCopying'),
  457. category: 'tests',
  458. fn: function (){
  459. var self=this;
  460. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq", [(1)])]);
  461. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq", [(1)])]);
  462. return self;},
  463. args: [],
  464. source: unescape('testCopying%0A%09self%20assert%3A%201%20copy%20%3D%201.%0A%09self%20assert%3A%201%20deepCopy%20%3D%201'),
  465. messageSends: ["assert:", unescape("%3D"), "copy", "deepCopy"],
  466. referencedClasses: []
  467. }),
  468. smalltalk.NumberTest);
  469. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  470. smalltalk.addMethod(
  471. unescape('_testMethodWithArguments'),
  472. smalltalk.method({
  473. selector: unescape('testMethodWithArguments'),
  474. category: 'tests',
  475. fn: function (){
  476. var self=this;
  477. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  478. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  479. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  480. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  481. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  482. return self;},
  483. args: [],
  484. source: unescape('testMethodWithArguments%0A%09self%20deny%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.%0A%0A%09%27body%27%20asJQuery%20addClass%3A%20%27amber%27.%0A%09self%20assert%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.%0A%0A%09%27body%27%20asJQuery%20removeClass%3A%20%27amber%27.%0A%09self%20deny%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.'),
  485. messageSends: ["deny:", "hasClass:", "asJQuery", "addClass:", "assert:", "removeClass:"],
  486. referencedClasses: []
  487. }),
  488. smalltalk.JSObjectProxyTest);
  489. smalltalk.addMethod(
  490. unescape('_testYourself'),
  491. smalltalk.method({
  492. selector: unescape('testYourself'),
  493. category: 'tests',
  494. fn: function (){
  495. var self=this;
  496. var body=nil;
  497. body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", []));
  498. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  499. smalltalk.send(body, "_removeClass_", ["amber"]);
  500. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  501. return self;},
  502. args: [],
  503. source: unescape('testYourself%0A%09%7Cbody%7C%0A%09body%20%3A%3D%20%27body%27%20asJQuery%0A%09%09%09%09addClass%3A%20%27amber%27%3B%0A%09%09%09%09yourself.%0A%0A%09self%20assert%3A%20%28body%20hasClass%3A%20%27amber%27%29.%0A%0A%09body%20removeClass%3A%20%27amber%27.%0A%09self%20deny%3A%20%28body%20hasClass%3A%20%27amber%27%29.'),
  504. messageSends: ["addClass:", "yourself", "asJQuery", "assert:", "hasClass:", "removeClass:", "deny:"],
  505. referencedClasses: []
  506. }),
  507. smalltalk.JSObjectProxyTest);
  508. smalltalk.addMethod(
  509. unescape('_testPropertyThatReturnsEmptyString'),
  510. smalltalk.method({
  511. selector: unescape('testPropertyThatReturnsEmptyString'),
  512. category: 'tests',
  513. fn: function (){
  514. var self=this;
  515. document.location.hash = '';
  516. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  517. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  518. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  519. return self;},
  520. args: [],
  521. source: unescape('testPropertyThatReturnsEmptyString%0A%09%3Cdocument.location.hash%20%3D%20%27%27%3E.%0A%09self%20assert%3A%20%27%27%20equals%3A%20document%20location%20hash.%0A%0A%09document%20location%20hash%3A%20%27test%27.%0A%09self%20assert%3A%20%27%23test%27%20equals%3A%20document%20location%20hash.'),
  522. messageSends: ["assert:equals:", "hash", "location", "hash:"],
  523. referencedClasses: []
  524. }),
  525. smalltalk.JSObjectProxyTest);
  526. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  527. smalltalk.addMethod(
  528. unescape('_setUp'),
  529. smalltalk.method({
  530. selector: unescape('setUp'),
  531. category: 'running',
  532. fn: function (){
  533. var self=this;
  534. self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []);
  535. self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []);
  536. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  537. self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]);
  538. self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", [unescape("server/grul/js")]);smalltalk.send($rec, "_commitPathSt_", [unescape("grul/st")]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", []));
  539. return self;},
  540. args: [],
  541. source: unescape('setUp%0A%09backUpCommitPathJs%20%3A%3D%20Package%20defaultCommitPathJs.%0A%09backUpCommitPathSt%20%3A%3D%20Package%20defaultCommitPathSt.%0A%0A%09Package%20resetCommitPaths.%0A%0A%09zorkPackage%20%3A%3D%20Package%20new%20name%3A%20%27Zork%27.%0A%09grulPackage%20%3A%3D%20Package%20new%20%0A%09%09%09%09%09name%3A%20%27Grul%27%3B%0A%09%09%09%09%09commitPathJs%3A%20%27server/grul/js%27%3B%0A%09%09%09%09%09commitPathSt%3A%20%27grul/st%27%3B%0A%09%09%09%09%09yourself'),
  542. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  543. referencedClasses: ["Package"]
  544. }),
  545. smalltalk.PackageTest);
  546. smalltalk.addMethod(
  547. unescape('_tearDown'),
  548. smalltalk.method({
  549. selector: unescape('tearDown'),
  550. category: 'running',
  551. fn: function (){
  552. var self=this;
  553. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  554. return self;},
  555. args: [],
  556. source: unescape('tearDown%0A%09%20Package%20%0A%09%09defaultCommitPathJs%3A%20backUpCommitPathJs%3B%0A%09%09defaultCommitPathSt%3A%20backUpCommitPathSt'),
  557. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  558. referencedClasses: ["Package"]
  559. }),
  560. smalltalk.PackageTest);
  561. smalltalk.addMethod(
  562. unescape('_testGrulCommitPathStShouldBeGrulSt'),
  563. smalltalk.method({
  564. selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
  565. category: 'tests',
  566. fn: function (){
  567. var self=this;
  568. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  569. return self;},
  570. args: [],
  571. source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
  572. messageSends: ["assert:equals:", "commitPathSt"],
  573. referencedClasses: []
  574. }),
  575. smalltalk.PackageTest);
  576. smalltalk.addMethod(
  577. unescape('_testZorkCommitPathStShouldBeSt'),
  578. smalltalk.method({
  579. selector: unescape('testZorkCommitPathStShouldBeSt'),
  580. category: 'tests',
  581. fn: function (){
  582. var self=this;
  583. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  584. return self;},
  585. args: [],
  586. source: unescape('testZorkCommitPathStShouldBeSt%0A%09self%20assert%3A%20%27st%27%20equals%3A%20zorkPackage%20commitPathSt'),
  587. messageSends: ["assert:equals:", "commitPathSt"],
  588. referencedClasses: []
  589. }),
  590. smalltalk.PackageTest);
  591. smalltalk.addMethod(
  592. unescape('_testZorkCommitPathJsShouldBeJs'),
  593. smalltalk.method({
  594. selector: unescape('testZorkCommitPathJsShouldBeJs'),
  595. category: 'tests',
  596. fn: function (){
  597. var self=this;
  598. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  599. return self;},
  600. args: [],
  601. source: unescape('testZorkCommitPathJsShouldBeJs%0A%09self%20assert%3A%20%27js%27%20equals%3A%20zorkPackage%20commitPathJs'),
  602. messageSends: ["assert:equals:", "commitPathJs"],
  603. referencedClasses: []
  604. }),
  605. smalltalk.PackageTest);
  606. smalltalk.addMethod(
  607. unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
  608. smalltalk.method({
  609. selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
  610. category: 'tests',
  611. fn: function (){
  612. var self=this;
  613. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  614. return self;},
  615. args: [],
  616. source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
  617. messageSends: ["assert:equals:", "commitPathJs"],
  618. referencedClasses: []
  619. }),
  620. smalltalk.PackageTest);
  621. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  622. smalltalk.addMethod(
  623. unescape('_setUp'),
  624. smalltalk.method({
  625. selector: unescape('setUp'),
  626. category: 'running',
  627. fn: function (){
  628. var self=this;
  629. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  630. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  631. return self;},
  632. args: [],
  633. source: unescape('setUp%0A%09super%20setUp.%0A%0A%09Package%0A%09%09defaultCommitPathJs%3A%20%27javascripts/%27%3B%0A%09%09defaultCommitPathSt%3A%20%27smalltalk/%27.'),
  634. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  635. referencedClasses: ["Package"]
  636. }),
  637. smalltalk.PackageWithDefaultCommitPathChangedTest);
  638. smalltalk.addMethod(
  639. unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
  640. smalltalk.method({
  641. selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
  642. category: 'tests',
  643. fn: function (){
  644. var self=this;
  645. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  646. return self;},
  647. args: [],
  648. source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
  649. messageSends: ["assert:equals:", "commitPathJs"],
  650. referencedClasses: []
  651. }),
  652. smalltalk.PackageWithDefaultCommitPathChangedTest);
  653. smalltalk.addMethod(
  654. unescape('_testGrulCommitPathStShouldBeGrulSt'),
  655. smalltalk.method({
  656. selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
  657. category: 'tests',
  658. fn: function (){
  659. var self=this;
  660. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  661. return self;},
  662. args: [],
  663. source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
  664. messageSends: ["assert:equals:", "commitPathSt"],
  665. referencedClasses: []
  666. }),
  667. smalltalk.PackageWithDefaultCommitPathChangedTest);
  668. smalltalk.addMethod(
  669. unescape('_testZorkCommitPathJsShouldBeJavascript'),
  670. smalltalk.method({
  671. selector: unescape('testZorkCommitPathJsShouldBeJavascript'),
  672. category: 'tests',
  673. fn: function (){
  674. var self=this;
  675. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  676. return self;},
  677. args: [],
  678. source: unescape('testZorkCommitPathJsShouldBeJavascript%0A%09self%20assert%3A%20%27javascripts/%27%20equals%3A%20zorkPackage%20commitPathJs'),
  679. messageSends: ["assert:equals:", "commitPathJs"],
  680. referencedClasses: []
  681. }),
  682. smalltalk.PackageWithDefaultCommitPathChangedTest);
  683. smalltalk.addMethod(
  684. unescape('_testZorkCommitPathStShouldBeSmalltalk'),
  685. smalltalk.method({
  686. selector: unescape('testZorkCommitPathStShouldBeSmalltalk'),
  687. category: 'tests',
  688. fn: function (){
  689. var self=this;
  690. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  691. return self;},
  692. args: [],
  693. source: unescape('testZorkCommitPathStShouldBeSmalltalk%0A%09self%20assert%3A%20%27smalltalk/%27%20equals%3A%20zorkPackage%20commitPathSt'),
  694. messageSends: ["assert:equals:", "commitPathSt"],
  695. referencedClasses: []
  696. }),
  697. smalltalk.PackageWithDefaultCommitPathChangedTest);
  698. smalltalk.addMethod(
  699. unescape('_shouldInheritSelectors'),
  700. smalltalk.method({
  701. selector: unescape('shouldInheritSelectors'),
  702. category: 'accessing',
  703. fn: function (){
  704. var self=this;
  705. return false;
  706. return self;},
  707. args: [],
  708. source: unescape('shouldInheritSelectors%0A%09%5E%20false'),
  709. messageSends: [],
  710. referencedClasses: []
  711. }),
  712. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);