Kernel-Tests.deploy.js 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('ArrayTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testAtIfAbsent",
  5. smalltalk.method({
  6. selector: "testAtIfAbsent",
  7. fn: function () {
  8. var self=this;
  9. var array=nil;
  10. (array=["hello", "world"]);
  11. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(1)]), "hello"]);
  12. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(2)]), "world"]);
  13. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(2), (function(){return "not found";})]), "world"]);
  14. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(0), (function(){return "not found";})]), "not found"]);
  15. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(-10), (function(){return "not found";})]), "not found"]);
  16. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(3), (function(){return "not found";})]), "not found"]);
  17. return self;}
  18. }),
  19. smalltalk.ArrayTest);
  20. smalltalk.addMethod(
  21. "_testFirstN",
  22. smalltalk.method({
  23. selector: "testFirstN",
  24. fn: function () {
  25. var self=this;
  26. smalltalk.send(self, "_assert_equals_", [[(1),(2),(3)], smalltalk.send([(1),(2),(3),(4),(5)], "_first_", [(3)])]);
  27. return self;}
  28. }),
  29. smalltalk.ArrayTest);
  30. smalltalk.addMethod(
  31. "_testIfEmpty",
  32. smalltalk.method({
  33. selector: "testIfEmpty",
  34. fn: function () {
  35. var self=this;
  36. smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [(function(){return "zork";})])]);
  37. return self;}
  38. }),
  39. smalltalk.ArrayTest);
  40. smalltalk.addMethod(
  41. "_testPrintString",
  42. smalltalk.method({
  43. selector: "testPrintString",
  44. fn: function () {
  45. var self=this;
  46. var array=nil;
  47. (array=smalltalk.send((smalltalk.Array || Array), "_new", []));
  48. smalltalk.send(self, "_assert_equals_", ["a Array ()", smalltalk.send(array, "_printString", [])]);
  49. (function($rec){smalltalk.send($rec, "_add_", [(1)]);return smalltalk.send($rec, "_add_", [(3)]);})(array);
  50. smalltalk.send(self, "_assert_equals_", ["a Array (1 3)", smalltalk.send(array, "_printString", [])]);
  51. smalltalk.send(array, "_add_", ["foo"]);
  52. smalltalk.send(self, "_assert_equals_", ["a Array (1 3 'foo')", smalltalk.send(array, "_printString", [])]);
  53. (function($rec){smalltalk.send($rec, "_remove_", [(1)]);return smalltalk.send($rec, "_remove_", [(3)]);})(array);
  54. smalltalk.send(self, "_assert_equals_", ["a Array ('foo')", smalltalk.send(array, "_printString", [])]);
  55. smalltalk.send(array, "_addLast_", [(3)]);
  56. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3)", smalltalk.send(array, "_printString", [])]);
  57. smalltalk.send(array, "_addLast_", [(3)]);
  58. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3 3)", smalltalk.send(array, "_printString", [])]);
  59. return self;}
  60. }),
  61. smalltalk.ArrayTest);
  62. smalltalk.addClass('AssociationTest', smalltalk.TestCase, [], 'Kernel-Tests');
  63. smalltalk.addMethod(
  64. "_testClassCreation",
  65. smalltalk.method({
  66. selector: "testClassCreation",
  67. fn: function (){
  68. var self=this;
  69. var anAssociation=nil;
  70. var key=nil;
  71. var value=nil;
  72. (key="KEY_STRING");
  73. (value="VALUE_STRING");
  74. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", [key, value]));
  75. smalltalk.send(self, "_assert_equals_", [key, smalltalk.send(anAssociation, "_key", [])]);
  76. smalltalk.send(self, "_assert_equals_", [value, smalltalk.send(anAssociation, "_value", [])]);
  77. return self;}
  78. }),
  79. smalltalk.AssociationTest);
  80. smalltalk.addMethod(
  81. "_testEqualAssociations",
  82. smalltalk.method({
  83. selector: "testEqualAssociations",
  84. fn: function (){
  85. var self=this;
  86. var anAssociation=nil;
  87. var anotherAssociation=nil;
  88. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  89. (anotherAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  90. smalltalk.send(self, "_assert_equals_", [anAssociation, anotherAssociation]);
  91. return self;}
  92. }),
  93. smalltalk.AssociationTest);
  94. smalltalk.addMethod(
  95. "_testKeyAccess",
  96. smalltalk.method({
  97. selector: "testKeyAccess",
  98. fn: function (){
  99. var self=this;
  100. var anAssociation=nil;
  101. var key=nil;
  102. (key="KEY_STRING");
  103. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_new", []));
  104. smalltalk.send(anAssociation, "_key_", [key]);
  105. smalltalk.send(self, "_assert_equals_", [key, smalltalk.send(anAssociation, "_key", [])]);
  106. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_value", [])]);
  107. return self;}
  108. }),
  109. smalltalk.AssociationTest);
  110. smalltalk.addMethod(
  111. "_testNotEqualAssociations",
  112. smalltalk.method({
  113. selector: "testNotEqualAssociations",
  114. fn: function (){
  115. var self=this;
  116. var anAssociation=nil;
  117. var anotherAssociation=nil;
  118. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  119. (anotherAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY2", "VALUE2"]));
  120. smalltalk.send(self, "_deny_", [smalltalk.send(anAssociation, "__eq", [anotherAssociation])]);
  121. return self;}
  122. }),
  123. smalltalk.AssociationTest);
  124. smalltalk.addMethod(
  125. "_testPrintString",
  126. smalltalk.method({
  127. selector: "testPrintString",
  128. fn: function (){
  129. var self=this;
  130. var anAssociation=nil;
  131. var returnString=nil;
  132. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  133. (returnString=smalltalk.send(anAssociation, "_printString", []));
  134. smalltalk.send(self, "_assert_equals_", ["'KEY'->'VALUE'", returnString]);
  135. return self;}
  136. }),
  137. smalltalk.AssociationTest);
  138. smalltalk.addMethod(
  139. "_testUninitializedObject",
  140. smalltalk.method({
  141. selector: "testUninitializedObject",
  142. fn: function (){
  143. var self=this;
  144. var anAssociation=nil;
  145. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_new", []));
  146. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_key", [])]);
  147. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_value", [])]);
  148. return self;}
  149. }),
  150. smalltalk.AssociationTest);
  151. smalltalk.addMethod(
  152. "_testValueAccess",
  153. smalltalk.method({
  154. selector: "testValueAccess",
  155. fn: function (){
  156. var self=this;
  157. var anAssociation=nil;
  158. var value=nil;
  159. (value="VALUE_STRING");
  160. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_new", []));
  161. smalltalk.send(anAssociation, "_value_", [value]);
  162. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_key", [])]);
  163. smalltalk.send(self, "_assert_equals_", [value, smalltalk.send(anAssociation, "_value", [])]);
  164. return self;}
  165. }),
  166. smalltalk.AssociationTest);
  167. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  168. smalltalk.addMethod(
  169. "_testCompiledSource",
  170. smalltalk.method({
  171. selector: "testCompiledSource",
  172. fn: function () {
  173. var self=this;
  174. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), "_includesSubString_", ["function"])]);
  175. return self;}
  176. }),
  177. smalltalk.BlockClosureTest);
  178. smalltalk.addMethod(
  179. "_testEnsure",
  180. smalltalk.method({
  181. selector: "testEnsure",
  182. fn: function () {
  183. var self=this;
  184. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  185. return self;}
  186. }),
  187. smalltalk.BlockClosureTest);
  188. smalltalk.addMethod(
  189. "_testNumArgs",
  190. smalltalk.method({
  191. selector: "testNumArgs",
  192. fn: function () {
  193. var self=this;
  194. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  195. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  196. return self;}
  197. }),
  198. smalltalk.BlockClosureTest);
  199. smalltalk.addMethod(
  200. "_testOnDo",
  201. smalltalk.method({
  202. selector: "testOnDo",
  203. fn: function () {
  204. var self=this;
  205. 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;})])]);
  206. return self;}
  207. }),
  208. smalltalk.BlockClosureTest);
  209. smalltalk.addMethod(
  210. "_testValue",
  211. smalltalk.method({
  212. selector: "testValue",
  213. fn: function () {
  214. var self=this;
  215. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  216. 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)]);
  217. 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)]);
  218. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  219. return self;}
  220. }),
  221. smalltalk.BlockClosureTest);
  222. smalltalk.addMethod(
  223. "_testValueWithPossibleArguments",
  224. smalltalk.method({
  225. selector: "testValueWithPossibleArguments",
  226. fn: function () {
  227. var self=this;
  228. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  229. 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)]);
  230. 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)]);
  231. return self;}
  232. }),
  233. smalltalk.BlockClosureTest);
  234. smalltalk.addMethod(
  235. "_testWhileFalse",
  236. smalltalk.method({
  237. selector: "testWhileFalse",
  238. fn: function () {
  239. var self=this;
  240. var i=nil;
  241. (i=(0));
  242. (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)])));})()}})();
  243. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  244. (i=(0));
  245. (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)]));})()) {}})();
  246. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  247. return self;}
  248. }),
  249. smalltalk.BlockClosureTest);
  250. smalltalk.addMethod(
  251. "_testWhileTrue",
  252. smalltalk.method({
  253. selector: "testWhileTrue",
  254. fn: function () {
  255. var self=this;
  256. var i=nil;
  257. (i=(0));
  258. (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)])));})()}})();
  259. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  260. (i=(0));
  261. (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)]));})()) {}})();
  262. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  263. return self;}
  264. }),
  265. smalltalk.BlockClosureTest);
  266. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  267. smalltalk.addMethod(
  268. "_testEquality",
  269. smalltalk.method({
  270. selector: "testEquality",
  271. fn: function () {
  272. var self=this;
  273. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  274. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  275. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  276. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  277. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  278. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  279. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  280. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  281. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  282. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  283. return self;}
  284. }),
  285. smalltalk.BooleanTest);
  286. smalltalk.addMethod(
  287. "_testIdentity",
  288. smalltalk.method({
  289. selector: "testIdentity",
  290. fn: function () {
  291. var self=this;
  292. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq_eq", [false])]);
  293. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [(0)])]);
  294. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [false])]);
  295. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [""])]);
  296. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  297. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [true])]);
  298. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  299. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq_eq", [false])]);
  300. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  301. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  302. return self;}
  303. }),
  304. smalltalk.BooleanTest);
  305. smalltalk.addMethod(
  306. "_testIfTrueIfFalse",
  307. smalltalk.method({
  308. selector: "testIfTrueIfFalse",
  309. fn: function () {
  310. var self=this;
  311. 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"])]);
  312. 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])]);
  313. 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])]);
  314. 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"])]);
  315. 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"])]);
  316. 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"])]);
  317. 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"])]);
  318. 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"])]);
  319. return self;}
  320. }),
  321. smalltalk.BooleanTest);
  322. smalltalk.addMethod(
  323. "_testLogic",
  324. smalltalk.method({
  325. selector: "testLogic",
  326. fn: function () {
  327. var self=this;
  328. (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);
  329. (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);
  330. (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);
  331. (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);
  332. return self;}
  333. }),
  334. smalltalk.BooleanTest);
  335. smalltalk.addMethod(
  336. "_testLogicKeywords",
  337. smalltalk.method({
  338. selector: "testLogicKeywords",
  339. fn: function () {
  340. var self=this;
  341. (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);
  342. (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);
  343. (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);
  344. (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);
  345. return self;}
  346. }),
  347. smalltalk.BooleanTest);
  348. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  349. smalltalk.addMethod(
  350. "_setUp",
  351. smalltalk.method({
  352. selector: "setUp",
  353. fn: function () {
  354. var self=this;
  355. (self['@builder']=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []));
  356. return self;}
  357. }),
  358. smalltalk.ClassBuilderTest);
  359. smalltalk.addMethod(
  360. "_tearDown",
  361. smalltalk.method({
  362. selector: "tearDown",
  363. fn: function () {
  364. var self=this;
  365. (($receiver = self['@theClass']) != nil && $receiver != undefined) ? (function(){smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_removeClass_", [self['@theClass']]);return (self['@theClass']=nil);})() : nil;
  366. return self;}
  367. }),
  368. smalltalk.ClassBuilderTest);
  369. smalltalk.addMethod(
  370. "_testClassCopy",
  371. smalltalk.method({
  372. selector: "testClassCopy",
  373. fn: function () {
  374. var self=this;
  375. (self['@theClass']=smalltalk.send(self['@builder'], "_copyClass_named_", [(smalltalk.ObjectMock || ObjectMock), "ObjectMock2"]));
  376. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_superclass", [])])]);
  377. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_instanceVariableNames", [])])]);
  378. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  379. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_package", [])])]);
  380. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_methodDictionary", []), "_keys", [])]);
  381. return self;}
  382. }),
  383. smalltalk.ClassBuilderTest);
  384. smalltalk.addMethod(
  385. "_testInstanceVariableNames",
  386. smalltalk.method({
  387. selector: "testInstanceVariableNames",
  388. fn: function () {
  389. var self=this;
  390. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  391. return self;}
  392. }),
  393. smalltalk.ClassBuilderTest);
  394. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  395. smalltalk.addMethod(
  396. "_assertSameContents_as_",
  397. smalltalk.method({
  398. selector: "assertSameContents:as:",
  399. fn: function (aCollection, anotherCollection) {
  400. var self=this;
  401. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(aCollection, "_size", []), "__eq", [smalltalk.send(anotherCollection, "_size", [])])]);
  402. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(aCollection, "_at_", [each]), "__eq", [smalltalk.send(anotherCollection, "_at_", [each])])]);})]);
  403. return self;}
  404. }),
  405. smalltalk.CollectionTest);
  406. smalltalk.addMethod(
  407. "_collection",
  408. smalltalk.method({
  409. selector: "collection",
  410. fn: function () {
  411. var self=this;
  412. return smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_withAll_", [smalltalk.send(self, "_defaultValues", [])]);
  413. return self;}
  414. }),
  415. smalltalk.CollectionTest);
  416. smalltalk.addMethod(
  417. "_collectionClass",
  418. smalltalk.method({
  419. selector: "collectionClass",
  420. fn: function () {
  421. var self=this;
  422. return smalltalk.send(smalltalk.send(self, "_class", []), "_collectionClass", []);
  423. return self;}
  424. }),
  425. smalltalk.CollectionTest);
  426. smalltalk.addMethod(
  427. "_defaultValues",
  428. smalltalk.method({
  429. selector: "defaultValues",
  430. fn: function () {
  431. var self=this;
  432. return ["a", (1), (2), smalltalk.symbolFor("e")];
  433. return self;}
  434. }),
  435. smalltalk.CollectionTest);
  436. smalltalk.addMethod(
  437. "_testAsArray",
  438. smalltalk.method({
  439. selector: "testAsArray",
  440. fn: function () {
  441. var self=this;
  442. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), smalltalk.send(smalltalk.send(self, "_collection", []), "_asArray", [])]);
  443. return self;}
  444. }),
  445. smalltalk.CollectionTest);
  446. smalltalk.addMethod(
  447. "_testAsOrderedCollection",
  448. smalltalk.method({
  449. selector: "testAsOrderedCollection",
  450. fn: function () {
  451. var self=this;
  452. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), smalltalk.send(smalltalk.send(self, "_collection", []), "_asOrderedCollection", [])]);
  453. return self;}
  454. }),
  455. smalltalk.CollectionTest);
  456. smalltalk.addMethod(
  457. "_testAsSet",
  458. smalltalk.method({
  459. selector: "testAsSet",
  460. fn: function () {
  461. var self=this;
  462. var c=nil;
  463. var set=nil;
  464. (c=smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_withAll_", [["a", "b", "c", (1), (2), (1), "a"]]));
  465. (set=smalltalk.send(c, "_asSet", []));
  466. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(5)])]);
  467. smalltalk.send(c, "_do_", [(function(each){return smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [each])]);})]);
  468. return self;}
  469. }),
  470. smalltalk.CollectionTest);
  471. smalltalk.addMethod(
  472. "_testIsEmpty",
  473. smalltalk.method({
  474. selector: "testIsEmpty",
  475. fn: function () {
  476. var self=this;
  477. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_new", []), "_isEmpty", [])]);
  478. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_isEmpty", [])]);
  479. return self;}
  480. }),
  481. smalltalk.CollectionTest);
  482. smalltalk.addMethod(
  483. "_testSize",
  484. smalltalk.method({
  485. selector: "testSize",
  486. fn: function () {
  487. var self=this;
  488. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_new", []), "_size", []), "__eq", [(0)])]);
  489. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_size", []), "__eq", [(4)])]);
  490. return self;}
  491. }),
  492. smalltalk.CollectionTest);
  493. smalltalk.addMethod(
  494. "_collectionClass",
  495. smalltalk.method({
  496. selector: "collectionClass",
  497. fn: function () {
  498. var self=this;
  499. return nil;
  500. return self;}
  501. }),
  502. smalltalk.CollectionTest.klass);
  503. smalltalk.addMethod(
  504. "_isAbstract",
  505. smalltalk.method({
  506. selector: "isAbstract",
  507. fn: function () {
  508. var self=this;
  509. return smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_notNil", []);
  510. return self;}
  511. }),
  512. smalltalk.CollectionTest.klass);
  513. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  514. smalltalk.addMethod(
  515. "_testAccessing",
  516. smalltalk.method({
  517. selector: "testAccessing",
  518. fn: function () {
  519. var self=this;
  520. var d=nil;
  521. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  522. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  523. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  524. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  525. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  526. smalltalk.send(d, "_at_put_", [(1), (2)]);
  527. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  528. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  529. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  530. return self;}
  531. }),
  532. smalltalk.DictionaryTest);
  533. smalltalk.addMethod(
  534. "_testDynamicDictionaries",
  535. smalltalk.method({
  536. selector: "testDynamicDictionaries",
  537. fn: function () {
  538. var self=this;
  539. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.HashedCollection._fromPairs_([smalltalk.send("hello", "__minus_gt", [(1)])]), "_asDictionary", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_", [smalltalk.send("hello", "__minus_gt", [(1)])])])]);
  540. return self;}
  541. }),
  542. smalltalk.DictionaryTest);
  543. smalltalk.addMethod(
  544. "_testEquality",
  545. smalltalk.method({
  546. selector: "testEquality",
  547. fn: function () {
  548. var self=this;
  549. var d1=nil;
  550. var d2=nil;
  551. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  552. (d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  553. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  554. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  555. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  556. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  557. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  558. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  559. (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", [])));
  560. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  561. return self;}
  562. }),
  563. smalltalk.DictionaryTest);
  564. smalltalk.addMethod(
  565. "_testIfAbsent",
  566. smalltalk.method({
  567. selector: "testIfAbsent",
  568. fn: function () {
  569. var self=this;
  570. var d=nil;
  571. var visited=nil;
  572. (visited=false);
  573. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  574. smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return (visited=true);})]);
  575. smalltalk.send(self, "_assert_", [visited]);
  576. return self;}
  577. }),
  578. smalltalk.DictionaryTest);
  579. smalltalk.addMethod(
  580. "_testIfPresent",
  581. smalltalk.method({
  582. selector: "testIfPresent",
  583. fn: function () {
  584. var self=this;
  585. var d=nil;
  586. var visited=nil;
  587. var absent=nil;
  588. (visited=false);
  589. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  590. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  591. smalltalk.send(d, "_at_ifPresent_", ["hello", (function(value){return (visited=value);})]);
  592. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  593. (absent=smalltalk.send(d, "_at_ifPresent_", ["bye", (function(value){return (visited=value);})]));
  594. smalltalk.send(self, "_assert_", [smalltalk.send(absent, "_isNil", [])]);
  595. return self;}
  596. }),
  597. smalltalk.DictionaryTest);
  598. smalltalk.addMethod(
  599. "_testIfPresentIfAbsent",
  600. smalltalk.method({
  601. selector: "testIfPresentIfAbsent",
  602. fn: function () {
  603. var self=this;
  604. var d=nil;
  605. var visited=nil;
  606. (visited=false);
  607. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  608. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  609. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["hello", (function(value){return (visited=value);}), (function(){return (visited=true);})]);
  610. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  611. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["buy", (function(value){return (visited=value);}), (function(){return (visited=true);})]);
  612. smalltalk.send(self, "_assert_", [visited]);
  613. return self;}
  614. }),
  615. smalltalk.DictionaryTest);
  616. smalltalk.addMethod(
  617. "_testKeys",
  618. smalltalk.method({
  619. selector: "testKeys",
  620. fn: function () {
  621. var self=this;
  622. var d=nil;
  623. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  624. smalltalk.send(d, "_at_put_", [(1), (2)]);
  625. smalltalk.send(d, "_at_put_", [(2), (3)]);
  626. smalltalk.send(d, "_at_put_", [(3), (4)]);
  627. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  628. return self;}
  629. }),
  630. smalltalk.DictionaryTest);
  631. smalltalk.addMethod(
  632. "_testPrintString",
  633. smalltalk.method({
  634. selector: "testPrintString",
  635. fn: function () {
  636. var self=this;
  637. smalltalk.send(self, "_assert_equals_", ["a Dictionary('firstname' -> 'James' , 'lastname' -> 'Bond')", (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", []))]);
  638. return self;}
  639. }),
  640. smalltalk.DictionaryTest);
  641. smalltalk.addMethod(
  642. "_testRemoveKey",
  643. smalltalk.method({
  644. selector: "testRemoveKey",
  645. fn: function () {
  646. var self=this;
  647. var d=nil;
  648. var key=nil;
  649. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  650. smalltalk.send(d, "_at_put_", [(1), (2)]);
  651. smalltalk.send(d, "_at_put_", [(2), (3)]);
  652. smalltalk.send(d, "_at_put_", [(3), (4)]);
  653. (key=(2));
  654. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  655. smalltalk.send(d, "_removeKey_", [key]);
  656. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (3)]])]);
  657. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (4)]])]);
  658. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [(2)])]);
  659. return self;}
  660. }),
  661. smalltalk.DictionaryTest);
  662. smalltalk.addMethod(
  663. "_testRemoveKeyIfAbsent",
  664. smalltalk.method({
  665. selector: "testRemoveKeyIfAbsent",
  666. fn: function () {
  667. var self=this;
  668. var d=nil;
  669. var key=nil;
  670. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  671. smalltalk.send(d, "_at_put_", [(1), (2)]);
  672. smalltalk.send(d, "_at_put_", [(2), (3)]);
  673. smalltalk.send(d, "_at_put_", [(3), (4)]);
  674. (key=(2));
  675. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [(3)])]);
  676. (key=(3));
  677. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(4)])]);
  678. (key="why");
  679. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(42)])]);
  680. return self;}
  681. }),
  682. smalltalk.DictionaryTest);
  683. smalltalk.addMethod(
  684. "_testSize",
  685. smalltalk.method({
  686. selector: "testSize",
  687. fn: function () {
  688. var self=this;
  689. var d=nil;
  690. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  691. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  692. smalltalk.send(d, "_at_put_", [(1), (2)]);
  693. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  694. smalltalk.send(d, "_at_put_", [(2), (3)]);
  695. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  696. return self;}
  697. }),
  698. smalltalk.DictionaryTest);
  699. smalltalk.addMethod(
  700. "_testValues",
  701. smalltalk.method({
  702. selector: "testValues",
  703. fn: function () {
  704. var self=this;
  705. var d=nil;
  706. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  707. smalltalk.send(d, "_at_put_", [(1), (2)]);
  708. smalltalk.send(d, "_at_put_", [(2), (3)]);
  709. smalltalk.send(d, "_at_put_", [(3), (4)]);
  710. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  711. return self;}
  712. }),
  713. smalltalk.DictionaryTest);
  714. smalltalk.addClass('HashedCollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  715. smalltalk.addMethod(
  716. "_testPrintString",
  717. smalltalk.method({
  718. selector: "testPrintString",
  719. fn: function (){
  720. var self=this;
  721. var aHashedCollection=nil;
  722. (aHashedCollection=smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_new", []));
  723. smalltalk.send(self, "_assert_equals_", ["a HashedCollection()", smalltalk.send(aHashedCollection, "_printString", [])]);
  724. smalltalk.send(aHashedCollection, "_at_put_", ["key1", (1)]);
  725. smalltalk.send(self, "_assert_equals_", ["a HashedCollection('key1'->1)", smalltalk.send(aHashedCollection, "_printString", [])]);
  726. smalltalk.send(aHashedCollection, "_at_put_", ["key2", (2)]);
  727. smalltalk.send(self, "_assert_equals_", ["a HashedCollection('key1'->1 , 'key2'->2)", smalltalk.send(aHashedCollection, "_printString", [])]);
  728. return self;}
  729. }),
  730. smalltalk.HashedCollectionTest);
  731. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  732. smalltalk.addMethod(
  733. "_jsObject",
  734. smalltalk.method({
  735. selector: "jsObject",
  736. fn: function () {
  737. var self=this;
  738. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  739. return self;}
  740. }),
  741. smalltalk.JSObjectProxyTest);
  742. smalltalk.addMethod(
  743. "_testDNU",
  744. smalltalk.method({
  745. selector: "testDNU",
  746. fn: function () {
  747. var self=this;
  748. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  749. return self;}
  750. }),
  751. smalltalk.JSObjectProxyTest);
  752. smalltalk.addMethod(
  753. "_testMessageSend",
  754. smalltalk.method({
  755. selector: "testMessageSend",
  756. fn: function () {
  757. var self=this;
  758. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
  759. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
  760. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
  761. return self;}
  762. }),
  763. smalltalk.JSObjectProxyTest);
  764. smalltalk.addMethod(
  765. "_testMethodWithArguments",
  766. smalltalk.method({
  767. selector: "testMethodWithArguments",
  768. fn: function () {
  769. var self=this;
  770. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  771. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  772. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  773. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  774. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  775. return self;}
  776. }),
  777. smalltalk.JSObjectProxyTest);
  778. smalltalk.addMethod(
  779. "_testPrinting",
  780. smalltalk.method({
  781. selector: "testPrinting",
  782. fn: function () {
  783. var self=this;
  784. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", ["[object Object]"])]);
  785. return self;}
  786. }),
  787. smalltalk.JSObjectProxyTest);
  788. smalltalk.addMethod(
  789. "_testPropertyThatReturnsEmptyString",
  790. smalltalk.method({
  791. selector: "testPropertyThatReturnsEmptyString",
  792. fn: function () {
  793. var self=this;
  794. document.location.hash = '';
  795. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  796. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  797. smalltalk.send(self, "_assert_equals_", ["#test", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  798. return self;}
  799. }),
  800. smalltalk.JSObjectProxyTest);
  801. smalltalk.addMethod(
  802. "_testYourself",
  803. smalltalk.method({
  804. selector: "testYourself",
  805. fn: function () {
  806. var self=this;
  807. var body=nil;
  808. (body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", [])));
  809. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  810. smalltalk.send(body, "_removeClass_", ["amber"]);
  811. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  812. return self;}
  813. }),
  814. smalltalk.JSObjectProxyTest);
  815. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  816. smalltalk.addMethod(
  817. "_testArithmetic",
  818. smalltalk.method({
  819. selector: "testArithmetic",
  820. fn: function () {
  821. var self=this;
  822. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  823. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  824. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  825. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  826. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  827. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  828. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  829. return self;}
  830. }),
  831. smalltalk.NumberTest);
  832. smalltalk.addMethod(
  833. "_testComparison",
  834. smalltalk.method({
  835. selector: "testComparison",
  836. fn: function () {
  837. var self=this;
  838. smalltalk.send(self, "_assert_", [(3) > (2)]);
  839. smalltalk.send(self, "_assert_", [(2) < (3)]);
  840. smalltalk.send(self, "_deny_", [(3) < (2)]);
  841. smalltalk.send(self, "_deny_", [(2) > (3)]);
  842. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  843. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  844. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  845. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  846. return self;}
  847. }),
  848. smalltalk.NumberTest);
  849. smalltalk.addMethod(
  850. "_testCopying",
  851. smalltalk.method({
  852. selector: "testCopying",
  853. fn: function () {
  854. var self=this;
  855. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  856. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  857. return self;}
  858. }),
  859. smalltalk.NumberTest);
  860. smalltalk.addMethod(
  861. "_testEquality",
  862. smalltalk.method({
  863. selector: "testEquality",
  864. fn: function () {
  865. var self=this;
  866. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  867. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  868. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  869. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  870. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  871. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  872. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  873. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  874. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  875. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  876. return self;}
  877. }),
  878. smalltalk.NumberTest);
  879. smalltalk.addMethod(
  880. "_testIdentity",
  881. smalltalk.method({
  882. selector: "testIdentity",
  883. fn: function () {
  884. var self=this;
  885. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  886. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  887. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  888. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  889. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  890. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  891. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  892. return self;}
  893. }),
  894. smalltalk.NumberTest);
  895. smalltalk.addMethod(
  896. "_testMinMax",
  897. smalltalk.method({
  898. selector: "testMinMax",
  899. fn: function () {
  900. var self=this;
  901. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  902. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  903. return self;}
  904. }),
  905. smalltalk.NumberTest);
  906. smalltalk.addMethod(
  907. "_testNegated",
  908. smalltalk.method({
  909. selector: "testNegated",
  910. fn: function () {
  911. var self=this;
  912. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  913. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  914. return self;}
  915. }),
  916. smalltalk.NumberTest);
  917. smalltalk.addMethod(
  918. "_testPrintShowingDecimalPlaces",
  919. smalltalk.method({
  920. selector: "testPrintShowingDecimalPlaces",
  921. fn: function () {
  922. var self=this;
  923. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  924. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  925. smalltalk.send(self, "_assert_equals_", ["-234.56700", smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  926. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  927. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  928. smalltalk.send(self, "_assert_equals_", ["-23", smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  929. smalltalk.send(self, "_assert_equals_", ["-24", smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  930. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  931. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  932. smalltalk.send(self, "_assert_equals_", ["-0.98", smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  933. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  934. smalltalk.send(self, "_assert_equals_", ["-2.57", smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  935. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  936. return self;}
  937. }),
  938. smalltalk.NumberTest);
  939. smalltalk.addMethod(
  940. "_testRounded",
  941. smalltalk.method({
  942. selector: "testRounded",
  943. fn: function () {
  944. var self=this;
  945. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  946. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  947. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  948. return self;}
  949. }),
  950. smalltalk.NumberTest);
  951. smalltalk.addMethod(
  952. "_testSqrt",
  953. smalltalk.method({
  954. selector: "testSqrt",
  955. fn: function () {
  956. var self=this;
  957. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  958. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  959. return self;}
  960. }),
  961. smalltalk.NumberTest);
  962. smalltalk.addMethod(
  963. "_testSquared",
  964. smalltalk.method({
  965. selector: "testSquared",
  966. fn: function () {
  967. var self=this;
  968. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  969. return self;}
  970. }),
  971. smalltalk.NumberTest);
  972. smalltalk.addMethod(
  973. "_testTimesRepeat",
  974. smalltalk.method({
  975. selector: "testTimesRepeat",
  976. fn: function () {
  977. var self=this;
  978. var i=nil;
  979. (i=(0));
  980. smalltalk.send((0), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  981. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  982. smalltalk.send((5), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  983. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  984. return self;}
  985. }),
  986. smalltalk.NumberTest);
  987. smalltalk.addMethod(
  988. "_testTo",
  989. smalltalk.method({
  990. selector: "testTo",
  991. fn: function () {
  992. var self=this;
  993. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  994. return self;}
  995. }),
  996. smalltalk.NumberTest);
  997. smalltalk.addMethod(
  998. "_testToBy",
  999. smalltalk.method({
  1000. selector: "testToBy",
  1001. fn: function () {
  1002. var self=this;
  1003. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  1004. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  1005. return self;}
  1006. }),
  1007. smalltalk.NumberTest);
  1008. smalltalk.addMethod(
  1009. "_testTruncated",
  1010. smalltalk.method({
  1011. selector: "testTruncated",
  1012. fn: function () {
  1013. var self=this;
  1014. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  1015. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  1016. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  1017. return self;}
  1018. }),
  1019. smalltalk.NumberTest);
  1020. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1021. smalltalk.addMethod(
  1022. "_foo",
  1023. smalltalk.method({
  1024. selector: "foo",
  1025. fn: function () {
  1026. var self=this;
  1027. return self['@foo'];
  1028. return self;}
  1029. }),
  1030. smalltalk.ObjectMock);
  1031. smalltalk.addMethod(
  1032. "_foo_",
  1033. smalltalk.method({
  1034. selector: "foo:",
  1035. fn: function (anObject) {
  1036. var self=this;
  1037. (self['@foo']=anObject);
  1038. return self;}
  1039. }),
  1040. smalltalk.ObjectMock);
  1041. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1042. smalltalk.addMethod(
  1043. "_testBasicAccess",
  1044. smalltalk.method({
  1045. selector: "testBasicAccess",
  1046. fn: function () {
  1047. var self=this;
  1048. var o=nil;
  1049. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1050. smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
  1051. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
  1052. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  1053. return self;}
  1054. }),
  1055. smalltalk.ObjectTest);
  1056. smalltalk.addMethod(
  1057. "_testBasicPerform",
  1058. smalltalk.method({
  1059. selector: "testBasicPerform",
  1060. fn: function () {
  1061. var self=this;
  1062. var o=nil;
  1063. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1064. smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
  1065. smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  1066. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  1067. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
  1068. return self;}
  1069. }),
  1070. smalltalk.ObjectTest);
  1071. smalltalk.addMethod(
  1072. "_testDNU",
  1073. smalltalk.method({
  1074. selector: "testDNU",
  1075. fn: function () {
  1076. var self=this;
  1077. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1078. return self;}
  1079. }),
  1080. smalltalk.ObjectTest);
  1081. smalltalk.addMethod(
  1082. "_testEquality",
  1083. smalltalk.method({
  1084. selector: "testEquality",
  1085. fn: function () {
  1086. var self=this;
  1087. var o=nil;
  1088. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1089. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1090. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  1091. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  1092. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  1093. return self;}
  1094. }),
  1095. smalltalk.ObjectTest);
  1096. smalltalk.addMethod(
  1097. "_testHalt",
  1098. smalltalk.method({
  1099. selector: "testHalt",
  1100. fn: function () {
  1101. var self=this;
  1102. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
  1103. return self;}
  1104. }),
  1105. smalltalk.ObjectTest);
  1106. smalltalk.addMethod(
  1107. "_testIdentity",
  1108. smalltalk.method({
  1109. selector: "testIdentity",
  1110. fn: function () {
  1111. var self=this;
  1112. var o=nil;
  1113. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1114. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1115. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  1116. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1117. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
  1118. return self;}
  1119. }),
  1120. smalltalk.ObjectTest);
  1121. smalltalk.addMethod(
  1122. "_testIfNil",
  1123. smalltalk.method({
  1124. selector: "testIfNil",
  1125. fn: function () {
  1126. var self=this;
  1127. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  1128. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  1129. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1130. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1131. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1132. return self;}
  1133. }),
  1134. smalltalk.ObjectTest);
  1135. smalltalk.addMethod(
  1136. "_testInstVars",
  1137. smalltalk.method({
  1138. selector: "testInstVars",
  1139. fn: function () {
  1140. var self=this;
  1141. var o=nil;
  1142. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1143. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  1144. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  1145. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  1146. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  1147. return self;}
  1148. }),
  1149. smalltalk.ObjectTest);
  1150. smalltalk.addMethod(
  1151. "_testNilUndefined",
  1152. smalltalk.method({
  1153. selector: "testNilUndefined",
  1154. fn: function () {
  1155. var self=this;
  1156. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  1157. return self;}
  1158. }),
  1159. smalltalk.ObjectTest);
  1160. smalltalk.addMethod(
  1161. "_testYourself",
  1162. smalltalk.method({
  1163. selector: "testYourself",
  1164. fn: function () {
  1165. var self=this;
  1166. var o=nil;
  1167. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1168. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1169. return self;}
  1170. }),
  1171. smalltalk.ObjectTest);
  1172. smalltalk.addMethod(
  1173. "_testidentityHash",
  1174. smalltalk.method({
  1175. selector: "testidentityHash",
  1176. fn: function () {
  1177. var self=this;
  1178. var o1=nil;
  1179. var o2=nil;
  1180. (o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1181. (o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1182. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  1183. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  1184. return self;}
  1185. }),
  1186. smalltalk.ObjectTest);
  1187. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1188. smalltalk.addMethod(
  1189. "_setUp",
  1190. smalltalk.method({
  1191. selector: "setUp",
  1192. fn: function () {
  1193. var self=this;
  1194. (self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
  1195. (self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
  1196. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  1197. (self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
  1198. (self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", ["server/grul/js"]);smalltalk.send($rec, "_commitPathSt_", ["grul/st"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", [])));
  1199. return self;}
  1200. }),
  1201. smalltalk.PackageTest);
  1202. smalltalk.addMethod(
  1203. "_tearDown",
  1204. smalltalk.method({
  1205. selector: "tearDown",
  1206. fn: function () {
  1207. var self=this;
  1208. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  1209. return self;}
  1210. }),
  1211. smalltalk.PackageTest);
  1212. smalltalk.addMethod(
  1213. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1214. smalltalk.method({
  1215. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1216. fn: function () {
  1217. var self=this;
  1218. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1219. return self;}
  1220. }),
  1221. smalltalk.PackageTest);
  1222. smalltalk.addMethod(
  1223. "_testGrulCommitPathStShouldBeGrulSt",
  1224. smalltalk.method({
  1225. selector: "testGrulCommitPathStShouldBeGrulSt",
  1226. fn: function () {
  1227. var self=this;
  1228. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1229. return self;}
  1230. }),
  1231. smalltalk.PackageTest);
  1232. smalltalk.addMethod(
  1233. "_testZorkCommitPathJsShouldBeJs",
  1234. smalltalk.method({
  1235. selector: "testZorkCommitPathJsShouldBeJs",
  1236. fn: function () {
  1237. var self=this;
  1238. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1239. return self;}
  1240. }),
  1241. smalltalk.PackageTest);
  1242. smalltalk.addMethod(
  1243. "_testZorkCommitPathStShouldBeSt",
  1244. smalltalk.method({
  1245. selector: "testZorkCommitPathStShouldBeSt",
  1246. fn: function () {
  1247. var self=this;
  1248. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1249. return self;}
  1250. }),
  1251. smalltalk.PackageTest);
  1252. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  1253. smalltalk.addMethod(
  1254. "_setUp",
  1255. smalltalk.method({
  1256. selector: "setUp",
  1257. fn: function () {
  1258. var self=this;
  1259. smalltalk.send(self, "_setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest.superclass || nil);
  1260. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", ["javascripts/"]);return smalltalk.send($rec, "_defaultCommitPathSt_", ["smalltalk/"]);})((smalltalk.Package || Package));
  1261. return self;}
  1262. }),
  1263. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1264. smalltalk.addMethod(
  1265. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1266. smalltalk.method({
  1267. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1268. fn: function () {
  1269. var self=this;
  1270. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1271. return self;}
  1272. }),
  1273. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1274. smalltalk.addMethod(
  1275. "_testGrulCommitPathStShouldBeGrulSt",
  1276. smalltalk.method({
  1277. selector: "testGrulCommitPathStShouldBeGrulSt",
  1278. fn: function () {
  1279. var self=this;
  1280. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1281. return self;}
  1282. }),
  1283. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1284. smalltalk.addMethod(
  1285. "_testZorkCommitPathJsShouldBeJavascript",
  1286. smalltalk.method({
  1287. selector: "testZorkCommitPathJsShouldBeJavascript",
  1288. fn: function () {
  1289. var self=this;
  1290. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1291. return self;}
  1292. }),
  1293. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1294. smalltalk.addMethod(
  1295. "_testZorkCommitPathStShouldBeSmalltalk",
  1296. smalltalk.method({
  1297. selector: "testZorkCommitPathStShouldBeSmalltalk",
  1298. fn: function () {
  1299. var self=this;
  1300. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1301. return self;}
  1302. }),
  1303. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1304. smalltalk.addMethod(
  1305. "_shouldInheritSelectors",
  1306. smalltalk.method({
  1307. selector: "shouldInheritSelectors",
  1308. fn: function () {
  1309. var self=this;
  1310. return false;
  1311. return self;}
  1312. }),
  1313. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  1314. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1315. smalltalk.addMethod(
  1316. "_testAccessing",
  1317. smalltalk.method({
  1318. selector: "testAccessing",
  1319. fn: function () {
  1320. var self=this;
  1321. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  1322. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  1323. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  1324. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  1325. return self;}
  1326. }),
  1327. smalltalk.PointTest);
  1328. smalltalk.addMethod(
  1329. "_testArithmetic",
  1330. smalltalk.method({
  1331. selector: "testArithmetic",
  1332. fn: function () {
  1333. var self=this;
  1334. 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)])]);
  1335. 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)])]);
  1336. 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)])]);
  1337. 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)])]);
  1338. return self;}
  1339. }),
  1340. smalltalk.PointTest);
  1341. smalltalk.addMethod(
  1342. "_testAt",
  1343. smalltalk.method({
  1344. selector: "testAt",
  1345. fn: function () {
  1346. var self=this;
  1347. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1348. return self;}
  1349. }),
  1350. smalltalk.PointTest);
  1351. smalltalk.addMethod(
  1352. "_testEgality",
  1353. smalltalk.method({
  1354. selector: "testEgality",
  1355. fn: function () {
  1356. var self=this;
  1357. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1358. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1359. return self;}
  1360. }),
  1361. smalltalk.PointTest);
  1362. smalltalk.addMethod(
  1363. "_testTranslateBy",
  1364. smalltalk.method({
  1365. selector: "testTranslateBy",
  1366. fn: function () {
  1367. var self=this;
  1368. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [(1)])])]);
  1369. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(2)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [smalltalk.send((1), "_negated", [])])])]);
  1370. smalltalk.send(self, "_assert_equals_", [smalltalk.send((5), "__at", [(6)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((2), "__at", [(3)])])]);
  1371. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "__at", [(3)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__at", [(0)])])]);
  1372. return self;}
  1373. }),
  1374. smalltalk.PointTest);
  1375. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1376. smalltalk.addMethod(
  1377. "_textNext",
  1378. smalltalk.method({
  1379. selector: "textNext",
  1380. fn: function () {
  1381. var self=this;
  1382. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1383. var next=nil;
  1384. (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]);})]);
  1385. return self;}
  1386. }),
  1387. smalltalk.RandomTest);
  1388. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1389. smalltalk.addMethod(
  1390. "_testAddRemove",
  1391. smalltalk.method({
  1392. selector: "testAddRemove",
  1393. fn: function () {
  1394. var self=this;
  1395. var set=nil;
  1396. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1397. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1398. smalltalk.send(set, "_add_", [(3)]);
  1399. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1400. smalltalk.send(set, "_add_", [(5)]);
  1401. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1402. smalltalk.send(set, "_remove_", [(3)]);
  1403. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1404. return self;}
  1405. }),
  1406. smalltalk.SetTest);
  1407. smalltalk.addMethod(
  1408. "_testAt",
  1409. smalltalk.method({
  1410. selector: "testAt",
  1411. fn: function () {
  1412. var self=this;
  1413. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1414. return self;}
  1415. }),
  1416. smalltalk.SetTest);
  1417. smalltalk.addMethod(
  1418. "_testPrintString",
  1419. smalltalk.method({
  1420. selector: "testPrintString",
  1421. fn: function () {
  1422. var self=this;
  1423. var set=nil;
  1424. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1425. smalltalk.send(self, "_assert_equals_", ["a Set ()", smalltalk.send(set, "_printString", [])]);
  1426. (function($rec){smalltalk.send($rec, "_add_", [(1)]);return smalltalk.send($rec, "_add_", [(3)]);})(set);
  1427. smalltalk.send(self, "_assert_equals_", ["a Set (1 3)", smalltalk.send(set, "_printString", [])]);
  1428. smalltalk.send(set, "_add_", ["foo"]);
  1429. smalltalk.send(self, "_assert_equals_", ["a Set (1 3 'foo')", smalltalk.send(set, "_printString", [])]);
  1430. (function($rec){smalltalk.send($rec, "_remove_", [(1)]);return smalltalk.send($rec, "_remove_", [(3)]);})(set);
  1431. smalltalk.send(self, "_assert_equals_", ["a Set ('foo')", smalltalk.send(set, "_printString", [])]);
  1432. smalltalk.send(set, "_add_", [(3)]);
  1433. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  1434. smalltalk.send(set, "_add_", [(3)]);
  1435. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  1436. return self;}
  1437. }),
  1438. smalltalk.SetTest);
  1439. smalltalk.addMethod(
  1440. "_testSize",
  1441. smalltalk.method({
  1442. selector: "testSize",
  1443. fn: function () {
  1444. var self=this;
  1445. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1446. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1447. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1448. return self;}
  1449. }),
  1450. smalltalk.SetTest);
  1451. smalltalk.addMethod(
  1452. "_testUnicity",
  1453. smalltalk.method({
  1454. selector: "testUnicity",
  1455. fn: function () {
  1456. var self=this;
  1457. var set=nil;
  1458. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1459. smalltalk.send(set, "_add_", [(21)]);
  1460. smalltalk.send(set, "_add_", ["hello"]);
  1461. smalltalk.send(set, "_add_", [(21)]);
  1462. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1463. smalltalk.send(set, "_add_", ["hello"]);
  1464. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1465. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1466. return self;}
  1467. }),
  1468. smalltalk.SetTest);
  1469. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1470. smalltalk.addMethod(
  1471. "_testAddRemove",
  1472. smalltalk.method({
  1473. selector: "testAddRemove",
  1474. fn: function () {
  1475. var self=this;
  1476. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  1477. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  1478. return self;}
  1479. }),
  1480. smalltalk.StringTest);
  1481. smalltalk.addMethod(
  1482. "_testAsArray",
  1483. smalltalk.method({
  1484. selector: "testAsArray",
  1485. fn: function () {
  1486. var self=this;
  1487. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  1488. return self;}
  1489. }),
  1490. smalltalk.StringTest);
  1491. smalltalk.addMethod(
  1492. "_testAt",
  1493. smalltalk.method({
  1494. selector: "testAt",
  1495. fn: function () {
  1496. var self=this;
  1497. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  1498. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  1499. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1500. return self;}
  1501. }),
  1502. smalltalk.StringTest);
  1503. smalltalk.addMethod(
  1504. "_testAtPut",
  1505. smalltalk.method({
  1506. selector: "testAtPut",
  1507. fn: function () {
  1508. var self=this;
  1509. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1510. return self;}
  1511. }),
  1512. smalltalk.StringTest);
  1513. smalltalk.addMethod(
  1514. "_testCopyWithoutAll",
  1515. smalltalk.method({
  1516. selector: "testCopyWithoutAll",
  1517. fn: function () {
  1518. var self=this;
  1519. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1520. return self;}
  1521. }),
  1522. smalltalk.StringTest);
  1523. smalltalk.addMethod(
  1524. "_testEquality",
  1525. smalltalk.method({
  1526. selector: "testEquality",
  1527. fn: function () {
  1528. var self=this;
  1529. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1530. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1531. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1532. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1533. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  1534. return self;}
  1535. }),
  1536. smalltalk.StringTest);
  1537. smalltalk.addMethod(
  1538. "_testIdentity",
  1539. smalltalk.method({
  1540. selector: "testIdentity",
  1541. fn: function () {
  1542. var self=this;
  1543. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1544. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1545. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1546. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1547. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [(0)])]);
  1548. return self;}
  1549. }),
  1550. smalltalk.StringTest);
  1551. smalltalk.addMethod(
  1552. "_testIncludesSubString",
  1553. smalltalk.method({
  1554. selector: "testIncludesSubString",
  1555. fn: function () {
  1556. var self=this;
  1557. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1558. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1559. return self;}
  1560. }),
  1561. smalltalk.StringTest);
  1562. smalltalk.addMethod(
  1563. "_testJoin",
  1564. smalltalk.method({
  1565. selector: "testJoin",
  1566. fn: function () {
  1567. var self=this;
  1568. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1569. return self;}
  1570. }),
  1571. smalltalk.StringTest);
  1572. smalltalk.addMethod(
  1573. "_testPrintString",
  1574. smalltalk.method({
  1575. selector: "testPrintString",
  1576. fn: function (){
  1577. var self=this;
  1578. smalltalk.send(self, "_assert_equals_", ["'test_string'", smalltalk.send("test_string", "_printString", [])]);
  1579. return self;}
  1580. }),
  1581. smalltalk.StringTest);
  1582. smalltalk.addMethod(
  1583. "_testSize",
  1584. smalltalk.method({
  1585. selector: "testSize",
  1586. fn: function () {
  1587. var self=this;
  1588. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  1589. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  1590. return self;}
  1591. }),
  1592. smalltalk.StringTest);
  1593. smalltalk.addMethod(
  1594. "_testStreamContents",
  1595. smalltalk.method({
  1596. selector: "testStreamContents",
  1597. fn: function () {
  1598. var self=this;
  1599. 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);})])]);
  1600. return self;}
  1601. }),
  1602. smalltalk.StringTest);
  1603. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1604. smalltalk.addMethod(
  1605. "_testAsString",
  1606. smalltalk.method({
  1607. selector: "testAsString",
  1608. fn: function () {
  1609. var self=this;
  1610. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1611. return self;}
  1612. }),
  1613. smalltalk.SymbolTest);
  1614. smalltalk.addMethod(
  1615. "_testAsSymbol",
  1616. smalltalk.method({
  1617. selector: "testAsSymbol",
  1618. fn: function () {
  1619. var self=this;
  1620. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1621. return self;}
  1622. }),
  1623. smalltalk.SymbolTest);
  1624. smalltalk.addMethod(
  1625. "_testAt",
  1626. smalltalk.method({
  1627. selector: "testAt",
  1628. fn: function () {
  1629. var self=this;
  1630. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  1631. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  1632. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1633. return self;}
  1634. }),
  1635. smalltalk.SymbolTest);
  1636. smalltalk.addMethod(
  1637. "_testAtPut",
  1638. smalltalk.method({
  1639. selector: "testAtPut",
  1640. fn: function () {
  1641. var self=this;
  1642. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1643. return self;}
  1644. }),
  1645. smalltalk.SymbolTest);
  1646. smalltalk.addMethod(
  1647. "_testComparing",
  1648. smalltalk.method({
  1649. selector: "testComparing",
  1650. fn: function () {
  1651. var self=this;
  1652. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  1653. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  1654. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1655. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1656. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  1657. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  1658. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1659. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1660. return self;}
  1661. }),
  1662. smalltalk.SymbolTest);
  1663. smalltalk.addMethod(
  1664. "_testCopying",
  1665. smalltalk.method({
  1666. selector: "testCopying",
  1667. fn: function () {
  1668. var self=this;
  1669. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1670. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1671. return self;}
  1672. }),
  1673. smalltalk.SymbolTest);
  1674. smalltalk.addMethod(
  1675. "_testEquality",
  1676. smalltalk.method({
  1677. selector: "testEquality",
  1678. fn: function () {
  1679. var self=this;
  1680. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1681. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1682. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1683. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1684. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1685. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1686. return self;}
  1687. }),
  1688. smalltalk.SymbolTest);
  1689. smalltalk.addMethod(
  1690. "_testIdentity",
  1691. smalltalk.method({
  1692. selector: "testIdentity",
  1693. fn: function () {
  1694. var self=this;
  1695. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1696. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1697. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1698. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1699. return self;}
  1700. }),
  1701. smalltalk.SymbolTest);
  1702. smalltalk.addMethod(
  1703. "_testIsSymbolIsString",
  1704. smalltalk.method({
  1705. selector: "testIsSymbolIsString",
  1706. fn: function () {
  1707. var self=this;
  1708. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1709. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1710. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1711. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1712. return self;}
  1713. }),
  1714. smalltalk.SymbolTest);
  1715. smalltalk.addMethod(
  1716. "_testPrintString",
  1717. smalltalk.method({
  1718. selector: "testPrintString",
  1719. fn: function (){
  1720. var self=this;
  1721. smalltalk.send(self, "_assert_equals_", ["#symbol", smalltalk.send(smalltalk.symbolFor("symbol"), "_printString", [])]);
  1722. return self;}
  1723. }),
  1724. smalltalk.SymbolTest);
  1725. smalltalk.addMethod(
  1726. "_testSize",
  1727. smalltalk.method({
  1728. selector: "testSize",
  1729. fn: function () {
  1730. var self=this;
  1731. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1732. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1733. return self;}
  1734. }),
  1735. smalltalk.SymbolTest);
  1736. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1737. smalltalk.addMethod(
  1738. "_testCopying",
  1739. smalltalk.method({
  1740. selector: "testCopying",
  1741. fn: function () {
  1742. var self=this;
  1743. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1744. return self;}
  1745. }),
  1746. smalltalk.UndefinedTest);
  1747. smalltalk.addMethod(
  1748. "_testDeepCopy",
  1749. smalltalk.method({
  1750. selector: "testDeepCopy",
  1751. fn: function () {
  1752. var self=this;
  1753. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1754. return self;}
  1755. }),
  1756. smalltalk.UndefinedTest);
  1757. smalltalk.addMethod(
  1758. "_testIfNil",
  1759. smalltalk.method({
  1760. selector: "testIfNil",
  1761. fn: function () {
  1762. var self=this;
  1763. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1764. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1765. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1766. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1767. return self;}
  1768. }),
  1769. smalltalk.UndefinedTest);
  1770. smalltalk.addMethod(
  1771. "_testIsNil",
  1772. smalltalk.method({
  1773. selector: "testIsNil",
  1774. fn: function () {
  1775. var self=this;
  1776. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1777. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1778. return self;}
  1779. }),
  1780. smalltalk.UndefinedTest);