Kernel-Tests.deploy.js 99 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCanClearInterval",
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. fn: function (){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { _st(self)._shouldnt_raise_((function(){
  10. return smalltalk.withContext(function($ctx2) { return _st(_st((function(){
  11. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  12. })}))._valueWithInterval_((0)))._clearInterval();
  13. })}),(smalltalk.Error || Error));
  14. return self}, self, "testCanClearInterval", [], smalltalk.BlockClosureTest)}
  15. }),
  16. smalltalk.BlockClosureTest);
  17. smalltalk.addMethod(
  18. "_testCanClearTimeout",
  19. smalltalk.method({
  20. selector: "testCanClearTimeout",
  21. fn: function (){
  22. var self=this;
  23. return smalltalk.withContext(function($ctx1) { _st(self)._shouldnt_raise_((function(){
  24. return smalltalk.withContext(function($ctx2) { return _st(_st((function(){
  25. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  26. })}))._valueWithTimeout_((0)))._clearTimeout();
  27. })}),(smalltalk.Error || Error));
  28. return self}, self, "testCanClearTimeout", [], smalltalk.BlockClosureTest)}
  29. }),
  30. smalltalk.BlockClosureTest);
  31. smalltalk.addMethod(
  32. "_testCompiledSource",
  33. smalltalk.method({
  34. selector: "testCompiledSource",
  35. fn: function (){
  36. var self=this;
  37. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((function(){
  38. return smalltalk.withContext(function($ctx2) { return _st((1)).__plus((1));
  39. })}))._compiledSource())._includesSubString_("function"));
  40. return self}, self, "testCompiledSource", [], smalltalk.BlockClosureTest)}
  41. }),
  42. smalltalk.BlockClosureTest);
  43. smalltalk.addMethod(
  44. "_testEnsure",
  45. smalltalk.method({
  46. selector: "testEnsure",
  47. fn: function (){
  48. var self=this;
  49. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_((3),_st((function(){
  50. return smalltalk.withContext(function($ctx2) { return (3);
  51. })}))._ensure_((function(){
  52. return smalltalk.withContext(function($ctx2) { return (4);
  53. })})));
  54. return self}, self, "testEnsure", [], smalltalk.BlockClosureTest)}
  55. }),
  56. smalltalk.BlockClosureTest);
  57. smalltalk.addMethod(
  58. "_testEnsureRaises",
  59. smalltalk.method({
  60. selector: "testEnsureRaises",
  61. fn: function (){
  62. var self=this;
  63. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  64. return smalltalk.withContext(function($ctx2) { return _st((function(){
  65. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  66. })}))._ensure_((function(){
  67. return smalltalk.withContext(function($ctx3) { return true;
  68. })}));
  69. })}),(smalltalk.Error || Error));
  70. return self}, self, "testEnsureRaises", [], smalltalk.BlockClosureTest)}
  71. }),
  72. smalltalk.BlockClosureTest);
  73. smalltalk.addMethod(
  74. "_testNumArgs",
  75. smalltalk.method({
  76. selector: "testNumArgs",
  77. fn: function (){
  78. var self=this;
  79. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  80. return smalltalk.withContext(function($ctx2) { })}))._numArgs(),(0));
  81. _st(self)._assert_equals_(_st((function(a,b){
  82. return smalltalk.withContext(function($ctx2) { })}))._numArgs(),(2));
  83. return self}, self, "testNumArgs", [], smalltalk.BlockClosureTest)}
  84. }),
  85. smalltalk.BlockClosureTest);
  86. smalltalk.addMethod(
  87. "_testOnDo",
  88. smalltalk.method({
  89. selector: "testOnDo",
  90. fn: function (){
  91. var self=this;
  92. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((function(){
  93. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  94. })}))._on_do_((smalltalk.Error || Error),(function(ex){
  95. return smalltalk.withContext(function($ctx2) { return true;
  96. })})));
  97. return self}, self, "testOnDo", [], smalltalk.BlockClosureTest)}
  98. }),
  99. smalltalk.BlockClosureTest);
  100. smalltalk.addMethod(
  101. "_testValue",
  102. smalltalk.method({
  103. selector: "testValue",
  104. fn: function (){
  105. var self=this;
  106. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  107. return smalltalk.withContext(function($ctx2) { return _st((1)).__plus((1));
  108. })}))._value(),(2));
  109. _st(self)._assert_equals_(_st((function(x){
  110. return smalltalk.withContext(function($ctx2) { return _st(x).__plus((1));
  111. })}))._value_((2)),(3));
  112. _st(self)._assert_equals_(_st((function(x,y){
  113. return smalltalk.withContext(function($ctx2) { return _st(x).__star(y);
  114. })}))._value_value_((2),(4)),(8));
  115. _st(self)._assert_equals_(_st((function(a,b,c){
  116. return smalltalk.withContext(function($ctx2) { return (1);
  117. })}))._value(),(1));
  118. return self}, self, "testValue", [], smalltalk.BlockClosureTest)}
  119. }),
  120. smalltalk.BlockClosureTest);
  121. smalltalk.addMethod(
  122. "_testValueWithPossibleArguments",
  123. smalltalk.method({
  124. selector: "testValueWithPossibleArguments",
  125. fn: function (){
  126. var self=this;
  127. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  128. return smalltalk.withContext(function($ctx2) { return (1);
  129. })}))._valueWithPossibleArguments_([(3), (4)]),(1));
  130. _st(self)._assert_equals_(_st((function(a){
  131. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((4));
  132. })}))._valueWithPossibleArguments_([(3), (4)]),(7));
  133. _st(self)._assert_equals_(_st((function(a,b){
  134. return smalltalk.withContext(function($ctx2) { return _st(a).__plus(b);
  135. })}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  136. return self}, self, "testValueWithPossibleArguments", [], smalltalk.BlockClosureTest)}
  137. }),
  138. smalltalk.BlockClosureTest);
  139. smalltalk.addMethod(
  140. "_testWhileFalse",
  141. smalltalk.method({
  142. selector: "testWhileFalse",
  143. fn: function (){
  144. var self=this;
  145. return smalltalk.withContext(function($ctx1) { $ctx1.locals.i=nil;
  146. $ctx1.locals.i=(0);
  147. _st((function(){
  148. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.i).__gt((5));
  149. })}))._whileFalse_((function(){
  150. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  151. return $ctx1.locals.i;
  152. })}));
  153. _st(self)._assert_equals_($ctx1.locals.i,(6));
  154. $ctx1.locals.i=(0);
  155. _st((function(){
  156. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  157. $ctx1.locals.i;
  158. return _st($ctx1.locals.i).__gt((5));
  159. })}))._whileFalse();
  160. _st(self)._assert_equals_($ctx1.locals.i,(6));
  161. return self}, self, "testWhileFalse", [], smalltalk.BlockClosureTest)}
  162. }),
  163. smalltalk.BlockClosureTest);
  164. smalltalk.addMethod(
  165. "_testWhileTrue",
  166. smalltalk.method({
  167. selector: "testWhileTrue",
  168. fn: function (){
  169. var self=this;
  170. return smalltalk.withContext(function($ctx1) { $ctx1.locals.i=nil;
  171. $ctx1.locals.i=(0);
  172. _st((function(){
  173. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.i).__lt((5));
  174. })}))._whileTrue_((function(){
  175. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  176. return $ctx1.locals.i;
  177. })}));
  178. _st(self)._assert_equals_($ctx1.locals.i,(5));
  179. $ctx1.locals.i=(0);
  180. _st((function(){
  181. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  182. $ctx1.locals.i;
  183. return _st($ctx1.locals.i).__lt((5));
  184. })}))._whileTrue();
  185. _st(self)._assert_equals_($ctx1.locals.i,(5));
  186. return self}, self, "testWhileTrue", [], smalltalk.BlockClosureTest)}
  187. }),
  188. smalltalk.BlockClosureTest);
  189. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  190. smalltalk.addMethod(
  191. "_testEquality",
  192. smalltalk.method({
  193. selector: "testEquality",
  194. fn: function (){
  195. var self=this;
  196. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq(false));
  197. _st(self)._deny_(_st(false).__eq((0)));
  198. _st(self)._deny_(_st("").__eq(false));
  199. _st(self)._deny_(_st(false).__eq(""));
  200. _st(self)._assert_(_st(true).__eq(true));
  201. _st(self)._deny_(_st(false).__eq(true));
  202. _st(self)._deny_(_st(true).__eq(false));
  203. _st(self)._assert_(_st(false).__eq(false));
  204. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  205. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  206. return self}, self, "testEquality", [], smalltalk.BooleanTest)}
  207. }),
  208. smalltalk.BooleanTest);
  209. smalltalk.addMethod(
  210. "_testIdentity",
  211. smalltalk.method({
  212. selector: "testIdentity",
  213. fn: function (){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq_eq(false));
  216. _st(self)._deny_(_st(false).__eq_eq((0)));
  217. _st(self)._deny_(_st("").__eq_eq(false));
  218. _st(self)._deny_(_st(false).__eq_eq(""));
  219. _st(self)._assert_(_st(true).__eq_eq(true));
  220. _st(self)._deny_(_st(false).__eq_eq(true));
  221. _st(self)._deny_(_st(true).__eq_eq(false));
  222. _st(self)._assert_(_st(false).__eq_eq(false));
  223. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  224. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  225. return self}, self, "testIdentity", [], smalltalk.BooleanTest)}
  226. }),
  227. smalltalk.BooleanTest);
  228. smalltalk.addMethod(
  229. "_testIfTrueIfFalse",
  230. smalltalk.method({
  231. selector: "testIfTrueIfFalse",
  232. fn: function (){
  233. var self=this;
  234. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  235. $1=self;
  236. if(smalltalk.assert(true)){
  237. $3="alternative block";
  238. };
  239. $2=_st($3).__eq("alternative block");
  240. _st($1)._assert_($2);
  241. $4=self;
  242. if(! smalltalk.assert(true)){
  243. $6="alternative block";
  244. };
  245. $5=_st($6).__eq(nil);
  246. _st($4)._assert_($5);
  247. $7=self;
  248. if(smalltalk.assert(false)){
  249. $9="alternative block";
  250. };
  251. $8=_st($9).__eq(nil);
  252. _st($7)._assert_($8);
  253. $10=self;
  254. if(! smalltalk.assert(false)){
  255. $12="alternative block";
  256. };
  257. $11=_st($12).__eq("alternative block");
  258. _st($10)._assert_($11);
  259. $13=self;
  260. if(smalltalk.assert(false)){
  261. $15="alternative block";
  262. } else {
  263. $15="alternative block2";
  264. };
  265. $14=_st($15).__eq("alternative block2");
  266. _st($13)._assert_($14);
  267. $16=self;
  268. if(smalltalk.assert(false)){
  269. $18="alternative block2";
  270. } else {
  271. $18="alternative block";
  272. };
  273. $17=_st($18).__eq("alternative block");
  274. _st($16)._assert_($17);
  275. $19=self;
  276. if(smalltalk.assert(true)){
  277. $21="alternative block";
  278. } else {
  279. $21="alternative block2";
  280. };
  281. $20=_st($21).__eq("alternative block");
  282. _st($19)._assert_($20);
  283. $22=self;
  284. if(smalltalk.assert(true)){
  285. $24="alternative block2";
  286. } else {
  287. $24="alternative block";
  288. };
  289. $23=_st($24).__eq("alternative block2");
  290. _st($22)._assert_($23);
  291. return self}, self, "testIfTrueIfFalse", [], smalltalk.BooleanTest)}
  292. }),
  293. smalltalk.BooleanTest);
  294. smalltalk.addMethod(
  295. "_testIfTrueIfFalseWithBoxing",
  296. smalltalk.method({
  297. selector: "testIfTrueIfFalseWithBoxing",
  298. fn: function (){
  299. var self=this;
  300. return smalltalk.withContext(function($ctx1) { var $1,$4,$3,$2,$5,$8,$7,$6,$9,$12,$11,$10,$13,$16,$15,$14,$17,$20,$19,$18,$21,$24,$23,$22,$25,$28,$27,$26,$29,$32,$31,$30;
  301. $1=self;
  302. $4=_st(true)._yourself();
  303. if(smalltalk.assert($4)){
  304. $3="alternative block";
  305. };
  306. $2=_st($3).__eq("alternative block");
  307. _st($1)._assert_($2);
  308. $5=self;
  309. $8=_st(true)._yourself();
  310. if(! smalltalk.assert($8)){
  311. $7="alternative block";
  312. };
  313. $6=_st($7).__eq(nil);
  314. _st($5)._assert_($6);
  315. $9=self;
  316. $12=_st(false)._yourself();
  317. if(smalltalk.assert($12)){
  318. $11="alternative block";
  319. };
  320. $10=_st($11).__eq(nil);
  321. _st($9)._assert_($10);
  322. $13=self;
  323. $16=_st(false)._yourself();
  324. if(! smalltalk.assert($16)){
  325. $15="alternative block";
  326. };
  327. $14=_st($15).__eq("alternative block");
  328. _st($13)._assert_($14);
  329. $17=self;
  330. $20=_st(false)._yourself();
  331. if(smalltalk.assert($20)){
  332. $19="alternative block";
  333. } else {
  334. $19="alternative block2";
  335. };
  336. $18=_st($19).__eq("alternative block2");
  337. _st($17)._assert_($18);
  338. $21=self;
  339. $24=_st(false)._yourself();
  340. if(smalltalk.assert($24)){
  341. $23="alternative block2";
  342. } else {
  343. $23="alternative block";
  344. };
  345. $22=_st($23).__eq("alternative block");
  346. _st($21)._assert_($22);
  347. $25=self;
  348. $28=_st(true)._yourself();
  349. if(smalltalk.assert($28)){
  350. $27="alternative block";
  351. } else {
  352. $27="alternative block2";
  353. };
  354. $26=_st($27).__eq("alternative block");
  355. _st($25)._assert_($26);
  356. $29=self;
  357. $32=_st(true)._yourself();
  358. if(smalltalk.assert($32)){
  359. $31="alternative block2";
  360. } else {
  361. $31="alternative block";
  362. };
  363. $30=_st($31).__eq("alternative block2");
  364. _st($29)._assert_($30);
  365. return self}, self, "testIfTrueIfFalseWithBoxing", [], smalltalk.BooleanTest)}
  366. }),
  367. smalltalk.BooleanTest);
  368. smalltalk.addMethod(
  369. "_testLogic",
  370. smalltalk.method({
  371. selector: "testLogic",
  372. fn: function (){
  373. var self=this;
  374. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8;
  375. $1=self;
  376. _st($1)._assert_(_st(true).__and(true));
  377. _st($1)._deny_(_st(true).__and(false));
  378. _st($1)._deny_(_st(false).__and(true));
  379. $2=_st($1)._deny_(_st(false).__and(false));
  380. $3=self;
  381. _st($3)._assert_(_st(true).__or(true));
  382. _st($3)._assert_(_st(true).__or(false));
  383. _st($3)._assert_(_st(false).__or(true));
  384. $4=_st($3)._deny_(_st(false).__or(false));
  385. $5=self;
  386. _st($5)._assert_(_st(true).__and(_st((1)).__gt((0))));
  387. _st($5)._deny_(_st(_st((1)).__gt((0))).__and(false));
  388. $6=_st($5)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  389. $7=self;
  390. _st($7)._assert_(_st(false).__or(_st((1)).__gt((0))));
  391. _st($7)._assert_(_st(_st((1)).__gt((0))).__or(false));
  392. $8=_st($7)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  393. return self}, self, "testLogic", [], smalltalk.BooleanTest)}
  394. }),
  395. smalltalk.BooleanTest);
  396. smalltalk.addMethod(
  397. "_testLogicKeywords",
  398. smalltalk.method({
  399. selector: "testLogicKeywords",
  400. fn: function (){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8;
  403. $1=self;
  404. _st($1)._assert_(_st(true)._and_((function(){
  405. return smalltalk.withContext(function($ctx2) { return true;
  406. })})));
  407. _st($1)._deny_(_st(true)._and_((function(){
  408. return smalltalk.withContext(function($ctx2) { return false;
  409. })})));
  410. _st($1)._deny_(_st(false)._and_((function(){
  411. return smalltalk.withContext(function($ctx2) { return true;
  412. })})));
  413. $2=_st($1)._deny_(_st(false)._and_((function(){
  414. return smalltalk.withContext(function($ctx2) { return false;
  415. })})));
  416. $3=self;
  417. _st($3)._assert_(_st(true)._or_((function(){
  418. return smalltalk.withContext(function($ctx2) { return true;
  419. })})));
  420. _st($3)._assert_(_st(true)._or_((function(){
  421. return smalltalk.withContext(function($ctx2) { return false;
  422. })})));
  423. _st($3)._assert_(_st(false)._or_((function(){
  424. return smalltalk.withContext(function($ctx2) { return true;
  425. })})));
  426. $4=_st($3)._deny_(_st(false)._or_((function(){
  427. return smalltalk.withContext(function($ctx2) { return false;
  428. })})));
  429. $5=self;
  430. _st($5)._assert_(_st(true)._and_((function(){
  431. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  432. })})));
  433. _st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  434. return smalltalk.withContext(function($ctx2) { return false;
  435. })})));
  436. $6=_st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  437. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  438. })})));
  439. $7=self;
  440. _st($7)._assert_(_st(false)._or_((function(){
  441. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  442. })})));
  443. _st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  444. return smalltalk.withContext(function($ctx2) { return false;
  445. })})));
  446. $8=_st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  447. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  448. })})));
  449. return self}, self, "testLogicKeywords", [], smalltalk.BooleanTest)}
  450. }),
  451. smalltalk.BooleanTest);
  452. smalltalk.addMethod(
  453. "_testNonBooleanError",
  454. smalltalk.method({
  455. selector: "testNonBooleanError",
  456. fn: function (){
  457. var self=this;
  458. return smalltalk.withContext(function($ctx1) { var $1,$2;
  459. $1=self;
  460. $2=(function(){
  461. return smalltalk.withContext(function($ctx2) { if(smalltalk.assert("")){
  462. } else {
  463. };
  464. })});
  465. _st($1)._should_raise_($2,(smalltalk.NonBooleanReceiver || NonBooleanReceiver));
  466. return self}, self, "testNonBooleanError", [], smalltalk.BooleanTest)}
  467. }),
  468. smalltalk.BooleanTest);
  469. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  470. smalltalk.addMethod(
  471. "_setUp",
  472. smalltalk.method({
  473. selector: "setUp",
  474. fn: function (){
  475. var self=this;
  476. return smalltalk.withContext(function($ctx1) { self["@builder"]=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
  477. return self}, self, "setUp", [], smalltalk.ClassBuilderTest)}
  478. }),
  479. smalltalk.ClassBuilderTest);
  480. smalltalk.addMethod(
  481. "_tearDown",
  482. smalltalk.method({
  483. selector: "tearDown",
  484. fn: function (){
  485. var self=this;
  486. return smalltalk.withContext(function($ctx1) { var $1;
  487. $1=self["@theClass"];
  488. if(($receiver = $1) == nil || $receiver == undefined){
  489. $1;
  490. } else {
  491. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(self["@theClass"]);
  492. self["@theClass"]=nil;
  493. self["@theClass"];
  494. };
  495. return self}, self, "tearDown", [], smalltalk.ClassBuilderTest)}
  496. }),
  497. smalltalk.ClassBuilderTest);
  498. smalltalk.addMethod(
  499. "_testClassCopy",
  500. smalltalk.method({
  501. selector: "testClassCopy",
  502. fn: function (){
  503. var self=this;
  504. return smalltalk.withContext(function($ctx1) { self["@theClass"]=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  505. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._superclass()));
  506. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._instanceVariableNames()));
  507. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  508. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._package()));
  509. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st((smalltalk.ObjectMock || ObjectMock))._methodDictionary())._keys());
  510. return self}, self, "testClassCopy", [], smalltalk.ClassBuilderTest)}
  511. }),
  512. smalltalk.ClassBuilderTest);
  513. smalltalk.addMethod(
  514. "_testInstanceVariableNames",
  515. smalltalk.method({
  516. selector: "testInstanceVariableNames",
  517. fn: function (){
  518. var self=this;
  519. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  520. return self}, self, "testInstanceVariableNames", [], smalltalk.ClassBuilderTest)}
  521. }),
  522. smalltalk.ClassBuilderTest);
  523. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  524. smalltalk.addMethod(
  525. "_assertSameContents_as_",
  526. smalltalk.method({
  527. selector: "assertSameContents:as:",
  528. fn: function (aCollection,anotherCollection){
  529. var self=this;
  530. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  531. _st(aCollection)._do_((function(each){
  532. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  533. })}));
  534. return self}, self, "assertSameContents:as:", [aCollection,anotherCollection], smalltalk.CollectionTest)}
  535. }),
  536. smalltalk.CollectionTest);
  537. smalltalk.addMethod(
  538. "_collection",
  539. smalltalk.method({
  540. selector: "collection",
  541. fn: function (){
  542. var self=this;
  543. return smalltalk.withContext(function($ctx1) { var $1;
  544. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  545. return $1;
  546. }, self, "collection", [], smalltalk.CollectionTest)}
  547. }),
  548. smalltalk.CollectionTest);
  549. smalltalk.addMethod(
  550. "_collectionClass",
  551. smalltalk.method({
  552. selector: "collectionClass",
  553. fn: function (){
  554. var self=this;
  555. return smalltalk.withContext(function($ctx1) { var $1;
  556. $1=_st(_st(self)._class())._collectionClass();
  557. return $1;
  558. }, self, "collectionClass", [], smalltalk.CollectionTest)}
  559. }),
  560. smalltalk.CollectionTest);
  561. smalltalk.addMethod(
  562. "_collectionWithDuplicates",
  563. smalltalk.method({
  564. selector: "collectionWithDuplicates",
  565. fn: function (){
  566. var self=this;
  567. return smalltalk.withContext(function($ctx1) { var $1;
  568. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  569. return $1;
  570. }, self, "collectionWithDuplicates", [], smalltalk.CollectionTest)}
  571. }),
  572. smalltalk.CollectionTest);
  573. smalltalk.addMethod(
  574. "_defaultValues",
  575. smalltalk.method({
  576. selector: "defaultValues",
  577. fn: function (){
  578. var self=this;
  579. return smalltalk.withContext(function($ctx1) { return [(1), (2), (3), (-4)];
  580. }, self, "defaultValues", [], smalltalk.CollectionTest)}
  581. }),
  582. smalltalk.CollectionTest);
  583. smalltalk.addMethod(
  584. "_isCollectionReadOnly",
  585. smalltalk.method({
  586. selector: "isCollectionReadOnly",
  587. fn: function (){
  588. var self=this;
  589. return smalltalk.withContext(function($ctx1) { return false;
  590. }, self, "isCollectionReadOnly", [], smalltalk.CollectionTest)}
  591. }),
  592. smalltalk.CollectionTest);
  593. smalltalk.addMethod(
  594. "_testAsArray",
  595. smalltalk.method({
  596. selector: "testAsArray",
  597. fn: function (){
  598. var self=this;
  599. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  600. return self}, self, "testAsArray", [], smalltalk.CollectionTest)}
  601. }),
  602. smalltalk.CollectionTest);
  603. smalltalk.addMethod(
  604. "_testAsOrderedCollection",
  605. smalltalk.method({
  606. selector: "testAsOrderedCollection",
  607. fn: function (){
  608. var self=this;
  609. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  610. return self}, self, "testAsOrderedCollection", [], smalltalk.CollectionTest)}
  611. }),
  612. smalltalk.CollectionTest);
  613. smalltalk.addMethod(
  614. "_testAsSet",
  615. smalltalk.method({
  616. selector: "testAsSet",
  617. fn: function (){
  618. var self=this;
  619. return smalltalk.withContext(function($ctx1) { $ctx1.locals.c=nil;
  620. $ctx1.locals.set=nil;
  621. $ctx1.locals.c=_st(self)._collectionWithDuplicates();
  622. $ctx1.locals.set=_st($ctx1.locals.c)._asSet();
  623. _st(self)._assert_(_st(_st($ctx1.locals.set)._size()).__eq((5)));
  624. _st($ctx1.locals.c)._do_((function(each){
  625. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st($ctx1.locals.set)._includes_(each));
  626. })}));
  627. return self}, self, "testAsSet", [], smalltalk.CollectionTest)}
  628. }),
  629. smalltalk.CollectionTest);
  630. smalltalk.addMethod(
  631. "_testCollect",
  632. smalltalk.method({
  633. selector: "testCollect",
  634. fn: function (){
  635. var self=this;
  636. return smalltalk.withContext(function($ctx1) { $ctx1.locals.newCollection=nil;
  637. $ctx1.locals.newCollection=[(1), (2), (3), (4)];
  638. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  639. return smalltalk.withContext(function($ctx2) { return _st(each)._abs();
  640. })})),$ctx1.locals.newCollection);
  641. return self}, self, "testCollect", [], smalltalk.CollectionTest)}
  642. }),
  643. smalltalk.CollectionTest);
  644. smalltalk.addMethod(
  645. "_testDetect",
  646. smalltalk.method({
  647. selector: "testDetect",
  648. fn: function (){
  649. var self=this;
  650. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  651. return smalltalk.withContext(function($ctx2) { return _st(each).__lt((0));
  652. })}))).__eq((-4)));
  653. _st(self)._should_raise_((function(){
  654. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  655. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  656. })}));
  657. })}),(smalltalk.Error || Error));
  658. return self}, self, "testDetect", [], smalltalk.CollectionTest)}
  659. }),
  660. smalltalk.CollectionTest);
  661. smalltalk.addMethod(
  662. "_testDo",
  663. smalltalk.method({
  664. selector: "testDo",
  665. fn: function (){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) { $ctx1.locals.newCollection=nil;
  668. $ctx1.locals.newCollection=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  669. _st(_st(self)._collection())._do_((function(each){
  670. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.newCollection)._add_(each);
  671. })}));
  672. _st(self)._assertSameContents_as_(_st(self)._collection(),$ctx1.locals.newCollection);
  673. return self}, self, "testDo", [], smalltalk.CollectionTest)}
  674. }),
  675. smalltalk.CollectionTest);
  676. smalltalk.addMethod(
  677. "_testIsEmpty",
  678. smalltalk.method({
  679. selector: "testIsEmpty",
  680. fn: function (){
  681. var self=this;
  682. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  683. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  684. return self}, self, "testIsEmpty", [], smalltalk.CollectionTest)}
  685. }),
  686. smalltalk.CollectionTest);
  687. smalltalk.addMethod(
  688. "_testSelect",
  689. smalltalk.method({
  690. selector: "testSelect",
  691. fn: function (){
  692. var self=this;
  693. return smalltalk.withContext(function($ctx1) { $ctx1.locals.newCollection=nil;
  694. $ctx1.locals.newCollection=[(2), (-4)];
  695. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  696. return smalltalk.withContext(function($ctx2) { return _st(each)._even();
  697. })})),$ctx1.locals.newCollection);
  698. return self}, self, "testSelect", [], smalltalk.CollectionTest)}
  699. }),
  700. smalltalk.CollectionTest);
  701. smalltalk.addMethod(
  702. "_testSize",
  703. smalltalk.method({
  704. selector: "testSize",
  705. fn: function (){
  706. var self=this;
  707. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(_st(self)._collectionClass())._new())._size()).__eq((0)));
  708. _st(self)._assert_(_st(_st(_st(self)._collection())._size()).__eq((4)));
  709. return self}, self, "testSize", [], smalltalk.CollectionTest)}
  710. }),
  711. smalltalk.CollectionTest);
  712. smalltalk.addMethod(
  713. "_collectionClass",
  714. smalltalk.method({
  715. selector: "collectionClass",
  716. fn: function (){
  717. var self=this;
  718. return smalltalk.withContext(function($ctx1) { return nil;
  719. }, self, "collectionClass", [], smalltalk.CollectionTest.klass)}
  720. }),
  721. smalltalk.CollectionTest.klass);
  722. smalltalk.addMethod(
  723. "_isAbstract",
  724. smalltalk.method({
  725. selector: "isAbstract",
  726. fn: function (){
  727. var self=this;
  728. return smalltalk.withContext(function($ctx1) { var $1;
  729. $1=_st(_st(self)._collectionClass())._isNil();
  730. return $1;
  731. }, self, "isAbstract", [], smalltalk.CollectionTest.klass)}
  732. }),
  733. smalltalk.CollectionTest.klass);
  734. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  735. smalltalk.addMethod(
  736. "_collection",
  737. smalltalk.method({
  738. selector: "collection",
  739. fn: function (){
  740. var self=this;
  741. return smalltalk.withContext(function($ctx1) { var $1;
  742. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  743. return $1;
  744. }, self, "collection", [], smalltalk.HashedCollectionTest)}
  745. }),
  746. smalltalk.HashedCollectionTest);
  747. smalltalk.addMethod(
  748. "_collectionWithDuplicates",
  749. smalltalk.method({
  750. selector: "collectionWithDuplicates",
  751. fn: function (){
  752. var self=this;
  753. return smalltalk.withContext(function($ctx1) { var $1;
  754. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4)),_st("e").__minus_gt((1)),_st("f").__minus_gt((2)),_st("g").__minus_gt((10))]);
  755. return $1;
  756. }, self, "collectionWithDuplicates", [], smalltalk.HashedCollectionTest)}
  757. }),
  758. smalltalk.HashedCollectionTest);
  759. smalltalk.addMethod(
  760. "_collectionClass",
  761. smalltalk.method({
  762. selector: "collectionClass",
  763. fn: function (){
  764. var self=this;
  765. return smalltalk.withContext(function($ctx1) { var $1;
  766. $1=(smalltalk.HashedCollection || HashedCollection);
  767. return $1;
  768. }, self, "collectionClass", [], smalltalk.HashedCollectionTest.klass)}
  769. }),
  770. smalltalk.HashedCollectionTest.klass);
  771. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  772. smalltalk.addMethod(
  773. "_collection",
  774. smalltalk.method({
  775. selector: "collection",
  776. fn: function (){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  779. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  780. _st($2)._at_put_((1),(1));
  781. _st($2)._at_put_("a",(2));
  782. _st($2)._at_put_(true,(3));
  783. _st($2)._at_put_((4),(-4));
  784. $3=_st($2)._yourself();
  785. $1=$3;
  786. return $1;
  787. }, self, "collection", [], smalltalk.DictionaryTest)}
  788. }),
  789. smalltalk.DictionaryTest);
  790. smalltalk.addMethod(
  791. "_collectionWithDuplicates",
  792. smalltalk.method({
  793. selector: "collectionWithDuplicates",
  794. fn: function (){
  795. var self=this;
  796. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  797. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  798. _st($2)._at_put_((1),(1));
  799. _st($2)._at_put_("a",(2));
  800. _st($2)._at_put_(true,(3));
  801. _st($2)._at_put_((4),(-4));
  802. _st($2)._at_put_("b",(1));
  803. _st($2)._at_put_((3),(3));
  804. _st($2)._at_put_(false,(12));
  805. $3=_st($2)._yourself();
  806. $1=$3;
  807. return $1;
  808. }, self, "collectionWithDuplicates", [], smalltalk.DictionaryTest)}
  809. }),
  810. smalltalk.DictionaryTest);
  811. smalltalk.addMethod(
  812. "_testAccessing",
  813. smalltalk.method({
  814. selector: "testAccessing",
  815. fn: function (){
  816. var self=this;
  817. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  818. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  819. _st($ctx1.locals.d)._at_put_("hello","world");
  820. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_("hello")).__eq("world"));
  821. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_ifAbsent_("hello",(function(){
  822. return smalltalk.withContext(function($ctx2) { return nil;
  823. })}))).__eq("world"));
  824. _st(self)._deny_(_st(_st($ctx1.locals.d)._at_ifAbsent_("foo",(function(){
  825. return smalltalk.withContext(function($ctx2) { return nil;
  826. })}))).__eq("world"));
  827. _st($ctx1.locals.d)._at_put_((1),(2));
  828. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_((1))).__eq((2)));
  829. _st($ctx1.locals.d)._at_put_(_st((1)).__at((3)),(3));
  830. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_(_st((1)).__at((3)))).__eq((3)));
  831. return self}, self, "testAccessing", [], smalltalk.DictionaryTest)}
  832. }),
  833. smalltalk.DictionaryTest);
  834. smalltalk.addMethod(
  835. "_testDynamicDictionaries",
  836. smalltalk.method({
  837. selector: "testDynamicDictionaries",
  838. fn: function (){
  839. var self=this;
  840. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.HashedCollection._fromPairs_([_st("hello").__minus_gt((1))]))._asDictionary()).__eq(_st((smalltalk.Dictionary || Dictionary))._with_(_st("hello").__minus_gt((1)))));
  841. return self}, self, "testDynamicDictionaries", [], smalltalk.DictionaryTest)}
  842. }),
  843. smalltalk.DictionaryTest);
  844. smalltalk.addMethod(
  845. "_testEquality",
  846. smalltalk.method({
  847. selector: "testEquality",
  848. fn: function (){
  849. var self=this;
  850. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  851. $ctx1.locals.d1=nil;
  852. $ctx1.locals.d2=nil;
  853. _st(self)._assert_(_st(_st((smalltalk.Dictionary || Dictionary))._new()).__eq(_st((smalltalk.Dictionary || Dictionary))._new()));
  854. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  855. _st($1)._at_put_((1),(2));
  856. $2=_st($1)._yourself();
  857. $ctx1.locals.d1=$2;
  858. $3=_st((smalltalk.Dictionary || Dictionary))._new();
  859. _st($3)._at_put_((1),(2));
  860. $4=_st($3)._yourself();
  861. $ctx1.locals.d2=$4;
  862. _st(self)._assert_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  863. $5=_st((smalltalk.Dictionary || Dictionary))._new();
  864. _st($5)._at_put_((1),(3));
  865. $6=_st($5)._yourself();
  866. $ctx1.locals.d2=$6;
  867. _st(self)._deny_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  868. $7=_st((smalltalk.Dictionary || Dictionary))._new();
  869. _st($7)._at_put_((2),(2));
  870. $8=_st($7)._yourself();
  871. $ctx1.locals.d2=$8;
  872. _st(self)._deny_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  873. $9=_st((smalltalk.Dictionary || Dictionary))._new();
  874. _st($9)._at_put_((1),(2));
  875. _st($9)._at_put_((3),(4));
  876. $10=_st($9)._yourself();
  877. $ctx1.locals.d2=$10;
  878. _st(self)._deny_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  879. return self}, self, "testEquality", [], smalltalk.DictionaryTest)}
  880. }),
  881. smalltalk.DictionaryTest);
  882. smalltalk.addMethod(
  883. "_testIfAbsent",
  884. smalltalk.method({
  885. selector: "testIfAbsent",
  886. fn: function (){
  887. var self=this;
  888. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  889. $ctx1.locals.visited=nil;
  890. $ctx1.locals.visited=false;
  891. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  892. _st($ctx1.locals.d)._at_ifAbsent_("hello",(function(){
  893. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=true;
  894. return $ctx1.locals.visited;
  895. })}));
  896. _st(self)._assert_($ctx1.locals.visited);
  897. return self}, self, "testIfAbsent", [], smalltalk.DictionaryTest)}
  898. }),
  899. smalltalk.DictionaryTest);
  900. smalltalk.addMethod(
  901. "_testIfPresent",
  902. smalltalk.method({
  903. selector: "testIfPresent",
  904. fn: function (){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  907. $ctx1.locals.visited=nil;
  908. $ctx1.locals.absent=nil;
  909. $ctx1.locals.visited=false;
  910. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  911. _st($ctx1.locals.d)._at_put_("hello","world");
  912. _st($ctx1.locals.d)._at_ifPresent_("hello",(function(value){
  913. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  914. return $ctx1.locals.visited;
  915. })}));
  916. _st(self)._assert_(_st($ctx1.locals.visited).__eq("world"));
  917. $ctx1.locals.absent=_st($ctx1.locals.d)._at_ifPresent_("bye",(function(value){
  918. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  919. return $ctx1.locals.visited;
  920. })}));
  921. _st(self)._assert_(_st($ctx1.locals.absent)._isNil());
  922. return self}, self, "testIfPresent", [], smalltalk.DictionaryTest)}
  923. }),
  924. smalltalk.DictionaryTest);
  925. smalltalk.addMethod(
  926. "_testIfPresentIfAbsent",
  927. smalltalk.method({
  928. selector: "testIfPresentIfAbsent",
  929. fn: function (){
  930. var self=this;
  931. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  932. $ctx1.locals.visited=nil;
  933. $ctx1.locals.visited=false;
  934. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  935. _st($ctx1.locals.d)._at_put_("hello","world");
  936. _st($ctx1.locals.d)._at_ifPresent_ifAbsent_("hello",(function(value){
  937. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  938. return $ctx1.locals.visited;
  939. })}),(function(){
  940. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=true;
  941. return $ctx1.locals.visited;
  942. })}));
  943. _st(self)._assert_(_st($ctx1.locals.visited).__eq("world"));
  944. _st($ctx1.locals.d)._at_ifPresent_ifAbsent_("buy",(function(value){
  945. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  946. return $ctx1.locals.visited;
  947. })}),(function(){
  948. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=true;
  949. return $ctx1.locals.visited;
  950. })}));
  951. _st(self)._assert_($ctx1.locals.visited);
  952. return self}, self, "testIfPresentIfAbsent", [], smalltalk.DictionaryTest)}
  953. }),
  954. smalltalk.DictionaryTest);
  955. smalltalk.addMethod(
  956. "_testKeys",
  957. smalltalk.method({
  958. selector: "testKeys",
  959. fn: function (){
  960. var self=this;
  961. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  962. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  963. _st($ctx1.locals.d)._at_put_((1),(2));
  964. _st($ctx1.locals.d)._at_put_((2),(3));
  965. _st($ctx1.locals.d)._at_put_((3),(4));
  966. _st(self)._assert_(_st(_st($ctx1.locals.d)._keys()).__eq([(1), (2), (3)]));
  967. return self}, self, "testKeys", [], smalltalk.DictionaryTest)}
  968. }),
  969. smalltalk.DictionaryTest);
  970. smalltalk.addMethod(
  971. "_testPrintString",
  972. smalltalk.method({
  973. selector: "testPrintString",
  974. fn: function (){
  975. var self=this;
  976. return smalltalk.withContext(function($ctx1) { var $1,$2;
  977. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  978. _st($1)._at_put_("firstname","James");
  979. _st($1)._at_put_("lastname","Bond");
  980. $2=_st($1)._printString();
  981. _st(self)._assert_equals_("a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2);
  982. return self}, self, "testPrintString", [], smalltalk.DictionaryTest)}
  983. }),
  984. smalltalk.DictionaryTest);
  985. smalltalk.addMethod(
  986. "_testRemoveKey",
  987. smalltalk.method({
  988. selector: "testRemoveKey",
  989. fn: function (){
  990. var self=this;
  991. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  992. $ctx1.locals.key=nil;
  993. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  994. _st($ctx1.locals.d)._at_put_((1),(2));
  995. _st($ctx1.locals.d)._at_put_((2),(3));
  996. _st($ctx1.locals.d)._at_put_((3),(4));
  997. $ctx1.locals.key=(2);
  998. _st(self)._assert_(_st(_st($ctx1.locals.d)._keys()).__eq([(1), (2), (3)]));
  999. _st($ctx1.locals.d)._removeKey_($ctx1.locals.key);
  1000. _st(self)._assert_(_st(_st($ctx1.locals.d)._keys()).__eq([(1), (3)]));
  1001. _st(self)._assert_(_st(_st($ctx1.locals.d)._values()).__eq([(2), (4)]));
  1002. _st(self)._deny_(_st($ctx1.locals.d)._includesKey_((2)));
  1003. return self}, self, "testRemoveKey", [], smalltalk.DictionaryTest)}
  1004. }),
  1005. smalltalk.DictionaryTest);
  1006. smalltalk.addMethod(
  1007. "_testRemoveKeyIfAbsent",
  1008. smalltalk.method({
  1009. selector: "testRemoveKeyIfAbsent",
  1010. fn: function (){
  1011. var self=this;
  1012. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  1013. $ctx1.locals.key=nil;
  1014. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  1015. _st($ctx1.locals.d)._at_put_((1),(2));
  1016. _st($ctx1.locals.d)._at_put_((2),(3));
  1017. _st($ctx1.locals.d)._at_put_((3),(4));
  1018. $ctx1.locals.key=(2);
  1019. _st(self)._assert_(_st(_st($ctx1.locals.d)._removeKey_($ctx1.locals.key)).__eq((3)));
  1020. $ctx1.locals.key=(3);
  1021. _st(self)._assert_(_st(_st($ctx1.locals.d)._removeKey_ifAbsent_($ctx1.locals.key,(function(){
  1022. return smalltalk.withContext(function($ctx2) { return (42);
  1023. })}))).__eq((4)));
  1024. $ctx1.locals.key="why";
  1025. _st(self)._assert_(_st(_st($ctx1.locals.d)._removeKey_ifAbsent_($ctx1.locals.key,(function(){
  1026. return smalltalk.withContext(function($ctx2) { return (42);
  1027. })}))).__eq((42)));
  1028. return self}, self, "testRemoveKeyIfAbsent", [], smalltalk.DictionaryTest)}
  1029. }),
  1030. smalltalk.DictionaryTest);
  1031. smalltalk.addMethod(
  1032. "_testSize",
  1033. smalltalk.method({
  1034. selector: "testSize",
  1035. fn: function (){
  1036. var self=this;
  1037. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  1038. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  1039. _st(self)._assert_(_st(_st($ctx1.locals.d)._size()).__eq((0)));
  1040. _st($ctx1.locals.d)._at_put_((1),(2));
  1041. _st(self)._assert_(_st(_st($ctx1.locals.d)._size()).__eq((1)));
  1042. _st($ctx1.locals.d)._at_put_((2),(3));
  1043. _st(self)._assert_(_st(_st($ctx1.locals.d)._size()).__eq((2)));
  1044. return self}, self, "testSize", [], smalltalk.DictionaryTest)}
  1045. }),
  1046. smalltalk.DictionaryTest);
  1047. smalltalk.addMethod(
  1048. "_testValues",
  1049. smalltalk.method({
  1050. selector: "testValues",
  1051. fn: function (){
  1052. var self=this;
  1053. return smalltalk.withContext(function($ctx1) { $ctx1.locals.d=nil;
  1054. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  1055. _st($ctx1.locals.d)._at_put_((1),(2));
  1056. _st($ctx1.locals.d)._at_put_((2),(3));
  1057. _st($ctx1.locals.d)._at_put_((3),(4));
  1058. _st(self)._assert_(_st(_st($ctx1.locals.d)._values()).__eq([(2), (3), (4)]));
  1059. return self}, self, "testValues", [], smalltalk.DictionaryTest)}
  1060. }),
  1061. smalltalk.DictionaryTest);
  1062. smalltalk.addMethod(
  1063. "_collectionClass",
  1064. smalltalk.method({
  1065. selector: "collectionClass",
  1066. fn: function (){
  1067. var self=this;
  1068. return smalltalk.withContext(function($ctx1) { var $1;
  1069. $1=(smalltalk.Dictionary || Dictionary);
  1070. return $1;
  1071. }, self, "collectionClass", [], smalltalk.DictionaryTest.klass)}
  1072. }),
  1073. smalltalk.DictionaryTest.klass);
  1074. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1075. smalltalk.addMethod(
  1076. "_testAt",
  1077. smalltalk.method({
  1078. selector: "testAt",
  1079. fn: function (){
  1080. var self=this;
  1081. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_((4))).__eq((-4)));
  1082. _st(self)._should_raise_((function(){
  1083. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._at_((5));
  1084. })}),(smalltalk.Error || Error));
  1085. return self}, self, "testAt", [], smalltalk.SequenceableCollectionTest)}
  1086. }),
  1087. smalltalk.SequenceableCollectionTest);
  1088. smalltalk.addMethod(
  1089. "_testAtIfAbsent",
  1090. smalltalk.method({
  1091. selector: "testAtIfAbsent",
  1092. fn: function (){
  1093. var self=this;
  1094. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  1095. return smalltalk.withContext(function($ctx2) { return "none";
  1096. })}))).__eq("none"));
  1097. return self}, self, "testAtIfAbsent", [], smalltalk.SequenceableCollectionTest)}
  1098. }),
  1099. smalltalk.SequenceableCollectionTest);
  1100. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1101. smalltalk.addMethod(
  1102. "_testAtIfAbsent",
  1103. smalltalk.method({
  1104. selector: "testAtIfAbsent",
  1105. fn: function (){
  1106. var self=this;
  1107. return smalltalk.withContext(function($ctx1) { $ctx1.locals.array=nil;
  1108. $ctx1.locals.array=["hello", "world"];
  1109. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_((1)),"hello");
  1110. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_((2)),"world");
  1111. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((2),(function(){
  1112. return smalltalk.withContext(function($ctx2) { return "not found";
  1113. })})),"world");
  1114. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((0),(function(){
  1115. return smalltalk.withContext(function($ctx2) { return "not found";
  1116. })})),"not found");
  1117. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((-10),(function(){
  1118. return smalltalk.withContext(function($ctx2) { return "not found";
  1119. })})),"not found");
  1120. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((3),(function(){
  1121. return smalltalk.withContext(function($ctx2) { return "not found";
  1122. })})),"not found");
  1123. return self}, self, "testAtIfAbsent", [], smalltalk.ArrayTest)}
  1124. }),
  1125. smalltalk.ArrayTest);
  1126. smalltalk.addMethod(
  1127. "_testFirstN",
  1128. smalltalk.method({
  1129. selector: "testFirstN",
  1130. fn: function (){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_([(1),(2),(3)],_st([(1),(2),(3),(4),(5)])._first_((3)));
  1133. return self}, self, "testFirstN", [], smalltalk.ArrayTest)}
  1134. }),
  1135. smalltalk.ArrayTest);
  1136. smalltalk.addMethod(
  1137. "_testIfEmpty",
  1138. smalltalk.method({
  1139. selector: "testIfEmpty",
  1140. fn: function (){
  1141. var self=this;
  1142. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("zork",_st("")._ifEmpty_((function(){
  1143. return smalltalk.withContext(function($ctx2) { return "zork";
  1144. })})));
  1145. return self}, self, "testIfEmpty", [], smalltalk.ArrayTest)}
  1146. }),
  1147. smalltalk.ArrayTest);
  1148. smalltalk.addMethod(
  1149. "_testPrintString",
  1150. smalltalk.method({
  1151. selector: "testPrintString",
  1152. fn: function (){
  1153. var self=this;
  1154. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  1155. $ctx1.locals.array=nil;
  1156. $ctx1.locals.array=_st((smalltalk.Array || Array))._new();
  1157. _st(self)._assert_equals_("a Array ()",_st($ctx1.locals.array)._printString());
  1158. $1=$ctx1.locals.array;
  1159. _st($1)._add_((1));
  1160. $2=_st($1)._add_((3));
  1161. _st(self)._assert_equals_("a Array (1 3)",_st($ctx1.locals.array)._printString());
  1162. _st($ctx1.locals.array)._add_("foo");
  1163. _st(self)._assert_equals_("a Array (1 3 'foo')",_st($ctx1.locals.array)._printString());
  1164. $3=$ctx1.locals.array;
  1165. _st($3)._remove_((1));
  1166. $4=_st($3)._remove_((3));
  1167. _st(self)._assert_equals_("a Array ('foo')",_st($ctx1.locals.array)._printString());
  1168. _st($ctx1.locals.array)._addLast_((3));
  1169. _st(self)._assert_equals_("a Array ('foo' 3)",_st($ctx1.locals.array)._printString());
  1170. _st($ctx1.locals.array)._addLast_((3));
  1171. _st(self)._assert_equals_("a Array ('foo' 3 3)",_st($ctx1.locals.array)._printString());
  1172. return self}, self, "testPrintString", [], smalltalk.ArrayTest)}
  1173. }),
  1174. smalltalk.ArrayTest);
  1175. smalltalk.addMethod(
  1176. "_collectionClass",
  1177. smalltalk.method({
  1178. selector: "collectionClass",
  1179. fn: function (){
  1180. var self=this;
  1181. return smalltalk.withContext(function($ctx1) { var $1;
  1182. $1=(smalltalk.Array || Array);
  1183. return $1;
  1184. }, self, "collectionClass", [], smalltalk.ArrayTest.klass)}
  1185. }),
  1186. smalltalk.ArrayTest.klass);
  1187. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1188. smalltalk.addMethod(
  1189. "_collection",
  1190. smalltalk.method({
  1191. selector: "collection",
  1192. fn: function (){
  1193. var self=this;
  1194. return smalltalk.withContext(function($ctx1) { return "hello";
  1195. }, self, "collection", [], smalltalk.StringTest)}
  1196. }),
  1197. smalltalk.StringTest);
  1198. smalltalk.addMethod(
  1199. "_collectionWithDuplicates",
  1200. smalltalk.method({
  1201. selector: "collectionWithDuplicates",
  1202. fn: function (){
  1203. var self=this;
  1204. return smalltalk.withContext(function($ctx1) { return "abbaerte";
  1205. }, self, "collectionWithDuplicates", [], smalltalk.StringTest)}
  1206. }),
  1207. smalltalk.StringTest);
  1208. smalltalk.addMethod(
  1209. "_testAddRemove",
  1210. smalltalk.method({
  1211. selector: "testAddRemove",
  1212. fn: function (){
  1213. var self=this;
  1214. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1215. return smalltalk.withContext(function($ctx2) { return _st("hello")._add_("a");
  1216. })}),(smalltalk.Error || Error));
  1217. _st(self)._should_raise_((function(){
  1218. return smalltalk.withContext(function($ctx2) { return _st("hello")._remove_("h");
  1219. })}),(smalltalk.Error || Error));
  1220. return self}, self, "testAddRemove", [], smalltalk.StringTest)}
  1221. }),
  1222. smalltalk.StringTest);
  1223. smalltalk.addMethod(
  1224. "_testAsArray",
  1225. smalltalk.method({
  1226. selector: "testAsArray",
  1227. fn: function (){
  1228. var self=this;
  1229. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._asArray()).__eq(["h", "e", "l", "l", "o"]));
  1230. return self}, self, "testAsArray", [], smalltalk.StringTest)}
  1231. }),
  1232. smalltalk.StringTest);
  1233. smalltalk.addMethod(
  1234. "_testAt",
  1235. smalltalk.method({
  1236. selector: "testAt",
  1237. fn: function (){
  1238. var self=this;
  1239. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._at_((1))).__eq("h"));
  1240. _st(self)._assert_(_st(_st("hello")._at_((5))).__eq("o"));
  1241. _st(self)._assert_(_st(_st("hello")._at_ifAbsent_((6),(function(){
  1242. return smalltalk.withContext(function($ctx2) { return nil;
  1243. })}))).__eq(nil));
  1244. return self}, self, "testAt", [], smalltalk.StringTest)}
  1245. }),
  1246. smalltalk.StringTest);
  1247. smalltalk.addMethod(
  1248. "_testAtPut",
  1249. smalltalk.method({
  1250. selector: "testAtPut",
  1251. fn: function (){
  1252. var self=this;
  1253. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1254. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1255. })}),(smalltalk.Error || Error));
  1256. return self}, self, "testAtPut", [], smalltalk.StringTest)}
  1257. }),
  1258. smalltalk.StringTest);
  1259. smalltalk.addMethod(
  1260. "_testCollect",
  1261. smalltalk.method({
  1262. selector: "testCollect",
  1263. fn: function (){
  1264. var self=this;
  1265. return smalltalk.withContext(function($ctx1) { $ctx1.locals.newCollection=nil;
  1266. $ctx1.locals.newCollection="hheelllloo";
  1267. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1268. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  1269. })})),$ctx1.locals.newCollection);
  1270. return self}, self, "testCollect", [], smalltalk.StringTest)}
  1271. }),
  1272. smalltalk.StringTest);
  1273. smalltalk.addMethod(
  1274. "_testCopyWithoutAll",
  1275. smalltalk.method({
  1276. selector: "testCopyWithoutAll",
  1277. fn: function (){
  1278. var self=this;
  1279. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello world",_st("*hello* *world*")._copyWithoutAll_("*"));
  1280. return self}, self, "testCopyWithoutAll", [], smalltalk.StringTest)}
  1281. }),
  1282. smalltalk.StringTest);
  1283. smalltalk.addMethod(
  1284. "_testDetect",
  1285. smalltalk.method({
  1286. selector: "testDetect",
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  1290. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  1291. })}))).__eq("h"));
  1292. _st(self)._should_raise_((function(){
  1293. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  1294. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  1295. })}));
  1296. })}),(smalltalk.Error || Error));
  1297. return self}, self, "testDetect", [], smalltalk.StringTest)}
  1298. }),
  1299. smalltalk.StringTest);
  1300. smalltalk.addMethod(
  1301. "_testEquality",
  1302. smalltalk.method({
  1303. selector: "testEquality",
  1304. fn: function (){
  1305. var self=this;
  1306. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq("hello"));
  1307. _st(self)._deny_(_st("hello").__eq("world"));
  1308. _st(self)._assert_(_st("hello").__eq(_st("hello")._yourself()));
  1309. _st(self)._assert_(_st(_st("hello")._yourself()).__eq("hello"));
  1310. _st(self)._deny_(_st("").__eq((0)));
  1311. return self}, self, "testEquality", [], smalltalk.StringTest)}
  1312. }),
  1313. smalltalk.StringTest);
  1314. smalltalk.addMethod(
  1315. "_testIdentity",
  1316. smalltalk.method({
  1317. selector: "testIdentity",
  1318. fn: function (){
  1319. var self=this;
  1320. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq_eq("hello"));
  1321. _st(self)._deny_(_st("hello").__eq_eq("world"));
  1322. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  1323. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  1324. _st(self)._deny_(_st("").__eq_eq((0)));
  1325. return self}, self, "testIdentity", [], smalltalk.StringTest)}
  1326. }),
  1327. smalltalk.StringTest);
  1328. smalltalk.addMethod(
  1329. "_testIncludesSubString",
  1330. smalltalk.method({
  1331. selector: "testIncludesSubString",
  1332. fn: function (){
  1333. var self=this;
  1334. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  1335. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  1336. return self}, self, "testIncludesSubString", [], smalltalk.StringTest)}
  1337. }),
  1338. smalltalk.StringTest);
  1339. smalltalk.addMethod(
  1340. "_testJoin",
  1341. smalltalk.method({
  1342. selector: "testJoin",
  1343. fn: function (){
  1344. var self=this;
  1345. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello,world",_st(",")._join_(["hello", "world"]));
  1346. return self}, self, "testJoin", [], smalltalk.StringTest)}
  1347. }),
  1348. smalltalk.StringTest);
  1349. smalltalk.addMethod(
  1350. "_testSelect",
  1351. smalltalk.method({
  1352. selector: "testSelect",
  1353. fn: function (){
  1354. var self=this;
  1355. return smalltalk.withContext(function($ctx1) { $ctx1.locals.newCollection=nil;
  1356. $ctx1.locals.newCollection="o";
  1357. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1358. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  1359. })})),$ctx1.locals.newCollection);
  1360. return self}, self, "testSelect", [], smalltalk.StringTest)}
  1361. }),
  1362. smalltalk.StringTest);
  1363. smalltalk.addMethod(
  1364. "_testSize",
  1365. smalltalk.method({
  1366. selector: "testSize",
  1367. fn: function (){
  1368. var self=this;
  1369. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  1370. _st(self)._assert_equals_(_st("")._size(),(0));
  1371. return self}, self, "testSize", [], smalltalk.StringTest)}
  1372. }),
  1373. smalltalk.StringTest);
  1374. smalltalk.addMethod(
  1375. "_testStreamContents",
  1376. smalltalk.method({
  1377. selector: "testStreamContents",
  1378. fn: function (){
  1379. var self=this;
  1380. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1381. _st(self)._assert_equals_("hello world",_st((smalltalk.String || String))._streamContents_((function(aStream){
  1382. return smalltalk.withContext(function($ctx2) { $1=aStream;
  1383. _st($1)._nextPutAll_("hello");
  1384. _st($1)._space();
  1385. $2=_st($1)._nextPutAll_("world");
  1386. return $2;
  1387. })})));
  1388. return self}, self, "testStreamContents", [], smalltalk.StringTest)}
  1389. }),
  1390. smalltalk.StringTest);
  1391. smalltalk.addMethod(
  1392. "_collectionClass",
  1393. smalltalk.method({
  1394. selector: "collectionClass",
  1395. fn: function (){
  1396. var self=this;
  1397. return smalltalk.withContext(function($ctx1) { var $1;
  1398. $1=(smalltalk.String || String);
  1399. return $1;
  1400. }, self, "collectionClass", [], smalltalk.StringTest.klass)}
  1401. }),
  1402. smalltalk.StringTest.klass);
  1403. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1404. smalltalk.addMethod(
  1405. "_collection",
  1406. smalltalk.method({
  1407. selector: "collection",
  1408. fn: function (){
  1409. var self=this;
  1410. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("hello");
  1411. }, self, "collection", [], smalltalk.SymbolTest)}
  1412. }),
  1413. smalltalk.SymbolTest);
  1414. smalltalk.addMethod(
  1415. "_collectionWithDuplicates",
  1416. smalltalk.method({
  1417. selector: "collectionWithDuplicates",
  1418. fn: function (){
  1419. var self=this;
  1420. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("phhaaarorra");
  1421. }, self, "collectionWithDuplicates", [], smalltalk.SymbolTest)}
  1422. }),
  1423. smalltalk.SymbolTest);
  1424. smalltalk.addMethod(
  1425. "_testAsString",
  1426. smalltalk.method({
  1427. selector: "testAsString",
  1428. fn: function (){
  1429. var self=this;
  1430. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._asString(),"hello");
  1431. return self}, self, "testAsString", [], smalltalk.SymbolTest)}
  1432. }),
  1433. smalltalk.SymbolTest);
  1434. smalltalk.addMethod(
  1435. "_testAsSymbol",
  1436. smalltalk.method({
  1437. selector: "testAsSymbol",
  1438. fn: function (){
  1439. var self=this;
  1440. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(_st(smalltalk.symbolFor("hello"))._asSymbol()));
  1441. return self}, self, "testAsSymbol", [], smalltalk.SymbolTest)}
  1442. }),
  1443. smalltalk.SymbolTest);
  1444. smalltalk.addMethod(
  1445. "_testAt",
  1446. smalltalk.method({
  1447. selector: "testAt",
  1448. fn: function (){
  1449. var self=this;
  1450. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((1))).__eq("h"));
  1451. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((5))).__eq("o"));
  1452. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_ifAbsent_((6),(function(){
  1453. return smalltalk.withContext(function($ctx2) { return nil;
  1454. })}))).__eq(nil));
  1455. return self}, self, "testAt", [], smalltalk.SymbolTest)}
  1456. }),
  1457. smalltalk.SymbolTest);
  1458. smalltalk.addMethod(
  1459. "_testAtPut",
  1460. smalltalk.method({
  1461. selector: "testAtPut",
  1462. fn: function (){
  1463. var self=this;
  1464. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1465. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1466. })}),(smalltalk.Error || Error));
  1467. return self}, self, "testAtPut", [], smalltalk.SymbolTest)}
  1468. }),
  1469. smalltalk.SymbolTest);
  1470. smalltalk.addMethod(
  1471. "_testCollect",
  1472. smalltalk.method({
  1473. selector: "testCollect",
  1474. fn: function (){
  1475. var self=this;
  1476. return smalltalk.withContext(function($ctx1) { $ctx1.locals.newCollection=nil;
  1477. $ctx1.locals.newCollection=smalltalk.symbolFor("hheelllloo");
  1478. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1479. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  1480. })})),$ctx1.locals.newCollection);
  1481. return self}, self, "testCollect", [], smalltalk.SymbolTest)}
  1482. }),
  1483. smalltalk.SymbolTest);
  1484. smalltalk.addMethod(
  1485. "_testComparing",
  1486. smalltalk.method({
  1487. selector: "testComparing",
  1488. fn: function (){
  1489. var self=this;
  1490. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("aa")));
  1491. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("ba")));
  1492. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt(smalltalk.symbolFor("ba")));
  1493. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt(smalltalk.symbolFor("ba")));
  1494. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("aa")));
  1495. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("ba")));
  1496. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt_eq(smalltalk.symbolFor("ba")));
  1497. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt_eq(smalltalk.symbolFor("ba")));
  1498. return self}, self, "testComparing", [], smalltalk.SymbolTest)}
  1499. }),
  1500. smalltalk.SymbolTest);
  1501. smalltalk.addMethod(
  1502. "_testCopying",
  1503. smalltalk.method({
  1504. selector: "testCopying",
  1505. fn: function (){
  1506. var self=this;
  1507. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._copy()).__eq_eq(smalltalk.symbolFor("hello")));
  1508. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._deepCopy()).__eq_eq(smalltalk.symbolFor("hello")));
  1509. return self}, self, "testCopying", [], smalltalk.SymbolTest)}
  1510. }),
  1511. smalltalk.SymbolTest);
  1512. smalltalk.addMethod(
  1513. "_testDetect",
  1514. smalltalk.method({
  1515. selector: "testDetect",
  1516. fn: function (){
  1517. var self=this;
  1518. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  1519. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  1520. })}))).__eq("h"));
  1521. _st(self)._should_raise_((function(){
  1522. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  1523. return smalltalk.withContext(function($ctx3) { return _st(each).__eq("z");
  1524. })}));
  1525. })}),(smalltalk.Error || Error));
  1526. return self}, self, "testDetect", [], smalltalk.SymbolTest)}
  1527. }),
  1528. smalltalk.SymbolTest);
  1529. smalltalk.addMethod(
  1530. "_testEquality",
  1531. smalltalk.method({
  1532. selector: "testEquality",
  1533. fn: function (){
  1534. var self=this;
  1535. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("hello")));
  1536. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("world")));
  1537. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  1538. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(smalltalk.symbolFor("hello")));
  1539. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq("hello"));
  1540. _st(self)._deny_(_st("hello").__eq(smalltalk.symbolFor("hello")));
  1541. return self}, self, "testEquality", [], smalltalk.SymbolTest)}
  1542. }),
  1543. smalltalk.SymbolTest);
  1544. smalltalk.addMethod(
  1545. "_testIdentity",
  1546. smalltalk.method({
  1547. selector: "testIdentity",
  1548. fn: function (){
  1549. var self=this;
  1550. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("hello")));
  1551. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("world")));
  1552. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  1553. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(_st(_st(smalltalk.symbolFor("hello"))._asString())._asSymbol()));
  1554. return self}, self, "testIdentity", [], smalltalk.SymbolTest)}
  1555. }),
  1556. smalltalk.SymbolTest);
  1557. smalltalk.addMethod(
  1558. "_testIsEmpty",
  1559. smalltalk.method({
  1560. selector: "testIsEmpty",
  1561. fn: function (){
  1562. var self=this;
  1563. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  1564. _st(self)._assert_(_st(_st("")._asSymbol())._isEmpty());
  1565. return self}, self, "testIsEmpty", [], smalltalk.SymbolTest)}
  1566. }),
  1567. smalltalk.SymbolTest);
  1568. smalltalk.addMethod(
  1569. "_testIsSymbolIsString",
  1570. smalltalk.method({
  1571. selector: "testIsSymbolIsString",
  1572. fn: function (){
  1573. var self=this;
  1574. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello"))._isSymbol());
  1575. _st(self)._deny_(_st("hello")._isSymbol());
  1576. _st(self)._deny_(_st(smalltalk.symbolFor("hello"))._isString());
  1577. _st(self)._assert_(_st("hello")._isString());
  1578. return self}, self, "testIsSymbolIsString", [], smalltalk.SymbolTest)}
  1579. }),
  1580. smalltalk.SymbolTest);
  1581. smalltalk.addMethod(
  1582. "_testSelect",
  1583. smalltalk.method({
  1584. selector: "testSelect",
  1585. fn: function (){
  1586. var self=this;
  1587. return smalltalk.withContext(function($ctx1) { $ctx1.locals.newCollection=nil;
  1588. $ctx1.locals.newCollection="o";
  1589. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1590. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  1591. })})),$ctx1.locals.newCollection);
  1592. return self}, self, "testSelect", [], smalltalk.SymbolTest)}
  1593. }),
  1594. smalltalk.SymbolTest);
  1595. smalltalk.addMethod(
  1596. "_testSize",
  1597. smalltalk.method({
  1598. selector: "testSize",
  1599. fn: function (){
  1600. var self=this;
  1601. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("a"))._size(),(1));
  1602. _st(self)._assert_equals_(_st(smalltalk.symbolFor("aaaaa"))._size(),(5));
  1603. return self}, self, "testSize", [], smalltalk.SymbolTest)}
  1604. }),
  1605. smalltalk.SymbolTest);
  1606. smalltalk.addMethod(
  1607. "_collectionClass",
  1608. smalltalk.method({
  1609. selector: "collectionClass",
  1610. fn: function (){
  1611. var self=this;
  1612. return smalltalk.withContext(function($ctx1) { var $1;
  1613. $1=(smalltalk.Symbol || Symbol);
  1614. return $1;
  1615. }, self, "collectionClass", [], smalltalk.SymbolTest.klass)}
  1616. }),
  1617. smalltalk.SymbolTest.klass);
  1618. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1619. smalltalk.addMethod(
  1620. "_jsObject",
  1621. smalltalk.method({
  1622. selector: "jsObject",
  1623. fn: function (){
  1624. var self=this;
  1625. return smalltalk.withContext(function($ctx1) { return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null};
  1626. return self}, self, "jsObject", [], smalltalk.JSObjectProxyTest)}
  1627. }),
  1628. smalltalk.JSObjectProxyTest);
  1629. smalltalk.addMethod(
  1630. "_testDNU",
  1631. smalltalk.method({
  1632. selector: "testDNU",
  1633. fn: function (){
  1634. var self=this;
  1635. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1636. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._jsObject())._foo();
  1637. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1638. return self}, self, "testDNU", [], smalltalk.JSObjectProxyTest)}
  1639. }),
  1640. smalltalk.JSObjectProxyTest);
  1641. smalltalk.addMethod(
  1642. "_testMessageSend",
  1643. smalltalk.method({
  1644. selector: "testMessageSend",
  1645. fn: function (){
  1646. var self=this;
  1647. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  1648. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  1649. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  1650. return self}, self, "testMessageSend", [], smalltalk.JSObjectProxyTest)}
  1651. }),
  1652. smalltalk.JSObjectProxyTest);
  1653. smalltalk.addMethod(
  1654. "_testMethodWithArguments",
  1655. smalltalk.method({
  1656. selector: "testMethodWithArguments",
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  1660. return self}, self, "testMethodWithArguments", [], smalltalk.JSObjectProxyTest)}
  1661. }),
  1662. smalltalk.JSObjectProxyTest);
  1663. smalltalk.addMethod(
  1664. "_testPrinting",
  1665. smalltalk.method({
  1666. selector: "testPrinting",
  1667. fn: function (){
  1668. var self=this;
  1669. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._jsObject())._printString()).__eq("[object Object]"));
  1670. return self}, self, "testPrinting", [], smalltalk.JSObjectProxyTest)}
  1671. }),
  1672. smalltalk.JSObjectProxyTest);
  1673. smalltalk.addMethod(
  1674. "_testPropertyThatReturnsEmptyString",
  1675. smalltalk.method({
  1676. selector: "testPropertyThatReturnsEmptyString",
  1677. fn: function (){
  1678. var self=this;
  1679. return smalltalk.withContext(function($ctx1) { $ctx1.locals.object=nil;
  1680. $ctx1.locals.object=_st(self)._jsObject();
  1681. _st(self)._assert_equals_("",_st($ctx1.locals.object)._d());
  1682. _st($ctx1.locals.object)._d_("hello");
  1683. _st(self)._assert_equals_("hello",_st($ctx1.locals.object)._d());
  1684. return self}, self, "testPropertyThatReturnsEmptyString", [], smalltalk.JSObjectProxyTest)}
  1685. }),
  1686. smalltalk.JSObjectProxyTest);
  1687. smalltalk.addMethod(
  1688. "_testPropertyThatReturnsUndefined",
  1689. smalltalk.method({
  1690. selector: "testPropertyThatReturnsUndefined",
  1691. fn: function (){
  1692. var self=this;
  1693. return smalltalk.withContext(function($ctx1) { $ctx1.locals.object=nil;
  1694. $ctx1.locals.object=_st(self)._jsObject();
  1695. _st(self)._shouldnt_raise_((function(){
  1696. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.object)._e();
  1697. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1698. _st(self)._assert_(_st(_st($ctx1.locals.object)._e())._isNil());
  1699. return self}, self, "testPropertyThatReturnsUndefined", [], smalltalk.JSObjectProxyTest)}
  1700. }),
  1701. smalltalk.JSObjectProxyTest);
  1702. smalltalk.addMethod(
  1703. "_testYourself",
  1704. smalltalk.method({
  1705. selector: "testYourself",
  1706. fn: function (){
  1707. var self=this;
  1708. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1709. $ctx1.locals.object=nil;
  1710. $1=_st(self)._jsObject();
  1711. _st($1)._d_("test");
  1712. $2=_st($1)._yourself();
  1713. $ctx1.locals.object=$2;
  1714. _st(self)._assert_equals_(_st($ctx1.locals.object)._d(),"test");
  1715. return self}, self, "testYourself", [], smalltalk.JSObjectProxyTest)}
  1716. }),
  1717. smalltalk.JSObjectProxyTest);
  1718. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1719. smalltalk.addMethod(
  1720. "_testAbs",
  1721. smalltalk.method({
  1722. selector: "testAbs",
  1723. fn: function (){
  1724. var self=this;
  1725. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._abs()).__eq((4)));
  1726. _st(self)._assert_(_st(_st((-4))._abs()).__eq((4)));
  1727. return self}, self, "testAbs", [], smalltalk.NumberTest)}
  1728. }),
  1729. smalltalk.NumberTest);
  1730. smalltalk.addMethod(
  1731. "_testArithmetic",
  1732. smalltalk.method({
  1733. selector: "testArithmetic",
  1734. fn: function (){
  1735. var self=this;
  1736. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1.5)).__plus((1))).__eq((2.5)));
  1737. _st(self)._assert_(_st(_st((2)).__minus((1))).__eq((1)));
  1738. _st(self)._assert_(_st(_st((-2)).__minus((1))).__eq((-3)));
  1739. _st(self)._assert_(_st(_st((12)).__slash((2))).__eq((6)));
  1740. _st(self)._assert_(_st(_st((3)).__star((4))).__eq((12)));
  1741. _st(self)._assert_(_st(_st(_st((1)).__plus((2))).__star((3))).__eq((9)));
  1742. _st(self)._assert_(_st(_st((1)).__plus(_st((2)).__star((3)))).__eq((7)));
  1743. return self}, self, "testArithmetic", [], smalltalk.NumberTest)}
  1744. }),
  1745. smalltalk.NumberTest);
  1746. smalltalk.addMethod(
  1747. "_testComparison",
  1748. smalltalk.method({
  1749. selector: "testComparison",
  1750. fn: function (){
  1751. var self=this;
  1752. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((3)).__gt((2)));
  1753. _st(self)._assert_(_st((2)).__lt((3)));
  1754. _st(self)._deny_(_st((3)).__lt((2)));
  1755. _st(self)._deny_(_st((2)).__gt((3)));
  1756. _st(self)._assert_(_st((3)).__gt_eq((3)));
  1757. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  1758. _st(self)._assert_(_st((3)).__lt_eq((3)));
  1759. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  1760. return self}, self, "testComparison", [], smalltalk.NumberTest)}
  1761. }),
  1762. smalltalk.NumberTest);
  1763. smalltalk.addMethod(
  1764. "_testCopying",
  1765. smalltalk.method({
  1766. selector: "testCopying",
  1767. fn: function (){
  1768. var self=this;
  1769. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  1770. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  1771. return self}, self, "testCopying", [], smalltalk.NumberTest)}
  1772. }),
  1773. smalltalk.NumberTest);
  1774. smalltalk.addMethod(
  1775. "_testEquality",
  1776. smalltalk.method({
  1777. selector: "testEquality",
  1778. fn: function (){
  1779. var self=this;
  1780. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq((1)));
  1781. _st(self)._assert_(_st((0)).__eq((0)));
  1782. _st(self)._deny_(_st((1)).__eq((0)));
  1783. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  1784. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  1785. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  1786. _st(self)._deny_(_st((0)).__eq(false));
  1787. _st(self)._deny_(_st(false).__eq((0)));
  1788. _st(self)._deny_(_st("").__eq((0)));
  1789. _st(self)._deny_(_st((0)).__eq(""));
  1790. return self}, self, "testEquality", [], smalltalk.NumberTest)}
  1791. }),
  1792. smalltalk.NumberTest);
  1793. smalltalk.addMethod(
  1794. "_testHexNumbers",
  1795. smalltalk.method({
  1796. selector: "testHexNumbers",
  1797. fn: function (){
  1798. var self=this;
  1799. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((9)).__eq((9)));
  1800. _st(self)._assert_(_st(_st((10))._truncated()).__eq((10)));
  1801. _st(self)._assert_(_st(_st((11))._truncated()).__eq((11)));
  1802. _st(self)._assert_(_st(_st((12))._truncated()).__eq((12)));
  1803. _st(self)._assert_(_st(_st((13))._truncated()).__eq((13)));
  1804. _st(self)._assert_(_st(_st((14))._truncated()).__eq((14)));
  1805. _st(self)._assert_(_st(_st((15))._truncated()).__eq((15)));
  1806. return self}, self, "testHexNumbers", [], smalltalk.NumberTest)}
  1807. }),
  1808. smalltalk.NumberTest);
  1809. smalltalk.addMethod(
  1810. "_testIdentity",
  1811. smalltalk.method({
  1812. selector: "testIdentity",
  1813. fn: function (){
  1814. var self=this;
  1815. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq_eq((1)));
  1816. _st(self)._assert_(_st((0)).__eq_eq((0)));
  1817. _st(self)._deny_(_st((1)).__eq_eq((0)));
  1818. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  1819. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  1820. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  1821. _st(self)._deny_(_st((1)).__eq_eq((2)));
  1822. return self}, self, "testIdentity", [], smalltalk.NumberTest)}
  1823. }),
  1824. smalltalk.NumberTest);
  1825. smalltalk.addMethod(
  1826. "_testInvalidHexNumbers",
  1827. smalltalk.method({
  1828. selector: "testInvalidHexNumbers",
  1829. fn: function (){
  1830. var self=this;
  1831. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1832. return smalltalk.withContext(function($ctx2) { return _st((16))._rG();
  1833. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1834. _st(self)._should_raise_((function(){
  1835. return smalltalk.withContext(function($ctx2) { return _st((16))._rg();
  1836. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1837. _st(self)._should_raise_((function(){
  1838. return smalltalk.withContext(function($ctx2) { return _st((16))._rH();
  1839. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1840. _st(self)._should_raise_((function(){
  1841. return smalltalk.withContext(function($ctx2) { return _st((16))._rh();
  1842. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1843. _st(self)._should_raise_((function(){
  1844. return smalltalk.withContext(function($ctx2) { return _st((16))._rI();
  1845. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1846. _st(self)._should_raise_((function(){
  1847. return smalltalk.withContext(function($ctx2) { return _st((16))._ri();
  1848. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1849. _st(self)._should_raise_((function(){
  1850. return smalltalk.withContext(function($ctx2) { return _st((16))._rJ();
  1851. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1852. _st(self)._should_raise_((function(){
  1853. return smalltalk.withContext(function($ctx2) { return _st((16))._rj();
  1854. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1855. _st(self)._should_raise_((function(){
  1856. return smalltalk.withContext(function($ctx2) { return _st((16))._rK();
  1857. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1858. _st(self)._should_raise_((function(){
  1859. return smalltalk.withContext(function($ctx2) { return _st((16))._rk();
  1860. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1861. _st(self)._should_raise_((function(){
  1862. return smalltalk.withContext(function($ctx2) { return _st((16))._rL();
  1863. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1864. _st(self)._should_raise_((function(){
  1865. return smalltalk.withContext(function($ctx2) { return _st((16))._rl();
  1866. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1867. _st(self)._should_raise_((function(){
  1868. return smalltalk.withContext(function($ctx2) { return _st((16))._rM();
  1869. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1870. _st(self)._should_raise_((function(){
  1871. return smalltalk.withContext(function($ctx2) { return _st((16))._rm();
  1872. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1873. _st(self)._should_raise_((function(){
  1874. return smalltalk.withContext(function($ctx2) { return _st((16))._rN();
  1875. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1876. _st(self)._should_raise_((function(){
  1877. return smalltalk.withContext(function($ctx2) { return _st((16))._rn();
  1878. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1879. _st(self)._should_raise_((function(){
  1880. return smalltalk.withContext(function($ctx2) { return _st((16))._rO();
  1881. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1882. _st(self)._should_raise_((function(){
  1883. return smalltalk.withContext(function($ctx2) { return _st((16))._ro();
  1884. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1885. _st(self)._should_raise_((function(){
  1886. return smalltalk.withContext(function($ctx2) { return _st((16))._rP();
  1887. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1888. _st(self)._should_raise_((function(){
  1889. return smalltalk.withContext(function($ctx2) { return _st((16))._rp();
  1890. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1891. _st(self)._should_raise_((function(){
  1892. return smalltalk.withContext(function($ctx2) { return _st((16))._rQ();
  1893. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1894. _st(self)._should_raise_((function(){
  1895. return smalltalk.withContext(function($ctx2) { return _st((16))._rq();
  1896. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1897. _st(self)._should_raise_((function(){
  1898. return smalltalk.withContext(function($ctx2) { return _st((16))._rR();
  1899. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1900. _st(self)._should_raise_((function(){
  1901. return smalltalk.withContext(function($ctx2) { return _st((16))._rr();
  1902. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1903. _st(self)._should_raise_((function(){
  1904. return smalltalk.withContext(function($ctx2) { return _st((16))._rS();
  1905. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1906. _st(self)._should_raise_((function(){
  1907. return smalltalk.withContext(function($ctx2) { return _st((16))._rs();
  1908. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1909. _st(self)._should_raise_((function(){
  1910. return smalltalk.withContext(function($ctx2) { return _st((16))._rT();
  1911. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1912. _st(self)._should_raise_((function(){
  1913. return smalltalk.withContext(function($ctx2) { return _st((16))._rt();
  1914. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1915. _st(self)._should_raise_((function(){
  1916. return smalltalk.withContext(function($ctx2) { return _st((16))._rU();
  1917. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1918. _st(self)._should_raise_((function(){
  1919. return smalltalk.withContext(function($ctx2) { return _st((16))._ru();
  1920. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1921. _st(self)._should_raise_((function(){
  1922. return smalltalk.withContext(function($ctx2) { return _st((16))._rV();
  1923. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1924. _st(self)._should_raise_((function(){
  1925. return smalltalk.withContext(function($ctx2) { return _st((16))._rv();
  1926. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1927. _st(self)._should_raise_((function(){
  1928. return smalltalk.withContext(function($ctx2) { return _st((16))._rW();
  1929. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1930. _st(self)._should_raise_((function(){
  1931. return smalltalk.withContext(function($ctx2) { return _st((16))._rw();
  1932. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1933. _st(self)._should_raise_((function(){
  1934. return smalltalk.withContext(function($ctx2) { return _st((16))._rX();
  1935. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1936. _st(self)._should_raise_((function(){
  1937. return smalltalk.withContext(function($ctx2) { return _st((16))._rx();
  1938. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1939. _st(self)._should_raise_((function(){
  1940. return smalltalk.withContext(function($ctx2) { return _st((16))._rY();
  1941. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1942. _st(self)._should_raise_((function(){
  1943. return smalltalk.withContext(function($ctx2) { return _st((16))._ry();
  1944. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1945. _st(self)._should_raise_((function(){
  1946. return smalltalk.withContext(function($ctx2) { return _st((16))._rZ();
  1947. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1948. _st(self)._should_raise_((function(){
  1949. return smalltalk.withContext(function($ctx2) { return _st((16))._rz();
  1950. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1951. _st(self)._should_raise_((function(){
  1952. return smalltalk.withContext(function($ctx2) { return _st((11259375))._Z();
  1953. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1954. return self}, self, "testInvalidHexNumbers", [], smalltalk.NumberTest)}
  1955. }),
  1956. smalltalk.NumberTest);
  1957. smalltalk.addMethod(
  1958. "_testMinMax",
  1959. smalltalk.method({
  1960. selector: "testMinMax",
  1961. fn: function (){
  1962. var self=this;
  1963. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  1964. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  1965. return self}, self, "testMinMax", [], smalltalk.NumberTest)}
  1966. }),
  1967. smalltalk.NumberTest);
  1968. smalltalk.addMethod(
  1969. "_testNegated",
  1970. smalltalk.method({
  1971. selector: "testNegated",
  1972. fn: function (){
  1973. var self=this;
  1974. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._negated()).__eq((-3)));
  1975. _st(self)._assert_(_st(_st((-3))._negated()).__eq((3)));
  1976. return self}, self, "testNegated", [], smalltalk.NumberTest)}
  1977. }),
  1978. smalltalk.NumberTest);
  1979. smalltalk.addMethod(
  1980. "_testPrintShowingDecimalPlaces",
  1981. smalltalk.method({
  1982. selector: "testPrintShowingDecimalPlaces",
  1983. fn: function (){
  1984. var self=this;
  1985. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("23.00",_st((23))._printShowingDecimalPlaces_((2)));
  1986. _st(self)._assert_equals_("23.57",_st((23.5698))._printShowingDecimalPlaces_((2)));
  1987. _st(self)._assert_equals_("-234.56700",_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)));
  1988. _st(self)._assert_equals_("23",_st((23.4567))._printShowingDecimalPlaces_((0)));
  1989. _st(self)._assert_equals_("24",_st((23.5567))._printShowingDecimalPlaces_((0)));
  1990. _st(self)._assert_equals_("-23",_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)));
  1991. _st(self)._assert_equals_("-24",_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)));
  1992. _st(self)._assert_equals_("100000000.0",_st((100000000))._printShowingDecimalPlaces_((1)));
  1993. _st(self)._assert_equals_("0.98000",_st((0.98))._printShowingDecimalPlaces_((5)));
  1994. _st(self)._assert_equals_("-0.98",_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)));
  1995. _st(self)._assert_equals_("2.57",_st((2.567))._printShowingDecimalPlaces_((2)));
  1996. _st(self)._assert_equals_("-2.57",_st((-2.567))._printShowingDecimalPlaces_((2)));
  1997. _st(self)._assert_equals_("0.00",_st((0))._printShowingDecimalPlaces_((2)));
  1998. return self}, self, "testPrintShowingDecimalPlaces", [], smalltalk.NumberTest)}
  1999. }),
  2000. smalltalk.NumberTest);
  2001. smalltalk.addMethod(
  2002. "_testRounded",
  2003. smalltalk.method({
  2004. selector: "testRounded",
  2005. fn: function (){
  2006. var self=this;
  2007. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._rounded()).__eq((3)));
  2008. _st(self)._assert_(_st(_st((3.212))._rounded()).__eq((3)));
  2009. _st(self)._assert_(_st(_st((3.51))._rounded()).__eq((4)));
  2010. return self}, self, "testRounded", [], smalltalk.NumberTest)}
  2011. }),
  2012. smalltalk.NumberTest);
  2013. smalltalk.addMethod(
  2014. "_testSqrt",
  2015. smalltalk.method({
  2016. selector: "testSqrt",
  2017. fn: function (){
  2018. var self=this;
  2019. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._sqrt()).__eq((2)));
  2020. _st(self)._assert_(_st(_st((16))._sqrt()).__eq((4)));
  2021. return self}, self, "testSqrt", [], smalltalk.NumberTest)}
  2022. }),
  2023. smalltalk.NumberTest);
  2024. smalltalk.addMethod(
  2025. "_testSquared",
  2026. smalltalk.method({
  2027. selector: "testSquared",
  2028. fn: function (){
  2029. var self=this;
  2030. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._squared()).__eq((16)));
  2031. return self}, self, "testSquared", [], smalltalk.NumberTest)}
  2032. }),
  2033. smalltalk.NumberTest);
  2034. smalltalk.addMethod(
  2035. "_testTimesRepeat",
  2036. smalltalk.method({
  2037. selector: "testTimesRepeat",
  2038. fn: function (){
  2039. var self=this;
  2040. return smalltalk.withContext(function($ctx1) { $ctx1.locals.i=nil;
  2041. $ctx1.locals.i=(0);
  2042. _st((0))._timesRepeat_((function(){
  2043. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  2044. return $ctx1.locals.i;
  2045. })}));
  2046. _st(self)._assert_equals_($ctx1.locals.i,(0));
  2047. _st((5))._timesRepeat_((function(){
  2048. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  2049. return $ctx1.locals.i;
  2050. })}));
  2051. _st(self)._assert_equals_($ctx1.locals.i,(5));
  2052. return self}, self, "testTimesRepeat", [], smalltalk.NumberTest)}
  2053. }),
  2054. smalltalk.NumberTest);
  2055. smalltalk.addMethod(
  2056. "_testTo",
  2057. smalltalk.method({
  2058. selector: "testTo",
  2059. fn: function (){
  2060. var self=this;
  2061. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  2062. return self}, self, "testTo", [], smalltalk.NumberTest)}
  2063. }),
  2064. smalltalk.NumberTest);
  2065. smalltalk.addMethod(
  2066. "_testToBy",
  2067. smalltalk.method({
  2068. selector: "testToBy",
  2069. fn: function (){
  2070. var self=this;
  2071. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  2072. _st(self)._should_raise_((function(){
  2073. return smalltalk.withContext(function($ctx2) { return _st((1))._to_by_((4),(0));
  2074. })}),(smalltalk.Error || Error));
  2075. return self}, self, "testToBy", [], smalltalk.NumberTest)}
  2076. }),
  2077. smalltalk.NumberTest);
  2078. smalltalk.addMethod(
  2079. "_testTruncated",
  2080. smalltalk.method({
  2081. selector: "testTruncated",
  2082. fn: function (){
  2083. var self=this;
  2084. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._truncated()).__eq((3)));
  2085. _st(self)._assert_(_st(_st((3.212))._truncated()).__eq((3)));
  2086. _st(self)._assert_(_st(_st((3.51))._truncated()).__eq((3)));
  2087. return self}, self, "testTruncated", [], smalltalk.NumberTest)}
  2088. }),
  2089. smalltalk.NumberTest);
  2090. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  2091. smalltalk.addMethod(
  2092. "_foo",
  2093. smalltalk.method({
  2094. selector: "foo",
  2095. fn: function (){
  2096. var self=this;
  2097. return smalltalk.withContext(function($ctx1) { var $1;
  2098. $1=self["@foo"];
  2099. return $1;
  2100. }, self, "foo", [], smalltalk.ObjectMock)}
  2101. }),
  2102. smalltalk.ObjectMock);
  2103. smalltalk.addMethod(
  2104. "_foo_",
  2105. smalltalk.method({
  2106. selector: "foo:",
  2107. fn: function (anObject){
  2108. var self=this;
  2109. return smalltalk.withContext(function($ctx1) { self["@foo"]=anObject;
  2110. return self}, self, "foo:", [anObject], smalltalk.ObjectMock)}
  2111. }),
  2112. smalltalk.ObjectMock);
  2113. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2114. smalltalk.addMethod(
  2115. "_notDefined",
  2116. smalltalk.method({
  2117. selector: "notDefined",
  2118. fn: function (){
  2119. var self=this;
  2120. return smalltalk.withContext(function($ctx1) { return undefined;;
  2121. return self}, self, "notDefined", [], smalltalk.ObjectTest)}
  2122. }),
  2123. smalltalk.ObjectTest);
  2124. smalltalk.addMethod(
  2125. "_testBasicAccess",
  2126. smalltalk.method({
  2127. selector: "testBasicAccess",
  2128. fn: function (){
  2129. var self=this;
  2130. return smalltalk.withContext(function($ctx1) { $ctx1.locals.o=nil;
  2131. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  2132. _st($ctx1.locals.o)._basicAt_put_("a",(1));
  2133. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicAt_("a"),(1));
  2134. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicAt_("b"),nil);
  2135. return self}, self, "testBasicAccess", [], smalltalk.ObjectTest)}
  2136. }),
  2137. smalltalk.ObjectTest);
  2138. smalltalk.addMethod(
  2139. "_testBasicPerform",
  2140. smalltalk.method({
  2141. selector: "testBasicPerform",
  2142. fn: function (){
  2143. var self=this;
  2144. return smalltalk.withContext(function($ctx1) { $ctx1.locals.o=nil;
  2145. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  2146. _st($ctx1.locals.o)._basicAt_put_("func",(function(){
  2147. return smalltalk.withContext(function($ctx2) { return "hello";
  2148. })}));
  2149. _st($ctx1.locals.o)._basicAt_put_("func2",(function(a){
  2150. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((1));
  2151. })}));
  2152. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicPerform_("func"),"hello");
  2153. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicPerform_withArguments_("func2",[(3)]),(4));
  2154. return self}, self, "testBasicPerform", [], smalltalk.ObjectTest)}
  2155. }),
  2156. smalltalk.ObjectTest);
  2157. smalltalk.addMethod(
  2158. "_testDNU",
  2159. smalltalk.method({
  2160. selector: "testDNU",
  2161. fn: function (){
  2162. var self=this;
  2163. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2164. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._foo();
  2165. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2166. return self}, self, "testDNU", [], smalltalk.ObjectTest)}
  2167. }),
  2168. smalltalk.ObjectTest);
  2169. smalltalk.addMethod(
  2170. "_testEquality",
  2171. smalltalk.method({
  2172. selector: "testEquality",
  2173. fn: function (){
  2174. var self=this;
  2175. return smalltalk.withContext(function($ctx1) { $ctx1.locals.o=nil;
  2176. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  2177. _st(self)._deny_(_st($ctx1.locals.o).__eq(_st((smalltalk.Object || Object))._new()));
  2178. _st(self)._assert_(_st($ctx1.locals.o).__eq($ctx1.locals.o));
  2179. _st(self)._assert_(_st(_st($ctx1.locals.o)._yourself()).__eq($ctx1.locals.o));
  2180. _st(self)._assert_(_st($ctx1.locals.o).__eq(_st($ctx1.locals.o)._yourself()));
  2181. return self}, self, "testEquality", [], smalltalk.ObjectTest)}
  2182. }),
  2183. smalltalk.ObjectTest);
  2184. smalltalk.addMethod(
  2185. "_testHalt",
  2186. smalltalk.method({
  2187. selector: "testHalt",
  2188. fn: function (){
  2189. var self=this;
  2190. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2191. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._halt();
  2192. })}),(smalltalk.Error || Error));
  2193. return self}, self, "testHalt", [], smalltalk.ObjectTest)}
  2194. }),
  2195. smalltalk.ObjectTest);
  2196. smalltalk.addMethod(
  2197. "_testIdentity",
  2198. smalltalk.method({
  2199. selector: "testIdentity",
  2200. fn: function (){
  2201. var self=this;
  2202. return smalltalk.withContext(function($ctx1) { $ctx1.locals.o=nil;
  2203. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  2204. _st(self)._deny_(_st($ctx1.locals.o).__eq_eq(_st((smalltalk.Object || Object))._new()));
  2205. _st(self)._assert_(_st($ctx1.locals.o).__eq_eq($ctx1.locals.o));
  2206. _st(self)._assert_(_st(_st($ctx1.locals.o)._yourself()).__eq_eq($ctx1.locals.o));
  2207. _st(self)._assert_(_st($ctx1.locals.o).__eq_eq(_st($ctx1.locals.o)._yourself()));
  2208. return self}, self, "testIdentity", [], smalltalk.ObjectTest)}
  2209. }),
  2210. smalltalk.ObjectTest);
  2211. smalltalk.addMethod(
  2212. "_testIfNil",
  2213. smalltalk.method({
  2214. selector: "testIfNil",
  2215. fn: function (){
  2216. var self=this;
  2217. return smalltalk.withContext(function($ctx1) { var $1,$4,$3,$2,$5,$8,$7,$6,$9,$12,$11,$10;
  2218. _st(self)._deny_(_st(_st((smalltalk.Object || Object))._new())._isNil());
  2219. $1=self;
  2220. $4=_st((smalltalk.Object || Object))._new();
  2221. if(($receiver = $4) == nil || $receiver == undefined){
  2222. $3=true;
  2223. } else {
  2224. $3=$4;
  2225. };
  2226. $2=_st($3).__eq(true);
  2227. _st($1)._deny_($2);
  2228. $5=self;
  2229. $8=_st((smalltalk.Object || Object))._new();
  2230. if(($receiver = $8) == nil || $receiver == undefined){
  2231. $7=$8;
  2232. } else {
  2233. $7=true;
  2234. };
  2235. $6=_st($7).__eq(true);
  2236. _st($5)._assert_($6);
  2237. $9=self;
  2238. $12=_st((smalltalk.Object || Object))._new();
  2239. if(($receiver = $12) == nil || $receiver == undefined){
  2240. $11=false;
  2241. } else {
  2242. $11=true;
  2243. };
  2244. $10=_st($11).__eq(true);
  2245. _st($9)._assert_($10);
  2246. _st(self)._assert_(_st(_st(_st((smalltalk.Object || Object))._new())._ifNotNil_ifNil_((function(){
  2247. return smalltalk.withContext(function($ctx2) { return true;
  2248. })}),(function(){
  2249. return smalltalk.withContext(function($ctx2) { return false;
  2250. })}))).__eq(true));
  2251. return self}, self, "testIfNil", [], smalltalk.ObjectTest)}
  2252. }),
  2253. smalltalk.ObjectTest);
  2254. smalltalk.addMethod(
  2255. "_testInstVars",
  2256. smalltalk.method({
  2257. selector: "testInstVars",
  2258. fn: function (){
  2259. var self=this;
  2260. return smalltalk.withContext(function($ctx1) { $ctx1.locals.o=nil;
  2261. $ctx1.locals.o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  2262. _st(self)._assert_equals_(_st($ctx1.locals.o)._instVarAt_(smalltalk.symbolFor("foo")),nil);
  2263. _st($ctx1.locals.o)._instVarAt_put_(smalltalk.symbolFor("foo"),(1));
  2264. _st(self)._assert_equals_(_st($ctx1.locals.o)._instVarAt_(smalltalk.symbolFor("foo")),(1));
  2265. _st(self)._assert_equals_(_st($ctx1.locals.o)._instVarAt_("foo"),(1));
  2266. return self}, self, "testInstVars", [], smalltalk.ObjectTest)}
  2267. }),
  2268. smalltalk.ObjectTest);
  2269. smalltalk.addMethod(
  2270. "_testNilUndefined",
  2271. smalltalk.method({
  2272. selector: "testNilUndefined",
  2273. fn: function (){
  2274. var self=this;
  2275. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil).__eq(_st(self)._notDefined()));
  2276. return self}, self, "testNilUndefined", [], smalltalk.ObjectTest)}
  2277. }),
  2278. smalltalk.ObjectTest);
  2279. smalltalk.addMethod(
  2280. "_testYourself",
  2281. smalltalk.method({
  2282. selector: "testYourself",
  2283. fn: function (){
  2284. var self=this;
  2285. return smalltalk.withContext(function($ctx1) { $ctx1.locals.o=nil;
  2286. $ctx1.locals.o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  2287. _st(self)._assert_(_st(_st($ctx1.locals.o)._yourself()).__eq_eq($ctx1.locals.o));
  2288. return self}, self, "testYourself", [], smalltalk.ObjectTest)}
  2289. }),
  2290. smalltalk.ObjectTest);
  2291. smalltalk.addMethod(
  2292. "_testidentityHash",
  2293. smalltalk.method({
  2294. selector: "testidentityHash",
  2295. fn: function (){
  2296. var self=this;
  2297. return smalltalk.withContext(function($ctx1) { $ctx1.locals.o1=nil;
  2298. $ctx1.locals.o2=nil;
  2299. $ctx1.locals.o1=_st((smalltalk.Object || Object))._new();
  2300. $ctx1.locals.o2=_st((smalltalk.Object || Object))._new();
  2301. _st(self)._assert_(_st(_st($ctx1.locals.o1)._identityHash()).__eq_eq(_st($ctx1.locals.o1)._identityHash()));
  2302. _st(self)._deny_(_st(_st($ctx1.locals.o1)._identityHash()).__eq_eq(_st($ctx1.locals.o2)._identityHash()));
  2303. return self}, self, "testidentityHash", [], smalltalk.ObjectTest)}
  2304. }),
  2305. smalltalk.ObjectTest);
  2306. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2307. smalltalk.addMethod(
  2308. "_setUp",
  2309. smalltalk.method({
  2310. selector: "setUp",
  2311. fn: function (){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2314. self["@backUpCommitPathJs"]=_st((smalltalk.Package || Package))._defaultCommitPathJs();
  2315. self["@backUpCommitPathSt"]=_st((smalltalk.Package || Package))._defaultCommitPathSt();
  2316. _st((smalltalk.Package || Package))._resetCommitPaths();
  2317. self["@zorkPackage"]=_st(_st((smalltalk.Package || Package))._new())._name_("Zork");
  2318. $1=_st((smalltalk.Package || Package))._new();
  2319. _st($1)._name_("Grul");
  2320. _st($1)._commitPathJs_("server/grul/js");
  2321. _st($1)._commitPathSt_("grul/st");
  2322. $2=_st($1)._yourself();
  2323. self["@grulPackage"]=$2;
  2324. return self}, self, "setUp", [], smalltalk.PackageTest)}
  2325. }),
  2326. smalltalk.PackageTest);
  2327. smalltalk.addMethod(
  2328. "_tearDown",
  2329. smalltalk.method({
  2330. selector: "tearDown",
  2331. fn: function (){
  2332. var self=this;
  2333. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2334. $1=(smalltalk.Package || Package);
  2335. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2336. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2337. return self}, self, "tearDown", [], smalltalk.PackageTest)}
  2338. }),
  2339. smalltalk.PackageTest);
  2340. smalltalk.addMethod(
  2341. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2342. smalltalk.method({
  2343. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2344. fn: function (){
  2345. var self=this;
  2346. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  2347. return self}, self, "testGrulCommitPathJsShouldBeServerGrulJs", [], smalltalk.PackageTest)}
  2348. }),
  2349. smalltalk.PackageTest);
  2350. smalltalk.addMethod(
  2351. "_testGrulCommitPathStShouldBeGrulSt",
  2352. smalltalk.method({
  2353. selector: "testGrulCommitPathStShouldBeGrulSt",
  2354. fn: function (){
  2355. var self=this;
  2356. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  2357. return self}, self, "testGrulCommitPathStShouldBeGrulSt", [], smalltalk.PackageTest)}
  2358. }),
  2359. smalltalk.PackageTest);
  2360. smalltalk.addMethod(
  2361. "_testZorkCommitPathJsShouldBeJs",
  2362. smalltalk.method({
  2363. selector: "testZorkCommitPathJsShouldBeJs",
  2364. fn: function (){
  2365. var self=this;
  2366. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("js",_st(self["@zorkPackage"])._commitPathJs());
  2367. return self}, self, "testZorkCommitPathJsShouldBeJs", [], smalltalk.PackageTest)}
  2368. }),
  2369. smalltalk.PackageTest);
  2370. smalltalk.addMethod(
  2371. "_testZorkCommitPathStShouldBeSt",
  2372. smalltalk.method({
  2373. selector: "testZorkCommitPathStShouldBeSt",
  2374. fn: function (){
  2375. var self=this;
  2376. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("st",_st(self["@zorkPackage"])._commitPathSt());
  2377. return self}, self, "testZorkCommitPathStShouldBeSt", [], smalltalk.PackageTest)}
  2378. }),
  2379. smalltalk.PackageTest);
  2380. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2381. smalltalk.addMethod(
  2382. "_setUp",
  2383. smalltalk.method({
  2384. selector: "setUp",
  2385. fn: function (){
  2386. var self=this;
  2387. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2388. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  2389. $1=(smalltalk.Package || Package);
  2390. _st($1)._defaultCommitPathJs_("javascripts/");
  2391. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2392. return self}, self, "setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2393. }),
  2394. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2395. smalltalk.addMethod(
  2396. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2397. smalltalk.method({
  2398. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2399. fn: function (){
  2400. var self=this;
  2401. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  2402. return self}, self, "testGrulCommitPathJsShouldBeServerGrulJs", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2403. }),
  2404. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2405. smalltalk.addMethod(
  2406. "_testGrulCommitPathStShouldBeGrulSt",
  2407. smalltalk.method({
  2408. selector: "testGrulCommitPathStShouldBeGrulSt",
  2409. fn: function (){
  2410. var self=this;
  2411. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  2412. return self}, self, "testGrulCommitPathStShouldBeGrulSt", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2413. }),
  2414. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2415. smalltalk.addMethod(
  2416. "_testZorkCommitPathJsShouldBeJavascript",
  2417. smalltalk.method({
  2418. selector: "testZorkCommitPathJsShouldBeJavascript",
  2419. fn: function (){
  2420. var self=this;
  2421. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("javascripts/",_st(self["@zorkPackage"])._commitPathJs());
  2422. return self}, self, "testZorkCommitPathJsShouldBeJavascript", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2423. }),
  2424. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2425. smalltalk.addMethod(
  2426. "_testZorkCommitPathStShouldBeSmalltalk",
  2427. smalltalk.method({
  2428. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2429. fn: function (){
  2430. var self=this;
  2431. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("smalltalk/",_st(self["@zorkPackage"])._commitPathSt());
  2432. return self}, self, "testZorkCommitPathStShouldBeSmalltalk", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2433. }),
  2434. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2435. smalltalk.addMethod(
  2436. "_shouldInheritSelectors",
  2437. smalltalk.method({
  2438. selector: "shouldInheritSelectors",
  2439. fn: function (){
  2440. var self=this;
  2441. return smalltalk.withContext(function($ctx1) { return false;
  2442. }, self, "shouldInheritSelectors", [], smalltalk.PackageWithDefaultCommitPathChangedTest.klass)}
  2443. }),
  2444. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2445. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2446. smalltalk.addMethod(
  2447. "_testAccessing",
  2448. smalltalk.method({
  2449. selector: "testAccessing",
  2450. fn: function (){
  2451. var self=this;
  2452. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._x(),(3));
  2453. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._y(),(4));
  2454. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._x_((3)))._x(),(3));
  2455. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._y_((4)))._y(),(4));
  2456. return self}, self, "testAccessing", [], smalltalk.PointTest)}
  2457. }),
  2458. smalltalk.PointTest);
  2459. smalltalk.addMethod(
  2460. "_testArithmetic",
  2461. smalltalk.method({
  2462. selector: "testArithmetic",
  2463. fn: function (){
  2464. var self=this;
  2465. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((3)).__at((4))).__star(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((9),(16)));
  2466. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((6),(8)));
  2467. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((0),(0)));
  2468. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((2),(2)));
  2469. return self}, self, "testArithmetic", [], smalltalk.PointTest)}
  2470. }),
  2471. smalltalk.PointTest);
  2472. smalltalk.addMethod(
  2473. "_testAt",
  2474. smalltalk.method({
  2475. selector: "testAt",
  2476. fn: function (){
  2477. var self=this;
  2478. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st((smalltalk.Point || Point))._x_y_((3),(4)));
  2479. return self}, self, "testAt", [], smalltalk.PointTest)}
  2480. }),
  2481. smalltalk.PointTest);
  2482. smalltalk.addMethod(
  2483. "_testEgality",
  2484. smalltalk.method({
  2485. selector: "testEgality",
  2486. fn: function (){
  2487. var self=this;
  2488. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  2489. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  2490. return self}, self, "testEgality", [], smalltalk.PointTest)}
  2491. }),
  2492. smalltalk.PointTest);
  2493. smalltalk.addMethod(
  2494. "_testTranslateBy",
  2495. smalltalk.method({
  2496. selector: "testTranslateBy",
  2497. fn: function (){
  2498. var self=this;
  2499. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))));
  2500. _st(self)._assert_equals_(_st((3)).__at((2)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())));
  2501. _st(self)._assert_equals_(_st((5)).__at((6)),_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))));
  2502. _st(self)._assert_equals_(_st((0)).__at((3)),_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))));
  2503. return self}, self, "testTranslateBy", [], smalltalk.PointTest)}
  2504. }),
  2505. smalltalk.PointTest);
  2506. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2507. smalltalk.addMethod(
  2508. "_textNext",
  2509. smalltalk.method({
  2510. selector: "textNext",
  2511. fn: function (){
  2512. var self=this;
  2513. return smalltalk.withContext(function($ctx1) { _st((10000))._timesRepeat_((function(){
  2514. return smalltalk.withContext(function($ctx2) { $ctx2.locals.current=nil;
  2515. $ctx2.locals.next=nil;
  2516. $ctx2.locals.next=_st(_st((smalltalk.Random || Random))._new())._next();
  2517. $ctx2.locals.next;
  2518. _st(self)._assert_(_st($ctx2.locals.next).__gt_eq((0)));
  2519. _st(self)._assert_(_st($ctx2.locals.next).__lt((1)));
  2520. _st(self)._deny_(_st($ctx2.locals.current).__eq($ctx2.locals.next));
  2521. return _st($ctx2.locals.next).__eq($ctx2.locals.current);
  2522. })}));
  2523. return self}, self, "textNext", [], smalltalk.RandomTest)}
  2524. }),
  2525. smalltalk.RandomTest);
  2526. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2527. smalltalk.addMethod(
  2528. "_testAddRemove",
  2529. smalltalk.method({
  2530. selector: "testAddRemove",
  2531. fn: function (){
  2532. var self=this;
  2533. return smalltalk.withContext(function($ctx1) { $ctx1.locals.set=nil;
  2534. $ctx1.locals.set=_st((smalltalk.Set || Set))._new();
  2535. _st(self)._assert_(_st($ctx1.locals.set)._isEmpty());
  2536. _st($ctx1.locals.set)._add_((3));
  2537. _st(self)._assert_(_st($ctx1.locals.set)._includes_((3)));
  2538. _st($ctx1.locals.set)._add_((5));
  2539. _st(self)._assert_(_st($ctx1.locals.set)._includes_((5)));
  2540. _st($ctx1.locals.set)._remove_((3));
  2541. _st(self)._deny_(_st($ctx1.locals.set)._includes_((3)));
  2542. return self}, self, "testAddRemove", [], smalltalk.SetTest)}
  2543. }),
  2544. smalltalk.SetTest);
  2545. smalltalk.addMethod(
  2546. "_testAt",
  2547. smalltalk.method({
  2548. selector: "testAt",
  2549. fn: function (){
  2550. var self=this;
  2551. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2552. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Set || Set))._new())._at_put_((1),(2));
  2553. })}),(smalltalk.Error || Error));
  2554. return self}, self, "testAt", [], smalltalk.SetTest)}
  2555. }),
  2556. smalltalk.SetTest);
  2557. smalltalk.addMethod(
  2558. "_testPrintString",
  2559. smalltalk.method({
  2560. selector: "testPrintString",
  2561. fn: function (){
  2562. var self=this;
  2563. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  2564. $ctx1.locals.set=nil;
  2565. $ctx1.locals.set=_st((smalltalk.Set || Set))._new();
  2566. _st(self)._assert_equals_("a Set ()",_st($ctx1.locals.set)._printString());
  2567. $1=$ctx1.locals.set;
  2568. _st($1)._add_((1));
  2569. $2=_st($1)._add_((3));
  2570. _st(self)._assert_equals_("a Set (1 3)",_st($ctx1.locals.set)._printString());
  2571. _st($ctx1.locals.set)._add_("foo");
  2572. _st(self)._assert_equals_("a Set (1 3 'foo')",_st($ctx1.locals.set)._printString());
  2573. $3=$ctx1.locals.set;
  2574. _st($3)._remove_((1));
  2575. $4=_st($3)._remove_((3));
  2576. _st(self)._assert_equals_("a Set ('foo')",_st($ctx1.locals.set)._printString());
  2577. _st($ctx1.locals.set)._add_((3));
  2578. _st(self)._assert_equals_("a Set ('foo' 3)",_st($ctx1.locals.set)._printString());
  2579. _st($ctx1.locals.set)._add_((3));
  2580. _st(self)._assert_equals_("a Set ('foo' 3)",_st($ctx1.locals.set)._printString());
  2581. return self}, self, "testPrintString", [], smalltalk.SetTest)}
  2582. }),
  2583. smalltalk.SetTest);
  2584. smalltalk.addMethod(
  2585. "_testSize",
  2586. smalltalk.method({
  2587. selector: "testSize",
  2588. fn: function (){
  2589. var self=this;
  2590. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._new())._size(),(0));
  2591. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (2), (3), (4)]))._size(),(4));
  2592. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (1), (1), (1)]))._size(),(1));
  2593. return self}, self, "testSize", [], smalltalk.SetTest)}
  2594. }),
  2595. smalltalk.SetTest);
  2596. smalltalk.addMethod(
  2597. "_testUnicity",
  2598. smalltalk.method({
  2599. selector: "testUnicity",
  2600. fn: function (){
  2601. var self=this;
  2602. return smalltalk.withContext(function($ctx1) { $ctx1.locals.set=nil;
  2603. $ctx1.locals.set=_st((smalltalk.Set || Set))._new();
  2604. _st($ctx1.locals.set)._add_((21));
  2605. _st($ctx1.locals.set)._add_("hello");
  2606. _st($ctx1.locals.set)._add_((21));
  2607. _st(self)._assert_(_st(_st($ctx1.locals.set)._size()).__eq((2)));
  2608. _st($ctx1.locals.set)._add_("hello");
  2609. _st(self)._assert_(_st(_st($ctx1.locals.set)._size()).__eq((2)));
  2610. _st(self)._assert_equals_(_st($ctx1.locals.set)._asArray(),[(21), "hello"]);
  2611. return self}, self, "testUnicity", [], smalltalk.SetTest)}
  2612. }),
  2613. smalltalk.SetTest);
  2614. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2615. smalltalk.addMethod(
  2616. "_testCopying",
  2617. smalltalk.method({
  2618. selector: "testCopying",
  2619. fn: function (){
  2620. var self=this;
  2621. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(nil)._copy(),nil);
  2622. return self}, self, "testCopying", [], smalltalk.UndefinedTest)}
  2623. }),
  2624. smalltalk.UndefinedTest);
  2625. smalltalk.addMethod(
  2626. "_testDeepCopy",
  2627. smalltalk.method({
  2628. selector: "testDeepCopy",
  2629. fn: function (){
  2630. var self=this;
  2631. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  2632. return self}, self, "testDeepCopy", [], smalltalk.UndefinedTest)}
  2633. }),
  2634. smalltalk.UndefinedTest);
  2635. smalltalk.addMethod(
  2636. "_testIfNil",
  2637. smalltalk.method({
  2638. selector: "testIfNil",
  2639. fn: function (){
  2640. var self=this;
  2641. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$5,$4,$6,$7;
  2642. $1=self;
  2643. if(($receiver = nil) == nil || $receiver == undefined){
  2644. $2=true;
  2645. } else {
  2646. $2=nil;
  2647. };
  2648. _st($1)._assert_equals_($2,true);
  2649. $3=self;
  2650. if(($receiver = nil) == nil || $receiver == undefined){
  2651. $5=nil;
  2652. } else {
  2653. $5=true;
  2654. };
  2655. $4=_st($5).__eq(true);
  2656. _st($3)._deny_($4);
  2657. $6=self;
  2658. if(($receiver = nil) == nil || $receiver == undefined){
  2659. $7=true;
  2660. } else {
  2661. $7=false;
  2662. };
  2663. _st($6)._assert_equals_($7,true);
  2664. _st(self)._deny_(_st(_st(nil)._ifNotNil_ifNil_((function(){
  2665. return smalltalk.withContext(function($ctx2) { return true;
  2666. })}),(function(){
  2667. return smalltalk.withContext(function($ctx2) { return false;
  2668. })}))).__eq(true));
  2669. return self}, self, "testIfNil", [], smalltalk.UndefinedTest)}
  2670. }),
  2671. smalltalk.UndefinedTest);
  2672. smalltalk.addMethod(
  2673. "_testIsNil",
  2674. smalltalk.method({
  2675. selector: "testIsNil",
  2676. fn: function (){
  2677. var self=this;
  2678. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil)._isNil());
  2679. _st(self)._deny_(_st(nil)._notNil());
  2680. return self}, self, "testIsNil", [], smalltalk.UndefinedTest)}
  2681. }),
  2682. smalltalk.UndefinedTest);