Kernel-Tests.js 194 KB

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