Kernel-Tests.deploy.js 74 KB

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