Kernel-Tests.js 218 KB

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