Kernel-Tests.deploy.js 143 KB

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