Kernel-Tests.js 184 KB

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