Kernel-Tests.deploy.js 142 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681
  1. smalltalk.addPackage('Kernel-Tests');
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "testCanClearInterval",
  6. fn: function (){
  7. var self=this;
  8. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  9. return smalltalk.withContext(function($ctx1) {
  10. _st(self)._shouldnt_raise_((function(){
  11. return smalltalk.withContext(function($ctx2) {
  12. return _st(_st((function(){
  13. return smalltalk.withContext(function($ctx3) {
  14. return _st(_st($Error())._new())._signal();
  15. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithInterval_((0)))._clearInterval();
  16. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  17. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  18. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]}),
  19. smalltalk.BlockClosureTest);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "testCanClearTimeout",
  23. fn: function (){
  24. var self=this;
  25. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  26. return smalltalk.withContext(function($ctx1) {
  27. _st(self)._shouldnt_raise_((function(){
  28. return smalltalk.withContext(function($ctx2) {
  29. return _st(_st((function(){
  30. return smalltalk.withContext(function($ctx3) {
  31. return _st(_st($Error())._new())._signal();
  32. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((0)))._clearTimeout();
  33. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  34. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  35. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]}),
  36. smalltalk.BlockClosureTest);
  37. smalltalk.addMethod(
  38. smalltalk.method({
  39. selector: "testCompiledSource",
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. _st(self)._assert_(_st(_st((function(){
  44. return smalltalk.withContext(function($ctx2) {
  45. return _st((1)).__plus((1));
  46. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  47. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  48. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]}),
  49. smalltalk.BlockClosureTest);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "testCurrySelf",
  53. fn: function (){
  54. var self=this;
  55. var curriedMethod,array;
  56. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  57. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  58. return smalltalk.withContext(function($ctx1) {
  59. curriedMethod=_st(_st((function(selfarg,x){
  60. return smalltalk.withContext(function($ctx2) {
  61. return _st(selfarg)._at_(x);
  62. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  63. array=[(3), (1), (4)];
  64. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  65. _st((function(){
  66. return smalltalk.withContext(function($ctx2) {
  67. return _st(self)._assert_equals_(_st(array)._foo_((2)),(1));
  68. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  69. return smalltalk.withContext(function($ctx2) {
  70. return _st($Array())._removeCompiledMethod_(curriedMethod);
  71. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  72. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  73. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "removeCompiledMethod:", "assert:equals:", "foo:"]}),
  74. smalltalk.BlockClosureTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testEnsure",
  78. fn: function (){
  79. var self=this;
  80. return smalltalk.withContext(function($ctx1) {
  81. _st(self)._assert_equals_(_st((function(){
  82. return smalltalk.withContext(function($ctx2) {
  83. return (3);
  84. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  85. return smalltalk.withContext(function($ctx2) {
  86. return (4);
  87. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(3));
  88. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  89. messageSends: ["assert:equals:", "ensure:"]}),
  90. smalltalk.BlockClosureTest);
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "testEnsureRaises",
  94. fn: function (){
  95. var self=this;
  96. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  97. return smalltalk.withContext(function($ctx1) {
  98. _st(self)._should_raise_((function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. return _st((function(){
  101. return smalltalk.withContext(function($ctx3) {
  102. return _st(_st($Error())._new())._signal();
  103. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  104. return smalltalk.withContext(function($ctx3) {
  105. return true;
  106. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  108. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  109. messageSends: ["should:raise:", "ensure:", "signal", "new"]}),
  110. smalltalk.BlockClosureTest);
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testExceptionSemantics",
  114. fn: function (){
  115. var self=this;
  116. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  117. return smalltalk.withContext(function($ctx1) {
  118. _st(self)._timeout_((100));
  119. _st(_st(self)._async_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. _st(self)._assert_(true);
  124. _st($Error())._signal();
  125. _st(self)._deny_(true);
  126. return _st(self)._finished();
  127. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(self)._finished();
  130. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx1)})}));
  131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  132. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  133. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"]}),
  134. smalltalk.BlockClosureTest);
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "testNewWithValues",
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. function theTestPrototype() {this.name = "theTestPrototype";}
  142. function theTestConstructor(arg1, arg2, arg3) {}
  143. theTestConstructor.prototype = new theTestPrototype;
  144. var theWrappedConstructor = _st(theTestConstructor);
  145. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  146. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  147. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  148. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  149. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  150. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  151. messageSends: []}),
  152. smalltalk.BlockClosureTest);
  153. smalltalk.addMethod(
  154. smalltalk.method({
  155. selector: "testNumArgs",
  156. fn: function (){
  157. var self=this;
  158. return smalltalk.withContext(function($ctx1) {
  159. _st(self)._assert_equals_(_st((function(){
  160. return smalltalk.withContext(function($ctx2) {
  161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  162. _st(self)._assert_equals_(_st((function(a,b){
  163. return smalltalk.withContext(function($ctx2) {
  164. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  165. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  166. messageSends: ["assert:equals:", "numArgs"]}),
  167. smalltalk.BlockClosureTest);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "testOnDo",
  171. fn: function (){
  172. var self=this;
  173. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  174. return smalltalk.withContext(function($ctx1) {
  175. _st(self)._assert_(_st((function(){
  176. return smalltalk.withContext(function($ctx2) {
  177. return _st(_st($Error())._new())._signal();
  178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  179. return smalltalk.withContext(function($ctx2) {
  180. return true;
  181. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  182. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  183. messageSends: ["assert:", "on:do:", "signal", "new"]}),
  184. smalltalk.BlockClosureTest);
  185. smalltalk.addMethod(
  186. smalltalk.method({
  187. selector: "testValue",
  188. fn: function (){
  189. var self=this;
  190. return smalltalk.withContext(function($ctx1) {
  191. _st(self)._assert_equals_(_st((function(){
  192. return smalltalk.withContext(function($ctx2) {
  193. return _st((1)).__plus((1));
  194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  195. _st(self)._assert_equals_(_st((function(x){
  196. return smalltalk.withContext(function($ctx2) {
  197. return _st(x).__plus((1));
  198. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  199. _st(self)._assert_equals_(_st((function(x,y){
  200. return smalltalk.withContext(function($ctx2) {
  201. return _st(x).__star(y);
  202. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  203. _st(self)._assert_equals_(_st((function(a,b,c){
  204. return smalltalk.withContext(function($ctx2) {
  205. return (1);
  206. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  208. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]}),
  209. smalltalk.BlockClosureTest);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "testValueWithPossibleArguments",
  213. fn: function (){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) {
  216. _st(self)._assert_equals_(_st((function(){
  217. return smalltalk.withContext(function($ctx2) {
  218. return (1);
  219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  220. _st(self)._assert_equals_(_st((function(a){
  221. return smalltalk.withContext(function($ctx2) {
  222. return _st(a).__plus((4));
  223. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  224. _st(self)._assert_equals_(_st((function(a,b){
  225. return smalltalk.withContext(function($ctx2) {
  226. return _st(a).__plus(b);
  227. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  228. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  229. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]}),
  230. smalltalk.BlockClosureTest);
  231. smalltalk.addMethod(
  232. smalltalk.method({
  233. selector: "testWhileFalse",
  234. fn: function (){
  235. var self=this;
  236. var i;
  237. return smalltalk.withContext(function($ctx1) {
  238. i=(0);
  239. _st((function(){
  240. return smalltalk.withContext(function($ctx2) {
  241. return _st(i).__gt((5));
  242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  243. return smalltalk.withContext(function($ctx2) {
  244. i=_st(i).__plus((1));
  245. return i;
  246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  247. _st(self)._assert_equals_(i,(6));
  248. i=(0);
  249. _st((function(){
  250. return smalltalk.withContext(function($ctx2) {
  251. i=_st(i).__plus((1));
  252. i;
  253. return _st(i).__gt((5));
  254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  255. _st(self)._assert_equals_(i,(6));
  256. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  257. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"]}),
  258. smalltalk.BlockClosureTest);
  259. smalltalk.addMethod(
  260. smalltalk.method({
  261. selector: "testWhileTrue",
  262. fn: function (){
  263. var self=this;
  264. var i;
  265. return smalltalk.withContext(function($ctx1) {
  266. i=(0);
  267. _st((function(){
  268. return smalltalk.withContext(function($ctx2) {
  269. return _st(i).__lt((5));
  270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  271. return smalltalk.withContext(function($ctx2) {
  272. i=_st(i).__plus((1));
  273. return i;
  274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  275. _st(self)._assert_equals_(i,(5));
  276. i=(0);
  277. _st((function(){
  278. return smalltalk.withContext(function($ctx2) {
  279. i=_st(i).__plus((1));
  280. i;
  281. return _st(i).__lt((5));
  282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  283. _st(self)._assert_equals_(i,(5));
  284. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  285. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"]}),
  286. smalltalk.BlockClosureTest);
  287. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  288. smalltalk.addMethod(
  289. smalltalk.method({
  290. selector: "testEquality",
  291. fn: function (){
  292. var self=this;
  293. return smalltalk.withContext(function($ctx1) {
  294. _st(self)._deny_(_st((0)).__eq(false));
  295. _st(self)._deny_(_st(false).__eq((0)));
  296. _st(self)._deny_(_st("").__eq(false));
  297. _st(self)._deny_(_st(false).__eq(""));
  298. _st(self)._assert_(_st(true).__eq(true));
  299. _st(self)._deny_(_st(false).__eq(true));
  300. _st(self)._deny_(_st(true).__eq(false));
  301. _st(self)._assert_(_st(false).__eq(false));
  302. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  303. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  304. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  305. messageSends: ["deny:", "=", "assert:", "yourself"]}),
  306. smalltalk.BooleanTest);
  307. smalltalk.addMethod(
  308. smalltalk.method({
  309. selector: "testIdentity",
  310. fn: function (){
  311. var self=this;
  312. return smalltalk.withContext(function($ctx1) {
  313. _st(self)._deny_(_st((0)).__eq_eq(false));
  314. _st(self)._deny_(_st(false).__eq_eq((0)));
  315. _st(self)._deny_(_st("").__eq_eq(false));
  316. _st(self)._deny_(_st(false).__eq_eq(""));
  317. _st(self)._assert_(_st(true).__eq_eq(true));
  318. _st(self)._deny_(_st(false).__eq_eq(true));
  319. _st(self)._deny_(_st(true).__eq_eq(false));
  320. _st(self)._assert_(_st(false).__eq_eq(false));
  321. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  322. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  323. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  324. messageSends: ["deny:", "==", "assert:", "yourself"]}),
  325. smalltalk.BooleanTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testIfTrueIfFalse",
  329. fn: function (){
  330. var self=this;
  331. return smalltalk.withContext(function($ctx1) {
  332. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  333. $1=self;
  334. if(smalltalk.assert(true)){
  335. $2="alternative block";
  336. };
  337. _st($1)._assert_equals_($2,"alternative block");
  338. $3=self;
  339. if(! smalltalk.assert(true)){
  340. $4="alternative block";
  341. };
  342. _st($3)._assert_equals_($4,nil);
  343. $5=self;
  344. if(smalltalk.assert(false)){
  345. $6="alternative block";
  346. };
  347. _st($5)._assert_equals_($6,nil);
  348. $7=self;
  349. if(! smalltalk.assert(false)){
  350. $8="alternative block";
  351. };
  352. _st($7)._assert_equals_($8,"alternative block");
  353. $9=self;
  354. if(smalltalk.assert(false)){
  355. $10="alternative block";
  356. } else {
  357. $10="alternative block2";
  358. };
  359. _st($9)._assert_equals_($10,"alternative block2");
  360. $11=self;
  361. if(smalltalk.assert(false)){
  362. $12="alternative block2";
  363. } else {
  364. $12="alternative block";
  365. };
  366. _st($11)._assert_equals_($12,"alternative block");
  367. $13=self;
  368. if(smalltalk.assert(true)){
  369. $14="alternative block";
  370. } else {
  371. $14="alternative block2";
  372. };
  373. _st($13)._assert_equals_($14,"alternative block");
  374. $15=self;
  375. if(smalltalk.assert(true)){
  376. $16="alternative block2";
  377. } else {
  378. $16="alternative block";
  379. };
  380. _st($15)._assert_equals_($16,"alternative block2");
  381. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  382. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]}),
  383. smalltalk.BooleanTest);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "testIfTrueIfFalseWithBoxing",
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. 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;
  391. $1=self;
  392. $3=_st(true)._yourself();
  393. if(smalltalk.assert($3)){
  394. $2="alternative block";
  395. };
  396. _st($1)._assert_equals_($2,"alternative block");
  397. $4=self;
  398. $6=_st(true)._yourself();
  399. if(! smalltalk.assert($6)){
  400. $5="alternative block";
  401. };
  402. _st($4)._assert_equals_($5,nil);
  403. $7=self;
  404. $9=_st(false)._yourself();
  405. if(smalltalk.assert($9)){
  406. $8="alternative block";
  407. };
  408. _st($7)._assert_equals_($8,nil);
  409. $10=self;
  410. $12=_st(false)._yourself();
  411. if(! smalltalk.assert($12)){
  412. $11="alternative block";
  413. };
  414. _st($10)._assert_equals_($11,"alternative block");
  415. $13=self;
  416. $15=_st(false)._yourself();
  417. if(smalltalk.assert($15)){
  418. $14="alternative block";
  419. } else {
  420. $14="alternative block2";
  421. };
  422. _st($13)._assert_equals_($14,"alternative block2");
  423. $16=self;
  424. $18=_st(false)._yourself();
  425. if(smalltalk.assert($18)){
  426. $17="alternative block2";
  427. } else {
  428. $17="alternative block";
  429. };
  430. _st($16)._assert_equals_($17,"alternative block");
  431. $19=self;
  432. $21=_st(true)._yourself();
  433. if(smalltalk.assert($21)){
  434. $20="alternative block";
  435. } else {
  436. $20="alternative block2";
  437. };
  438. _st($19)._assert_equals_($20,"alternative block");
  439. $22=self;
  440. $24=_st(true)._yourself();
  441. if(smalltalk.assert($24)){
  442. $23="alternative block2";
  443. } else {
  444. $23="alternative block";
  445. };
  446. _st($22)._assert_equals_($23,"alternative block2");
  447. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  448. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]}),
  449. smalltalk.BooleanTest);
  450. smalltalk.addMethod(
  451. smalltalk.method({
  452. selector: "testLogic",
  453. fn: function (){
  454. var self=this;
  455. return smalltalk.withContext(function($ctx1) {
  456. var $1,$2,$3,$4,$5,$6,$7,$8;
  457. $1=self;
  458. _st($1)._assert_(_st(true).__and(true));
  459. _st($1)._deny_(_st(true).__and(false));
  460. _st($1)._deny_(_st(false).__and(true));
  461. $2=_st($1)._deny_(_st(false).__and(false));
  462. $3=self;
  463. _st($3)._assert_(_st(true).__or(true));
  464. _st($3)._assert_(_st(true).__or(false));
  465. _st($3)._assert_(_st(false).__or(true));
  466. $4=_st($3)._deny_(_st(false).__or(false));
  467. $5=self;
  468. _st($5)._assert_(_st(true).__and(_st((1)).__gt((0))));
  469. _st($5)._deny_(_st(_st((1)).__gt((0))).__and(false));
  470. $6=_st($5)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  471. $7=self;
  472. _st($7)._assert_(_st(false).__or(_st((1)).__gt((0))));
  473. _st($7)._assert_(_st(_st((1)).__gt((0))).__or(false));
  474. $8=_st($7)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  475. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  476. messageSends: ["assert:", "&", "deny:", "|", ">"]}),
  477. smalltalk.BooleanTest);
  478. smalltalk.addMethod(
  479. smalltalk.method({
  480. selector: "testLogicKeywords",
  481. fn: function (){
  482. var self=this;
  483. return smalltalk.withContext(function($ctx1) {
  484. var $1,$2,$3,$4,$5,$6,$7,$8;
  485. $1=self;
  486. _st($1)._assert_(_st(true)._and_((function(){
  487. return smalltalk.withContext(function($ctx2) {
  488. return true;
  489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  490. _st($1)._deny_(_st(true)._and_((function(){
  491. return smalltalk.withContext(function($ctx2) {
  492. return false;
  493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  494. _st($1)._deny_(_st(false)._and_((function(){
  495. return smalltalk.withContext(function($ctx2) {
  496. return true;
  497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  498. $2=_st($1)._deny_(_st(false)._and_((function(){
  499. return smalltalk.withContext(function($ctx2) {
  500. return false;
  501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  502. $3=self;
  503. _st($3)._assert_(_st(true)._or_((function(){
  504. return smalltalk.withContext(function($ctx2) {
  505. return true;
  506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  507. _st($3)._assert_(_st(true)._or_((function(){
  508. return smalltalk.withContext(function($ctx2) {
  509. return false;
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  511. _st($3)._assert_(_st(false)._or_((function(){
  512. return smalltalk.withContext(function($ctx2) {
  513. return true;
  514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  515. $4=_st($3)._deny_(_st(false)._or_((function(){
  516. return smalltalk.withContext(function($ctx2) {
  517. return false;
  518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  519. $5=self;
  520. _st($5)._assert_(_st(true)._and_((function(){
  521. return smalltalk.withContext(function($ctx2) {
  522. return _st((1)).__gt((0));
  523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  524. _st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  525. return smalltalk.withContext(function($ctx2) {
  526. return false;
  527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  528. $6=_st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  529. return smalltalk.withContext(function($ctx2) {
  530. return _st((1)).__gt((2));
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  532. $7=self;
  533. _st($7)._assert_(_st(false)._or_((function(){
  534. return smalltalk.withContext(function($ctx2) {
  535. return _st((1)).__gt((0));
  536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  537. _st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  538. return smalltalk.withContext(function($ctx2) {
  539. return false;
  540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  541. $8=_st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  542. return smalltalk.withContext(function($ctx2) {
  543. return _st((1)).__gt((2));
  544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  545. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  546. messageSends: ["assert:", "and:", "deny:", "or:", ">"]}),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testNonBooleanError",
  551. fn: function (){
  552. var self=this;
  553. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  554. return smalltalk.withContext(function($ctx1) {
  555. _st(self)._should_raise_((function(){
  556. return smalltalk.withContext(function($ctx2) {
  557. if(smalltalk.assert("")){
  558. } else {
  559. };
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$NonBooleanReceiver());
  561. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  562. messageSends: ["should:raise:", "ifTrue:ifFalse:"]}),
  563. smalltalk.BooleanTest);
  564. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  565. smalltalk.addMethod(
  566. smalltalk.method({
  567. selector: "setUp",
  568. fn: function (){
  569. var self=this;
  570. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  571. return smalltalk.withContext(function($ctx1) {
  572. self["@builder"]=_st($ClassBuilder())._new();
  573. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  574. messageSends: ["new"]}),
  575. smalltalk.ClassBuilderTest);
  576. smalltalk.addMethod(
  577. smalltalk.method({
  578. selector: "tearDown",
  579. fn: function (){
  580. var self=this;
  581. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  582. return smalltalk.withContext(function($ctx1) {
  583. var $1;
  584. $1=self["@theClass"];
  585. if(($receiver = $1) == nil || $receiver == undefined){
  586. $1;
  587. } else {
  588. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  589. self["@theClass"]=nil;
  590. self["@theClass"];
  591. };
  592. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  593. messageSends: ["ifNotNil:", "removeClass:", "current"]}),
  594. smalltalk.ClassBuilderTest);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "testClassCopy",
  598. fn: function (){
  599. var self=this;
  600. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  601. return smalltalk.withContext(function($ctx1) {
  602. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  603. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st($ObjectMock())._superclass()));
  604. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st($ObjectMock())._instanceVariableNames()));
  605. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  606. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st($ObjectMock())._package()));
  607. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st($ObjectMock())._methodDictionary())._keys());
  608. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  609. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]}),
  610. smalltalk.ClassBuilderTest);
  611. smalltalk.addMethod(
  612. smalltalk.method({
  613. selector: "testClassMigration",
  614. fn: function (){
  615. var self=this;
  616. var instance,oldClass;
  617. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  618. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  619. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  620. return smalltalk.withContext(function($ctx1) {
  621. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  622. instance=_st(_st(_st($Smalltalk())._current())._at_("ObjectMock2"))._new();
  623. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  624. _st(self)._deny_(_st(oldClass).__eq_eq($ObjectMock2()));
  625. _st(self)._assert_(_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock()));
  626. _st(self)._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  627. _st(self)._assert_equals_(_st($ObjectMock2())._selectors(),_st(oldClass)._selectors());
  628. _st(self)._assert_equals_(_st($ObjectMock2())._comment(),_st(oldClass)._comment());
  629. _st(self)._assert_equals_(_st(_st($ObjectMock2())._package())._name(),"Kernel-Tests");
  630. _st(self)._deny_(_st(_st(instance)._class()).__eq_eq($ObjectMock2()));
  631. _st(self)._assert_(_st(_st(_st($Smalltalk())._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  632. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  633. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  634. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]}),
  635. smalltalk.ClassBuilderTest);
  636. smalltalk.addMethod(
  637. smalltalk.method({
  638. selector: "testClassMigrationWithClassInstanceVariables",
  639. fn: function (){
  640. var self=this;
  641. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  642. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  643. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  644. return smalltalk.withContext(function($ctx1) {
  645. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  646. _st(_st($ObjectMock2())._class())._instanceVariableNames_("foo bar");
  647. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  648. _st(self)._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  649. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  650. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  651. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"]}),
  652. smalltalk.ClassBuilderTest);
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "testClassMigrationWithSubclasses",
  656. fn: function (){
  657. var self=this;
  658. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  659. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  660. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  661. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  662. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  663. return smalltalk.withContext(function($ctx1) {
  664. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  665. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  666. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  667. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  668. _st(self)._assert_(_st(_st($ObjectMock())._subclasses())._includes_($ObjectMock2()));
  669. _st(self)._assert_(_st(_st($ObjectMock2())._subclasses())._includes_($ObjectMock3()));
  670. _st(self)._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  671. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  672. return smalltalk.withContext(function($ctx2) {
  673. return _st(_st($Smalltalk())._current())._removeClass_(each);
  674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  675. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  676. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"]}),
  677. smalltalk.ClassBuilderTest);
  678. smalltalk.addMethod(
  679. smalltalk.method({
  680. selector: "testInstanceVariableNames",
  681. fn: function (){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  685. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  686. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]}),
  687. smalltalk.ClassBuilderTest);
  688. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  689. smalltalk.addMethod(
  690. smalltalk.method({
  691. selector: "assertSameContents:as:",
  692. fn: function (aCollection,anotherCollection){
  693. var self=this;
  694. return smalltalk.withContext(function($ctx1) {
  695. _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  696. _st(aCollection)._do_((function(each){
  697. return smalltalk.withContext(function($ctx2) {
  698. return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  700. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  701. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]}),
  702. smalltalk.CollectionTest);
  703. smalltalk.addMethod(
  704. smalltalk.method({
  705. selector: "collection",
  706. fn: function (){
  707. var self=this;
  708. return smalltalk.withContext(function($ctx1) {
  709. var $1;
  710. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  711. return $1;
  712. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  713. messageSends: ["withAll:", "defaultValues", "collectionClass"]}),
  714. smalltalk.CollectionTest);
  715. smalltalk.addMethod(
  716. smalltalk.method({
  717. selector: "collectionClass",
  718. fn: function (){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) {
  721. var $1;
  722. $1=_st(_st(self)._class())._collectionClass();
  723. return $1;
  724. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  725. messageSends: ["collectionClass", "class"]}),
  726. smalltalk.CollectionTest);
  727. smalltalk.addMethod(
  728. smalltalk.method({
  729. selector: "collectionWithDuplicates",
  730. fn: function (){
  731. var self=this;
  732. return smalltalk.withContext(function($ctx1) {
  733. var $1;
  734. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  735. return $1;
  736. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  737. messageSends: ["withAll:", "collectionClass"]}),
  738. smalltalk.CollectionTest);
  739. smalltalk.addMethod(
  740. smalltalk.method({
  741. selector: "defaultValues",
  742. fn: function (){
  743. var self=this;
  744. return smalltalk.withContext(function($ctx1) {
  745. var $1;
  746. $1=[(1), (2), (3), (-4)];
  747. return $1;
  748. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  749. messageSends: []}),
  750. smalltalk.CollectionTest);
  751. smalltalk.addMethod(
  752. smalltalk.method({
  753. selector: "isCollectionReadOnly",
  754. fn: function (){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) {
  757. return false;
  758. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  759. messageSends: []}),
  760. smalltalk.CollectionTest);
  761. smalltalk.addMethod(
  762. smalltalk.method({
  763. selector: "testAsArray",
  764. fn: function (){
  765. var self=this;
  766. return smalltalk.withContext(function($ctx1) {
  767. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  768. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  769. messageSends: ["assertSameContents:as:", "collection", "asArray"]}),
  770. smalltalk.CollectionTest);
  771. smalltalk.addMethod(
  772. smalltalk.method({
  773. selector: "testAsOrderedCollection",
  774. fn: function (){
  775. var self=this;
  776. return smalltalk.withContext(function($ctx1) {
  777. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  778. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  779. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]}),
  780. smalltalk.CollectionTest);
  781. smalltalk.addMethod(
  782. smalltalk.method({
  783. selector: "testAsSet",
  784. fn: function (){
  785. var self=this;
  786. var c,set;
  787. return smalltalk.withContext(function($ctx1) {
  788. c=_st(self)._collectionWithDuplicates();
  789. set=_st(c)._asSet();
  790. _st(self)._assert_equals_(_st(set)._size(),(5));
  791. _st(c)._do_((function(each){
  792. return smalltalk.withContext(function($ctx2) {
  793. return _st(self)._assert_(_st(set)._includes_(each));
  794. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  795. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  796. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]}),
  797. smalltalk.CollectionTest);
  798. smalltalk.addMethod(
  799. smalltalk.method({
  800. selector: "testCollect",
  801. fn: function (){
  802. var self=this;
  803. var newCollection;
  804. return smalltalk.withContext(function($ctx1) {
  805. newCollection=[(1), (2), (3), (4)];
  806. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  807. return smalltalk.withContext(function($ctx2) {
  808. return _st(each)._abs();
  809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  810. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  811. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"]}),
  812. smalltalk.CollectionTest);
  813. smalltalk.addMethod(
  814. smalltalk.method({
  815. selector: "testDetect",
  816. fn: function (){
  817. var self=this;
  818. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  819. return smalltalk.withContext(function($ctx1) {
  820. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  821. return smalltalk.withContext(function($ctx2) {
  822. return _st(each).__lt((0));
  823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),(-4));
  824. _st(self)._should_raise_((function(){
  825. return smalltalk.withContext(function($ctx2) {
  826. return _st(_st(self)._collection())._detect_((function(each){
  827. return smalltalk.withContext(function($ctx3) {
  828. return _st(each).__eq((6));
  829. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  831. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  832. messageSends: ["assert:equals:", "detect:", "<", "collection", "should:raise:", "="]}),
  833. smalltalk.CollectionTest);
  834. smalltalk.addMethod(
  835. smalltalk.method({
  836. selector: "testDo",
  837. fn: function (){
  838. var self=this;
  839. var newCollection;
  840. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  841. return smalltalk.withContext(function($ctx1) {
  842. newCollection=_st($OrderedCollection())._new();
  843. _st(_st(self)._collection())._do_((function(each){
  844. return smalltalk.withContext(function($ctx2) {
  845. return _st(newCollection)._add_(each);
  846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  847. _st(self)._assertSameContents_as_(_st(self)._collection(),newCollection);
  848. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  849. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"]}),
  850. smalltalk.CollectionTest);
  851. smalltalk.addMethod(
  852. smalltalk.method({
  853. selector: "testIsEmpty",
  854. fn: function (){
  855. var self=this;
  856. return smalltalk.withContext(function($ctx1) {
  857. _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  858. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  859. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  860. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]}),
  861. smalltalk.CollectionTest);
  862. smalltalk.addMethod(
  863. smalltalk.method({
  864. selector: "testSelect",
  865. fn: function (){
  866. var self=this;
  867. var newCollection;
  868. return smalltalk.withContext(function($ctx1) {
  869. newCollection=[(2), (-4)];
  870. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  871. return smalltalk.withContext(function($ctx2) {
  872. return _st(each)._even();
  873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  874. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  875. messageSends: ["assertSameContents:as:", "select:", "even", "collection"]}),
  876. smalltalk.CollectionTest);
  877. smalltalk.addMethod(
  878. smalltalk.method({
  879. selector: "testSize",
  880. fn: function (){
  881. var self=this;
  882. return smalltalk.withContext(function($ctx1) {
  883. _st(self)._assert_equals_(_st(_st(_st(self)._collectionClass())._new())._size(),(0));
  884. _st(self)._assert_equals_(_st(_st(self)._collection())._size(),(4));
  885. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  886. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"]}),
  887. smalltalk.CollectionTest);
  888. smalltalk.addMethod(
  889. smalltalk.method({
  890. selector: "collectionClass",
  891. fn: function (){
  892. var self=this;
  893. return smalltalk.withContext(function($ctx1) {
  894. return nil;
  895. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  896. messageSends: []}),
  897. smalltalk.CollectionTest.klass);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "isAbstract",
  901. fn: function (){
  902. var self=this;
  903. return smalltalk.withContext(function($ctx1) {
  904. var $1;
  905. $1=_st(_st(self)._collectionClass())._isNil();
  906. return $1;
  907. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  908. messageSends: ["isNil", "collectionClass"]}),
  909. smalltalk.CollectionTest.klass);
  910. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  911. smalltalk.addMethod(
  912. smalltalk.method({
  913. selector: "testAt",
  914. fn: function (){
  915. var self=this;
  916. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  917. return smalltalk.withContext(function($ctx1) {
  918. _st(self)._assert_equals_(_st(_st(self)._collection())._at_((4)),(-4));
  919. _st(self)._should_raise_((function(){
  920. return smalltalk.withContext(function($ctx2) {
  921. return _st(_st(self)._collection())._at_((5));
  922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  923. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  924. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"]}),
  925. smalltalk.IndexableCollectionTest);
  926. smalltalk.addMethod(
  927. smalltalk.method({
  928. selector: "testAtIfAbsent",
  929. fn: function (){
  930. var self=this;
  931. return smalltalk.withContext(function($ctx1) {
  932. _st(self)._assert_equals_(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return "none";
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"none");
  936. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  937. messageSends: ["assert:equals:", "at:ifAbsent:", "+", "size", "collection"]}),
  938. smalltalk.IndexableCollectionTest);
  939. smalltalk.addMethod(
  940. smalltalk.method({
  941. selector: "testContains",
  942. fn: function (){
  943. var self=this;
  944. var collection;
  945. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  946. return smalltalk.withContext(function($ctx1) {
  947. collection=_st(self)._collection();
  948. _st(self)._assert_(_st(_st(self)._collection())._contains_((function(each){
  949. return smalltalk.withContext(function($ctx2) {
  950. return _st(each).__eq(_st(_st(self)._collection())._first());
  951. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  952. _st(self)._deny_(_st(_st(self)._collection())._contains_((function(each){
  953. return smalltalk.withContext(function($ctx2) {
  954. return _st(each).__eq(_st($Object())._new());
  955. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  956. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  957. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"]}),
  958. smalltalk.IndexableCollectionTest);
  959. smalltalk.addMethod(
  960. smalltalk.method({
  961. selector: "testIndexOf",
  962. fn: function (){
  963. var self=this;
  964. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  965. return smalltalk.withContext(function($ctx1) {
  966. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_((2)),(2));
  967. _st(self)._should_raise_((function(){
  968. return smalltalk.withContext(function($ctx2) {
  969. return _st(_st(self)._collection())._indexOf_((999));
  970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  971. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_ifAbsent_((999),(function(){
  972. return smalltalk.withContext(function($ctx2) {
  973. return "sentinel";
  974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  975. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  976. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  977. smalltalk.IndexableCollectionTest);
  978. smalltalk.addMethod(
  979. smalltalk.method({
  980. selector: "testWithIndexDo",
  981. fn: function (){
  982. var self=this;
  983. var collection;
  984. return smalltalk.withContext(function($ctx1) {
  985. collection=_st(self)._collection();
  986. _st(_st(self)._collection())._withIndexDo_((function(each,index){
  987. return smalltalk.withContext(function($ctx2) {
  988. return _st(self)._assert_equals_(_st(collection)._at_(index),each);
  989. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  990. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  991. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]}),
  992. smalltalk.IndexableCollectionTest);
  993. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  994. smalltalk.addMethod(
  995. smalltalk.method({
  996. selector: "collection",
  997. fn: function (){
  998. var self=this;
  999. return smalltalk.withContext(function($ctx1) {
  1000. var $1;
  1001. $1=smalltalk.HashedCollection._fromPairs_([_st("b").__minus_gt((1)),_st("a").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  1002. return $1;
  1003. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1004. messageSends: ["->"]}),
  1005. smalltalk.HashedCollectionTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "collectionWithDuplicates",
  1009. fn: function (){
  1010. var self=this;
  1011. return smalltalk.withContext(function($ctx1) {
  1012. var $1;
  1013. $1=smalltalk.HashedCollection._fromPairs_([_st("b").__minus_gt((1)),_st("a").__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))]);
  1014. return $1;
  1015. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1016. messageSends: ["->"]}),
  1017. smalltalk.HashedCollectionTest);
  1018. smalltalk.addMethod(
  1019. smalltalk.method({
  1020. selector: "testAt",
  1021. fn: function (){
  1022. var self=this;
  1023. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1024. return smalltalk.withContext(function($ctx1) {
  1025. _st(self)._assert_equals_(_st(_st(self)._collection())._at_("a"),(2));
  1026. _st(self)._should_raise_((function(){
  1027. return smalltalk.withContext(function($ctx2) {
  1028. return _st(_st(self)._collection())._at_((5));
  1029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1030. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1031. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"]}),
  1032. smalltalk.HashedCollectionTest);
  1033. smalltalk.addMethod(
  1034. smalltalk.method({
  1035. selector: "testContains",
  1036. fn: function (){
  1037. var self=this;
  1038. var collection;
  1039. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1040. return smalltalk.withContext(function($ctx1) {
  1041. collection=_st(self)._collection();
  1042. _st(self)._assert_(_st(_st(self)._collection())._contains_((function(each){
  1043. return smalltalk.withContext(function($ctx2) {
  1044. return _st(each).__eq(_st(_st(_st(self)._collection())._values())._first());
  1045. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1046. _st(self)._deny_(_st(_st(self)._collection())._contains_((function(each){
  1047. return smalltalk.withContext(function($ctx2) {
  1048. return _st(each).__eq(_st($Object())._new());
  1049. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1050. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1051. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"]}),
  1052. smalltalk.HashedCollectionTest);
  1053. smalltalk.addMethod(
  1054. smalltalk.method({
  1055. selector: "testIndexOf",
  1056. fn: function (){
  1057. var self=this;
  1058. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1059. return smalltalk.withContext(function($ctx1) {
  1060. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_((2)),"a");
  1061. _st(self)._should_raise_((function(){
  1062. return smalltalk.withContext(function($ctx2) {
  1063. return _st(_st(self)._collection())._indexOf_((999));
  1064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1065. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_ifAbsent_((999),(function(){
  1066. return smalltalk.withContext(function($ctx2) {
  1067. return "sentinel";
  1068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1069. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1070. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  1071. smalltalk.HashedCollectionTest);
  1072. smalltalk.addMethod(
  1073. smalltalk.method({
  1074. selector: "testNewFrom",
  1075. fn: function (){
  1076. var self=this;
  1077. var associations;
  1078. return smalltalk.withContext(function($ctx1) {
  1079. associations=[_st("a").__minus_gt((1)),_st("b").__minus_gt((2))];
  1080. _st(self)._assertSameContents_as_(_st(_st(_st(self)._class())._collectionClass())._newFrom_(associations),smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2))]));
  1081. return self}, function($ctx1) {$ctx1.fill(self,"testNewFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1082. messageSends: ["->", "assertSameContents:as:", "newFrom:", "collectionClass", "class"]}),
  1083. smalltalk.HashedCollectionTest);
  1084. smalltalk.addMethod(
  1085. smalltalk.method({
  1086. selector: "testNewFromPairs",
  1087. fn: function (){
  1088. var self=this;
  1089. var flattenedAssociations;
  1090. return smalltalk.withContext(function($ctx1) {
  1091. flattenedAssociations=["a",(1),"b",(2)];
  1092. _st(self)._assertSameContents_as_(_st(_st(_st(self)._class())._collectionClass())._newFromPairs_(flattenedAssociations),smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2))]));
  1093. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1094. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"]}),
  1095. smalltalk.HashedCollectionTest);
  1096. smalltalk.addMethod(
  1097. smalltalk.method({
  1098. selector: "collectionClass",
  1099. fn: function (){
  1100. var self=this;
  1101. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1102. return smalltalk.withContext(function($ctx1) {
  1103. var $1;
  1104. $1=$HashedCollection();
  1105. return $1;
  1106. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1107. messageSends: []}),
  1108. smalltalk.HashedCollectionTest.klass);
  1109. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "collection",
  1113. fn: function (){
  1114. var self=this;
  1115. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $2,$3,$1;
  1118. $2=_st($Dictionary())._new();
  1119. _st($2)._at_put_((1),(1));
  1120. _st($2)._at_put_("a",(2));
  1121. _st($2)._at_put_(true,(3));
  1122. _st($2)._at_put_((4),(-4));
  1123. $3=_st($2)._yourself();
  1124. $1=$3;
  1125. return $1;
  1126. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1127. messageSends: ["at:put:", "new", "yourself"]}),
  1128. smalltalk.DictionaryTest);
  1129. smalltalk.addMethod(
  1130. smalltalk.method({
  1131. selector: "collectionWithDuplicates",
  1132. fn: function (){
  1133. var self=this;
  1134. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1135. return smalltalk.withContext(function($ctx1) {
  1136. var $2,$3,$1;
  1137. $2=_st($Dictionary())._new();
  1138. _st($2)._at_put_((1),(1));
  1139. _st($2)._at_put_("a",(2));
  1140. _st($2)._at_put_(true,(3));
  1141. _st($2)._at_put_((4),(-4));
  1142. _st($2)._at_put_("b",(1));
  1143. _st($2)._at_put_((3),(3));
  1144. _st($2)._at_put_(false,(12));
  1145. $3=_st($2)._yourself();
  1146. $1=$3;
  1147. return $1;
  1148. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1149. messageSends: ["at:put:", "new", "yourself"]}),
  1150. smalltalk.DictionaryTest);
  1151. smalltalk.addMethod(
  1152. smalltalk.method({
  1153. selector: "testAccessing",
  1154. fn: function (){
  1155. var self=this;
  1156. var d;
  1157. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1158. return smalltalk.withContext(function($ctx1) {
  1159. d=_st($Dictionary())._new();
  1160. _st(d)._at_put_("hello","world");
  1161. _st(self)._assert_equals_(_st(d)._at_("hello"),"world");
  1162. _st(self)._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1163. return smalltalk.withContext(function($ctx2) {
  1164. return nil;
  1165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1166. _st(self)._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1167. return smalltalk.withContext(function($ctx2) {
  1168. return nil;
  1169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1170. _st(self)._assert_(_st(d)._includesKey_("hello"));
  1171. _st(self)._deny_(_st(d)._includesKey_("foo"));
  1172. _st(d)._at_put_((1),(2));
  1173. _st(self)._assert_equals_(_st(d)._at_((1)),(2));
  1174. _st(d)._at_put_(_st((1)).__at((3)),(3));
  1175. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((3))),(3));
  1176. _st(self)._assert_(_st(d)._includesKey_(_st((1)).__at((3))));
  1177. _st(self)._deny_(_st(d)._includesKey_(_st((3)).__at((1))));
  1178. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1179. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]}),
  1180. smalltalk.DictionaryTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testDynamicDictionaries",
  1184. fn: function (){
  1185. var self=this;
  1186. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1187. return smalltalk.withContext(function($ctx1) {
  1188. _st(self)._assert_equals_(_st(smalltalk.HashedCollection._fromPairs_([_st("hello").__minus_gt((1))]))._asDictionary(),_st($Dictionary())._with_(_st("hello").__minus_gt((1))));
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1190. messageSends: ["assert:equals:", "asDictionary", "->", "with:"]}),
  1191. smalltalk.DictionaryTest);
  1192. smalltalk.addMethod(
  1193. smalltalk.method({
  1194. selector: "testEquality",
  1195. fn: function (){
  1196. var self=this;
  1197. var d1,d2;
  1198. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1199. return smalltalk.withContext(function($ctx1) {
  1200. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1201. _st(self)._assert_(_st(_st($Dictionary())._new()).__eq(_st($Dictionary())._new()));
  1202. $1=_st($Dictionary())._new();
  1203. _st($1)._at_put_((1),(2));
  1204. $2=_st($1)._yourself();
  1205. d1=$2;
  1206. $3=_st($Dictionary())._new();
  1207. _st($3)._at_put_((1),(2));
  1208. $4=_st($3)._yourself();
  1209. d2=$4;
  1210. _st(self)._assert_(_st(d1).__eq(d2));
  1211. $5=_st($Dictionary())._new();
  1212. _st($5)._at_put_((1),(3));
  1213. $6=_st($5)._yourself();
  1214. d2=$6;
  1215. _st(self)._deny_(_st(d1).__eq(d2));
  1216. $7=_st($Dictionary())._new();
  1217. _st($7)._at_put_((2),(2));
  1218. $8=_st($7)._yourself();
  1219. d2=$8;
  1220. _st(self)._deny_(_st(d1).__eq(d2));
  1221. $9=_st($Dictionary())._new();
  1222. _st($9)._at_put_((1),(2));
  1223. _st($9)._at_put_((3),(4));
  1224. $10=_st($9)._yourself();
  1225. d2=$10;
  1226. _st(self)._deny_(_st(d1).__eq(d2));
  1227. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  1228. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"]}),
  1229. smalltalk.DictionaryTest);
  1230. smalltalk.addMethod(
  1231. smalltalk.method({
  1232. selector: "testIfAbsent",
  1233. fn: function (){
  1234. var self=this;
  1235. var d,visited;
  1236. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1237. return smalltalk.withContext(function($ctx1) {
  1238. visited=false;
  1239. d=_st($Dictionary())._new();
  1240. _st(d)._at_ifAbsent_("hello",(function(){
  1241. return smalltalk.withContext(function($ctx2) {
  1242. visited=true;
  1243. return visited;
  1244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1245. _st(self)._assert_(visited);
  1246. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1247. messageSends: ["new", "at:ifAbsent:", "assert:"]}),
  1248. smalltalk.DictionaryTest);
  1249. smalltalk.addMethod(
  1250. smalltalk.method({
  1251. selector: "testIfPresent",
  1252. fn: function (){
  1253. var self=this;
  1254. var d,visited,absent;
  1255. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1256. return smalltalk.withContext(function($ctx1) {
  1257. visited=false;
  1258. d=_st($Dictionary())._new();
  1259. _st(d)._at_put_("hello","world");
  1260. _st(d)._at_ifPresent_("hello",(function(value){
  1261. return smalltalk.withContext(function($ctx2) {
  1262. visited=value;
  1263. return visited;
  1264. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1265. _st(self)._assert_equals_(visited,"world");
  1266. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1267. return smalltalk.withContext(function($ctx2) {
  1268. visited=value;
  1269. return visited;
  1270. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1271. _st(self)._assert_(_st(absent)._isNil());
  1272. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  1273. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"]}),
  1274. smalltalk.DictionaryTest);
  1275. smalltalk.addMethod(
  1276. smalltalk.method({
  1277. selector: "testIfPresentIfAbsent",
  1278. fn: function (){
  1279. var self=this;
  1280. var d,visited;
  1281. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1282. return smalltalk.withContext(function($ctx1) {
  1283. visited=false;
  1284. d=_st($Dictionary())._new();
  1285. _st(d)._at_put_("hello","world");
  1286. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1287. return smalltalk.withContext(function($ctx2) {
  1288. visited=value;
  1289. return visited;
  1290. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1291. return smalltalk.withContext(function($ctx2) {
  1292. visited=true;
  1293. return visited;
  1294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1295. _st(self)._assert_equals_(visited,"world");
  1296. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1297. return smalltalk.withContext(function($ctx2) {
  1298. visited=value;
  1299. return visited;
  1300. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1301. return smalltalk.withContext(function($ctx2) {
  1302. visited=true;
  1303. return visited;
  1304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1305. _st(self)._assert_(visited);
  1306. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1307. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"]}),
  1308. smalltalk.DictionaryTest);
  1309. smalltalk.addMethod(
  1310. smalltalk.method({
  1311. selector: "testKeys",
  1312. fn: function (){
  1313. var self=this;
  1314. var d;
  1315. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1316. return smalltalk.withContext(function($ctx1) {
  1317. d=_st($Dictionary())._new();
  1318. _st(d)._at_put_((1),(2));
  1319. _st(d)._at_put_((2),(3));
  1320. _st(d)._at_put_((3),(4));
  1321. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1322. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  1323. messageSends: ["new", "at:put:", "assert:equals:", "keys"]}),
  1324. smalltalk.DictionaryTest);
  1325. smalltalk.addMethod(
  1326. smalltalk.method({
  1327. selector: "testPointKey",
  1328. fn: function (){
  1329. var self=this;
  1330. var d;
  1331. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1332. return smalltalk.withContext(function($ctx1) {
  1333. d=_st($Dictionary())._new();
  1334. _st(d)._at_put_(_st((1)).__at((1)),"foo");
  1335. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"foo");
  1336. _st(d)._at_put_(_st((1)).__at((1)),"bar");
  1337. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"bar");
  1338. _st(d)._removeKey_(_st((1)).__at((1)));
  1339. _st(self)._assert_equals_(_st(d)._at_ifAbsent_(_st((1)).__at((1)),(function(){
  1340. return smalltalk.withContext(function($ctx2) {
  1341. return "baz";
  1342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"baz");
  1343. _st(self)._deny_(_st(d)._includesKey_(_st((1)).__at((1))));
  1344. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  1345. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"]}),
  1346. smalltalk.DictionaryTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "testPrintString",
  1350. fn: function (){
  1351. var self=this;
  1352. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1,$2;
  1355. $1=_st($Dictionary())._new();
  1356. _st($1)._at_put_("firstname","James");
  1357. _st($1)._at_put_("lastname","Bond");
  1358. $2=_st($1)._printString();
  1359. _st(self)._assert_equals_($2,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  1360. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  1361. messageSends: ["assert:equals:", "at:put:", "new", "printString"]}),
  1362. smalltalk.DictionaryTest);
  1363. smalltalk.addMethod(
  1364. smalltalk.method({
  1365. selector: "testRemoveKey",
  1366. fn: function (){
  1367. var self=this;
  1368. var d,key;
  1369. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1370. return smalltalk.withContext(function($ctx1) {
  1371. d=_st($Dictionary())._new();
  1372. _st(d)._at_put_((1),(2));
  1373. _st(d)._at_put_((2),(3));
  1374. _st(d)._at_put_((3),(4));
  1375. key=(2);
  1376. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1377. _st(d)._removeKey_(key);
  1378. _st(self)._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1379. _st(self)._assert_equals_(_st(d)._values(),[(2), (4)]);
  1380. _st(self)._deny_(_st(d)._includesKey_((2)));
  1381. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  1382. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"]}),
  1383. smalltalk.DictionaryTest);
  1384. smalltalk.addMethod(
  1385. smalltalk.method({
  1386. selector: "testRemoveKeyIfAbsent",
  1387. fn: function (){
  1388. var self=this;
  1389. var d,key;
  1390. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1391. return smalltalk.withContext(function($ctx1) {
  1392. d=_st($Dictionary())._new();
  1393. _st(d)._at_put_((1),(2));
  1394. _st(d)._at_put_((2),(3));
  1395. _st(d)._at_put_((3),(4));
  1396. key=(2);
  1397. _st(self)._assert_equals_(_st(d)._removeKey_(key),(3));
  1398. key=(3);
  1399. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1400. return smalltalk.withContext(function($ctx2) {
  1401. return (42);
  1402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(4));
  1403. key="why";
  1404. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1405. return smalltalk.withContext(function($ctx2) {
  1406. return (42);
  1407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(42));
  1408. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  1409. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"]}),
  1410. smalltalk.DictionaryTest);
  1411. smalltalk.addMethod(
  1412. smalltalk.method({
  1413. selector: "testSize",
  1414. fn: function (){
  1415. var self=this;
  1416. var d;
  1417. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1418. return smalltalk.withContext(function($ctx1) {
  1419. d=_st($Dictionary())._new();
  1420. _st(self)._assert_equals_(_st(d)._size(),(0));
  1421. _st(d)._at_put_((1),(2));
  1422. _st(self)._assert_equals_(_st(d)._size(),(1));
  1423. _st(d)._at_put_((2),(3));
  1424. _st(self)._assert_equals_(_st(d)._size(),(2));
  1425. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  1426. messageSends: ["new", "assert:equals:", "size", "at:put:"]}),
  1427. smalltalk.DictionaryTest);
  1428. smalltalk.addMethod(
  1429. smalltalk.method({
  1430. selector: "testValues",
  1431. fn: function (){
  1432. var self=this;
  1433. var d;
  1434. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1435. return smalltalk.withContext(function($ctx1) {
  1436. d=_st($Dictionary())._new();
  1437. _st(d)._at_put_((1),(2));
  1438. _st(d)._at_put_((2),(3));
  1439. _st(d)._at_put_((3),(4));
  1440. _st(self)._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1441. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  1442. messageSends: ["new", "at:put:", "assert:equals:", "values"]}),
  1443. smalltalk.DictionaryTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "collectionClass",
  1447. fn: function (){
  1448. var self=this;
  1449. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1450. return smalltalk.withContext(function($ctx1) {
  1451. var $1;
  1452. $1=$Dictionary();
  1453. return $1;
  1454. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  1455. messageSends: []}),
  1456. smalltalk.DictionaryTest.klass);
  1457. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1458. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1459. smalltalk.addMethod(
  1460. smalltalk.method({
  1461. selector: "testAtIfAbsent",
  1462. fn: function (){
  1463. var self=this;
  1464. var array;
  1465. return smalltalk.withContext(function($ctx1) {
  1466. array=["hello", "world"];
  1467. _st(self)._assert_equals_(_st(array)._at_((1)),"hello");
  1468. _st(self)._assert_equals_(_st(array)._at_((2)),"world");
  1469. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1470. return smalltalk.withContext(function($ctx2) {
  1471. return "not found";
  1472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1473. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1474. return smalltalk.withContext(function($ctx2) {
  1475. return "not found";
  1476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1477. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1478. return smalltalk.withContext(function($ctx2) {
  1479. return "not found";
  1480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1481. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return "not found";
  1484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1485. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  1486. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"]}),
  1487. smalltalk.ArrayTest);
  1488. smalltalk.addMethod(
  1489. smalltalk.method({
  1490. selector: "testFirstN",
  1491. fn: function (){
  1492. var self=this;
  1493. return smalltalk.withContext(function($ctx1) {
  1494. _st(self)._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1495. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  1496. messageSends: ["assert:equals:", "first:"]}),
  1497. smalltalk.ArrayTest);
  1498. smalltalk.addMethod(
  1499. smalltalk.method({
  1500. selector: "testIfEmpty",
  1501. fn: function (){
  1502. var self=this;
  1503. return smalltalk.withContext(function($ctx1) {
  1504. _st(self)._assert_equals_(_st("")._ifEmpty_((function(){
  1505. return smalltalk.withContext(function($ctx2) {
  1506. return "zork";
  1507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"zork");
  1508. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  1509. messageSends: ["assert:equals:", "ifEmpty:"]}),
  1510. smalltalk.ArrayTest);
  1511. smalltalk.addMethod(
  1512. smalltalk.method({
  1513. selector: "testPrintString",
  1514. fn: function (){
  1515. var self=this;
  1516. var array;
  1517. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1518. return smalltalk.withContext(function($ctx1) {
  1519. var $1,$2,$3,$4;
  1520. array=_st($Array())._new();
  1521. _st(self)._assert_equals_(_st(array)._printString(),"an Array ()");
  1522. $1=array;
  1523. _st($1)._add_((1));
  1524. $2=_st($1)._add_((3));
  1525. _st(self)._assert_equals_(_st(array)._printString(),"an Array (1 3)");
  1526. _st(array)._add_("foo");
  1527. _st(self)._assert_equals_(_st(array)._printString(),"an Array (1 3 'foo')");
  1528. $3=array;
  1529. _st($3)._remove_((1));
  1530. $4=_st($3)._remove_((3));
  1531. _st(self)._assert_equals_(_st(array)._printString(),"an Array ('foo')");
  1532. _st(array)._addLast_((3));
  1533. _st(self)._assert_equals_(_st(array)._printString(),"an Array ('foo' 3)");
  1534. _st(array)._addLast_((3));
  1535. _st(self)._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  1536. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  1537. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]}),
  1538. smalltalk.ArrayTest);
  1539. smalltalk.addMethod(
  1540. smalltalk.method({
  1541. selector: "collectionClass",
  1542. fn: function (){
  1543. var self=this;
  1544. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1545. return smalltalk.withContext(function($ctx1) {
  1546. var $1;
  1547. $1=$Array();
  1548. return $1;
  1549. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  1550. messageSends: []}),
  1551. smalltalk.ArrayTest.klass);
  1552. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "collection",
  1556. fn: function (){
  1557. var self=this;
  1558. return smalltalk.withContext(function($ctx1) {
  1559. return "hello";
  1560. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  1561. messageSends: []}),
  1562. smalltalk.StringTest);
  1563. smalltalk.addMethod(
  1564. smalltalk.method({
  1565. selector: "collectionWithDuplicates",
  1566. fn: function (){
  1567. var self=this;
  1568. return smalltalk.withContext(function($ctx1) {
  1569. return "abbaerte";
  1570. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  1571. messageSends: []}),
  1572. smalltalk.StringTest);
  1573. smalltalk.addMethod(
  1574. smalltalk.method({
  1575. selector: "testAddRemove",
  1576. fn: function (){
  1577. var self=this;
  1578. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1579. return smalltalk.withContext(function($ctx1) {
  1580. _st(self)._should_raise_((function(){
  1581. return smalltalk.withContext(function($ctx2) {
  1582. return _st("hello")._add_("a");
  1583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1584. _st(self)._should_raise_((function(){
  1585. return smalltalk.withContext(function($ctx2) {
  1586. return _st("hello")._remove_("h");
  1587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1588. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  1589. messageSends: ["should:raise:", "add:", "remove:"]}),
  1590. smalltalk.StringTest);
  1591. smalltalk.addMethod(
  1592. smalltalk.method({
  1593. selector: "testAsArray",
  1594. fn: function (){
  1595. var self=this;
  1596. return smalltalk.withContext(function($ctx1) {
  1597. _st(self)._assert_equals_(_st("hello")._asArray(),["h", "e", "l", "l", "o"]);
  1598. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  1599. messageSends: ["assert:equals:", "asArray"]}),
  1600. smalltalk.StringTest);
  1601. smalltalk.addMethod(
  1602. smalltalk.method({
  1603. selector: "testAt",
  1604. fn: function (){
  1605. var self=this;
  1606. return smalltalk.withContext(function($ctx1) {
  1607. _st(self)._assert_equals_(_st("hello")._at_((1)),"h");
  1608. _st(self)._assert_equals_(_st("hello")._at_((5)),"o");
  1609. _st(self)._assert_equals_(_st("hello")._at_ifAbsent_((6),(function(){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return nil;
  1612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1613. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  1614. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"]}),
  1615. smalltalk.StringTest);
  1616. smalltalk.addMethod(
  1617. smalltalk.method({
  1618. selector: "testAtPut",
  1619. fn: function (){
  1620. var self=this;
  1621. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1622. return smalltalk.withContext(function($ctx1) {
  1623. _st(self)._should_raise_((function(){
  1624. return smalltalk.withContext(function($ctx2) {
  1625. return _st("hello")._at_put_((1),"a");
  1626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1627. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  1628. messageSends: ["should:raise:", "at:put:"]}),
  1629. smalltalk.StringTest);
  1630. smalltalk.addMethod(
  1631. smalltalk.method({
  1632. selector: "testCollect",
  1633. fn: function (){
  1634. var self=this;
  1635. var newCollection;
  1636. return smalltalk.withContext(function($ctx1) {
  1637. newCollection="hheelllloo";
  1638. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1639. return smalltalk.withContext(function($ctx2) {
  1640. return _st(each).__comma(each);
  1641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1642. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  1643. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"]}),
  1644. smalltalk.StringTest);
  1645. smalltalk.addMethod(
  1646. smalltalk.method({
  1647. selector: "testCopyWithoutAll",
  1648. fn: function (){
  1649. var self=this;
  1650. return smalltalk.withContext(function($ctx1) {
  1651. _st(self)._assert_equals_(_st("*hello* *world*")._copyWithoutAll_("*"),"hello world");
  1652. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  1653. messageSends: ["assert:equals:", "copyWithoutAll:"]}),
  1654. smalltalk.StringTest);
  1655. smalltalk.addMethod(
  1656. smalltalk.method({
  1657. selector: "testDetect",
  1658. fn: function (){
  1659. var self=this;
  1660. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1661. return smalltalk.withContext(function($ctx1) {
  1662. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  1663. return smalltalk.withContext(function($ctx2) {
  1664. return _st(each).__eq("h");
  1665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  1666. _st(self)._should_raise_((function(){
  1667. return smalltalk.withContext(function($ctx2) {
  1668. return _st(_st(self)._collection())._detect_((function(each){
  1669. return smalltalk.withContext(function($ctx3) {
  1670. return _st(each).__eq((6));
  1671. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1673. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  1674. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"]}),
  1675. smalltalk.StringTest);
  1676. smalltalk.addMethod(
  1677. smalltalk.method({
  1678. selector: "testEquality",
  1679. fn: function (){
  1680. var self=this;
  1681. return smalltalk.withContext(function($ctx1) {
  1682. _st(self)._assert_equals_("hello","hello");
  1683. _st(self)._deny_(_st("hello").__eq("world"));
  1684. _st(self)._deny_(_st("hello").__eq(_st([])._at_ifAbsent_((1),(function(){
  1685. return smalltalk.withContext(function($ctx2) {
  1686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))));
  1687. _st(self)._assert_equals_("hello",_st("hello")._yourself());
  1688. _st(self)._assert_equals_(_st("hello")._yourself(),"hello");
  1689. _st(self)._deny_(_st("").__eq((0)));
  1690. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  1691. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]}),
  1692. smalltalk.StringTest);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "testIdentity",
  1696. fn: function (){
  1697. var self=this;
  1698. return smalltalk.withContext(function($ctx1) {
  1699. _st(self)._assert_(_st("hello").__eq_eq("hello"));
  1700. _st(self)._deny_(_st("hello").__eq_eq("world"));
  1701. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  1702. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  1703. _st(self)._deny_(_st("").__eq_eq((0)));
  1704. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  1705. messageSends: ["assert:", "==", "deny:", "yourself"]}),
  1706. smalltalk.StringTest);
  1707. smalltalk.addMethod(
  1708. smalltalk.method({
  1709. selector: "testIncludesSubString",
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  1714. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  1715. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  1716. messageSends: ["assert:", "includesSubString:", "deny:"]}),
  1717. smalltalk.StringTest);
  1718. smalltalk.addMethod(
  1719. smalltalk.method({
  1720. selector: "testIndexOf",
  1721. fn: function (){
  1722. var self=this;
  1723. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1724. return smalltalk.withContext(function($ctx1) {
  1725. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_("e"),(2));
  1726. _st(self)._should_raise_((function(){
  1727. return smalltalk.withContext(function($ctx2) {
  1728. return _st(_st(self)._collection())._indexOf_((999));
  1729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1730. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_ifAbsent_((999),(function(){
  1731. return smalltalk.withContext(function($ctx2) {
  1732. return "sentinel";
  1733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  1735. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  1736. smalltalk.StringTest);
  1737. smalltalk.addMethod(
  1738. smalltalk.method({
  1739. selector: "testJoin",
  1740. fn: function (){
  1741. var self=this;
  1742. return smalltalk.withContext(function($ctx1) {
  1743. _st(self)._assert_equals_(_st(",")._join_(["hello", "world"]),"hello,world");
  1744. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  1745. messageSends: ["assert:equals:", "join:"]}),
  1746. smalltalk.StringTest);
  1747. smalltalk.addMethod(
  1748. smalltalk.method({
  1749. selector: "testSelect",
  1750. fn: function (){
  1751. var self=this;
  1752. var newCollection;
  1753. return smalltalk.withContext(function($ctx1) {
  1754. newCollection="o";
  1755. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1756. return smalltalk.withContext(function($ctx2) {
  1757. return _st(each).__eq("o");
  1758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1759. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  1760. messageSends: ["assertSameContents:as:", "select:", "=", "collection"]}),
  1761. smalltalk.StringTest);
  1762. smalltalk.addMethod(
  1763. smalltalk.method({
  1764. selector: "testSize",
  1765. fn: function (){
  1766. var self=this;
  1767. return smalltalk.withContext(function($ctx1) {
  1768. _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  1769. _st(self)._assert_equals_(_st("")._size(),(0));
  1770. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  1771. messageSends: ["assert:equals:", "size"]}),
  1772. smalltalk.StringTest);
  1773. smalltalk.addMethod(
  1774. smalltalk.method({
  1775. selector: "testStreamContents",
  1776. fn: function (){
  1777. var self=this;
  1778. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1779. return smalltalk.withContext(function($ctx1) {
  1780. var $1,$2;
  1781. _st(self)._assert_equals_(_st($String())._streamContents_((function(aStream){
  1782. return smalltalk.withContext(function($ctx2) {
  1783. $1=aStream;
  1784. _st($1)._nextPutAll_("hello");
  1785. _st($1)._space();
  1786. $2=_st($1)._nextPutAll_("world");
  1787. return $2;
  1788. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  1789. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  1790. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]}),
  1791. smalltalk.StringTest);
  1792. smalltalk.addMethod(
  1793. smalltalk.method({
  1794. selector: "collectionClass",
  1795. fn: function (){
  1796. var self=this;
  1797. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1798. return smalltalk.withContext(function($ctx1) {
  1799. var $1;
  1800. $1=$String();
  1801. return $1;
  1802. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  1803. messageSends: []}),
  1804. smalltalk.StringTest.klass);
  1805. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1806. smalltalk.addMethod(
  1807. smalltalk.method({
  1808. selector: "testShow",
  1809. fn: function (){
  1810. var self=this;
  1811. var originalTranscript;
  1812. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  1813. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  1814. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1815. return smalltalk.withContext(function($ctx1) {
  1816. originalTranscript=_st($Transcript())._current();
  1817. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  1818. _st(self)._shouldnt_raise_((function(){
  1819. return smalltalk.withContext(function($ctx2) {
  1820. return _st($Transcript())._show_("Hello console!");
  1821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1822. _st(self)._shouldnt_raise_((function(){
  1823. return smalltalk.withContext(function($ctx2) {
  1824. return _st($Transcript())._show_(console);
  1825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1826. _st($Transcript())._register_(originalTranscript);
  1827. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  1828. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]}),
  1829. smalltalk.ConsoleTranscriptTest);
  1830. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1831. smalltalk.addMethod(
  1832. smalltalk.method({
  1833. selector: "jsObject",
  1834. fn: function (){
  1835. var self=this;
  1836. return smalltalk.withContext(function($ctx1) {
  1837. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  1838. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  1839. messageSends: []}),
  1840. smalltalk.JSObjectProxyTest);
  1841. smalltalk.addMethod(
  1842. smalltalk.method({
  1843. selector: "testAtIfAbsent",
  1844. fn: function (){
  1845. var self=this;
  1846. var testObject;
  1847. return smalltalk.withContext(function($ctx1) {
  1848. testObject=_st(self)._jsObject();
  1849. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  1850. return smalltalk.withContext(function($ctx2) {
  1851. return "Property does not exist";
  1852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  1853. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  1854. return smalltalk.withContext(function($ctx2) {
  1855. return "Property does not exist";
  1856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1857. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  1858. return smalltalk.withContext(function($ctx2) {
  1859. return "Property does not exist";
  1860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  1861. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  1862. return smalltalk.withContext(function($ctx2) {
  1863. return "Property does not exist";
  1864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1865. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1866. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]}),
  1867. smalltalk.JSObjectProxyTest);
  1868. smalltalk.addMethod(
  1869. smalltalk.method({
  1870. selector: "testAtIfPresent",
  1871. fn: function (){
  1872. var self=this;
  1873. var testObject;
  1874. return smalltalk.withContext(function($ctx1) {
  1875. testObject=_st(self)._jsObject();
  1876. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  1877. return smalltalk.withContext(function($ctx2) {
  1878. return _st("hello ").__comma(_st(x)._asString());
  1879. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),nil);
  1880. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  1881. return smalltalk.withContext(function($ctx2) {
  1882. return _st("hello ").__comma(_st(x)._asString());
  1883. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  1884. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  1885. return smalltalk.withContext(function($ctx2) {
  1886. return _st("hello ").__comma(_st(x)._asString());
  1887. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello 1");
  1888. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  1889. return smalltalk.withContext(function($ctx2) {
  1890. return _st("hello ").__comma(_st(x)._asString());
  1891. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  1892. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1893. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]}),
  1894. smalltalk.JSObjectProxyTest);
  1895. smalltalk.addMethod(
  1896. smalltalk.method({
  1897. selector: "testAtIfPresentIfAbsent",
  1898. fn: function (){
  1899. var self=this;
  1900. var testObject;
  1901. return smalltalk.withContext(function($ctx1) {
  1902. testObject=_st(self)._jsObject();
  1903. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return _st("hello ").__comma(_st(x)._asString());
  1906. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1907. return smalltalk.withContext(function($ctx2) {
  1908. return "not present";
  1909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not present");
  1910. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  1911. return smalltalk.withContext(function($ctx2) {
  1912. return _st("hello ").__comma(_st(x)._asString());
  1913. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1914. return smalltalk.withContext(function($ctx2) {
  1915. return "not present";
  1916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  1917. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  1918. return smalltalk.withContext(function($ctx2) {
  1919. return _st("hello ").__comma(_st(x)._asString());
  1920. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1921. return smalltalk.withContext(function($ctx2) {
  1922. return "not present";
  1923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello 1");
  1924. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return _st("hello ").__comma(_st(x)._asString());
  1927. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1928. return smalltalk.withContext(function($ctx2) {
  1929. return "not present";
  1930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  1931. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1932. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]}),
  1933. smalltalk.JSObjectProxyTest);
  1934. smalltalk.addMethod(
  1935. smalltalk.method({
  1936. selector: "testDNU",
  1937. fn: function (){
  1938. var self=this;
  1939. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1940. return smalltalk.withContext(function($ctx1) {
  1941. _st(self)._should_raise_((function(){
  1942. return smalltalk.withContext(function($ctx2) {
  1943. return _st(_st(self)._jsObject())._foo();
  1944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  1945. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  1946. messageSends: ["should:raise:", "foo", "jsObject"]}),
  1947. smalltalk.JSObjectProxyTest);
  1948. smalltalk.addMethod(
  1949. smalltalk.method({
  1950. selector: "testMessageSend",
  1951. fn: function (){
  1952. var self=this;
  1953. return smalltalk.withContext(function($ctx1) {
  1954. _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  1955. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  1956. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  1957. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  1958. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]}),
  1959. smalltalk.JSObjectProxyTest);
  1960. smalltalk.addMethod(
  1961. smalltalk.method({
  1962. selector: "testMethodWithArguments",
  1963. fn: function (){
  1964. var self=this;
  1965. return smalltalk.withContext(function($ctx1) {
  1966. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  1967. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  1968. messageSends: ["assert:equals:", "c:", "jsObject"]}),
  1969. smalltalk.JSObjectProxyTest);
  1970. smalltalk.addMethod(
  1971. smalltalk.method({
  1972. selector: "testPrinting",
  1973. fn: function (){
  1974. var self=this;
  1975. return smalltalk.withContext(function($ctx1) {
  1976. _st(self)._assert_equals_(_st(_st(self)._jsObject())._printString(),"[object Object]");
  1977. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  1978. messageSends: ["assert:equals:", "printString", "jsObject"]}),
  1979. smalltalk.JSObjectProxyTest);
  1980. smalltalk.addMethod(
  1981. smalltalk.method({
  1982. selector: "testPropertyThatReturnsEmptyString",
  1983. fn: function (){
  1984. var self=this;
  1985. var object;
  1986. return smalltalk.withContext(function($ctx1) {
  1987. object=_st(self)._jsObject();
  1988. _st(self)._assert_equals_(_st(object)._d(),"");
  1989. _st(object)._d_("hello");
  1990. _st(self)._assert_equals_(_st(object)._d(),"hello");
  1991. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  1992. messageSends: ["jsObject", "assert:equals:", "d", "d:"]}),
  1993. smalltalk.JSObjectProxyTest);
  1994. smalltalk.addMethod(
  1995. smalltalk.method({
  1996. selector: "testPropertyThatReturnsUndefined",
  1997. fn: function (){
  1998. var self=this;
  1999. var object;
  2000. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2001. return smalltalk.withContext(function($ctx1) {
  2002. object=_st(self)._jsObject();
  2003. _st(self)._shouldnt_raise_((function(){
  2004. return smalltalk.withContext(function($ctx2) {
  2005. return _st(object)._e();
  2006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2007. _st(self)._assert_(_st(_st(object)._e())._isNil());
  2008. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  2009. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]}),
  2010. smalltalk.JSObjectProxyTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testValue",
  2014. fn: function (){
  2015. var self=this;
  2016. var testObject;
  2017. return smalltalk.withContext(function($ctx1) {
  2018. testObject=_st(self)._jsObject();
  2019. _st(self)._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2020. _st(testObject)._at_put_("value","aValue");
  2021. _st(self)._assert_equals_(_st(testObject)._value(),"aValue");
  2022. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2023. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"]}),
  2024. smalltalk.JSObjectProxyTest);
  2025. smalltalk.addMethod(
  2026. smalltalk.method({
  2027. selector: "testYourself",
  2028. fn: function (){
  2029. var self=this;
  2030. var object;
  2031. return smalltalk.withContext(function($ctx1) {
  2032. var $1,$2;
  2033. $1=_st(self)._jsObject();
  2034. _st($1)._d_("test");
  2035. $2=_st($1)._yourself();
  2036. object=$2;
  2037. _st(self)._assert_equals_(_st(object)._d(),"test");
  2038. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  2039. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]}),
  2040. smalltalk.JSObjectProxyTest);
  2041. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2042. smalltalk.addMethod(
  2043. smalltalk.method({
  2044. selector: "testCatchingException",
  2045. fn: function (){
  2046. var self=this;
  2047. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2048. return smalltalk.withContext(function($ctx1) {
  2049. _st((function(){
  2050. return smalltalk.withContext(function($ctx2) {
  2051. return _st(self)._throwException();
  2052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(error){
  2053. return smalltalk.withContext(function($ctx2) {
  2054. return _st(self)._assert_(_st(_st(error)._exception()).__eq("test"));
  2055. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2057. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"]}),
  2058. smalltalk.JavaScriptExceptionTest);
  2059. smalltalk.addMethod(
  2060. smalltalk.method({
  2061. selector: "testRaisingException",
  2062. fn: function (){
  2063. var self=this;
  2064. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2065. return smalltalk.withContext(function($ctx1) {
  2066. _st(self)._should_raise_((function(){
  2067. return smalltalk.withContext(function($ctx2) {
  2068. return _st(self)._throwException();
  2069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$JavaScriptException());
  2070. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2071. messageSends: ["should:raise:", "throwException"]}),
  2072. smalltalk.JavaScriptExceptionTest);
  2073. smalltalk.addMethod(
  2074. smalltalk.method({
  2075. selector: "throwException",
  2076. fn: function (){
  2077. var self=this;
  2078. return smalltalk.withContext(function($ctx1) {
  2079. throw 'test';
  2080. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2081. messageSends: []}),
  2082. smalltalk.JavaScriptExceptionTest);
  2083. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2084. smalltalk.addMethod(
  2085. smalltalk.method({
  2086. selector: "testValue",
  2087. fn: function (){
  2088. var self=this;
  2089. var messageSend;
  2090. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2091. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2092. return smalltalk.withContext(function($ctx1) {
  2093. var $1,$2;
  2094. $1=_st($MessageSend())._new();
  2095. _st($1)._receiver_(_st($Object())._new());
  2096. _st($1)._selector_("asString");
  2097. $2=_st($1)._yourself();
  2098. messageSend=$2;
  2099. _st(self)._assert_equals_(_st(messageSend)._value(),"an Object");
  2100. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2101. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]}),
  2102. smalltalk.MessageSendTest);
  2103. smalltalk.addMethod(
  2104. smalltalk.method({
  2105. selector: "testValueWithArguments",
  2106. fn: function (){
  2107. var self=this;
  2108. var messageSend;
  2109. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2110. return smalltalk.withContext(function($ctx1) {
  2111. var $1,$2;
  2112. $1=_st($MessageSend())._new();
  2113. _st($1)._receiver_((2));
  2114. _st($1)._selector_("+");
  2115. $2=_st($1)._yourself();
  2116. messageSend=$2;
  2117. _st(self)._assert_equals_(_st(messageSend)._value_((3)),(5));
  2118. _st(self)._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2119. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2120. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]}),
  2121. smalltalk.MessageSendTest);
  2122. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2123. smalltalk.addMethod(
  2124. smalltalk.method({
  2125. selector: "testAbs",
  2126. fn: function (){
  2127. var self=this;
  2128. return smalltalk.withContext(function($ctx1) {
  2129. _st(self)._assert_equals_(_st((4))._abs(),(4));
  2130. _st(self)._assert_equals_(_st((-4))._abs(),(4));
  2131. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  2132. messageSends: ["assert:equals:", "abs"]}),
  2133. smalltalk.NumberTest);
  2134. smalltalk.addMethod(
  2135. smalltalk.method({
  2136. selector: "testArithmetic",
  2137. fn: function (){
  2138. var self=this;
  2139. return smalltalk.withContext(function($ctx1) {
  2140. _st(self)._assert_equals_(_st((1.5)).__plus((1)),(2.5));
  2141. _st(self)._assert_equals_(_st((2)).__minus((1)),(1));
  2142. _st(self)._assert_equals_(_st((-2)).__minus((1)),(-3));
  2143. _st(self)._assert_equals_(_st((12)).__slash((2)),(6));
  2144. _st(self)._assert_equals_(_st((3)).__star((4)),(12));
  2145. _st(self)._assert_equals_(_st(_st((1)).__plus((2))).__star((3)),(9));
  2146. _st(self)._assert_equals_(_st((1)).__plus(_st((2)).__star((3))),(7));
  2147. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  2148. messageSends: ["assert:equals:", "+", "-", "/", "*"]}),
  2149. smalltalk.NumberTest);
  2150. smalltalk.addMethod(
  2151. smalltalk.method({
  2152. selector: "testComparison",
  2153. fn: function (){
  2154. var self=this;
  2155. return smalltalk.withContext(function($ctx1) {
  2156. _st(self)._assert_(_st((3)).__gt((2)));
  2157. _st(self)._assert_(_st((2)).__lt((3)));
  2158. _st(self)._deny_(_st((3)).__lt((2)));
  2159. _st(self)._deny_(_st((2)).__gt((3)));
  2160. _st(self)._assert_(_st((3)).__gt_eq((3)));
  2161. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  2162. _st(self)._assert_(_st((3)).__lt_eq((3)));
  2163. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  2164. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  2165. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]}),
  2166. smalltalk.NumberTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "testCopying",
  2170. fn: function (){
  2171. var self=this;
  2172. return smalltalk.withContext(function($ctx1) {
  2173. _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  2174. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  2175. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  2176. messageSends: ["assert:", "==", "copy", "deepCopy"]}),
  2177. smalltalk.NumberTest);
  2178. smalltalk.addMethod(
  2179. smalltalk.method({
  2180. selector: "testEquality",
  2181. fn: function (){
  2182. var self=this;
  2183. return smalltalk.withContext(function($ctx1) {
  2184. _st(self)._assert_(_st((1)).__eq((1)));
  2185. _st(self)._assert_(_st((0)).__eq((0)));
  2186. _st(self)._deny_(_st((1)).__eq((0)));
  2187. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  2188. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  2189. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  2190. _st(self)._deny_(_st((0)).__eq(false));
  2191. _st(self)._deny_(_st(false).__eq((0)));
  2192. _st(self)._deny_(_st("").__eq((0)));
  2193. _st(self)._deny_(_st((0)).__eq(""));
  2194. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  2195. messageSends: ["assert:", "=", "deny:", "yourself"]}),
  2196. smalltalk.NumberTest);
  2197. smalltalk.addMethod(
  2198. smalltalk.method({
  2199. selector: "testHexNumbers",
  2200. fn: function (){
  2201. var self=this;
  2202. return smalltalk.withContext(function($ctx1) {
  2203. _st(self)._assert_equals_((9),(9));
  2204. _st(self)._assert_equals_(_st((10))._truncated(),(10));
  2205. _st(self)._assert_equals_(_st((11))._truncated(),(11));
  2206. _st(self)._assert_equals_(_st((12))._truncated(),(12));
  2207. _st(self)._assert_equals_(_st((13))._truncated(),(13));
  2208. _st(self)._assert_equals_(_st((14))._truncated(),(14));
  2209. _st(self)._assert_equals_(_st((15))._truncated(),(15));
  2210. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  2211. messageSends: ["assert:equals:", "truncated"]}),
  2212. smalltalk.NumberTest);
  2213. smalltalk.addMethod(
  2214. smalltalk.method({
  2215. selector: "testIdentity",
  2216. fn: function (){
  2217. var self=this;
  2218. return smalltalk.withContext(function($ctx1) {
  2219. _st(self)._assert_(_st((1)).__eq_eq((1)));
  2220. _st(self)._assert_(_st((0)).__eq_eq((0)));
  2221. _st(self)._deny_(_st((1)).__eq_eq((0)));
  2222. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  2223. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  2224. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  2225. _st(self)._deny_(_st((1)).__eq_eq((2)));
  2226. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  2227. messageSends: ["assert:", "==", "deny:", "yourself"]}),
  2228. smalltalk.NumberTest);
  2229. smalltalk.addMethod(
  2230. smalltalk.method({
  2231. selector: "testInvalidHexNumbers",
  2232. fn: function (){
  2233. var self=this;
  2234. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2235. return smalltalk.withContext(function($ctx1) {
  2236. _st(self)._should_raise_((function(){
  2237. return smalltalk.withContext(function($ctx2) {
  2238. return _st((16))._rG();
  2239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2240. _st(self)._should_raise_((function(){
  2241. return smalltalk.withContext(function($ctx2) {
  2242. return _st((16))._rg();
  2243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2244. _st(self)._should_raise_((function(){
  2245. return smalltalk.withContext(function($ctx2) {
  2246. return _st((16))._rH();
  2247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2248. _st(self)._should_raise_((function(){
  2249. return smalltalk.withContext(function($ctx2) {
  2250. return _st((16))._rh();
  2251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2252. _st(self)._should_raise_((function(){
  2253. return smalltalk.withContext(function($ctx2) {
  2254. return _st((16))._rI();
  2255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2256. _st(self)._should_raise_((function(){
  2257. return smalltalk.withContext(function($ctx2) {
  2258. return _st((16))._ri();
  2259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2260. _st(self)._should_raise_((function(){
  2261. return smalltalk.withContext(function($ctx2) {
  2262. return _st((16))._rJ();
  2263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2264. _st(self)._should_raise_((function(){
  2265. return smalltalk.withContext(function($ctx2) {
  2266. return _st((16))._rj();
  2267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2268. _st(self)._should_raise_((function(){
  2269. return smalltalk.withContext(function($ctx2) {
  2270. return _st((16))._rK();
  2271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2272. _st(self)._should_raise_((function(){
  2273. return smalltalk.withContext(function($ctx2) {
  2274. return _st((16))._rk();
  2275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2276. _st(self)._should_raise_((function(){
  2277. return smalltalk.withContext(function($ctx2) {
  2278. return _st((16))._rL();
  2279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2280. _st(self)._should_raise_((function(){
  2281. return smalltalk.withContext(function($ctx2) {
  2282. return _st((16))._rl();
  2283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2284. _st(self)._should_raise_((function(){
  2285. return smalltalk.withContext(function($ctx2) {
  2286. return _st((16))._rM();
  2287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2288. _st(self)._should_raise_((function(){
  2289. return smalltalk.withContext(function($ctx2) {
  2290. return _st((16))._rm();
  2291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2292. _st(self)._should_raise_((function(){
  2293. return smalltalk.withContext(function($ctx2) {
  2294. return _st((16))._rN();
  2295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2296. _st(self)._should_raise_((function(){
  2297. return smalltalk.withContext(function($ctx2) {
  2298. return _st((16))._rn();
  2299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2300. _st(self)._should_raise_((function(){
  2301. return smalltalk.withContext(function($ctx2) {
  2302. return _st((16))._rO();
  2303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2304. _st(self)._should_raise_((function(){
  2305. return smalltalk.withContext(function($ctx2) {
  2306. return _st((16))._ro();
  2307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2308. _st(self)._should_raise_((function(){
  2309. return smalltalk.withContext(function($ctx2) {
  2310. return _st((16))._rP();
  2311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2312. _st(self)._should_raise_((function(){
  2313. return smalltalk.withContext(function($ctx2) {
  2314. return _st((16))._rp();
  2315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2316. _st(self)._should_raise_((function(){
  2317. return smalltalk.withContext(function($ctx2) {
  2318. return _st((16))._rQ();
  2319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2320. _st(self)._should_raise_((function(){
  2321. return smalltalk.withContext(function($ctx2) {
  2322. return _st((16))._rq();
  2323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2324. _st(self)._should_raise_((function(){
  2325. return smalltalk.withContext(function($ctx2) {
  2326. return _st((16))._rR();
  2327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2328. _st(self)._should_raise_((function(){
  2329. return smalltalk.withContext(function($ctx2) {
  2330. return _st((16))._rr();
  2331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2332. _st(self)._should_raise_((function(){
  2333. return smalltalk.withContext(function($ctx2) {
  2334. return _st((16))._rS();
  2335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2336. _st(self)._should_raise_((function(){
  2337. return smalltalk.withContext(function($ctx2) {
  2338. return _st((16))._rs();
  2339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2340. _st(self)._should_raise_((function(){
  2341. return smalltalk.withContext(function($ctx2) {
  2342. return _st((16))._rT();
  2343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2344. _st(self)._should_raise_((function(){
  2345. return smalltalk.withContext(function($ctx2) {
  2346. return _st((16))._rt();
  2347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2348. _st(self)._should_raise_((function(){
  2349. return smalltalk.withContext(function($ctx2) {
  2350. return _st((16))._rU();
  2351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2352. _st(self)._should_raise_((function(){
  2353. return smalltalk.withContext(function($ctx2) {
  2354. return _st((16))._ru();
  2355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2356. _st(self)._should_raise_((function(){
  2357. return smalltalk.withContext(function($ctx2) {
  2358. return _st((16))._rV();
  2359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2360. _st(self)._should_raise_((function(){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. return _st((16))._rv();
  2363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2364. _st(self)._should_raise_((function(){
  2365. return smalltalk.withContext(function($ctx2) {
  2366. return _st((16))._rW();
  2367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2368. _st(self)._should_raise_((function(){
  2369. return smalltalk.withContext(function($ctx2) {
  2370. return _st((16))._rw();
  2371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2372. _st(self)._should_raise_((function(){
  2373. return smalltalk.withContext(function($ctx2) {
  2374. return _st((16))._rX();
  2375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2376. _st(self)._should_raise_((function(){
  2377. return smalltalk.withContext(function($ctx2) {
  2378. return _st((16))._rx();
  2379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2380. _st(self)._should_raise_((function(){
  2381. return smalltalk.withContext(function($ctx2) {
  2382. return _st((16))._rY();
  2383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2384. _st(self)._should_raise_((function(){
  2385. return smalltalk.withContext(function($ctx2) {
  2386. return _st((16))._ry();
  2387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2388. _st(self)._should_raise_((function(){
  2389. return smalltalk.withContext(function($ctx2) {
  2390. return _st((16))._rZ();
  2391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2392. _st(self)._should_raise_((function(){
  2393. return smalltalk.withContext(function($ctx2) {
  2394. return _st((16))._rz();
  2395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2396. _st(self)._should_raise_((function(){
  2397. return smalltalk.withContext(function($ctx2) {
  2398. return _st((11259375))._Z();
  2399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2400. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  2401. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"]}),
  2402. smalltalk.NumberTest);
  2403. smalltalk.addMethod(
  2404. smalltalk.method({
  2405. selector: "testMinMax",
  2406. fn: function (){
  2407. var self=this;
  2408. return smalltalk.withContext(function($ctx1) {
  2409. _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  2410. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  2411. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  2412. messageSends: ["assert:equals:", "max:", "min:"]}),
  2413. smalltalk.NumberTest);
  2414. smalltalk.addMethod(
  2415. smalltalk.method({
  2416. selector: "testNegated",
  2417. fn: function (){
  2418. var self=this;
  2419. return smalltalk.withContext(function($ctx1) {
  2420. _st(self)._assert_equals_(_st((3))._negated(),(-3));
  2421. _st(self)._assert_equals_(_st((-3))._negated(),(3));
  2422. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  2423. messageSends: ["assert:equals:", "negated"]}),
  2424. smalltalk.NumberTest);
  2425. smalltalk.addMethod(
  2426. smalltalk.method({
  2427. selector: "testPrintShowingDecimalPlaces",
  2428. fn: function (){
  2429. var self=this;
  2430. return smalltalk.withContext(function($ctx1) {
  2431. _st(self)._assert_equals_(_st((23))._printShowingDecimalPlaces_((2)),"23.00");
  2432. _st(self)._assert_equals_(_st((23.5698))._printShowingDecimalPlaces_((2)),"23.57");
  2433. _st(self)._assert_equals_(_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  2434. _st(self)._assert_equals_(_st((23.4567))._printShowingDecimalPlaces_((0)),"23");
  2435. _st(self)._assert_equals_(_st((23.5567))._printShowingDecimalPlaces_((0)),"24");
  2436. _st(self)._assert_equals_(_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)),"-23");
  2437. _st(self)._assert_equals_(_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)),"-24");
  2438. _st(self)._assert_equals_(_st((100000000))._printShowingDecimalPlaces_((1)),"100000000.0");
  2439. _st(self)._assert_equals_(_st((0.98))._printShowingDecimalPlaces_((5)),"0.98000");
  2440. _st(self)._assert_equals_(_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  2441. _st(self)._assert_equals_(_st((2.567))._printShowingDecimalPlaces_((2)),"2.57");
  2442. _st(self)._assert_equals_(_st((-2.567))._printShowingDecimalPlaces_((2)),"-2.57");
  2443. _st(self)._assert_equals_(_st((0))._printShowingDecimalPlaces_((2)),"0.00");
  2444. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  2445. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]}),
  2446. smalltalk.NumberTest);
  2447. smalltalk.addMethod(
  2448. smalltalk.method({
  2449. selector: "testRounded",
  2450. fn: function (){
  2451. var self=this;
  2452. return smalltalk.withContext(function($ctx1) {
  2453. _st(self)._assert_equals_(_st((3))._rounded(),(3));
  2454. _st(self)._assert_equals_(_st((3.212))._rounded(),(3));
  2455. _st(self)._assert_equals_(_st((3.51))._rounded(),(4));
  2456. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  2457. messageSends: ["assert:equals:", "rounded"]}),
  2458. smalltalk.NumberTest);
  2459. smalltalk.addMethod(
  2460. smalltalk.method({
  2461. selector: "testSqrt",
  2462. fn: function (){
  2463. var self=this;
  2464. return smalltalk.withContext(function($ctx1) {
  2465. _st(self)._assert_equals_(_st((4))._sqrt(),(2));
  2466. _st(self)._assert_equals_(_st((16))._sqrt(),(4));
  2467. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  2468. messageSends: ["assert:equals:", "sqrt"]}),
  2469. smalltalk.NumberTest);
  2470. smalltalk.addMethod(
  2471. smalltalk.method({
  2472. selector: "testSquared",
  2473. fn: function (){
  2474. var self=this;
  2475. return smalltalk.withContext(function($ctx1) {
  2476. _st(self)._assert_equals_(_st((4))._squared(),(16));
  2477. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  2478. messageSends: ["assert:equals:", "squared"]}),
  2479. smalltalk.NumberTest);
  2480. smalltalk.addMethod(
  2481. smalltalk.method({
  2482. selector: "testTimesRepeat",
  2483. fn: function (){
  2484. var self=this;
  2485. var i;
  2486. return smalltalk.withContext(function($ctx1) {
  2487. i=(0);
  2488. _st((0))._timesRepeat_((function(){
  2489. return smalltalk.withContext(function($ctx2) {
  2490. i=_st(i).__plus((1));
  2491. return i;
  2492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2493. _st(self)._assert_equals_(i,(0));
  2494. _st((5))._timesRepeat_((function(){
  2495. return smalltalk.withContext(function($ctx2) {
  2496. i=_st(i).__plus((1));
  2497. return i;
  2498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2499. _st(self)._assert_equals_(i,(5));
  2500. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  2501. messageSends: ["timesRepeat:", "+", "assert:equals:"]}),
  2502. smalltalk.NumberTest);
  2503. smalltalk.addMethod(
  2504. smalltalk.method({
  2505. selector: "testTo",
  2506. fn: function (){
  2507. var self=this;
  2508. return smalltalk.withContext(function($ctx1) {
  2509. _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  2510. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  2511. messageSends: ["assert:equals:", "to:"]}),
  2512. smalltalk.NumberTest);
  2513. smalltalk.addMethod(
  2514. smalltalk.method({
  2515. selector: "testToBy",
  2516. fn: function (){
  2517. var self=this;
  2518. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2519. return smalltalk.withContext(function($ctx1) {
  2520. _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  2521. _st(self)._should_raise_((function(){
  2522. return smalltalk.withContext(function($ctx2) {
  2523. return _st((1))._to_by_((4),(0));
  2524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2525. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  2526. messageSends: ["assert:equals:", "to:by:", "should:raise:"]}),
  2527. smalltalk.NumberTest);
  2528. smalltalk.addMethod(
  2529. smalltalk.method({
  2530. selector: "testTruncated",
  2531. fn: function (){
  2532. var self=this;
  2533. return smalltalk.withContext(function($ctx1) {
  2534. _st(self)._assert_equals_(_st((3))._truncated(),(3));
  2535. _st(self)._assert_equals_(_st((3.212))._truncated(),(3));
  2536. _st(self)._assert_equals_(_st((3.51))._truncated(),(3));
  2537. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  2538. messageSends: ["assert:equals:", "truncated"]}),
  2539. smalltalk.NumberTest);
  2540. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  2541. smalltalk.addMethod(
  2542. smalltalk.method({
  2543. selector: "foo",
  2544. fn: function (){
  2545. var self=this;
  2546. return smalltalk.withContext(function($ctx1) {
  2547. var $1;
  2548. $1=self["@foo"];
  2549. return $1;
  2550. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  2551. messageSends: []}),
  2552. smalltalk.ObjectMock);
  2553. smalltalk.addMethod(
  2554. smalltalk.method({
  2555. selector: "foo:",
  2556. fn: function (anObject){
  2557. var self=this;
  2558. return smalltalk.withContext(function($ctx1) {
  2559. self["@foo"]=anObject;
  2560. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  2561. messageSends: []}),
  2562. smalltalk.ObjectMock);
  2563. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2564. smalltalk.addMethod(
  2565. smalltalk.method({
  2566. selector: "notDefined",
  2567. fn: function (){
  2568. var self=this;
  2569. return smalltalk.withContext(function($ctx1) {
  2570. return undefined;;
  2571. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  2572. messageSends: []}),
  2573. smalltalk.ObjectTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "testBasicAccess",
  2577. fn: function (){
  2578. var self=this;
  2579. var o;
  2580. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2581. return smalltalk.withContext(function($ctx1) {
  2582. o=_st($Object())._new();
  2583. _st(o)._basicAt_put_("a",(1));
  2584. _st(self)._assert_equals_(_st(o)._basicAt_("a"),(1));
  2585. _st(self)._assert_equals_(_st(o)._basicAt_("b"),nil);
  2586. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  2587. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]}),
  2588. smalltalk.ObjectTest);
  2589. smalltalk.addMethod(
  2590. smalltalk.method({
  2591. selector: "testBasicPerform",
  2592. fn: function (){
  2593. var self=this;
  2594. var o;
  2595. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2596. return smalltalk.withContext(function($ctx1) {
  2597. o=_st($Object())._new();
  2598. _st(o)._basicAt_put_("func",(function(){
  2599. return smalltalk.withContext(function($ctx2) {
  2600. return "hello";
  2601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2602. _st(o)._basicAt_put_("func2",(function(a){
  2603. return smalltalk.withContext(function($ctx2) {
  2604. return _st(a).__plus((1));
  2605. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  2606. _st(self)._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  2607. _st(self)._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  2608. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  2609. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]}),
  2610. smalltalk.ObjectTest);
  2611. smalltalk.addMethod(
  2612. smalltalk.method({
  2613. selector: "testDNU",
  2614. fn: function (){
  2615. var self=this;
  2616. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2617. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2618. return smalltalk.withContext(function($ctx1) {
  2619. _st(self)._should_raise_((function(){
  2620. return smalltalk.withContext(function($ctx2) {
  2621. return _st(_st($Object())._new())._foo();
  2622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2623. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  2624. messageSends: ["should:raise:", "foo", "new"]}),
  2625. smalltalk.ObjectTest);
  2626. smalltalk.addMethod(
  2627. smalltalk.method({
  2628. selector: "testEquality",
  2629. fn: function (){
  2630. var self=this;
  2631. var o;
  2632. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2633. return smalltalk.withContext(function($ctx1) {
  2634. o=_st($Object())._new();
  2635. _st(self)._deny_(_st(o).__eq(_st($Object())._new()));
  2636. _st(self)._assert_(_st(o).__eq(o));
  2637. _st(self)._assert_(_st(_st(o)._yourself()).__eq(o));
  2638. _st(self)._assert_(_st(o).__eq(_st(o)._yourself()));
  2639. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  2640. messageSends: ["new", "deny:", "=", "assert:", "yourself"]}),
  2641. smalltalk.ObjectTest);
  2642. smalltalk.addMethod(
  2643. smalltalk.method({
  2644. selector: "testHalt",
  2645. fn: function (){
  2646. var self=this;
  2647. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2648. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2649. return smalltalk.withContext(function($ctx1) {
  2650. _st(self)._should_raise_((function(){
  2651. return smalltalk.withContext(function($ctx2) {
  2652. return _st(_st($Object())._new())._halt();
  2653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2654. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  2655. messageSends: ["should:raise:", "halt", "new"]}),
  2656. smalltalk.ObjectTest);
  2657. smalltalk.addMethod(
  2658. smalltalk.method({
  2659. selector: "testIdentity",
  2660. fn: function (){
  2661. var self=this;
  2662. var o;
  2663. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2664. return smalltalk.withContext(function($ctx1) {
  2665. o=_st($Object())._new();
  2666. _st(self)._deny_(_st(o).__eq_eq(_st($Object())._new()));
  2667. _st(self)._assert_(_st(o).__eq_eq(o));
  2668. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2669. _st(self)._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  2670. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  2671. messageSends: ["new", "deny:", "==", "assert:", "yourself"]}),
  2672. smalltalk.ObjectTest);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "testIfNil",
  2676. fn: function (){
  2677. var self=this;
  2678. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2679. return smalltalk.withContext(function($ctx1) {
  2680. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  2681. _st(self)._deny_(_st(_st($Object())._new())._isNil());
  2682. $1=self;
  2683. $4=_st($Object())._new();
  2684. if(($receiver = $4) == nil || $receiver == undefined){
  2685. $3=true;
  2686. } else {
  2687. $3=$4;
  2688. };
  2689. $2=_st($3).__eq(true);
  2690. _st($1)._deny_($2);
  2691. $5=self;
  2692. $7=_st($Object())._new();
  2693. if(($receiver = $7) == nil || $receiver == undefined){
  2694. $6=$7;
  2695. } else {
  2696. $6=true;
  2697. };
  2698. _st($5)._assert_equals_($6,true);
  2699. $8=self;
  2700. $10=_st($Object())._new();
  2701. if(($receiver = $10) == nil || $receiver == undefined){
  2702. $9=false;
  2703. } else {
  2704. $9=true;
  2705. };
  2706. _st($8)._assert_equals_($9,true);
  2707. $11=self;
  2708. $13=_st($Object())._new();
  2709. if(($receiver = $13) == nil || $receiver == undefined){
  2710. $12=false;
  2711. } else {
  2712. $12=true;
  2713. };
  2714. _st($11)._assert_equals_($12,true);
  2715. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  2716. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]}),
  2717. smalltalk.ObjectTest);
  2718. smalltalk.addMethod(
  2719. smalltalk.method({
  2720. selector: "testInstVars",
  2721. fn: function (){
  2722. var self=this;
  2723. var o;
  2724. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  2725. return smalltalk.withContext(function($ctx1) {
  2726. o=_st($ObjectMock())._new();
  2727. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  2728. _st(o)._instVarAt_put_("foo",(1));
  2729. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  2730. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  2731. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  2732. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]}),
  2733. smalltalk.ObjectTest);
  2734. smalltalk.addMethod(
  2735. smalltalk.method({
  2736. selector: "testNilUndefined",
  2737. fn: function (){
  2738. var self=this;
  2739. return smalltalk.withContext(function($ctx1) {
  2740. _st(self)._assert_equals_(_st(self)._notDefined(),nil);
  2741. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  2742. messageSends: ["assert:equals:", "notDefined"]}),
  2743. smalltalk.ObjectTest);
  2744. smalltalk.addMethod(
  2745. smalltalk.method({
  2746. selector: "testYourself",
  2747. fn: function (){
  2748. var self=this;
  2749. var o;
  2750. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  2751. return smalltalk.withContext(function($ctx1) {
  2752. o=_st($ObjectMock())._new();
  2753. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2754. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  2755. messageSends: ["new", "assert:", "==", "yourself"]}),
  2756. smalltalk.ObjectTest);
  2757. smalltalk.addMethod(
  2758. smalltalk.method({
  2759. selector: "testidentityHash",
  2760. fn: function (){
  2761. var self=this;
  2762. var o1,o2;
  2763. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2764. return smalltalk.withContext(function($ctx1) {
  2765. o1=_st($Object())._new();
  2766. o2=_st($Object())._new();
  2767. _st(self)._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  2768. _st(self)._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  2769. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  2770. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]}),
  2771. smalltalk.ObjectTest);
  2772. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2773. smalltalk.addMethod(
  2774. smalltalk.method({
  2775. selector: "setUp",
  2776. fn: function (){
  2777. var self=this;
  2778. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2779. return smalltalk.withContext(function($ctx1) {
  2780. var $1,$2;
  2781. self["@backUpCommitPathJs"]=_st($Package())._defaultCommitPathJs();
  2782. self["@backUpCommitPathSt"]=_st($Package())._defaultCommitPathSt();
  2783. _st($Package())._resetCommitPaths();
  2784. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  2785. $1=_st($Package())._new();
  2786. _st($1)._name_("Grul");
  2787. _st($1)._commitPathJs_("server/grul/js");
  2788. _st($1)._commitPathSt_("grul/st");
  2789. $2=_st($1)._yourself();
  2790. self["@grulPackage"]=$2;
  2791. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageTest)})},
  2792. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"]}),
  2793. smalltalk.PackageTest);
  2794. smalltalk.addMethod(
  2795. smalltalk.method({
  2796. selector: "tearDown",
  2797. fn: function (){
  2798. var self=this;
  2799. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2800. return smalltalk.withContext(function($ctx1) {
  2801. var $1,$2;
  2802. $1=$Package();
  2803. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2804. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2805. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.PackageTest)})},
  2806. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"]}),
  2807. smalltalk.PackageTest);
  2808. smalltalk.addMethod(
  2809. smalltalk.method({
  2810. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2811. fn: function (){
  2812. var self=this;
  2813. return smalltalk.withContext(function($ctx1) {
  2814. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2815. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageTest)})},
  2816. messageSends: ["assert:equals:", "commitPathJs"]}),
  2817. smalltalk.PackageTest);
  2818. smalltalk.addMethod(
  2819. smalltalk.method({
  2820. selector: "testGrulCommitPathStShouldBeGrulSt",
  2821. fn: function (){
  2822. var self=this;
  2823. return smalltalk.withContext(function($ctx1) {
  2824. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2825. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageTest)})},
  2826. messageSends: ["assert:equals:", "commitPathSt"]}),
  2827. smalltalk.PackageTest);
  2828. smalltalk.addMethod(
  2829. smalltalk.method({
  2830. selector: "testZorkCommitPathJsShouldBeJs",
  2831. fn: function (){
  2832. var self=this;
  2833. return smalltalk.withContext(function($ctx1) {
  2834. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  2835. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.PackageTest)})},
  2836. messageSends: ["assert:equals:", "commitPathJs"]}),
  2837. smalltalk.PackageTest);
  2838. smalltalk.addMethod(
  2839. smalltalk.method({
  2840. selector: "testZorkCommitPathStShouldBeSt",
  2841. fn: function (){
  2842. var self=this;
  2843. return smalltalk.withContext(function($ctx1) {
  2844. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  2845. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.PackageTest)})},
  2846. messageSends: ["assert:equals:", "commitPathSt"]}),
  2847. smalltalk.PackageTest);
  2848. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2849. smalltalk.addMethod(
  2850. smalltalk.method({
  2851. selector: "setUp",
  2852. fn: function (){
  2853. var self=this;
  2854. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2855. return smalltalk.withContext(function($ctx1) {
  2856. var $1,$2;
  2857. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  2858. $1=$Package();
  2859. _st($1)._defaultCommitPathJs_("javascripts/");
  2860. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2861. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2862. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"]}),
  2863. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2864. smalltalk.addMethod(
  2865. smalltalk.method({
  2866. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2867. fn: function (){
  2868. var self=this;
  2869. return smalltalk.withContext(function($ctx1) {
  2870. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2871. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2872. messageSends: ["assert:equals:", "commitPathJs"]}),
  2873. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2874. smalltalk.addMethod(
  2875. smalltalk.method({
  2876. selector: "testGrulCommitPathStShouldBeGrulSt",
  2877. fn: function (){
  2878. var self=this;
  2879. return smalltalk.withContext(function($ctx1) {
  2880. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2881. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2882. messageSends: ["assert:equals:", "commitPathSt"]}),
  2883. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2884. smalltalk.addMethod(
  2885. smalltalk.method({
  2886. selector: "testZorkCommitPathJsShouldBeJavascript",
  2887. fn: function (){
  2888. var self=this;
  2889. return smalltalk.withContext(function($ctx1) {
  2890. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  2891. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2892. messageSends: ["assert:equals:", "commitPathJs"]}),
  2893. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2894. smalltalk.addMethod(
  2895. smalltalk.method({
  2896. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2897. fn: function (){
  2898. var self=this;
  2899. return smalltalk.withContext(function($ctx1) {
  2900. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  2901. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2902. messageSends: ["assert:equals:", "commitPathSt"]}),
  2903. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "shouldInheritSelectors",
  2907. fn: function (){
  2908. var self=this;
  2909. return smalltalk.withContext(function($ctx1) {
  2910. return false;
  2911. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.PackageWithDefaultCommitPathChangedTest.klass)})},
  2912. messageSends: []}),
  2913. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2914. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2915. smalltalk.addMethod(
  2916. smalltalk.method({
  2917. selector: "testAccessing",
  2918. fn: function (){
  2919. var self=this;
  2920. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2921. return smalltalk.withContext(function($ctx1) {
  2922. _st(self)._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  2923. _st(self)._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  2924. _st(self)._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  2925. _st(self)._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  2926. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  2927. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]}),
  2928. smalltalk.PointTest);
  2929. smalltalk.addMethod(
  2930. smalltalk.method({
  2931. selector: "testArithmetic",
  2932. fn: function (){
  2933. var self=this;
  2934. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2935. return smalltalk.withContext(function($ctx1) {
  2936. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__star(_st((3)).__at((4))),_st($Point())._x_y_((9),(16)));
  2937. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st($Point())._x_y_((6),(8)));
  2938. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st($Point())._x_y_((0),(0)));
  2939. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st($Point())._x_y_((2),(2)));
  2940. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  2941. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]}),
  2942. smalltalk.PointTest);
  2943. smalltalk.addMethod(
  2944. smalltalk.method({
  2945. selector: "testAt",
  2946. fn: function (){
  2947. var self=this;
  2948. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2949. return smalltalk.withContext(function($ctx1) {
  2950. _st(self)._assert_equals_(_st((3)).__at((4)),_st($Point())._x_y_((3),(4)));
  2951. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  2952. messageSends: ["assert:equals:", "@", "x:y:"]}),
  2953. smalltalk.PointTest);
  2954. smalltalk.addMethod(
  2955. smalltalk.method({
  2956. selector: "testEgality",
  2957. fn: function (){
  2958. var self=this;
  2959. return smalltalk.withContext(function($ctx1) {
  2960. _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  2961. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  2962. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  2963. messageSends: ["assert:", "=", "@", "deny:"]}),
  2964. smalltalk.PointTest);
  2965. smalltalk.addMethod(
  2966. smalltalk.method({
  2967. selector: "testTranslateBy",
  2968. fn: function (){
  2969. var self=this;
  2970. return smalltalk.withContext(function($ctx1) {
  2971. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))),_st((3)).__at((4)));
  2972. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())),_st((3)).__at((2)));
  2973. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))),_st((5)).__at((6)));
  2974. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))),_st((0)).__at((3)));
  2975. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  2976. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]}),
  2977. smalltalk.PointTest);
  2978. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2979. smalltalk.addMethod(
  2980. smalltalk.method({
  2981. selector: "textNext",
  2982. fn: function (){
  2983. var self=this;
  2984. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  2985. return smalltalk.withContext(function($ctx1) {
  2986. _st((10000))._timesRepeat_((function(){
  2987. var current,next;
  2988. return smalltalk.withContext(function($ctx2) {
  2989. next=_st(_st($Random())._new())._next();
  2990. next;
  2991. _st(self)._assert_(_st(next).__gt_eq((0)));
  2992. _st(self)._assert_(_st(next).__lt((1)));
  2993. _st(self)._deny_(_st(current).__eq(next));
  2994. return _st(next).__eq(current);
  2995. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  2996. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  2997. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]}),
  2998. smalltalk.RandomTest);
  2999. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3000. smalltalk.addMethod(
  3001. smalltalk.method({
  3002. selector: "testAddRemove",
  3003. fn: function (){
  3004. var self=this;
  3005. var set;
  3006. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3007. return smalltalk.withContext(function($ctx1) {
  3008. set=_st($Set())._new();
  3009. _st(self)._assert_(_st(set)._isEmpty());
  3010. _st(set)._add_((3));
  3011. _st(self)._assert_(_st(set)._includes_((3)));
  3012. _st(set)._add_((5));
  3013. _st(self)._assert_(_st(set)._includes_((5)));
  3014. _st(set)._remove_((3));
  3015. _st(self)._deny_(_st(set)._includes_((3)));
  3016. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  3017. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]}),
  3018. smalltalk.SetTest);
  3019. smalltalk.addMethod(
  3020. smalltalk.method({
  3021. selector: "testAt",
  3022. fn: function (){
  3023. var self=this;
  3024. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3025. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3026. return smalltalk.withContext(function($ctx1) {
  3027. _st(self)._should_raise_((function(){
  3028. return smalltalk.withContext(function($ctx2) {
  3029. return _st(_st($Set())._new())._at_put_((1),(2));
  3030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3031. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  3032. messageSends: ["should:raise:", "at:put:", "new"]}),
  3033. smalltalk.SetTest);
  3034. smalltalk.addMethod(
  3035. smalltalk.method({
  3036. selector: "testCollect",
  3037. fn: function (){
  3038. var self=this;
  3039. return smalltalk.withContext(function($ctx1) {
  3040. _st(self)._assert_equals_(_st(_st([(5), (6), (8)])._asSet())._collect_((function(x){
  3041. return smalltalk.withContext(function($ctx2) {
  3042. return _st(x).__backslash_backslash((3));
  3043. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),_st([(0), (2)])._asSet());
  3044. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  3045. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"]}),
  3046. smalltalk.SetTest);
  3047. smalltalk.addMethod(
  3048. smalltalk.method({
  3049. selector: "testComparing",
  3050. fn: function (){
  3051. var self=this;
  3052. return smalltalk.withContext(function($ctx1) {
  3053. _st(self)._assert_equals_(_st([(0), (2)])._asSet(),_st([(0), (2)])._asSet());
  3054. _st(self)._assert_equals_(_st([(2), (0)])._asSet(),_st([(0), (2)])._asSet());
  3055. _st(self)._deny_(_st(_st([(0), (2), (3)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3056. _st(self)._deny_(_st(_st([(1), (2)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3057. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  3058. messageSends: ["assert:equals:", "asSet", "deny:", "="]}),
  3059. smalltalk.SetTest);
  3060. smalltalk.addMethod(
  3061. smalltalk.method({
  3062. selector: "testPrintString",
  3063. fn: function (){
  3064. var self=this;
  3065. var set;
  3066. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3067. return smalltalk.withContext(function($ctx1) {
  3068. var $1,$2,$3,$4;
  3069. set=_st($Set())._new();
  3070. _st(self)._assert_equals_(_st(set)._printString(),"a Set ()");
  3071. $1=set;
  3072. _st($1)._add_((1));
  3073. $2=_st($1)._add_((3));
  3074. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  3075. _st(set)._add_("foo");
  3076. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  3077. $3=set;
  3078. _st($3)._remove_((1));
  3079. $4=_st($3)._remove_((3));
  3080. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  3081. _st(set)._add_((3));
  3082. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3083. _st(set)._add_((3));
  3084. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3085. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  3086. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]}),
  3087. smalltalk.SetTest);
  3088. smalltalk.addMethod(
  3089. smalltalk.method({
  3090. selector: "testSize",
  3091. fn: function (){
  3092. var self=this;
  3093. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3094. return smalltalk.withContext(function($ctx1) {
  3095. _st(self)._assert_equals_(_st(_st($Set())._new())._size(),(0));
  3096. _st(self)._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  3097. _st(self)._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  3098. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  3099. messageSends: ["assert:equals:", "size", "new", "withAll:"]}),
  3100. smalltalk.SetTest);
  3101. smalltalk.addMethod(
  3102. smalltalk.method({
  3103. selector: "testUnicity",
  3104. fn: function (){
  3105. var self=this;
  3106. var set;
  3107. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3108. return smalltalk.withContext(function($ctx1) {
  3109. set=_st($Set())._new();
  3110. _st(set)._add_((21));
  3111. _st(set)._add_("hello");
  3112. _st(set)._add_((21));
  3113. _st(self)._assert_equals_(_st(set)._size(),(2));
  3114. _st(set)._add_("hello");
  3115. _st(self)._assert_equals_(_st(set)._size(),(2));
  3116. _st(self)._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  3117. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  3118. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]}),
  3119. smalltalk.SetTest);
  3120. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3121. smalltalk.addMethod(
  3122. smalltalk.method({
  3123. selector: "collectionClass",
  3124. fn: function (){
  3125. var self=this;
  3126. return smalltalk.withContext(function($ctx1) {
  3127. var $1;
  3128. $1=_st(_st(self)._class())._collectionClass();
  3129. return $1;
  3130. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  3131. messageSends: ["collectionClass", "class"]}),
  3132. smalltalk.StreamTest);
  3133. smalltalk.addMethod(
  3134. smalltalk.method({
  3135. selector: "newCollection",
  3136. fn: function (){
  3137. var self=this;
  3138. return smalltalk.withContext(function($ctx1) {
  3139. var $1;
  3140. $1=_st(_st(self)._collectionClass())._new();
  3141. return $1;
  3142. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  3143. messageSends: ["new", "collectionClass"]}),
  3144. smalltalk.StreamTest);
  3145. smalltalk.addMethod(
  3146. smalltalk.method({
  3147. selector: "newStream",
  3148. fn: function (){
  3149. var self=this;
  3150. return smalltalk.withContext(function($ctx1) {
  3151. var $1;
  3152. $1=_st(_st(_st(self)._collectionClass())._new())._stream();
  3153. return $1;
  3154. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  3155. messageSends: ["stream", "new", "collectionClass"]}),
  3156. smalltalk.StreamTest);
  3157. smalltalk.addMethod(
  3158. smalltalk.method({
  3159. selector: "testAtStartAtEnd",
  3160. fn: function (){
  3161. var self=this;
  3162. var stream;
  3163. return smalltalk.withContext(function($ctx1) {
  3164. stream=_st(self)._newStream();
  3165. _st(self)._assert_(_st(stream)._atStart());
  3166. _st(self)._assert_(_st(stream)._atEnd());
  3167. _st(stream)._nextPutAll_(_st(self)._newCollection());
  3168. _st(self)._assert_(_st(stream)._atEnd());
  3169. _st(self)._deny_(_st(stream)._atStart());
  3170. _st(stream)._position_((1));
  3171. _st(self)._deny_(_st(stream)._atEnd());
  3172. _st(self)._deny_(_st(stream)._atStart());
  3173. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  3174. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]}),
  3175. smalltalk.StreamTest);
  3176. smalltalk.addMethod(
  3177. smalltalk.method({
  3178. selector: "testContents",
  3179. fn: function (){
  3180. var self=this;
  3181. var stream;
  3182. return smalltalk.withContext(function($ctx1) {
  3183. stream=_st(self)._newStream();
  3184. _st(stream)._nextPutAll_(_st(self)._newCollection());
  3185. _st(self)._assert_equals_(_st(stream)._contents(),_st(self)._newCollection());
  3186. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  3187. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]}),
  3188. smalltalk.StreamTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "testIsEmpty",
  3192. fn: function (){
  3193. var self=this;
  3194. var stream;
  3195. return smalltalk.withContext(function($ctx1) {
  3196. stream=_st(self)._newStream();
  3197. _st(self)._assert_(_st(stream)._isEmpty());
  3198. _st(stream)._nextPutAll_(_st(self)._newCollection());
  3199. _st(self)._deny_(_st(stream)._isEmpty());
  3200. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  3201. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]}),
  3202. smalltalk.StreamTest);
  3203. smalltalk.addMethod(
  3204. smalltalk.method({
  3205. selector: "testPosition",
  3206. fn: function (){
  3207. var self=this;
  3208. var collection,stream;
  3209. return smalltalk.withContext(function($ctx1) {
  3210. collection=_st(self)._newCollection();
  3211. stream=_st(self)._newStream();
  3212. _st(stream)._nextPutAll_(collection);
  3213. _st(self)._assert_equals_(_st(stream)._position(),_st(collection)._size());
  3214. _st(stream)._position_((0));
  3215. _st(self)._assert_equals_(_st(stream)._position(),(0));
  3216. _st(stream)._next();
  3217. _st(self)._assert_equals_(_st(stream)._position(),(1));
  3218. _st(stream)._next();
  3219. _st(self)._assert_equals_(_st(stream)._position(),(2));
  3220. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  3221. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]}),
  3222. smalltalk.StreamTest);
  3223. smalltalk.addMethod(
  3224. smalltalk.method({
  3225. selector: "testReading",
  3226. fn: function (){
  3227. var self=this;
  3228. var stream,collection;
  3229. return smalltalk.withContext(function($ctx1) {
  3230. var $1,$2;
  3231. collection=_st(self)._newCollection();
  3232. stream=_st(self)._newStream();
  3233. $1=stream;
  3234. _st($1)._nextPutAll_(collection);
  3235. $2=_st($1)._position_((0));
  3236. _st(collection)._do_((function(each){
  3237. return smalltalk.withContext(function($ctx2) {
  3238. return _st(self)._assert_equals_(_st(stream)._next(),each);
  3239. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3240. _st(self)._assert_(_st(_st(stream)._next())._isNil());
  3241. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3242. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]}),
  3243. smalltalk.StreamTest);
  3244. smalltalk.addMethod(
  3245. smalltalk.method({
  3246. selector: "testStreamContents",
  3247. fn: function (){
  3248. var self=this;
  3249. return smalltalk.withContext(function($ctx1) {
  3250. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  3251. messageSends: []}),
  3252. smalltalk.StreamTest);
  3253. smalltalk.addMethod(
  3254. smalltalk.method({
  3255. selector: "testWrite",
  3256. fn: function (){
  3257. var self=this;
  3258. var stream,collection;
  3259. return smalltalk.withContext(function($ctx1) {
  3260. collection=_st(self)._newCollection();
  3261. stream=_st(self)._newStream();
  3262. _st(collection)._do_((function(each){
  3263. return smalltalk.withContext(function($ctx2) {
  3264. return _st(stream).__lt_lt(each);
  3265. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3266. _st(self)._assert_equals_(_st(stream)._contents(),collection);
  3267. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3268. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]}),
  3269. smalltalk.StreamTest);
  3270. smalltalk.addMethod(
  3271. smalltalk.method({
  3272. selector: "testWriting",
  3273. fn: function (){
  3274. var self=this;
  3275. var stream,collection;
  3276. return smalltalk.withContext(function($ctx1) {
  3277. collection=_st(self)._newCollection();
  3278. stream=_st(self)._newStream();
  3279. _st(collection)._do_((function(each){
  3280. return smalltalk.withContext(function($ctx2) {
  3281. return _st(stream)._nextPut_(each);
  3282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3283. _st(self)._assert_equals_(_st(stream)._contents(),collection);
  3284. stream=_st(self)._newStream();
  3285. _st(stream)._nextPutAll_(collection);
  3286. _st(self)._assert_equals_(_st(stream)._contents(),collection);
  3287. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3288. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]}),
  3289. smalltalk.StreamTest);
  3290. smalltalk.addMethod(
  3291. smalltalk.method({
  3292. selector: "collectionClass",
  3293. fn: function (){
  3294. var self=this;
  3295. return smalltalk.withContext(function($ctx1) {
  3296. return nil;
  3297. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  3298. messageSends: []}),
  3299. smalltalk.StreamTest.klass);
  3300. smalltalk.addMethod(
  3301. smalltalk.method({
  3302. selector: "isAbstract",
  3303. fn: function (){
  3304. var self=this;
  3305. return smalltalk.withContext(function($ctx1) {
  3306. var $1;
  3307. $1=_st(_st(self)._collectionClass())._isNil();
  3308. return $1;
  3309. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  3310. messageSends: ["isNil", "collectionClass"]}),
  3311. smalltalk.StreamTest.klass);
  3312. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  3313. smalltalk.addMethod(
  3314. smalltalk.method({
  3315. selector: "newCollection",
  3316. fn: function (){
  3317. var self=this;
  3318. return smalltalk.withContext(function($ctx1) {
  3319. var $1;
  3320. $1=[true,(1),_st((3)).__at((4)),"foo"];
  3321. return $1;
  3322. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  3323. messageSends: ["@"]}),
  3324. smalltalk.ArrayStreamTest);
  3325. smalltalk.addMethod(
  3326. smalltalk.method({
  3327. selector: "collectionClass",
  3328. fn: function (){
  3329. var self=this;
  3330. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3331. return smalltalk.withContext(function($ctx1) {
  3332. var $1;
  3333. $1=$Array();
  3334. return $1;
  3335. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  3336. messageSends: []}),
  3337. smalltalk.ArrayStreamTest.klass);
  3338. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  3339. smalltalk.addMethod(
  3340. smalltalk.method({
  3341. selector: "newCollection",
  3342. fn: function (){
  3343. var self=this;
  3344. return smalltalk.withContext(function($ctx1) {
  3345. return "hello world";
  3346. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  3347. messageSends: []}),
  3348. smalltalk.StringStreamTest);
  3349. smalltalk.addMethod(
  3350. smalltalk.method({
  3351. selector: "collectionClass",
  3352. fn: function (){
  3353. var self=this;
  3354. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3355. return smalltalk.withContext(function($ctx1) {
  3356. var $1;
  3357. $1=$String();
  3358. return $1;
  3359. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  3360. messageSends: []}),
  3361. smalltalk.StringStreamTest.klass);
  3362. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3363. smalltalk.addMethod(
  3364. smalltalk.method({
  3365. selector: "testCopying",
  3366. fn: function (){
  3367. var self=this;
  3368. return smalltalk.withContext(function($ctx1) {
  3369. _st(self)._assert_equals_(_st(nil)._copy(),nil);
  3370. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  3371. messageSends: ["assert:equals:", "copy"]}),
  3372. smalltalk.UndefinedTest);
  3373. smalltalk.addMethod(
  3374. smalltalk.method({
  3375. selector: "testDeepCopy",
  3376. fn: function (){
  3377. var self=this;
  3378. return smalltalk.withContext(function($ctx1) {
  3379. _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  3380. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  3381. messageSends: ["assert:", "=", "deepCopy"]}),
  3382. smalltalk.UndefinedTest);
  3383. smalltalk.addMethod(
  3384. smalltalk.method({
  3385. selector: "testIfNil",
  3386. fn: function (){
  3387. var self=this;
  3388. return smalltalk.withContext(function($ctx1) {
  3389. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  3390. $1=self;
  3391. if(($receiver = nil) == nil || $receiver == undefined){
  3392. $2=true;
  3393. } else {
  3394. $2=nil;
  3395. };
  3396. _st($1)._assert_equals_($2,true);
  3397. $3=self;
  3398. if(($receiver = nil) == nil || $receiver == undefined){
  3399. $5=nil;
  3400. } else {
  3401. $5=true;
  3402. };
  3403. $4=_st($5).__eq(true);
  3404. _st($3)._deny_($4);
  3405. $6=self;
  3406. if(($receiver = nil) == nil || $receiver == undefined){
  3407. $7=true;
  3408. } else {
  3409. $7=false;
  3410. };
  3411. _st($6)._assert_equals_($7,true);
  3412. $8=self;
  3413. if(($receiver = nil) == nil || $receiver == undefined){
  3414. $10=false;
  3415. } else {
  3416. $10=true;
  3417. };
  3418. $9=_st($10).__eq(true);
  3419. _st($8)._deny_($9);
  3420. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  3421. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]}),
  3422. smalltalk.UndefinedTest);
  3423. smalltalk.addMethod(
  3424. smalltalk.method({
  3425. selector: "testIsNil",
  3426. fn: function (){
  3427. var self=this;
  3428. return smalltalk.withContext(function($ctx1) {
  3429. _st(self)._assert_(_st(nil)._isNil());
  3430. _st(self)._deny_(_st(nil)._notNil());
  3431. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  3432. messageSends: ["assert:", "isNil", "deny:", "notNil"]}),
  3433. smalltalk.UndefinedTest);