Kernel-Tests.deploy.js 142 KB

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