Kernel-Tests.deploy.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. '_testJoin',
  5. smalltalk.method({
  6. selector: 'testJoin',
  7. fn: function (){
  8. var self=this;
  9. smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
  10. return self;}
  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 || 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. smalltalk.StringTest);
  23. smalltalk.addMethod(
  24. '_testIncludesSubString',
  25. smalltalk.method({
  26. selector: 'testIncludesSubString',
  27. fn: function (){
  28. var self=this;
  29. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  30. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  31. return self;}
  32. }),
  33. smalltalk.StringTest);
  34. smalltalk.addMethod(
  35. '_testEquality',
  36. smalltalk.method({
  37. selector: 'testEquality',
  38. fn: function (){
  39. var self=this;
  40. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  41. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  42. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  43. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  44. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  45. return self;}
  46. }),
  47. smalltalk.StringTest);
  48. smalltalk.addMethod(
  49. '_testCopyWithoutAll',
  50. smalltalk.method({
  51. selector: 'testCopyWithoutAll',
  52. fn: function (){
  53. var self=this;
  54. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(unescape("*hello*%20*world*"), "_copyWithoutAll_", [unescape("*")])]);
  55. return self;}
  56. }),
  57. smalltalk.StringTest);
  58. smalltalk.addMethod(
  59. '_testAt',
  60. smalltalk.method({
  61. selector: 'testAt',
  62. fn: function (){
  63. var self=this;
  64. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  65. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  66. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  67. return self;}
  68. }),
  69. smalltalk.StringTest);
  70. smalltalk.addMethod(
  71. '_testAtPut',
  72. smalltalk.method({
  73. selector: 'testAtPut',
  74. fn: function (){
  75. var self=this;
  76. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  77. return self;}
  78. }),
  79. smalltalk.StringTest);
  80. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  81. smalltalk.addMethod(
  82. '_testPrintString',
  83. smalltalk.method({
  84. selector: 'testPrintString',
  85. fn: function (){
  86. var self=this;
  87. 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", []))]);
  88. return self;}
  89. }),
  90. smalltalk.DictionaryTest);
  91. smalltalk.addMethod(
  92. '_testEquality',
  93. smalltalk.method({
  94. selector: 'testEquality',
  95. fn: function (){
  96. var self=this;
  97. var d1=nil;
  98. var d2=nil;
  99. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  100. d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  101. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  102. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  103. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  104. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  105. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  106. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  107. 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", []));
  108. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  109. return self;}
  110. }),
  111. smalltalk.DictionaryTest);
  112. smalltalk.addMethod(
  113. '_testDynamicDictionaries',
  114. smalltalk.method({
  115. selector: 'testDynamicDictionaries',
  116. fn: function (){
  117. var self=this;
  118. 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"])])])]);
  119. return self;}
  120. }),
  121. smalltalk.DictionaryTest);
  122. smalltalk.addMethod(
  123. '_testAccessing',
  124. smalltalk.method({
  125. selector: 'testAccessing',
  126. fn: function (){
  127. var self=this;
  128. var d=nil;
  129. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  130. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  131. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  132. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  133. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  134. smalltalk.send(d, "_at_put_", [(1), (2)]);
  135. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  136. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  137. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  138. return self;}
  139. }),
  140. smalltalk.DictionaryTest);
  141. smalltalk.addMethod(
  142. '_testSize',
  143. smalltalk.method({
  144. selector: 'testSize',
  145. fn: function (){
  146. var self=this;
  147. var d=nil;
  148. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  149. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  150. smalltalk.send(d, "_at_put_", [(1), (2)]);
  151. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  152. smalltalk.send(d, "_at_put_", [(2), (3)]);
  153. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  154. return self;}
  155. }),
  156. smalltalk.DictionaryTest);
  157. smalltalk.addMethod(
  158. '_testValues',
  159. smalltalk.method({
  160. selector: 'testValues',
  161. fn: function (){
  162. var self=this;
  163. var d=nil;
  164. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  165. smalltalk.send(d, "_at_put_", [(1), (2)]);
  166. smalltalk.send(d, "_at_put_", [(2), (3)]);
  167. smalltalk.send(d, "_at_put_", [(3), (4)]);
  168. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  169. return self;}
  170. }),
  171. smalltalk.DictionaryTest);
  172. smalltalk.addMethod(
  173. '_testKeys',
  174. smalltalk.method({
  175. selector: 'testKeys',
  176. fn: function (){
  177. var self=this;
  178. var d=nil;
  179. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  180. smalltalk.send(d, "_at_put_", [(1), (2)]);
  181. smalltalk.send(d, "_at_put_", [(2), (3)]);
  182. smalltalk.send(d, "_at_put_", [(3), (4)]);
  183. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  184. return self;}
  185. }),
  186. smalltalk.DictionaryTest);
  187. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  188. smalltalk.addMethod(
  189. '_testLogic',
  190. smalltalk.method({
  191. selector: 'testLogic',
  192. fn: function (){
  193. var self=this;
  194. (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);
  195. (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);
  196. (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);
  197. (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);
  198. return self;}
  199. }),
  200. smalltalk.BooleanTest);
  201. smalltalk.addMethod(
  202. '_testEquality',
  203. smalltalk.method({
  204. selector: 'testEquality',
  205. fn: function (){
  206. var self=this;
  207. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  208. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  209. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  210. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  211. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  212. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  213. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  214. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  215. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  216. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  217. return self;}
  218. }),
  219. smalltalk.BooleanTest);
  220. smalltalk.addMethod(
  221. '_testLogicKeywords',
  222. smalltalk.method({
  223. selector: 'testLogicKeywords',
  224. fn: function (){
  225. var self=this;
  226. (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);
  227. (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);
  228. (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);
  229. (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);
  230. return self;}
  231. }),
  232. smalltalk.BooleanTest);
  233. smalltalk.addMethod(
  234. '_testIfTrueIfFalse',
  235. smalltalk.method({
  236. selector: 'testIfTrueIfFalse',
  237. fn: function (){
  238. var self=this;
  239. 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"])]);
  240. 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])]);
  241. 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])]);
  242. 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"])]);
  243. 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"])]);
  244. 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"])]);
  245. 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"])]);
  246. 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"])]);
  247. return self;}
  248. }),
  249. smalltalk.BooleanTest);
  250. smalltalk.addMethod(
  251. '_testIdentity',
  252. smalltalk.method({
  253. selector: 'testIdentity',
  254. fn: function (){
  255. var self=this;
  256. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  257. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  258. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  259. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  260. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  261. return self;}
  262. }),
  263. smalltalk.BooleanTest);
  264. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  265. smalltalk.addMethod(
  266. '_testPrintShowingDecimalPlaces',
  267. smalltalk.method({
  268. selector: 'testPrintShowingDecimalPlaces',
  269. fn: function (){
  270. var self=this;
  271. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  272. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  273. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  274. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  275. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  276. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  277. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  278. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  279. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  280. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  281. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  282. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  283. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  284. return self;}
  285. }),
  286. smalltalk.NumberTest);
  287. smalltalk.addMethod(
  288. '_testEquality',
  289. smalltalk.method({
  290. selector: 'testEquality',
  291. fn: function (){
  292. var self=this;
  293. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  294. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  295. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  296. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  297. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  298. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  299. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  300. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  301. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  302. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  303. return self;}
  304. }),
  305. smalltalk.NumberTest);
  306. smalltalk.addMethod(
  307. '_testArithmetic',
  308. smalltalk.method({
  309. selector: 'testArithmetic',
  310. fn: function (){
  311. var self=this;
  312. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  313. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  314. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  315. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  316. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  317. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  318. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  319. return self;}
  320. }),
  321. smalltalk.NumberTest);
  322. smalltalk.addMethod(
  323. '_testRounded',
  324. smalltalk.method({
  325. selector: 'testRounded',
  326. fn: function (){
  327. var self=this;
  328. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  329. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  330. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  331. return self;}
  332. }),
  333. smalltalk.NumberTest);
  334. smalltalk.addMethod(
  335. '_testNegated',
  336. smalltalk.method({
  337. selector: 'testNegated',
  338. fn: function (){
  339. var self=this;
  340. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  341. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  342. return self;}
  343. }),
  344. smalltalk.NumberTest);
  345. smalltalk.addMethod(
  346. '_testComparison',
  347. smalltalk.method({
  348. selector: 'testComparison',
  349. fn: function (){
  350. var self=this;
  351. smalltalk.send(self, "_assert_", [(3) > (2)]);
  352. smalltalk.send(self, "_assert_", [(2) < (3)]);
  353. smalltalk.send(self, "_deny_", [(3) < (2)]);
  354. smalltalk.send(self, "_deny_", [(2) > (3)]);
  355. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  356. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  357. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  358. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  359. return self;}
  360. }),
  361. smalltalk.NumberTest);
  362. smalltalk.addMethod(
  363. '_testTruncated',
  364. smalltalk.method({
  365. selector: 'testTruncated',
  366. fn: function (){
  367. var self=this;
  368. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  369. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  370. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  371. return self;}
  372. }),
  373. smalltalk.NumberTest);
  374. smalltalk.addMethod(
  375. '_testCopying',
  376. smalltalk.method({
  377. selector: 'testCopying',
  378. fn: function (){
  379. var self=this;
  380. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  381. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  382. return self;}
  383. }),
  384. smalltalk.NumberTest);
  385. smalltalk.addMethod(
  386. '_testMinMax',
  387. smalltalk.method({
  388. selector: 'testMinMax',
  389. fn: function (){
  390. var self=this;
  391. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  392. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  393. return self;}
  394. }),
  395. smalltalk.NumberTest);
  396. smalltalk.addMethod(
  397. '_testIdentity',
  398. smalltalk.method({
  399. selector: 'testIdentity',
  400. fn: function (){
  401. var self=this;
  402. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  403. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  404. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  405. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  406. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  407. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  408. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  409. return self;}
  410. }),
  411. smalltalk.NumberTest);
  412. smalltalk.addMethod(
  413. '_testSqrt',
  414. smalltalk.method({
  415. selector: 'testSqrt',
  416. fn: function (){
  417. var self=this;
  418. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  419. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  420. return self;}
  421. }),
  422. smalltalk.NumberTest);
  423. smalltalk.addMethod(
  424. '_testSquared',
  425. smalltalk.method({
  426. selector: 'testSquared',
  427. fn: function (){
  428. var self=this;
  429. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  430. return self;}
  431. }),
  432. smalltalk.NumberTest);
  433. smalltalk.addMethod(
  434. '_testTimesRepeat',
  435. smalltalk.method({
  436. selector: 'testTimesRepeat',
  437. fn: function (){
  438. var self=this;
  439. var i=nil;
  440. i=(0);
  441. smalltalk.send((0), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  442. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  443. smalltalk.send((5), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  444. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  445. return self;}
  446. }),
  447. smalltalk.NumberTest);
  448. smalltalk.addMethod(
  449. '_testTo',
  450. smalltalk.method({
  451. selector: 'testTo',
  452. fn: function (){
  453. var self=this;
  454. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  455. return self;}
  456. }),
  457. smalltalk.NumberTest);
  458. smalltalk.addMethod(
  459. '_testToBy',
  460. smalltalk.method({
  461. selector: 'testToBy',
  462. fn: function (){
  463. var self=this;
  464. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  465. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  466. return self;}
  467. }),
  468. smalltalk.NumberTest);
  469. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  470. smalltalk.addMethod(
  471. '_testMethodWithArguments',
  472. smalltalk.method({
  473. selector: 'testMethodWithArguments',
  474. fn: function (){
  475. var self=this;
  476. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  477. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  478. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  479. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  480. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  481. return self;}
  482. }),
  483. smalltalk.JSObjectProxyTest);
  484. smalltalk.addMethod(
  485. '_testYourself',
  486. smalltalk.method({
  487. selector: 'testYourself',
  488. fn: function (){
  489. var self=this;
  490. var body=nil;
  491. body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", []));
  492. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  493. smalltalk.send(body, "_removeClass_", ["amber"]);
  494. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  495. return self;}
  496. }),
  497. smalltalk.JSObjectProxyTest);
  498. smalltalk.addMethod(
  499. '_testPropertyThatReturnsEmptyString',
  500. smalltalk.method({
  501. selector: 'testPropertyThatReturnsEmptyString',
  502. fn: function (){
  503. var self=this;
  504. document.location.hash = '';
  505. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  506. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  507. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  508. return self;}
  509. }),
  510. smalltalk.JSObjectProxyTest);
  511. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  512. smalltalk.addMethod(
  513. '_setUp',
  514. smalltalk.method({
  515. selector: 'setUp',
  516. fn: function (){
  517. var self=this;
  518. self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []);
  519. self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []);
  520. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  521. self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]);
  522. 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", []));
  523. return self;}
  524. }),
  525. smalltalk.PackageTest);
  526. smalltalk.addMethod(
  527. '_tearDown',
  528. smalltalk.method({
  529. selector: 'tearDown',
  530. fn: function (){
  531. var self=this;
  532. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  533. return self;}
  534. }),
  535. smalltalk.PackageTest);
  536. smalltalk.addMethod(
  537. '_testGrulCommitPathStShouldBeGrulSt',
  538. smalltalk.method({
  539. selector: 'testGrulCommitPathStShouldBeGrulSt',
  540. fn: function (){
  541. var self=this;
  542. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  543. return self;}
  544. }),
  545. smalltalk.PackageTest);
  546. smalltalk.addMethod(
  547. '_testZorkCommitPathStShouldBeSt',
  548. smalltalk.method({
  549. selector: 'testZorkCommitPathStShouldBeSt',
  550. fn: function (){
  551. var self=this;
  552. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  553. return self;}
  554. }),
  555. smalltalk.PackageTest);
  556. smalltalk.addMethod(
  557. '_testZorkCommitPathJsShouldBeJs',
  558. smalltalk.method({
  559. selector: 'testZorkCommitPathJsShouldBeJs',
  560. fn: function (){
  561. var self=this;
  562. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  563. return self;}
  564. }),
  565. smalltalk.PackageTest);
  566. smalltalk.addMethod(
  567. '_testGrulCommitPathJsShouldBeServerGrulJs',
  568. smalltalk.method({
  569. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  570. fn: function (){
  571. var self=this;
  572. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  573. return self;}
  574. }),
  575. smalltalk.PackageTest);
  576. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  577. smalltalk.addMethod(
  578. '_setUp',
  579. smalltalk.method({
  580. selector: 'setUp',
  581. fn: function (){
  582. var self=this;
  583. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  584. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  585. return self;}
  586. }),
  587. smalltalk.PackageWithDefaultCommitPathChangedTest);
  588. smalltalk.addMethod(
  589. '_testGrulCommitPathJsShouldBeServerGrulJs',
  590. smalltalk.method({
  591. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  592. fn: function (){
  593. var self=this;
  594. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  595. return self;}
  596. }),
  597. smalltalk.PackageWithDefaultCommitPathChangedTest);
  598. smalltalk.addMethod(
  599. '_testGrulCommitPathStShouldBeGrulSt',
  600. smalltalk.method({
  601. selector: 'testGrulCommitPathStShouldBeGrulSt',
  602. fn: function (){
  603. var self=this;
  604. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  605. return self;}
  606. }),
  607. smalltalk.PackageWithDefaultCommitPathChangedTest);
  608. smalltalk.addMethod(
  609. '_testZorkCommitPathJsShouldBeJavascript',
  610. smalltalk.method({
  611. selector: 'testZorkCommitPathJsShouldBeJavascript',
  612. fn: function (){
  613. var self=this;
  614. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  615. return self;}
  616. }),
  617. smalltalk.PackageWithDefaultCommitPathChangedTest);
  618. smalltalk.addMethod(
  619. '_testZorkCommitPathStShouldBeSmalltalk',
  620. smalltalk.method({
  621. selector: 'testZorkCommitPathStShouldBeSmalltalk',
  622. fn: function (){
  623. var self=this;
  624. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  625. return self;}
  626. }),
  627. smalltalk.PackageWithDefaultCommitPathChangedTest);
  628. smalltalk.addMethod(
  629. '_shouldInheritSelectors',
  630. smalltalk.method({
  631. selector: 'shouldInheritSelectors',
  632. fn: function (){
  633. var self=this;
  634. return false;
  635. return self;}
  636. }),
  637. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  638. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  639. smalltalk.addMethod(
  640. '_testValue',
  641. smalltalk.method({
  642. selector: 'testValue',
  643. fn: function (){
  644. var self=this;
  645. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  646. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
  647. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
  648. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  649. return self;}
  650. }),
  651. smalltalk.BlockClosureTest);
  652. smalltalk.addMethod(
  653. '_testOnDo',
  654. smalltalk.method({
  655. selector: 'testOnDo',
  656. fn: function (){
  657. var self=this;
  658. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
  659. return self;}
  660. }),
  661. smalltalk.BlockClosureTest);
  662. smalltalk.addMethod(
  663. '_testEnsure',
  664. smalltalk.method({
  665. selector: 'testEnsure',
  666. fn: function (){
  667. var self=this;
  668. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  669. return self;}
  670. }),
  671. smalltalk.BlockClosureTest);
  672. smalltalk.addMethod(
  673. '_testNumArgs',
  674. smalltalk.method({
  675. selector: 'testNumArgs',
  676. fn: function (){
  677. var self=this;
  678. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  679. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  680. return self;}
  681. }),
  682. smalltalk.BlockClosureTest);
  683. smalltalk.addMethod(
  684. '_testValueWithPossibleArguments',
  685. smalltalk.method({
  686. selector: 'testValueWithPossibleArguments',
  687. fn: function (){
  688. var self=this;
  689. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  690. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
  691. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
  692. return self;}
  693. }),
  694. smalltalk.BlockClosureTest);
  695. smalltalk.addMethod(
  696. '_testWhileTrue',
  697. smalltalk.method({
  698. selector: 'testWhileTrue',
  699. fn: function (){
  700. var self=this;
  701. var i=nil;
  702. i=(0);
  703. (function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
  704. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  705. i=(0);
  706. (function(){while((function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
  707. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  708. return self;}
  709. }),
  710. smalltalk.BlockClosureTest);
  711. smalltalk.addMethod(
  712. '_testWhileFalse',
  713. smalltalk.method({
  714. selector: 'testWhileFalse',
  715. fn: function (){
  716. var self=this;
  717. var i=nil;
  718. i=(0);
  719. (function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
  720. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  721. i=(0);
  722. (function(){while(!(function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
  723. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  724. return self;}
  725. }),
  726. smalltalk.BlockClosureTest);
  727. smalltalk.addMethod(
  728. '_testCompiledSource',
  729. smalltalk.method({
  730. selector: 'testCompiledSource',
  731. fn: function (){
  732. var self=this;
  733. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), unescape("function%20%28%29%7Breturn%20%281%29%20+%20%281%29%3B%7D")]);
  734. return self;}
  735. }),
  736. smalltalk.BlockClosureTest);
  737. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  738. smalltalk.addMethod(
  739. '_testEquality',
  740. smalltalk.method({
  741. selector: 'testEquality',
  742. fn: function (){
  743. var self=this;
  744. var o=nil;
  745. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  746. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  747. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  748. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  749. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  750. return self;}
  751. }),
  752. smalltalk.ObjectTest);
  753. smalltalk.addMethod(
  754. '_testIdentity',
  755. smalltalk.method({
  756. selector: 'testIdentity',
  757. fn: function (){
  758. var self=this;
  759. var o=nil;
  760. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  761. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  762. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  763. return self;}
  764. }),
  765. smalltalk.ObjectTest);