Kernel-Tests.deploy.js 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  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.addMethod(
  81. '_testSize',
  82. smalltalk.method({
  83. selector: 'testSize',
  84. fn: function (){
  85. var self=this;
  86. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  87. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  88. return self;}
  89. }),
  90. smalltalk.StringTest);
  91. smalltalk.addMethod(
  92. '_testAddRemove',
  93. smalltalk.method({
  94. selector: 'testAddRemove',
  95. fn: function (){
  96. var self=this;
  97. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  98. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  99. return self;}
  100. }),
  101. smalltalk.StringTest);
  102. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  103. smalltalk.addMethod(
  104. '_testPrintString',
  105. smalltalk.method({
  106. selector: 'testPrintString',
  107. fn: function (){
  108. var self=this;
  109. 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", []))]);
  110. return self;}
  111. }),
  112. smalltalk.DictionaryTest);
  113. smalltalk.addMethod(
  114. '_testEquality',
  115. smalltalk.method({
  116. selector: 'testEquality',
  117. fn: function (){
  118. var self=this;
  119. var d1=nil;
  120. var d2=nil;
  121. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  122. d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  123. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  124. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  125. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  126. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  127. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  128. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  129. 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", []));
  130. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  131. return self;}
  132. }),
  133. smalltalk.DictionaryTest);
  134. smalltalk.addMethod(
  135. '_testDynamicDictionaries',
  136. smalltalk.method({
  137. selector: 'testDynamicDictionaries',
  138. fn: function (){
  139. var self=this;
  140. 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"])])])]);
  141. return self;}
  142. }),
  143. smalltalk.DictionaryTest);
  144. smalltalk.addMethod(
  145. '_testAccessing',
  146. smalltalk.method({
  147. selector: 'testAccessing',
  148. fn: function (){
  149. var self=this;
  150. var d=nil;
  151. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  152. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  153. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  154. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  155. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  156. smalltalk.send(d, "_at_put_", [(1), (2)]);
  157. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  158. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  159. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  160. return self;}
  161. }),
  162. smalltalk.DictionaryTest);
  163. smalltalk.addMethod(
  164. '_testSize',
  165. smalltalk.method({
  166. selector: 'testSize',
  167. fn: function (){
  168. var self=this;
  169. var d=nil;
  170. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  171. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  172. smalltalk.send(d, "_at_put_", [(1), (2)]);
  173. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  174. smalltalk.send(d, "_at_put_", [(2), (3)]);
  175. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  176. return self;}
  177. }),
  178. smalltalk.DictionaryTest);
  179. smalltalk.addMethod(
  180. '_testValues',
  181. smalltalk.method({
  182. selector: 'testValues',
  183. fn: function (){
  184. var self=this;
  185. var d=nil;
  186. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  187. smalltalk.send(d, "_at_put_", [(1), (2)]);
  188. smalltalk.send(d, "_at_put_", [(2), (3)]);
  189. smalltalk.send(d, "_at_put_", [(3), (4)]);
  190. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  191. return self;}
  192. }),
  193. smalltalk.DictionaryTest);
  194. smalltalk.addMethod(
  195. '_testKeys',
  196. smalltalk.method({
  197. selector: 'testKeys',
  198. fn: function (){
  199. var self=this;
  200. var d=nil;
  201. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  202. smalltalk.send(d, "_at_put_", [(1), (2)]);
  203. smalltalk.send(d, "_at_put_", [(2), (3)]);
  204. smalltalk.send(d, "_at_put_", [(3), (4)]);
  205. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  206. return self;}
  207. }),
  208. smalltalk.DictionaryTest);
  209. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  210. smalltalk.addMethod(
  211. '_testLogic',
  212. smalltalk.method({
  213. selector: 'testLogic',
  214. fn: function (){
  215. var self=this;
  216. (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);
  217. (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);
  218. (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);
  219. (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);
  220. return self;}
  221. }),
  222. smalltalk.BooleanTest);
  223. smalltalk.addMethod(
  224. '_testEquality',
  225. smalltalk.method({
  226. selector: 'testEquality',
  227. fn: function (){
  228. var self=this;
  229. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  230. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  231. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  232. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  233. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  234. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  235. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  236. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  237. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  238. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  239. return self;}
  240. }),
  241. smalltalk.BooleanTest);
  242. smalltalk.addMethod(
  243. '_testLogicKeywords',
  244. smalltalk.method({
  245. selector: 'testLogicKeywords',
  246. fn: function (){
  247. var self=this;
  248. (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);
  249. (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);
  250. (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);
  251. (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);
  252. return self;}
  253. }),
  254. smalltalk.BooleanTest);
  255. smalltalk.addMethod(
  256. '_testIfTrueIfFalse',
  257. smalltalk.method({
  258. selector: 'testIfTrueIfFalse',
  259. fn: function (){
  260. var self=this;
  261. 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"])]);
  262. 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])]);
  263. 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])]);
  264. 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"])]);
  265. 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"])]);
  266. 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"])]);
  267. 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"])]);
  268. 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"])]);
  269. return self;}
  270. }),
  271. smalltalk.BooleanTest);
  272. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  273. smalltalk.addMethod(
  274. '_testPrintShowingDecimalPlaces',
  275. smalltalk.method({
  276. selector: 'testPrintShowingDecimalPlaces',
  277. fn: function (){
  278. var self=this;
  279. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  280. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  281. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  282. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  283. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  284. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  285. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  286. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  287. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  288. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  289. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  290. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  291. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  292. return self;}
  293. }),
  294. smalltalk.NumberTest);
  295. smalltalk.addMethod(
  296. '_testEquality',
  297. smalltalk.method({
  298. selector: 'testEquality',
  299. fn: function (){
  300. var self=this;
  301. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  302. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  303. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  304. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  305. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  306. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  307. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  308. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  309. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  310. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  311. return self;}
  312. }),
  313. smalltalk.NumberTest);
  314. smalltalk.addMethod(
  315. '_testArithmetic',
  316. smalltalk.method({
  317. selector: 'testArithmetic',
  318. fn: function (){
  319. var self=this;
  320. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  321. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  322. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  323. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  324. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  325. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  326. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  327. return self;}
  328. }),
  329. smalltalk.NumberTest);
  330. smalltalk.addMethod(
  331. '_testRounded',
  332. smalltalk.method({
  333. selector: 'testRounded',
  334. fn: function (){
  335. var self=this;
  336. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  337. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  338. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  339. return self;}
  340. }),
  341. smalltalk.NumberTest);
  342. smalltalk.addMethod(
  343. '_testNegated',
  344. smalltalk.method({
  345. selector: 'testNegated',
  346. fn: function (){
  347. var self=this;
  348. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  349. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  350. return self;}
  351. }),
  352. smalltalk.NumberTest);
  353. smalltalk.addMethod(
  354. '_testComparison',
  355. smalltalk.method({
  356. selector: 'testComparison',
  357. fn: function (){
  358. var self=this;
  359. smalltalk.send(self, "_assert_", [(3) > (2)]);
  360. smalltalk.send(self, "_assert_", [(2) < (3)]);
  361. smalltalk.send(self, "_deny_", [(3) < (2)]);
  362. smalltalk.send(self, "_deny_", [(2) > (3)]);
  363. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  364. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  365. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  366. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  367. return self;}
  368. }),
  369. smalltalk.NumberTest);
  370. smalltalk.addMethod(
  371. '_testTruncated',
  372. smalltalk.method({
  373. selector: 'testTruncated',
  374. fn: function (){
  375. var self=this;
  376. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  377. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  378. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  379. return self;}
  380. }),
  381. smalltalk.NumberTest);
  382. smalltalk.addMethod(
  383. '_testCopying',
  384. smalltalk.method({
  385. selector: 'testCopying',
  386. fn: function (){
  387. var self=this;
  388. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  389. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  390. return self;}
  391. }),
  392. smalltalk.NumberTest);
  393. smalltalk.addMethod(
  394. '_testMinMax',
  395. smalltalk.method({
  396. selector: 'testMinMax',
  397. fn: function (){
  398. var self=this;
  399. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  400. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  401. return self;}
  402. }),
  403. smalltalk.NumberTest);
  404. smalltalk.addMethod(
  405. '_testIdentity',
  406. smalltalk.method({
  407. selector: 'testIdentity',
  408. fn: function (){
  409. var self=this;
  410. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  411. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  412. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  413. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  414. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  415. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  416. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  417. return self;}
  418. }),
  419. smalltalk.NumberTest);
  420. smalltalk.addMethod(
  421. '_testSqrt',
  422. smalltalk.method({
  423. selector: 'testSqrt',
  424. fn: function (){
  425. var self=this;
  426. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  427. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  428. return self;}
  429. }),
  430. smalltalk.NumberTest);
  431. smalltalk.addMethod(
  432. '_testSquared',
  433. smalltalk.method({
  434. selector: 'testSquared',
  435. fn: function (){
  436. var self=this;
  437. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  438. return self;}
  439. }),
  440. smalltalk.NumberTest);
  441. smalltalk.addMethod(
  442. '_testTimesRepeat',
  443. smalltalk.method({
  444. selector: 'testTimesRepeat',
  445. fn: function (){
  446. var self=this;
  447. var i=nil;
  448. i=(0);
  449. smalltalk.send((0), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  450. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  451. smalltalk.send((5), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  452. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  453. return self;}
  454. }),
  455. smalltalk.NumberTest);
  456. smalltalk.addMethod(
  457. '_testTo',
  458. smalltalk.method({
  459. selector: 'testTo',
  460. fn: function (){
  461. var self=this;
  462. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  463. return self;}
  464. }),
  465. smalltalk.NumberTest);
  466. smalltalk.addMethod(
  467. '_testToBy',
  468. smalltalk.method({
  469. selector: 'testToBy',
  470. fn: function (){
  471. var self=this;
  472. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  473. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  474. return self;}
  475. }),
  476. smalltalk.NumberTest);
  477. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  478. smalltalk.addMethod(
  479. '_testMethodWithArguments',
  480. smalltalk.method({
  481. selector: 'testMethodWithArguments',
  482. fn: function (){
  483. var self=this;
  484. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  485. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  486. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  487. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  488. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  489. return self;}
  490. }),
  491. smalltalk.JSObjectProxyTest);
  492. smalltalk.addMethod(
  493. '_testYourself',
  494. smalltalk.method({
  495. selector: 'testYourself',
  496. fn: function (){
  497. var self=this;
  498. var body=nil;
  499. body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", []));
  500. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  501. smalltalk.send(body, "_removeClass_", ["amber"]);
  502. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  503. return self;}
  504. }),
  505. smalltalk.JSObjectProxyTest);
  506. smalltalk.addMethod(
  507. '_testPropertyThatReturnsEmptyString',
  508. smalltalk.method({
  509. selector: 'testPropertyThatReturnsEmptyString',
  510. fn: function (){
  511. var self=this;
  512. document.location.hash = '';
  513. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  514. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  515. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  516. return self;}
  517. }),
  518. smalltalk.JSObjectProxyTest);
  519. smalltalk.addMethod(
  520. '_jsObject',
  521. smalltalk.method({
  522. selector: 'jsObject',
  523. fn: function (){
  524. var self=this;
  525. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  526. return self;}
  527. }),
  528. smalltalk.JSObjectProxyTest);
  529. smalltalk.addMethod(
  530. '_testDNU',
  531. smalltalk.method({
  532. selector: 'testDNU',
  533. fn: function (){
  534. var self=this;
  535. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  536. return self;}
  537. }),
  538. smalltalk.JSObjectProxyTest);
  539. smalltalk.addMethod(
  540. '_testMessageSend',
  541. smalltalk.method({
  542. selector: 'testMessageSend',
  543. fn: function (){
  544. var self=this;
  545. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
  546. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
  547. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
  548. return self;}
  549. }),
  550. smalltalk.JSObjectProxyTest);
  551. smalltalk.addMethod(
  552. '_testPrinting',
  553. smalltalk.method({
  554. selector: 'testPrinting',
  555. fn: function (){
  556. var self=this;
  557. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", [unescape("%5Bobject%20Object%5D")])]);
  558. return self;}
  559. }),
  560. smalltalk.JSObjectProxyTest);
  561. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  562. smalltalk.addMethod(
  563. '_setUp',
  564. smalltalk.method({
  565. selector: 'setUp',
  566. fn: function (){
  567. var self=this;
  568. self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []);
  569. self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []);
  570. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  571. self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]);
  572. 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", []));
  573. return self;}
  574. }),
  575. smalltalk.PackageTest);
  576. smalltalk.addMethod(
  577. '_tearDown',
  578. smalltalk.method({
  579. selector: 'tearDown',
  580. fn: function (){
  581. var self=this;
  582. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  583. return self;}
  584. }),
  585. smalltalk.PackageTest);
  586. smalltalk.addMethod(
  587. '_testGrulCommitPathStShouldBeGrulSt',
  588. smalltalk.method({
  589. selector: 'testGrulCommitPathStShouldBeGrulSt',
  590. fn: function (){
  591. var self=this;
  592. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  593. return self;}
  594. }),
  595. smalltalk.PackageTest);
  596. smalltalk.addMethod(
  597. '_testZorkCommitPathStShouldBeSt',
  598. smalltalk.method({
  599. selector: 'testZorkCommitPathStShouldBeSt',
  600. fn: function (){
  601. var self=this;
  602. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  603. return self;}
  604. }),
  605. smalltalk.PackageTest);
  606. smalltalk.addMethod(
  607. '_testZorkCommitPathJsShouldBeJs',
  608. smalltalk.method({
  609. selector: 'testZorkCommitPathJsShouldBeJs',
  610. fn: function (){
  611. var self=this;
  612. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  613. return self;}
  614. }),
  615. smalltalk.PackageTest);
  616. smalltalk.addMethod(
  617. '_testGrulCommitPathJsShouldBeServerGrulJs',
  618. smalltalk.method({
  619. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  620. fn: function (){
  621. var self=this;
  622. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  623. return self;}
  624. }),
  625. smalltalk.PackageTest);
  626. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  627. smalltalk.addMethod(
  628. '_setUp',
  629. smalltalk.method({
  630. selector: 'setUp',
  631. fn: function (){
  632. var self=this;
  633. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  634. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  635. return self;}
  636. }),
  637. smalltalk.PackageWithDefaultCommitPathChangedTest);
  638. smalltalk.addMethod(
  639. '_testGrulCommitPathJsShouldBeServerGrulJs',
  640. smalltalk.method({
  641. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  642. fn: function (){
  643. var self=this;
  644. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  645. return self;}
  646. }),
  647. smalltalk.PackageWithDefaultCommitPathChangedTest);
  648. smalltalk.addMethod(
  649. '_testGrulCommitPathStShouldBeGrulSt',
  650. smalltalk.method({
  651. selector: 'testGrulCommitPathStShouldBeGrulSt',
  652. fn: function (){
  653. var self=this;
  654. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  655. return self;}
  656. }),
  657. smalltalk.PackageWithDefaultCommitPathChangedTest);
  658. smalltalk.addMethod(
  659. '_testZorkCommitPathJsShouldBeJavascript',
  660. smalltalk.method({
  661. selector: 'testZorkCommitPathJsShouldBeJavascript',
  662. fn: function (){
  663. var self=this;
  664. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  665. return self;}
  666. }),
  667. smalltalk.PackageWithDefaultCommitPathChangedTest);
  668. smalltalk.addMethod(
  669. '_testZorkCommitPathStShouldBeSmalltalk',
  670. smalltalk.method({
  671. selector: 'testZorkCommitPathStShouldBeSmalltalk',
  672. fn: function (){
  673. var self=this;
  674. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  675. return self;}
  676. }),
  677. smalltalk.PackageWithDefaultCommitPathChangedTest);
  678. smalltalk.addMethod(
  679. '_shouldInheritSelectors',
  680. smalltalk.method({
  681. selector: 'shouldInheritSelectors',
  682. fn: function (){
  683. var self=this;
  684. return false;
  685. return self;}
  686. }),
  687. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  688. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  689. smalltalk.addMethod(
  690. '_testValue',
  691. smalltalk.method({
  692. selector: 'testValue',
  693. fn: function (){
  694. var self=this;
  695. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  696. 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)]);
  697. 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)]);
  698. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  699. return self;}
  700. }),
  701. smalltalk.BlockClosureTest);
  702. smalltalk.addMethod(
  703. '_testOnDo',
  704. smalltalk.method({
  705. selector: 'testOnDo',
  706. fn: function (){
  707. var self=this;
  708. 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;})])]);
  709. return self;}
  710. }),
  711. smalltalk.BlockClosureTest);
  712. smalltalk.addMethod(
  713. '_testEnsure',
  714. smalltalk.method({
  715. selector: 'testEnsure',
  716. fn: function (){
  717. var self=this;
  718. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  719. return self;}
  720. }),
  721. smalltalk.BlockClosureTest);
  722. smalltalk.addMethod(
  723. '_testNumArgs',
  724. smalltalk.method({
  725. selector: 'testNumArgs',
  726. fn: function (){
  727. var self=this;
  728. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  729. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  730. return self;}
  731. }),
  732. smalltalk.BlockClosureTest);
  733. smalltalk.addMethod(
  734. '_testValueWithPossibleArguments',
  735. smalltalk.method({
  736. selector: 'testValueWithPossibleArguments',
  737. fn: function (){
  738. var self=this;
  739. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  740. 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)]);
  741. 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)]);
  742. return self;}
  743. }),
  744. smalltalk.BlockClosureTest);
  745. smalltalk.addMethod(
  746. '_testWhileTrue',
  747. smalltalk.method({
  748. selector: 'testWhileTrue',
  749. fn: function (){
  750. var self=this;
  751. var i=nil;
  752. i=(0);
  753. (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)]));})()}})();
  754. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  755. i=(0);
  756. (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)]));})()) {}})();
  757. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  758. return self;}
  759. }),
  760. smalltalk.BlockClosureTest);
  761. smalltalk.addMethod(
  762. '_testWhileFalse',
  763. smalltalk.method({
  764. selector: 'testWhileFalse',
  765. fn: function (){
  766. var self=this;
  767. var i=nil;
  768. i=(0);
  769. (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)]));})()}})();
  770. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  771. i=(0);
  772. (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)]));})()) {}})();
  773. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  774. return self;}
  775. }),
  776. smalltalk.BlockClosureTest);
  777. smalltalk.addMethod(
  778. '_testCompiledSource',
  779. smalltalk.method({
  780. selector: 'testCompiledSource',
  781. fn: function (){
  782. var self=this;
  783. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), "_includesSubString_", ["function"])]);
  784. return self;}
  785. }),
  786. smalltalk.BlockClosureTest);
  787. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  788. smalltalk.addMethod(
  789. '_testEquality',
  790. smalltalk.method({
  791. selector: 'testEquality',
  792. fn: function (){
  793. var self=this;
  794. var o=nil;
  795. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  796. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  797. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  798. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  799. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  800. return self;}
  801. }),
  802. smalltalk.ObjectTest);
  803. smalltalk.addMethod(
  804. '_testIdentity',
  805. smalltalk.method({
  806. selector: 'testIdentity',
  807. fn: function (){
  808. var self=this;
  809. var o=nil;
  810. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  811. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  812. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  813. return self;}
  814. }),
  815. smalltalk.ObjectTest);
  816. smalltalk.addMethod(
  817. '_testHalt',
  818. smalltalk.method({
  819. selector: 'testHalt',
  820. fn: function (){
  821. var self=this;
  822. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
  823. return self;}
  824. }),
  825. smalltalk.ObjectTest);
  826. smalltalk.addMethod(
  827. '_testBasicAccess',
  828. smalltalk.method({
  829. selector: 'testBasicAccess',
  830. fn: function (){
  831. var self=this;
  832. var o=nil;
  833. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  834. smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
  835. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
  836. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  837. return self;}
  838. }),
  839. smalltalk.ObjectTest);
  840. smalltalk.addMethod(
  841. '_testNilUndefined',
  842. smalltalk.method({
  843. selector: 'testNilUndefined',
  844. fn: function (){
  845. var self=this;
  846. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  847. return self;}
  848. }),
  849. smalltalk.ObjectTest);
  850. smalltalk.addMethod(
  851. '_testidentityHash',
  852. smalltalk.method({
  853. selector: 'testidentityHash',
  854. fn: function (){
  855. var self=this;
  856. var o1=nil;
  857. var o2=nil;
  858. o1=smalltalk.send((smalltalk.Object || Object), "_new", []);
  859. o2=smalltalk.send((smalltalk.Object || Object), "_new", []);
  860. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  861. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  862. return self;}
  863. }),
  864. smalltalk.ObjectTest);
  865. smalltalk.addMethod(
  866. '_testBasicPerform',
  867. smalltalk.method({
  868. selector: 'testBasicPerform',
  869. fn: function (){
  870. var self=this;
  871. var o=nil;
  872. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  873. smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
  874. smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  875. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  876. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
  877. return self;}
  878. }),
  879. smalltalk.ObjectTest);
  880. smalltalk.addMethod(
  881. '_testIfNil',
  882. smalltalk.method({
  883. selector: 'testIfNil',
  884. fn: function (){
  885. var self=this;
  886. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  887. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  888. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  889. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  890. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  891. return self;}
  892. }),
  893. smalltalk.ObjectTest);
  894. smalltalk.addMethod(
  895. '_testInstVars',
  896. smalltalk.method({
  897. selector: 'testInstVars',
  898. fn: function (){
  899. var self=this;
  900. var o=nil;
  901. o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []);
  902. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  903. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  904. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  905. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  906. return self;}
  907. }),
  908. smalltalk.ObjectTest);
  909. smalltalk.addMethod(
  910. '_testYourself',
  911. smalltalk.method({
  912. selector: 'testYourself',
  913. fn: function (){
  914. var self=this;
  915. var o=nil;
  916. o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []);
  917. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  918. return self;}
  919. }),
  920. smalltalk.ObjectTest);
  921. smalltalk.addMethod(
  922. '_testDNU',
  923. smalltalk.method({
  924. selector: 'testDNU',
  925. fn: function (){
  926. var self=this;
  927. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  928. return self;}
  929. }),
  930. smalltalk.ObjectTest);
  931. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  932. smalltalk.addMethod(
  933. '_testEquality',
  934. smalltalk.method({
  935. selector: 'testEquality',
  936. fn: function (){
  937. var self=this;
  938. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  939. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  940. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  941. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  942. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  943. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  944. return self;}
  945. }),
  946. smalltalk.SymbolTest);
  947. smalltalk.addMethod(
  948. '_testAt',
  949. smalltalk.method({
  950. selector: 'testAt',
  951. fn: function (){
  952. var self=this;
  953. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  954. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  955. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  956. return self;}
  957. }),
  958. smalltalk.SymbolTest);
  959. smalltalk.addMethod(
  960. '_testAtPut',
  961. smalltalk.method({
  962. selector: 'testAtPut',
  963. fn: function (){
  964. var self=this;
  965. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  966. return self;}
  967. }),
  968. smalltalk.SymbolTest);
  969. smalltalk.addMethod(
  970. '_testIdentity',
  971. smalltalk.method({
  972. selector: 'testIdentity',
  973. fn: function (){
  974. var self=this;
  975. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  976. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  977. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  978. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  979. return self;}
  980. }),
  981. smalltalk.SymbolTest);
  982. smalltalk.addMethod(
  983. '_testComparing',
  984. smalltalk.method({
  985. selector: 'testComparing',
  986. fn: function (){
  987. var self=this;
  988. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  989. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  990. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  991. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  992. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  993. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  994. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  995. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  996. return self;}
  997. }),
  998. smalltalk.SymbolTest);
  999. smalltalk.addMethod(
  1000. '_testSize',
  1001. smalltalk.method({
  1002. selector: 'testSize',
  1003. fn: function (){
  1004. var self=this;
  1005. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1006. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1007. return self;}
  1008. }),
  1009. smalltalk.SymbolTest);
  1010. smalltalk.addMethod(
  1011. '_testAsString',
  1012. smalltalk.method({
  1013. selector: 'testAsString',
  1014. fn: function (){
  1015. var self=this;
  1016. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1017. return self;}
  1018. }),
  1019. smalltalk.SymbolTest);
  1020. smalltalk.addMethod(
  1021. '_testAsSymbol',
  1022. smalltalk.method({
  1023. selector: 'testAsSymbol',
  1024. fn: function (){
  1025. var self=this;
  1026. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1027. return self;}
  1028. }),
  1029. smalltalk.SymbolTest);
  1030. smalltalk.addMethod(
  1031. '_testCopying',
  1032. smalltalk.method({
  1033. selector: 'testCopying',
  1034. fn: function (){
  1035. var self=this;
  1036. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1037. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1038. return self;}
  1039. }),
  1040. smalltalk.SymbolTest);
  1041. smalltalk.addMethod(
  1042. '_testIsSymbolIsString',
  1043. smalltalk.method({
  1044. selector: 'testIsSymbolIsString',
  1045. fn: function (){
  1046. var self=this;
  1047. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1048. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1049. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1050. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1051. return self;}
  1052. }),
  1053. smalltalk.SymbolTest);
  1054. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1055. smalltalk.addMethod(
  1056. '_foo',
  1057. smalltalk.method({
  1058. selector: 'foo',
  1059. fn: function (){
  1060. var self=this;
  1061. return self['@foo'];
  1062. return self;}
  1063. }),
  1064. smalltalk.ObjectMock);
  1065. smalltalk.addMethod(
  1066. '_foo_',
  1067. smalltalk.method({
  1068. selector: 'foo:',
  1069. fn: function (anObject){
  1070. var self=this;
  1071. self['@foo']=anObject;
  1072. return self;}
  1073. }),
  1074. smalltalk.ObjectMock);
  1075. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1076. smalltalk.addMethod(
  1077. '_testIsNil',
  1078. smalltalk.method({
  1079. selector: 'testIsNil',
  1080. fn: function (){
  1081. var self=this;
  1082. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1083. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1084. return self;}
  1085. }),
  1086. smalltalk.UndefinedTest);
  1087. smalltalk.addMethod(
  1088. '_testIfNil',
  1089. smalltalk.method({
  1090. selector: 'testIfNil',
  1091. fn: function (){
  1092. var self=this;
  1093. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1094. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1095. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1096. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1097. return self;}
  1098. }),
  1099. smalltalk.UndefinedTest);
  1100. smalltalk.addMethod(
  1101. '_testCopying',
  1102. smalltalk.method({
  1103. selector: 'testCopying',
  1104. fn: function (){
  1105. var self=this;
  1106. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1107. return self;}
  1108. }),
  1109. smalltalk.UndefinedTest);
  1110. smalltalk.addMethod(
  1111. '_testDeepCopy',
  1112. smalltalk.method({
  1113. selector: 'testDeepCopy',
  1114. fn: function (){
  1115. var self=this;
  1116. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1117. return self;}
  1118. }),
  1119. smalltalk.UndefinedTest);
  1120. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1121. smalltalk.addMethod(
  1122. '_testAccessing',
  1123. smalltalk.method({
  1124. selector: 'testAccessing',
  1125. fn: function (){
  1126. var self=this;
  1127. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  1128. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  1129. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  1130. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  1131. return self;}
  1132. }),
  1133. smalltalk.PointTest);
  1134. smalltalk.addMethod(
  1135. '_testAt',
  1136. smalltalk.method({
  1137. selector: 'testAt',
  1138. fn: function (){
  1139. var self=this;
  1140. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1141. return self;}
  1142. }),
  1143. smalltalk.PointTest);
  1144. smalltalk.addMethod(
  1145. '_testEgality',
  1146. smalltalk.method({
  1147. selector: 'testEgality',
  1148. fn: function (){
  1149. var self=this;
  1150. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1151. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1152. return self;}
  1153. }),
  1154. smalltalk.PointTest);
  1155. smalltalk.addMethod(
  1156. '_testArithmetic',
  1157. smalltalk.method({
  1158. selector: 'testArithmetic',
  1159. fn: function (){
  1160. var self=this;
  1161. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver *smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__star", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(9), (16)])]);
  1162. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver +smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(6), (8)])]);
  1163. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver -smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__minus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(0), (0)])]);
  1164. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((6), "__at", [(8)])).klass === smalltalk.Number) ? $receiver /smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__slash", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(2), (2)])]);
  1165. return self;}
  1166. }),
  1167. smalltalk.PointTest);
  1168. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1169. smalltalk.addMethod(
  1170. '_textNext',
  1171. smalltalk.method({
  1172. selector: 'textNext',
  1173. fn: function (){
  1174. var self=this;
  1175. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1176. var next=nil;
  1177. next=smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", []);smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver >=(0) : smalltalk.send($receiver, "__gt_eq", [(0)]))]);smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver <(1) : smalltalk.send($receiver, "__lt", [(1)]))]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);})]);
  1178. return self;}
  1179. }),
  1180. smalltalk.RandomTest);
  1181. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1182. smalltalk.addMethod(
  1183. '_setUp',
  1184. smalltalk.method({
  1185. selector: 'setUp',
  1186. fn: function (){
  1187. var self=this;
  1188. self['@builder']=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []);
  1189. return self;}
  1190. }),
  1191. smalltalk.ClassBuilderTest);
  1192. smalltalk.addMethod(
  1193. '_tearDown',
  1194. smalltalk.method({
  1195. selector: 'tearDown',
  1196. fn: function (){
  1197. var self=this;
  1198. (($receiver = self['@theClass']) != nil && $receiver != undefined) ? (function(){smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_removeClass_", [self['@theClass']]);return self['@theClass']=nil;})() : nil;
  1199. return self;}
  1200. }),
  1201. smalltalk.ClassBuilderTest);
  1202. smalltalk.addMethod(
  1203. '_testClassCopy',
  1204. smalltalk.method({
  1205. selector: 'testClassCopy',
  1206. fn: function (){
  1207. var self=this;
  1208. self['@theClass']=smalltalk.send(self['@builder'], "_copyClass_named_", [(smalltalk.ObjectMock || ObjectMock), "ObjectMock2"]);
  1209. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_superclass", [])])]);
  1210. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_instanceVariableNames", [])])]);
  1211. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  1212. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_package", [])])]);
  1213. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_methodDictionary", []), "_keys", [])]);
  1214. return self;}
  1215. }),
  1216. smalltalk.ClassBuilderTest);
  1217. smalltalk.addMethod(
  1218. '_testInstanceVariableNames',
  1219. smalltalk.method({
  1220. selector: 'testInstanceVariableNames',
  1221. fn: function (){
  1222. var self=this;
  1223. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  1224. return self;}
  1225. }),
  1226. smalltalk.ClassBuilderTest);
  1227. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1228. smalltalk.addMethod(
  1229. '_testUnicity',
  1230. smalltalk.method({
  1231. selector: 'testUnicity',
  1232. fn: function (){
  1233. var self=this;
  1234. var set=nil;
  1235. set=smalltalk.send((smalltalk.Set || Set), "_new", []);
  1236. smalltalk.send(set, "_add_", [(21)]);
  1237. smalltalk.send(set, "_add_", ["hello"]);
  1238. smalltalk.send(set, "_add_", [(21)]);
  1239. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1240. smalltalk.send(set, "_add_", ["hello"]);
  1241. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1242. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1243. return self;}
  1244. }),
  1245. smalltalk.SetTest);
  1246. smalltalk.addMethod(
  1247. '_testAt',
  1248. smalltalk.method({
  1249. selector: 'testAt',
  1250. fn: function (){
  1251. var self=this;
  1252. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1253. return self;}
  1254. }),
  1255. smalltalk.SetTest);
  1256. smalltalk.addMethod(
  1257. '_testAddRemove',
  1258. smalltalk.method({
  1259. selector: 'testAddRemove',
  1260. fn: function (){
  1261. var self=this;
  1262. var set=nil;
  1263. set=smalltalk.send((smalltalk.Set || Set), "_new", []);
  1264. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1265. smalltalk.send(set, "_add_", [(3)]);
  1266. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1267. smalltalk.send(set, "_add_", [(5)]);
  1268. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1269. smalltalk.send(set, "_remove_", [(3)]);
  1270. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1271. return self;}
  1272. }),
  1273. smalltalk.SetTest);
  1274. smalltalk.addMethod(
  1275. '_testSize',
  1276. smalltalk.method({
  1277. selector: 'testSize',
  1278. fn: function (){
  1279. var self=this;
  1280. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1281. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1282. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1283. return self;}
  1284. }),
  1285. smalltalk.SetTest);