Kernel-Tests.deploy.js 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825
  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('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  395. smalltalk.addMethod(
  396. "_testAccessing",
  397. smalltalk.method({
  398. selector: "testAccessing",
  399. fn: function (){
  400. var self=this;
  401. var d=nil;
  402. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  403. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  404. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  405. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  406. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  407. smalltalk.send(d, "_at_put_", [(1), (2)]);
  408. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  409. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  410. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  411. return self;}
  412. }),
  413. smalltalk.DictionaryTest);
  414. smalltalk.addMethod(
  415. "_testDynamicDictionaries",
  416. smalltalk.method({
  417. selector: "testDynamicDictionaries",
  418. fn: function (){
  419. var self=this;
  420. 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)])])])]);
  421. return self;}
  422. }),
  423. smalltalk.DictionaryTest);
  424. smalltalk.addMethod(
  425. "_testEquality",
  426. smalltalk.method({
  427. selector: "testEquality",
  428. fn: function (){
  429. var self=this;
  430. var d1=nil;
  431. var d2=nil;
  432. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  433. (d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  434. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  435. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  436. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  437. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  438. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  439. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  440. (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", [])));
  441. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  442. return self;}
  443. }),
  444. smalltalk.DictionaryTest);
  445. smalltalk.addMethod(
  446. "_testIfAbsent",
  447. smalltalk.method({
  448. selector: "testIfAbsent",
  449. fn: function (){
  450. var self=this;
  451. var d=nil;
  452. var visited=nil;
  453. (visited=false);
  454. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  455. smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return (visited=true);})]);
  456. smalltalk.send(self, "_assert_", [visited]);
  457. return self;}
  458. }),
  459. smalltalk.DictionaryTest);
  460. smalltalk.addMethod(
  461. "_testIfPresent",
  462. smalltalk.method({
  463. selector: "testIfPresent",
  464. fn: function (){
  465. var self=this;
  466. var d=nil;
  467. var visited=nil;
  468. var absent=nil;
  469. (visited=false);
  470. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  471. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  472. smalltalk.send(d, "_at_ifPresent_", ["hello", (function(value){return (visited=value);})]);
  473. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  474. (absent=smalltalk.send(d, "_at_ifPresent_", ["bye", (function(value){return (visited=value);})]));
  475. smalltalk.send(self, "_assert_", [smalltalk.send(absent, "_isNil", [])]);
  476. return self;}
  477. }),
  478. smalltalk.DictionaryTest);
  479. smalltalk.addMethod(
  480. "_testIfPresentIfAbsent",
  481. smalltalk.method({
  482. selector: "testIfPresentIfAbsent",
  483. fn: function (){
  484. var self=this;
  485. var d=nil;
  486. var visited=nil;
  487. (visited=false);
  488. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  489. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  490. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["hello", (function(value){return (visited=value);}), (function(){return (visited=true);})]);
  491. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  492. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["buy", (function(value){return (visited=value);}), (function(){return (visited=true);})]);
  493. smalltalk.send(self, "_assert_", [visited]);
  494. return self;}
  495. }),
  496. smalltalk.DictionaryTest);
  497. smalltalk.addMethod(
  498. "_testKeys",
  499. smalltalk.method({
  500. selector: "testKeys",
  501. fn: function (){
  502. var self=this;
  503. var d=nil;
  504. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  505. smalltalk.send(d, "_at_put_", [(1), (2)]);
  506. smalltalk.send(d, "_at_put_", [(2), (3)]);
  507. smalltalk.send(d, "_at_put_", [(3), (4)]);
  508. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  509. return self;}
  510. }),
  511. smalltalk.DictionaryTest);
  512. smalltalk.addMethod(
  513. "_testPrintString",
  514. smalltalk.method({
  515. selector: "testPrintString",
  516. fn: function (){
  517. var self=this;
  518. 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", []))]);
  519. return self;}
  520. }),
  521. smalltalk.DictionaryTest);
  522. smalltalk.addMethod(
  523. "_testRemoveKey",
  524. smalltalk.method({
  525. selector: "testRemoveKey",
  526. fn: function (){
  527. var self=this;
  528. var d=nil;
  529. var key=nil;
  530. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  531. smalltalk.send(d, "_at_put_", [(1), (2)]);
  532. smalltalk.send(d, "_at_put_", [(2), (3)]);
  533. smalltalk.send(d, "_at_put_", [(3), (4)]);
  534. (key=(2));
  535. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  536. smalltalk.send(d, "_removeKey_", [key]);
  537. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (3)]])]);
  538. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (4)]])]);
  539. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [(2)])]);
  540. return self;}
  541. }),
  542. smalltalk.DictionaryTest);
  543. smalltalk.addMethod(
  544. "_testRemoveKeyIfAbsent",
  545. smalltalk.method({
  546. selector: "testRemoveKeyIfAbsent",
  547. fn: function (){
  548. var self=this;
  549. var d=nil;
  550. var key=nil;
  551. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  552. smalltalk.send(d, "_at_put_", [(1), (2)]);
  553. smalltalk.send(d, "_at_put_", [(2), (3)]);
  554. smalltalk.send(d, "_at_put_", [(3), (4)]);
  555. (key=(2));
  556. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [(3)])]);
  557. (key=(3));
  558. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(4)])]);
  559. (key="why");
  560. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(42)])]);
  561. return self;}
  562. }),
  563. smalltalk.DictionaryTest);
  564. smalltalk.addMethod(
  565. "_testSize",
  566. smalltalk.method({
  567. selector: "testSize",
  568. fn: function (){
  569. var self=this;
  570. var d=nil;
  571. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  572. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  573. smalltalk.send(d, "_at_put_", [(1), (2)]);
  574. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  575. smalltalk.send(d, "_at_put_", [(2), (3)]);
  576. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  577. return self;}
  578. }),
  579. smalltalk.DictionaryTest);
  580. smalltalk.addMethod(
  581. "_testValues",
  582. smalltalk.method({
  583. selector: "testValues",
  584. fn: function (){
  585. var self=this;
  586. var d=nil;
  587. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  588. smalltalk.send(d, "_at_put_", [(1), (2)]);
  589. smalltalk.send(d, "_at_put_", [(2), (3)]);
  590. smalltalk.send(d, "_at_put_", [(3), (4)]);
  591. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  592. return self;}
  593. }),
  594. smalltalk.DictionaryTest);
  595. smalltalk.addClass('HashedCollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  596. smalltalk.addMethod(
  597. "_testPrintString",
  598. smalltalk.method({
  599. selector: "testPrintString",
  600. fn: function (){
  601. var self=this;
  602. var aHashedCollection=nil;
  603. (aHashedCollection=smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_new", []));
  604. smalltalk.send(self, "_assert_equals_", ["a HashedCollection()", smalltalk.send(aHashedCollection, "_printString", [])]);
  605. smalltalk.send(aHashedCollection, "_at_put_", ["key1", (1)]);
  606. smalltalk.send(self, "_assert_equals_", ["a HashedCollection('key1'->1)", smalltalk.send(aHashedCollection, "_printString", [])]);
  607. smalltalk.send(aHashedCollection, "_at_put_", ["key2", (2)]);
  608. smalltalk.send(self, "_assert_equals_", ["a HashedCollection('key1'->1 , 'key2'->2)", smalltalk.send(aHashedCollection, "_printString", [])]);
  609. return self;}
  610. }),
  611. smalltalk.HashedCollectionTest);
  612. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  613. smalltalk.addMethod(
  614. "_jsObject",
  615. smalltalk.method({
  616. selector: "jsObject",
  617. fn: function (){
  618. var self=this;
  619. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  620. return self;}
  621. }),
  622. smalltalk.JSObjectProxyTest);
  623. smalltalk.addMethod(
  624. "_testDNU",
  625. smalltalk.method({
  626. selector: "testDNU",
  627. fn: function (){
  628. var self=this;
  629. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  630. return self;}
  631. }),
  632. smalltalk.JSObjectProxyTest);
  633. smalltalk.addMethod(
  634. "_testMessageSend",
  635. smalltalk.method({
  636. selector: "testMessageSend",
  637. fn: function (){
  638. var self=this;
  639. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
  640. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
  641. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
  642. return self;}
  643. }),
  644. smalltalk.JSObjectProxyTest);
  645. smalltalk.addMethod(
  646. "_testMethodWithArguments",
  647. smalltalk.method({
  648. selector: "testMethodWithArguments",
  649. fn: function (){
  650. var self=this;
  651. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  652. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  653. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  654. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  655. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  656. return self;}
  657. }),
  658. smalltalk.JSObjectProxyTest);
  659. smalltalk.addMethod(
  660. "_testPrinting",
  661. smalltalk.method({
  662. selector: "testPrinting",
  663. fn: function (){
  664. var self=this;
  665. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", ["[object Object]"])]);
  666. return self;}
  667. }),
  668. smalltalk.JSObjectProxyTest);
  669. smalltalk.addMethod(
  670. "_testPropertyThatReturnsEmptyString",
  671. smalltalk.method({
  672. selector: "testPropertyThatReturnsEmptyString",
  673. fn: function (){
  674. var self=this;
  675. document.location.hash = '';
  676. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  677. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  678. smalltalk.send(self, "_assert_equals_", ["#test", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  679. return self;}
  680. }),
  681. smalltalk.JSObjectProxyTest);
  682. smalltalk.addMethod(
  683. "_testYourself",
  684. smalltalk.method({
  685. selector: "testYourself",
  686. fn: function (){
  687. var self=this;
  688. var body=nil;
  689. (body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", [])));
  690. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  691. smalltalk.send(body, "_removeClass_", ["amber"]);
  692. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  693. return self;}
  694. }),
  695. smalltalk.JSObjectProxyTest);
  696. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  697. smalltalk.addMethod(
  698. "_testArithmetic",
  699. smalltalk.method({
  700. selector: "testArithmetic",
  701. fn: function (){
  702. var self=this;
  703. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  704. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  705. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  706. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  707. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  708. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  709. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  710. return self;}
  711. }),
  712. smalltalk.NumberTest);
  713. smalltalk.addMethod(
  714. "_testComparison",
  715. smalltalk.method({
  716. selector: "testComparison",
  717. fn: function (){
  718. var self=this;
  719. smalltalk.send(self, "_assert_", [(3) > (2)]);
  720. smalltalk.send(self, "_assert_", [(2) < (3)]);
  721. smalltalk.send(self, "_deny_", [(3) < (2)]);
  722. smalltalk.send(self, "_deny_", [(2) > (3)]);
  723. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  724. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  725. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  726. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  727. return self;}
  728. }),
  729. smalltalk.NumberTest);
  730. smalltalk.addMethod(
  731. "_testCopying",
  732. smalltalk.method({
  733. selector: "testCopying",
  734. fn: function (){
  735. var self=this;
  736. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  737. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  738. return self;}
  739. }),
  740. smalltalk.NumberTest);
  741. smalltalk.addMethod(
  742. "_testEquality",
  743. smalltalk.method({
  744. selector: "testEquality",
  745. fn: function (){
  746. var self=this;
  747. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  748. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  749. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  750. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  751. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  752. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  753. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  754. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  755. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  756. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  757. return self;}
  758. }),
  759. smalltalk.NumberTest);
  760. smalltalk.addMethod(
  761. "_testIdentity",
  762. smalltalk.method({
  763. selector: "testIdentity",
  764. fn: function (){
  765. var self=this;
  766. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  767. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  768. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  769. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  770. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  771. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  772. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  773. return self;}
  774. }),
  775. smalltalk.NumberTest);
  776. smalltalk.addMethod(
  777. "_testMinMax",
  778. smalltalk.method({
  779. selector: "testMinMax",
  780. fn: function (){
  781. var self=this;
  782. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  783. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  784. return self;}
  785. }),
  786. smalltalk.NumberTest);
  787. smalltalk.addMethod(
  788. "_testNegated",
  789. smalltalk.method({
  790. selector: "testNegated",
  791. fn: function (){
  792. var self=this;
  793. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  794. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  795. return self;}
  796. }),
  797. smalltalk.NumberTest);
  798. smalltalk.addMethod(
  799. "_testPrintShowingDecimalPlaces",
  800. smalltalk.method({
  801. selector: "testPrintShowingDecimalPlaces",
  802. fn: function (){
  803. var self=this;
  804. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  805. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  806. smalltalk.send(self, "_assert_equals_", ["-234.56700", smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  807. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  808. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  809. smalltalk.send(self, "_assert_equals_", ["-23", smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  810. smalltalk.send(self, "_assert_equals_", ["-24", smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  811. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  812. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  813. smalltalk.send(self, "_assert_equals_", ["-0.98", smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  814. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  815. smalltalk.send(self, "_assert_equals_", ["-2.57", smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  816. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  817. return self;}
  818. }),
  819. smalltalk.NumberTest);
  820. smalltalk.addMethod(
  821. "_testRounded",
  822. smalltalk.method({
  823. selector: "testRounded",
  824. fn: function (){
  825. var self=this;
  826. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  827. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  828. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  829. return self;}
  830. }),
  831. smalltalk.NumberTest);
  832. smalltalk.addMethod(
  833. "_testSqrt",
  834. smalltalk.method({
  835. selector: "testSqrt",
  836. fn: function (){
  837. var self=this;
  838. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  839. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  840. return self;}
  841. }),
  842. smalltalk.NumberTest);
  843. smalltalk.addMethod(
  844. "_testSquared",
  845. smalltalk.method({
  846. selector: "testSquared",
  847. fn: function (){
  848. var self=this;
  849. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  850. return self;}
  851. }),
  852. smalltalk.NumberTest);
  853. smalltalk.addMethod(
  854. "_testTimesRepeat",
  855. smalltalk.method({
  856. selector: "testTimesRepeat",
  857. fn: function (){
  858. var self=this;
  859. var i=nil;
  860. (i=(0));
  861. smalltalk.send((0), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  862. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  863. smalltalk.send((5), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  864. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  865. return self;}
  866. }),
  867. smalltalk.NumberTest);
  868. smalltalk.addMethod(
  869. "_testTo",
  870. smalltalk.method({
  871. selector: "testTo",
  872. fn: function (){
  873. var self=this;
  874. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  875. return self;}
  876. }),
  877. smalltalk.NumberTest);
  878. smalltalk.addMethod(
  879. "_testToBy",
  880. smalltalk.method({
  881. selector: "testToBy",
  882. fn: function (){
  883. var self=this;
  884. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  885. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  886. return self;}
  887. }),
  888. smalltalk.NumberTest);
  889. smalltalk.addMethod(
  890. "_testTruncated",
  891. smalltalk.method({
  892. selector: "testTruncated",
  893. fn: function (){
  894. var self=this;
  895. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  896. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  897. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  898. return self;}
  899. }),
  900. smalltalk.NumberTest);
  901. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  902. smalltalk.addMethod(
  903. "_foo",
  904. smalltalk.method({
  905. selector: "foo",
  906. fn: function (){
  907. var self=this;
  908. return self['@foo'];
  909. return self;}
  910. }),
  911. smalltalk.ObjectMock);
  912. smalltalk.addMethod(
  913. "_foo_",
  914. smalltalk.method({
  915. selector: "foo:",
  916. fn: function (anObject){
  917. var self=this;
  918. (self['@foo']=anObject);
  919. return self;}
  920. }),
  921. smalltalk.ObjectMock);
  922. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  923. smalltalk.addMethod(
  924. "_testBasicAccess",
  925. smalltalk.method({
  926. selector: "testBasicAccess",
  927. fn: function (){
  928. var self=this;
  929. var o=nil;
  930. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  931. smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
  932. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
  933. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  934. return self;}
  935. }),
  936. smalltalk.ObjectTest);
  937. smalltalk.addMethod(
  938. "_testBasicPerform",
  939. smalltalk.method({
  940. selector: "testBasicPerform",
  941. fn: function (){
  942. var self=this;
  943. var o=nil;
  944. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  945. smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
  946. smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  947. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  948. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
  949. return self;}
  950. }),
  951. smalltalk.ObjectTest);
  952. smalltalk.addMethod(
  953. "_testDNU",
  954. smalltalk.method({
  955. selector: "testDNU",
  956. fn: function (){
  957. var self=this;
  958. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  959. return self;}
  960. }),
  961. smalltalk.ObjectTest);
  962. smalltalk.addMethod(
  963. "_testEquality",
  964. smalltalk.method({
  965. selector: "testEquality",
  966. fn: function (){
  967. var self=this;
  968. var o=nil;
  969. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  970. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  971. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  972. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  973. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  974. return self;}
  975. }),
  976. smalltalk.ObjectTest);
  977. smalltalk.addMethod(
  978. "_testHalt",
  979. smalltalk.method({
  980. selector: "testHalt",
  981. fn: function (){
  982. var self=this;
  983. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
  984. return self;}
  985. }),
  986. smalltalk.ObjectTest);
  987. smalltalk.addMethod(
  988. "_testIdentity",
  989. smalltalk.method({
  990. selector: "testIdentity",
  991. fn: function (){
  992. var self=this;
  993. var o=nil;
  994. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  995. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  996. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  997. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  998. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
  999. return self;}
  1000. }),
  1001. smalltalk.ObjectTest);
  1002. smalltalk.addMethod(
  1003. "_testIfNil",
  1004. smalltalk.method({
  1005. selector: "testIfNil",
  1006. fn: function (){
  1007. var self=this;
  1008. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  1009. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  1010. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1011. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1012. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1013. return self;}
  1014. }),
  1015. smalltalk.ObjectTest);
  1016. smalltalk.addMethod(
  1017. "_testInstVars",
  1018. smalltalk.method({
  1019. selector: "testInstVars",
  1020. fn: function (){
  1021. var self=this;
  1022. var o=nil;
  1023. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1024. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  1025. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  1026. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  1027. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  1028. return self;}
  1029. }),
  1030. smalltalk.ObjectTest);
  1031. smalltalk.addMethod(
  1032. "_testNilUndefined",
  1033. smalltalk.method({
  1034. selector: "testNilUndefined",
  1035. fn: function (){
  1036. var self=this;
  1037. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  1038. return self;}
  1039. }),
  1040. smalltalk.ObjectTest);
  1041. smalltalk.addMethod(
  1042. "_testYourself",
  1043. smalltalk.method({
  1044. selector: "testYourself",
  1045. fn: function (){
  1046. var self=this;
  1047. var o=nil;
  1048. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1049. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1050. return self;}
  1051. }),
  1052. smalltalk.ObjectTest);
  1053. smalltalk.addMethod(
  1054. "_testidentityHash",
  1055. smalltalk.method({
  1056. selector: "testidentityHash",
  1057. fn: function (){
  1058. var self=this;
  1059. var o1=nil;
  1060. var o2=nil;
  1061. (o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1062. (o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1063. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  1064. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  1065. return self;}
  1066. }),
  1067. smalltalk.ObjectTest);
  1068. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1069. smalltalk.addMethod(
  1070. "_setUp",
  1071. smalltalk.method({
  1072. selector: "setUp",
  1073. fn: function (){
  1074. var self=this;
  1075. (self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
  1076. (self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
  1077. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  1078. (self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
  1079. (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", [])));
  1080. return self;}
  1081. }),
  1082. smalltalk.PackageTest);
  1083. smalltalk.addMethod(
  1084. "_tearDown",
  1085. smalltalk.method({
  1086. selector: "tearDown",
  1087. fn: function (){
  1088. var self=this;
  1089. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  1090. return self;}
  1091. }),
  1092. smalltalk.PackageTest);
  1093. smalltalk.addMethod(
  1094. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1095. smalltalk.method({
  1096. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1097. fn: function (){
  1098. var self=this;
  1099. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1100. return self;}
  1101. }),
  1102. smalltalk.PackageTest);
  1103. smalltalk.addMethod(
  1104. "_testGrulCommitPathStShouldBeGrulSt",
  1105. smalltalk.method({
  1106. selector: "testGrulCommitPathStShouldBeGrulSt",
  1107. fn: function (){
  1108. var self=this;
  1109. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1110. return self;}
  1111. }),
  1112. smalltalk.PackageTest);
  1113. smalltalk.addMethod(
  1114. "_testZorkCommitPathJsShouldBeJs",
  1115. smalltalk.method({
  1116. selector: "testZorkCommitPathJsShouldBeJs",
  1117. fn: function (){
  1118. var self=this;
  1119. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1120. return self;}
  1121. }),
  1122. smalltalk.PackageTest);
  1123. smalltalk.addMethod(
  1124. "_testZorkCommitPathStShouldBeSt",
  1125. smalltalk.method({
  1126. selector: "testZorkCommitPathStShouldBeSt",
  1127. fn: function (){
  1128. var self=this;
  1129. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1130. return self;}
  1131. }),
  1132. smalltalk.PackageTest);
  1133. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  1134. smalltalk.addMethod(
  1135. "_setUp",
  1136. smalltalk.method({
  1137. selector: "setUp",
  1138. fn: function (){
  1139. var self=this;
  1140. smalltalk.send(self, "_setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest.superclass || nil);
  1141. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", ["javascripts/"]);return smalltalk.send($rec, "_defaultCommitPathSt_", ["smalltalk/"]);})((smalltalk.Package || Package));
  1142. return self;}
  1143. }),
  1144. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1145. smalltalk.addMethod(
  1146. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1147. smalltalk.method({
  1148. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1149. fn: function (){
  1150. var self=this;
  1151. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1152. return self;}
  1153. }),
  1154. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1155. smalltalk.addMethod(
  1156. "_testGrulCommitPathStShouldBeGrulSt",
  1157. smalltalk.method({
  1158. selector: "testGrulCommitPathStShouldBeGrulSt",
  1159. fn: function (){
  1160. var self=this;
  1161. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1162. return self;}
  1163. }),
  1164. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1165. smalltalk.addMethod(
  1166. "_testZorkCommitPathJsShouldBeJavascript",
  1167. smalltalk.method({
  1168. selector: "testZorkCommitPathJsShouldBeJavascript",
  1169. fn: function (){
  1170. var self=this;
  1171. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1172. return self;}
  1173. }),
  1174. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1175. smalltalk.addMethod(
  1176. "_testZorkCommitPathStShouldBeSmalltalk",
  1177. smalltalk.method({
  1178. selector: "testZorkCommitPathStShouldBeSmalltalk",
  1179. fn: function (){
  1180. var self=this;
  1181. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1182. return self;}
  1183. }),
  1184. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1185. smalltalk.addMethod(
  1186. "_shouldInheritSelectors",
  1187. smalltalk.method({
  1188. selector: "shouldInheritSelectors",
  1189. fn: function (){
  1190. var self=this;
  1191. return false;
  1192. return self;}
  1193. }),
  1194. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  1195. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1196. smalltalk.addMethod(
  1197. "_testAccessing",
  1198. smalltalk.method({
  1199. selector: "testAccessing",
  1200. fn: function (){
  1201. var self=this;
  1202. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  1203. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  1204. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  1205. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  1206. return self;}
  1207. }),
  1208. smalltalk.PointTest);
  1209. smalltalk.addMethod(
  1210. "_testArithmetic",
  1211. smalltalk.method({
  1212. selector: "testArithmetic",
  1213. fn: function (){
  1214. var self=this;
  1215. 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)])]);
  1216. 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)])]);
  1217. 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)])]);
  1218. 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)])]);
  1219. return self;}
  1220. }),
  1221. smalltalk.PointTest);
  1222. smalltalk.addMethod(
  1223. "_testAt",
  1224. smalltalk.method({
  1225. selector: "testAt",
  1226. fn: function (){
  1227. var self=this;
  1228. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1229. return self;}
  1230. }),
  1231. smalltalk.PointTest);
  1232. smalltalk.addMethod(
  1233. "_testEgality",
  1234. smalltalk.method({
  1235. selector: "testEgality",
  1236. fn: function (){
  1237. var self=this;
  1238. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1239. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1240. return self;}
  1241. }),
  1242. smalltalk.PointTest);
  1243. smalltalk.addMethod(
  1244. "_testTranslateBy",
  1245. smalltalk.method({
  1246. selector: "testTranslateBy",
  1247. fn: function (){
  1248. var self=this;
  1249. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [(1)])])]);
  1250. 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", [])])])]);
  1251. smalltalk.send(self, "_assert_equals_", [smalltalk.send((5), "__at", [(6)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((2), "__at", [(3)])])]);
  1252. 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)])])]);
  1253. return self;}
  1254. }),
  1255. smalltalk.PointTest);
  1256. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1257. smalltalk.addMethod(
  1258. "_textNext",
  1259. smalltalk.method({
  1260. selector: "textNext",
  1261. fn: function (){
  1262. var self=this;
  1263. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1264. var next=nil;
  1265. (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]);})]);
  1266. return self;}
  1267. }),
  1268. smalltalk.RandomTest);
  1269. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1270. smalltalk.addMethod(
  1271. "_testAddRemove",
  1272. smalltalk.method({
  1273. selector: "testAddRemove",
  1274. fn: function (){
  1275. var self=this;
  1276. var set=nil;
  1277. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1278. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1279. smalltalk.send(set, "_add_", [(3)]);
  1280. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1281. smalltalk.send(set, "_add_", [(5)]);
  1282. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1283. smalltalk.send(set, "_remove_", [(3)]);
  1284. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1285. return self;}
  1286. }),
  1287. smalltalk.SetTest);
  1288. smalltalk.addMethod(
  1289. "_testAt",
  1290. smalltalk.method({
  1291. selector: "testAt",
  1292. fn: function (){
  1293. var self=this;
  1294. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1295. return self;}
  1296. }),
  1297. smalltalk.SetTest);
  1298. smalltalk.addMethod(
  1299. "_testPrintString",
  1300. smalltalk.method({
  1301. selector: "testPrintString",
  1302. fn: function (){
  1303. var self=this;
  1304. var set=nil;
  1305. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1306. smalltalk.send(self, "_assert_equals_", ["a Set ()", smalltalk.send(set, "_printString", [])]);
  1307. (function($rec){smalltalk.send($rec, "_add_", [(1)]);return smalltalk.send($rec, "_add_", [(3)]);})(set);
  1308. smalltalk.send(self, "_assert_equals_", ["a Set (1 3)", smalltalk.send(set, "_printString", [])]);
  1309. smalltalk.send(set, "_add_", ["foo"]);
  1310. smalltalk.send(self, "_assert_equals_", ["a Set (1 3 'foo')", smalltalk.send(set, "_printString", [])]);
  1311. (function($rec){smalltalk.send($rec, "_remove_", [(1)]);return smalltalk.send($rec, "_remove_", [(3)]);})(set);
  1312. smalltalk.send(self, "_assert_equals_", ["a Set ('foo')", smalltalk.send(set, "_printString", [])]);
  1313. smalltalk.send(set, "_add_", [(3)]);
  1314. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  1315. smalltalk.send(set, "_add_", [(3)]);
  1316. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  1317. return self;}
  1318. }),
  1319. smalltalk.SetTest);
  1320. smalltalk.addMethod(
  1321. "_testSize",
  1322. smalltalk.method({
  1323. selector: "testSize",
  1324. fn: function (){
  1325. var self=this;
  1326. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1327. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1328. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1329. return self;}
  1330. }),
  1331. smalltalk.SetTest);
  1332. smalltalk.addMethod(
  1333. "_testUnicity",
  1334. smalltalk.method({
  1335. selector: "testUnicity",
  1336. fn: function (){
  1337. var self=this;
  1338. var set=nil;
  1339. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1340. smalltalk.send(set, "_add_", [(21)]);
  1341. smalltalk.send(set, "_add_", ["hello"]);
  1342. smalltalk.send(set, "_add_", [(21)]);
  1343. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1344. smalltalk.send(set, "_add_", ["hello"]);
  1345. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1346. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1347. return self;}
  1348. }),
  1349. smalltalk.SetTest);
  1350. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1351. smalltalk.addMethod(
  1352. "_testAddRemove",
  1353. smalltalk.method({
  1354. selector: "testAddRemove",
  1355. fn: function (){
  1356. var self=this;
  1357. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  1358. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  1359. return self;}
  1360. }),
  1361. smalltalk.StringTest);
  1362. smalltalk.addMethod(
  1363. "_testAsArray",
  1364. smalltalk.method({
  1365. selector: "testAsArray",
  1366. fn: function (){
  1367. var self=this;
  1368. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  1369. return self;}
  1370. }),
  1371. smalltalk.StringTest);
  1372. smalltalk.addMethod(
  1373. "_testAt",
  1374. smalltalk.method({
  1375. selector: "testAt",
  1376. fn: function (){
  1377. var self=this;
  1378. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  1379. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  1380. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1381. return self;}
  1382. }),
  1383. smalltalk.StringTest);
  1384. smalltalk.addMethod(
  1385. "_testAtPut",
  1386. smalltalk.method({
  1387. selector: "testAtPut",
  1388. fn: function (){
  1389. var self=this;
  1390. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1391. return self;}
  1392. }),
  1393. smalltalk.StringTest);
  1394. smalltalk.addMethod(
  1395. "_testCopyWithoutAll",
  1396. smalltalk.method({
  1397. selector: "testCopyWithoutAll",
  1398. fn: function (){
  1399. var self=this;
  1400. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1401. return self;}
  1402. }),
  1403. smalltalk.StringTest);
  1404. smalltalk.addMethod(
  1405. "_testEquality",
  1406. smalltalk.method({
  1407. selector: "testEquality",
  1408. fn: function (){
  1409. var self=this;
  1410. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1411. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1412. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1413. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1414. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  1415. return self;}
  1416. }),
  1417. smalltalk.StringTest);
  1418. smalltalk.addMethod(
  1419. "_testIdentity",
  1420. smalltalk.method({
  1421. selector: "testIdentity",
  1422. fn: function (){
  1423. var self=this;
  1424. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1425. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1426. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1427. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1428. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [(0)])]);
  1429. return self;}
  1430. }),
  1431. smalltalk.StringTest);
  1432. smalltalk.addMethod(
  1433. "_testIncludesSubString",
  1434. smalltalk.method({
  1435. selector: "testIncludesSubString",
  1436. fn: function (){
  1437. var self=this;
  1438. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1439. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1440. return self;}
  1441. }),
  1442. smalltalk.StringTest);
  1443. smalltalk.addMethod(
  1444. "_testJoin",
  1445. smalltalk.method({
  1446. selector: "testJoin",
  1447. fn: function (){
  1448. var self=this;
  1449. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1450. return self;}
  1451. }),
  1452. smalltalk.StringTest);
  1453. smalltalk.addMethod(
  1454. "_testPrintString",
  1455. smalltalk.method({
  1456. selector: "testPrintString",
  1457. fn: function (){
  1458. var self=this;
  1459. smalltalk.send(self, "_assert_equals_", ["'test_string'", smalltalk.send("test_string", "_printString", [])]);
  1460. return self;}
  1461. }),
  1462. smalltalk.StringTest);
  1463. smalltalk.addMethod(
  1464. "_testSize",
  1465. smalltalk.method({
  1466. selector: "testSize",
  1467. fn: function (){
  1468. var self=this;
  1469. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  1470. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  1471. return self;}
  1472. }),
  1473. smalltalk.StringTest);
  1474. smalltalk.addMethod(
  1475. "_testStreamContents",
  1476. smalltalk.method({
  1477. selector: "testStreamContents",
  1478. fn: function (){
  1479. var self=this;
  1480. 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);})])]);
  1481. return self;}
  1482. }),
  1483. smalltalk.StringTest);
  1484. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1485. smalltalk.addMethod(
  1486. "_testAsString",
  1487. smalltalk.method({
  1488. selector: "testAsString",
  1489. fn: function (){
  1490. var self=this;
  1491. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1492. return self;}
  1493. }),
  1494. smalltalk.SymbolTest);
  1495. smalltalk.addMethod(
  1496. "_testAsSymbol",
  1497. smalltalk.method({
  1498. selector: "testAsSymbol",
  1499. fn: function (){
  1500. var self=this;
  1501. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1502. return self;}
  1503. }),
  1504. smalltalk.SymbolTest);
  1505. smalltalk.addMethod(
  1506. "_testAt",
  1507. smalltalk.method({
  1508. selector: "testAt",
  1509. fn: function (){
  1510. var self=this;
  1511. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  1512. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  1513. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1514. return self;}
  1515. }),
  1516. smalltalk.SymbolTest);
  1517. smalltalk.addMethod(
  1518. "_testAtPut",
  1519. smalltalk.method({
  1520. selector: "testAtPut",
  1521. fn: function (){
  1522. var self=this;
  1523. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1524. return self;}
  1525. }),
  1526. smalltalk.SymbolTest);
  1527. smalltalk.addMethod(
  1528. "_testComparing",
  1529. smalltalk.method({
  1530. selector: "testComparing",
  1531. fn: function (){
  1532. var self=this;
  1533. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  1534. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  1535. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1536. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1537. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  1538. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  1539. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1540. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1541. return self;}
  1542. }),
  1543. smalltalk.SymbolTest);
  1544. smalltalk.addMethod(
  1545. "_testCopying",
  1546. smalltalk.method({
  1547. selector: "testCopying",
  1548. fn: function (){
  1549. var self=this;
  1550. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1551. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1552. return self;}
  1553. }),
  1554. smalltalk.SymbolTest);
  1555. smalltalk.addMethod(
  1556. "_testEquality",
  1557. smalltalk.method({
  1558. selector: "testEquality",
  1559. fn: function (){
  1560. var self=this;
  1561. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1562. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1563. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1564. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1565. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1566. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1567. return self;}
  1568. }),
  1569. smalltalk.SymbolTest);
  1570. smalltalk.addMethod(
  1571. "_testIdentity",
  1572. smalltalk.method({
  1573. selector: "testIdentity",
  1574. fn: function (){
  1575. var self=this;
  1576. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1577. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1578. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1579. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1580. return self;}
  1581. }),
  1582. smalltalk.SymbolTest);
  1583. smalltalk.addMethod(
  1584. "_testIsSymbolIsString",
  1585. smalltalk.method({
  1586. selector: "testIsSymbolIsString",
  1587. fn: function (){
  1588. var self=this;
  1589. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1590. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1591. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1592. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1593. return self;}
  1594. }),
  1595. smalltalk.SymbolTest);
  1596. smalltalk.addMethod(
  1597. "_testPrintString",
  1598. smalltalk.method({
  1599. selector: "testPrintString",
  1600. fn: function (){
  1601. var self=this;
  1602. smalltalk.send(self, "_assert_equals_", ["#symbol", smalltalk.send(smalltalk.symbolFor("symbol"), "_printString", [])]);
  1603. return self;}
  1604. }),
  1605. smalltalk.SymbolTest);
  1606. smalltalk.addMethod(
  1607. "_testSize",
  1608. smalltalk.method({
  1609. selector: "testSize",
  1610. fn: function (){
  1611. var self=this;
  1612. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1613. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1614. return self;}
  1615. }),
  1616. smalltalk.SymbolTest);
  1617. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1618. smalltalk.addMethod(
  1619. "_testCopying",
  1620. smalltalk.method({
  1621. selector: "testCopying",
  1622. fn: function (){
  1623. var self=this;
  1624. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1625. return self;}
  1626. }),
  1627. smalltalk.UndefinedTest);
  1628. smalltalk.addMethod(
  1629. "_testDeepCopy",
  1630. smalltalk.method({
  1631. selector: "testDeepCopy",
  1632. fn: function (){
  1633. var self=this;
  1634. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1635. return self;}
  1636. }),
  1637. smalltalk.UndefinedTest);
  1638. smalltalk.addMethod(
  1639. "_testIfNil",
  1640. smalltalk.method({
  1641. selector: "testIfNil",
  1642. fn: function (){
  1643. var self=this;
  1644. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1645. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1646. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1647. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1648. return self;}
  1649. }),
  1650. smalltalk.UndefinedTest);
  1651. smalltalk.addMethod(
  1652. "_testIsNil",
  1653. smalltalk.method({
  1654. selector: "testIsNil",
  1655. fn: function (){
  1656. var self=this;
  1657. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1658. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1659. return self;}
  1660. }),
  1661. smalltalk.UndefinedTest);