Kernel-Tests.deploy.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  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.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  251. smalltalk.addMethod(
  252. '_testPrintShowingDecimalPlaces',
  253. smalltalk.method({
  254. selector: 'testPrintShowingDecimalPlaces',
  255. fn: function (){
  256. var self=this;
  257. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  258. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  259. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  260. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  261. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  262. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  263. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  264. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  265. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  266. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  267. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  268. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  269. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  270. return self;}
  271. }),
  272. smalltalk.NumberTest);
  273. smalltalk.addMethod(
  274. '_testEquality',
  275. smalltalk.method({
  276. selector: 'testEquality',
  277. fn: function (){
  278. var self=this;
  279. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  280. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  281. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  282. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  283. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  284. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  285. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  286. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  287. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  288. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  289. return self;}
  290. }),
  291. smalltalk.NumberTest);
  292. smalltalk.addMethod(
  293. '_testArithmetic',
  294. smalltalk.method({
  295. selector: 'testArithmetic',
  296. fn: function (){
  297. var self=this;
  298. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  299. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  300. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  301. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  302. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  303. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  304. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  305. return self;}
  306. }),
  307. smalltalk.NumberTest);
  308. smalltalk.addMethod(
  309. '_testRounded',
  310. smalltalk.method({
  311. selector: 'testRounded',
  312. fn: function (){
  313. var self=this;
  314. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  315. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  316. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  317. return self;}
  318. }),
  319. smalltalk.NumberTest);
  320. smalltalk.addMethod(
  321. '_testNegated',
  322. smalltalk.method({
  323. selector: 'testNegated',
  324. fn: function (){
  325. var self=this;
  326. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  327. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  328. return self;}
  329. }),
  330. smalltalk.NumberTest);
  331. smalltalk.addMethod(
  332. '_testComparison',
  333. smalltalk.method({
  334. selector: 'testComparison',
  335. fn: function (){
  336. var self=this;
  337. smalltalk.send(self, "_assert_", [(3) > (2)]);
  338. smalltalk.send(self, "_assert_", [(2) < (3)]);
  339. smalltalk.send(self, "_deny_", [(3) < (2)]);
  340. smalltalk.send(self, "_deny_", [(2) > (3)]);
  341. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  342. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  343. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  344. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  345. return self;}
  346. }),
  347. smalltalk.NumberTest);
  348. smalltalk.addMethod(
  349. '_testTruncated',
  350. smalltalk.method({
  351. selector: 'testTruncated',
  352. fn: function (){
  353. var self=this;
  354. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  355. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  356. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  357. return self;}
  358. }),
  359. smalltalk.NumberTest);
  360. smalltalk.addMethod(
  361. '_testCopying',
  362. smalltalk.method({
  363. selector: 'testCopying',
  364. fn: function (){
  365. var self=this;
  366. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  367. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  368. return self;}
  369. }),
  370. smalltalk.NumberTest);
  371. smalltalk.addMethod(
  372. '_testMinMax',
  373. smalltalk.method({
  374. selector: 'testMinMax',
  375. fn: function (){
  376. var self=this;
  377. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  378. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  379. return self;}
  380. }),
  381. smalltalk.NumberTest);
  382. smalltalk.addMethod(
  383. '_testIdentity',
  384. smalltalk.method({
  385. selector: 'testIdentity',
  386. fn: function (){
  387. var self=this;
  388. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  389. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  390. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  391. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  392. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  393. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  394. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  395. return self;}
  396. }),
  397. smalltalk.NumberTest);
  398. smalltalk.addMethod(
  399. '_testSqrt',
  400. smalltalk.method({
  401. selector: 'testSqrt',
  402. fn: function (){
  403. var self=this;
  404. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  405. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  406. return self;}
  407. }),
  408. smalltalk.NumberTest);
  409. smalltalk.addMethod(
  410. '_testSquared',
  411. smalltalk.method({
  412. selector: 'testSquared',
  413. fn: function (){
  414. var self=this;
  415. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  416. return self;}
  417. }),
  418. smalltalk.NumberTest);
  419. smalltalk.addMethod(
  420. '_testTimesRepeat',
  421. smalltalk.method({
  422. selector: 'testTimesRepeat',
  423. fn: function (){
  424. var self=this;
  425. var i=nil;
  426. i=(0);
  427. smalltalk.send((0), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  428. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  429. smalltalk.send((5), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  430. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  431. return self;}
  432. }),
  433. smalltalk.NumberTest);
  434. smalltalk.addMethod(
  435. '_testTo',
  436. smalltalk.method({
  437. selector: 'testTo',
  438. fn: function (){
  439. var self=this;
  440. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  441. return self;}
  442. }),
  443. smalltalk.NumberTest);
  444. smalltalk.addMethod(
  445. '_testToBy',
  446. smalltalk.method({
  447. selector: 'testToBy',
  448. fn: function (){
  449. var self=this;
  450. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  451. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  452. return self;}
  453. }),
  454. smalltalk.NumberTest);
  455. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  456. smalltalk.addMethod(
  457. '_testMethodWithArguments',
  458. smalltalk.method({
  459. selector: 'testMethodWithArguments',
  460. fn: function (){
  461. var self=this;
  462. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  463. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  464. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  465. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  466. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  467. return self;}
  468. }),
  469. smalltalk.JSObjectProxyTest);
  470. smalltalk.addMethod(
  471. '_testYourself',
  472. smalltalk.method({
  473. selector: 'testYourself',
  474. fn: function (){
  475. var self=this;
  476. var body=nil;
  477. body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", []));
  478. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  479. smalltalk.send(body, "_removeClass_", ["amber"]);
  480. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  481. return self;}
  482. }),
  483. smalltalk.JSObjectProxyTest);
  484. smalltalk.addMethod(
  485. '_testPropertyThatReturnsEmptyString',
  486. smalltalk.method({
  487. selector: 'testPropertyThatReturnsEmptyString',
  488. fn: function (){
  489. var self=this;
  490. document.location.hash = '';
  491. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  492. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  493. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  494. return self;}
  495. }),
  496. smalltalk.JSObjectProxyTest);
  497. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  498. smalltalk.addMethod(
  499. '_setUp',
  500. smalltalk.method({
  501. selector: 'setUp',
  502. fn: function (){
  503. var self=this;
  504. self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []);
  505. self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []);
  506. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  507. self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]);
  508. 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", []));
  509. return self;}
  510. }),
  511. smalltalk.PackageTest);
  512. smalltalk.addMethod(
  513. '_tearDown',
  514. smalltalk.method({
  515. selector: 'tearDown',
  516. fn: function (){
  517. var self=this;
  518. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  519. return self;}
  520. }),
  521. smalltalk.PackageTest);
  522. smalltalk.addMethod(
  523. '_testGrulCommitPathStShouldBeGrulSt',
  524. smalltalk.method({
  525. selector: 'testGrulCommitPathStShouldBeGrulSt',
  526. fn: function (){
  527. var self=this;
  528. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  529. return self;}
  530. }),
  531. smalltalk.PackageTest);
  532. smalltalk.addMethod(
  533. '_testZorkCommitPathStShouldBeSt',
  534. smalltalk.method({
  535. selector: 'testZorkCommitPathStShouldBeSt',
  536. fn: function (){
  537. var self=this;
  538. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  539. return self;}
  540. }),
  541. smalltalk.PackageTest);
  542. smalltalk.addMethod(
  543. '_testZorkCommitPathJsShouldBeJs',
  544. smalltalk.method({
  545. selector: 'testZorkCommitPathJsShouldBeJs',
  546. fn: function (){
  547. var self=this;
  548. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  549. return self;}
  550. }),
  551. smalltalk.PackageTest);
  552. smalltalk.addMethod(
  553. '_testGrulCommitPathJsShouldBeServerGrulJs',
  554. smalltalk.method({
  555. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  556. fn: function (){
  557. var self=this;
  558. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  559. return self;}
  560. }),
  561. smalltalk.PackageTest);
  562. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  563. smalltalk.addMethod(
  564. '_setUp',
  565. smalltalk.method({
  566. selector: 'setUp',
  567. fn: function (){
  568. var self=this;
  569. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  570. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  571. return self;}
  572. }),
  573. smalltalk.PackageWithDefaultCommitPathChangedTest);
  574. smalltalk.addMethod(
  575. '_testGrulCommitPathJsShouldBeServerGrulJs',
  576. smalltalk.method({
  577. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  578. fn: function (){
  579. var self=this;
  580. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  581. return self;}
  582. }),
  583. smalltalk.PackageWithDefaultCommitPathChangedTest);
  584. smalltalk.addMethod(
  585. '_testGrulCommitPathStShouldBeGrulSt',
  586. smalltalk.method({
  587. selector: 'testGrulCommitPathStShouldBeGrulSt',
  588. fn: function (){
  589. var self=this;
  590. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  591. return self;}
  592. }),
  593. smalltalk.PackageWithDefaultCommitPathChangedTest);
  594. smalltalk.addMethod(
  595. '_testZorkCommitPathJsShouldBeJavascript',
  596. smalltalk.method({
  597. selector: 'testZorkCommitPathJsShouldBeJavascript',
  598. fn: function (){
  599. var self=this;
  600. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  601. return self;}
  602. }),
  603. smalltalk.PackageWithDefaultCommitPathChangedTest);
  604. smalltalk.addMethod(
  605. '_testZorkCommitPathStShouldBeSmalltalk',
  606. smalltalk.method({
  607. selector: 'testZorkCommitPathStShouldBeSmalltalk',
  608. fn: function (){
  609. var self=this;
  610. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  611. return self;}
  612. }),
  613. smalltalk.PackageWithDefaultCommitPathChangedTest);
  614. smalltalk.addMethod(
  615. '_shouldInheritSelectors',
  616. smalltalk.method({
  617. selector: 'shouldInheritSelectors',
  618. fn: function (){
  619. var self=this;
  620. return false;
  621. return self;}
  622. }),
  623. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  624. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  625. smalltalk.addMethod(
  626. '_testValue',
  627. smalltalk.method({
  628. selector: 'testValue',
  629. fn: function (){
  630. var self=this;
  631. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  632. 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)]);
  633. 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)]);
  634. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  635. return self;}
  636. }),
  637. smalltalk.BlockClosureTest);
  638. smalltalk.addMethod(
  639. '_testOnDo',
  640. smalltalk.method({
  641. selector: 'testOnDo',
  642. fn: function (){
  643. var self=this;
  644. 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;})])]);
  645. return self;}
  646. }),
  647. smalltalk.BlockClosureTest);
  648. smalltalk.addMethod(
  649. '_testEnsure',
  650. smalltalk.method({
  651. selector: 'testEnsure',
  652. fn: function (){
  653. var self=this;
  654. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  655. return self;}
  656. }),
  657. smalltalk.BlockClosureTest);
  658. smalltalk.addMethod(
  659. '_testNumArgs',
  660. smalltalk.method({
  661. selector: 'testNumArgs',
  662. fn: function (){
  663. var self=this;
  664. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  665. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  666. return self;}
  667. }),
  668. smalltalk.BlockClosureTest);
  669. smalltalk.addMethod(
  670. '_testValueWithPossibleArguments',
  671. smalltalk.method({
  672. selector: 'testValueWithPossibleArguments',
  673. fn: function (){
  674. var self=this;
  675. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  676. 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)]);
  677. 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)]);
  678. return self;}
  679. }),
  680. smalltalk.BlockClosureTest);
  681. smalltalk.addMethod(
  682. '_testWhileTrue',
  683. smalltalk.method({
  684. selector: 'testWhileTrue',
  685. fn: function (){
  686. var self=this;
  687. var i=nil;
  688. i=(0);
  689. (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)]));})()}})();
  690. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  691. i=(0);
  692. (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)]));})()) {}})();
  693. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  694. return self;}
  695. }),
  696. smalltalk.BlockClosureTest);
  697. smalltalk.addMethod(
  698. '_testWhileFalse',
  699. smalltalk.method({
  700. selector: 'testWhileFalse',
  701. fn: function (){
  702. var self=this;
  703. var i=nil;
  704. i=(0);
  705. (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)]));})()}})();
  706. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  707. i=(0);
  708. (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)]));})()) {}})();
  709. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  710. return self;}
  711. }),
  712. smalltalk.BlockClosureTest);
  713. smalltalk.addMethod(
  714. '_testCompiledSource',
  715. smalltalk.method({
  716. selector: 'testCompiledSource',
  717. fn: function (){
  718. var self=this;
  719. 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")]);
  720. return self;}
  721. }),
  722. smalltalk.BlockClosureTest);
  723. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  724. smalltalk.addMethod(
  725. '_testEquality',
  726. smalltalk.method({
  727. selector: 'testEquality',
  728. fn: function (){
  729. var self=this;
  730. var o=nil;
  731. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  732. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  733. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  734. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  735. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  736. return self;}
  737. }),
  738. smalltalk.ObjectTest);
  739. smalltalk.addMethod(
  740. '_testIdentity',
  741. smalltalk.method({
  742. selector: 'testIdentity',
  743. fn: function (){
  744. var self=this;
  745. var o=nil;
  746. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  747. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  748. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  749. return self;}
  750. }),
  751. smalltalk.ObjectTest);