1
0

Kernel-Tests.js 268 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194
  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. var $1,$3,$2,$5,$4,$7,$6;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. $1=_st($AnnouncementSubscription())._new();
  22. subscription=_st($1)._announcementClass_($SystemAnnouncement());
  23. $3=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  24. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  25. $2=self._assert_equals_($3,true);
  26. $ctx1.sendIdx["assert:equals:"]=1;
  27. $5=_st(subscription)._handlesAnnouncement_(announcementClass1);
  28. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  29. $4=self._assert_equals_($5,true);
  30. $ctx1.sendIdx["assert:equals:"]=2;
  31. $7=_st(subscription)._handlesAnnouncement_($Object());
  32. $6=self._assert_equals_($7,false);
  33. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  34. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  35. args: [],
  36. 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.",
  37. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  38. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  39. }),
  40. smalltalk.AnnouncementSubscriptionTest);
  41. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  42. smalltalk.addMethod(
  43. smalltalk.method({
  44. selector: "testCanClearInterval",
  45. category: 'tests',
  46. fn: function (){
  47. var self=this;
  48. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  49. return smalltalk.withContext(function($ctx1) {
  50. self._shouldnt_raise_((function(){
  51. return smalltalk.withContext(function($ctx2) {
  52. return _st(_st((function(){
  53. return smalltalk.withContext(function($ctx3) {
  54. return _st(_st($Error())._new())._signal();
  55. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  56. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  57. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  58. args: [],
  59. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  60. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  61. referencedClasses: ["Error"]
  62. }),
  63. smalltalk.BlockClosureTest);
  64. smalltalk.addMethod(
  65. smalltalk.method({
  66. selector: "testCanClearTimeout",
  67. category: 'tests',
  68. fn: function (){
  69. var self=this;
  70. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  71. return smalltalk.withContext(function($ctx1) {
  72. self._shouldnt_raise_((function(){
  73. return smalltalk.withContext(function($ctx2) {
  74. return _st(_st((function(){
  75. return smalltalk.withContext(function($ctx3) {
  76. return _st(_st($Error())._new())._signal();
  77. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  78. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  79. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  80. args: [],
  81. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  82. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  83. referencedClasses: ["Error"]
  84. }),
  85. smalltalk.BlockClosureTest);
  86. smalltalk.addMethod(
  87. smalltalk.method({
  88. selector: "testCompiledSource",
  89. category: 'tests',
  90. fn: function (){
  91. var self=this;
  92. return smalltalk.withContext(function($ctx1) {
  93. self._assert_(_st(_st((function(){
  94. return smalltalk.withContext(function($ctx2) {
  95. return (1).__plus((1));
  96. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  97. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  98. args: [],
  99. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  100. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  101. referencedClasses: []
  102. }),
  103. smalltalk.BlockClosureTest);
  104. smalltalk.addMethod(
  105. smalltalk.method({
  106. selector: "testCurrySelf",
  107. category: 'tests',
  108. fn: function (){
  109. var self=this;
  110. var curriedMethod,array;
  111. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  112. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  113. return smalltalk.withContext(function($ctx1) {
  114. curriedMethod=_st(_st((function(selfarg,x){
  115. return smalltalk.withContext(function($ctx2) {
  116. return _st(selfarg)._at_(x);
  117. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  118. array=[(3), (1), (4)];
  119. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  120. _st((function(){
  121. return smalltalk.withContext(function($ctx2) {
  122. return self._assert_equals_(_st(array)._foo_((2)),(1));
  123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  124. return smalltalk.withContext(function($ctx2) {
  125. return _st($Array())._removeCompiledMethod_(curriedMethod);
  126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  127. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  128. args: [],
  129. 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 ]",
  130. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  131. referencedClasses: ["ClassBuilder", "Array"]
  132. }),
  133. smalltalk.BlockClosureTest);
  134. smalltalk.addMethod(
  135. smalltalk.method({
  136. selector: "testEnsure",
  137. category: 'tests',
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. self._assert_equals_(_st((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return (3);
  144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  145. return smalltalk.withContext(function($ctx2) {
  146. return (4);
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  148. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  151. messageSends: ["assert:equals:", "ensure:"],
  152. referencedClasses: []
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testEnsureRaises",
  158. category: 'tests',
  159. fn: function (){
  160. var self=this;
  161. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  162. return smalltalk.withContext(function($ctx1) {
  163. self._should_raise_((function(){
  164. return smalltalk.withContext(function($ctx2) {
  165. return _st((function(){
  166. return smalltalk.withContext(function($ctx3) {
  167. return _st(_st($Error())._new())._signal();
  168. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  169. return smalltalk.withContext(function($ctx3) {
  170. return true;
  171. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  173. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  174. args: [],
  175. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  176. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  177. referencedClasses: ["Error"]
  178. }),
  179. smalltalk.BlockClosureTest);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "testExceptionSemantics",
  183. category: 'tests',
  184. fn: function (){
  185. var self=this;
  186. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  187. return smalltalk.withContext(function($ctx1) {
  188. self._timeout_((100));
  189. _st(self._async_((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return _st((function(){
  192. return smalltalk.withContext(function($ctx3) {
  193. self._assert_(true);
  194. _st($Error())._signal();
  195. self._deny_(true);
  196. return self._finished();
  197. $ctx3.sendIdx["finished"]=1;
  198. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  199. return smalltalk.withContext(function($ctx3) {
  200. return self._finished();
  201. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  203. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  204. args: [],
  205. 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",
  206. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  207. referencedClasses: ["Error"]
  208. }),
  209. smalltalk.BlockClosureTest);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "testNewWithValues",
  213. category: 'tests',
  214. fn: function (){
  215. var self=this;
  216. return smalltalk.withContext(function($ctx1) {
  217. function theTestPrototype() {this.name = "theTestPrototype";}
  218. function theTestConstructor(arg1, arg2, arg3) {}
  219. theTestConstructor.prototype = new theTestPrototype;
  220. var theWrappedConstructor = _st(theTestConstructor);
  221. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  222. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  223. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  224. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  225. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  226. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  227. args: [],
  228. 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>",
  229. messageSends: [],
  230. referencedClasses: []
  231. }),
  232. smalltalk.BlockClosureTest);
  233. smalltalk.addMethod(
  234. smalltalk.method({
  235. selector: "testNumArgs",
  236. category: 'tests',
  237. fn: function (){
  238. var self=this;
  239. return smalltalk.withContext(function($ctx1) {
  240. var $2,$1,$4,$3;
  241. $2=_st((function(){
  242. return smalltalk.withContext(function($ctx2) {
  243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  244. $ctx1.sendIdx["numArgs"]=1;
  245. $1=self._assert_equals_($2,(0));
  246. $ctx1.sendIdx["assert:equals:"]=1;
  247. $4=_st((function(a,b){
  248. return smalltalk.withContext(function($ctx2) {
  249. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs();
  250. $3=self._assert_equals_($4,(2));
  251. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  252. args: [],
  253. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  254. messageSends: ["assert:equals:", "numArgs"],
  255. referencedClasses: []
  256. }),
  257. smalltalk.BlockClosureTest);
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "testOnDo",
  261. category: 'tests',
  262. fn: function (){
  263. var self=this;
  264. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  265. return smalltalk.withContext(function($ctx1) {
  266. self._assert_(_st((function(){
  267. return smalltalk.withContext(function($ctx2) {
  268. return _st(_st($Error())._new())._signal();
  269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  270. return smalltalk.withContext(function($ctx2) {
  271. return true;
  272. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  273. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  274. args: [],
  275. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  276. messageSends: ["assert:", "on:do:", "signal", "new"],
  277. referencedClasses: ["Error"]
  278. }),
  279. smalltalk.BlockClosureTest);
  280. smalltalk.addMethod(
  281. smalltalk.method({
  282. selector: "testValue",
  283. category: 'tests',
  284. fn: function (){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) {
  287. var $2,$1,$3,$4,$6,$5;
  288. $2=_st((function(){
  289. return smalltalk.withContext(function($ctx2) {
  290. return (1).__plus((1));
  291. $ctx2.sendIdx["+"]=1;
  292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  293. $ctx1.sendIdx["value"]=1;
  294. $1=self._assert_equals_($2,(2));
  295. $ctx1.sendIdx["assert:equals:"]=1;
  296. $3=self._assert_equals_(_st((function(x){
  297. return smalltalk.withContext(function($ctx2) {
  298. return _st(x).__plus((1));
  299. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  300. $ctx1.sendIdx["assert:equals:"]=2;
  301. $4=self._assert_equals_(_st((function(x,y){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(x).__star(y);
  304. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  305. $ctx1.sendIdx["assert:equals:"]=3;
  306. $6=_st((function(a,b,c){
  307. return smalltalk.withContext(function($ctx2) {
  308. return (1);
  309. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value();
  310. $5=self._assert_equals_($6,(1));
  311. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  312. args: [],
  313. 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",
  314. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  315. referencedClasses: []
  316. }),
  317. smalltalk.BlockClosureTest);
  318. smalltalk.addMethod(
  319. smalltalk.method({
  320. selector: "testValueWithPossibleArguments",
  321. category: 'tests',
  322. fn: function (){
  323. var self=this;
  324. return smalltalk.withContext(function($ctx1) {
  325. var $2,$1,$4,$3,$6,$5;
  326. $2=_st((function(){
  327. return smalltalk.withContext(function($ctx2) {
  328. return (1);
  329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  330. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  331. $1=self._assert_equals_($2,(1));
  332. $ctx1.sendIdx["assert:equals:"]=1;
  333. $4=_st((function(a){
  334. return smalltalk.withContext(function($ctx2) {
  335. return _st(a).__plus((4));
  336. $ctx2.sendIdx["+"]=1;
  337. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  338. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  339. $3=self._assert_equals_($4,(7));
  340. $ctx1.sendIdx["assert:equals:"]=2;
  341. $6=_st((function(a,b){
  342. return smalltalk.withContext(function($ctx2) {
  343. return _st(a).__plus(b);
  344. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]);
  345. $5=self._assert_equals_($6,(7));
  346. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  347. args: [],
  348. 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.",
  349. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  350. referencedClasses: []
  351. }),
  352. smalltalk.BlockClosureTest);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "testWhileFalse",
  356. category: 'tests',
  357. fn: function (){
  358. var self=this;
  359. var i;
  360. return smalltalk.withContext(function($ctx1) {
  361. var $1,$2;
  362. i=(0);
  363. _st((function(){
  364. return smalltalk.withContext(function($ctx2) {
  365. return _st(i).__gt((5));
  366. $ctx2.sendIdx[">"]=1;
  367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  368. return smalltalk.withContext(function($ctx2) {
  369. i=_st(i).__plus((1));
  370. $ctx2.sendIdx["+"]=1;
  371. return i;
  372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  373. $1=self._assert_equals_(i,(6));
  374. $ctx1.sendIdx["assert:equals:"]=1;
  375. i=(0);
  376. _st((function(){
  377. return smalltalk.withContext(function($ctx2) {
  378. i=_st(i).__plus((1));
  379. i;
  380. return _st(i).__gt((5));
  381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  382. $2=self._assert_equals_(i,(6));
  383. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  384. args: [],
  385. 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",
  386. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  387. referencedClasses: []
  388. }),
  389. smalltalk.BlockClosureTest);
  390. smalltalk.addMethod(
  391. smalltalk.method({
  392. selector: "testWhileTrue",
  393. category: 'tests',
  394. fn: function (){
  395. var self=this;
  396. var i;
  397. return smalltalk.withContext(function($ctx1) {
  398. var $1,$2;
  399. i=(0);
  400. _st((function(){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(i).__lt((5));
  403. $ctx2.sendIdx["<"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  405. return smalltalk.withContext(function($ctx2) {
  406. i=_st(i).__plus((1));
  407. $ctx2.sendIdx["+"]=1;
  408. return i;
  409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  410. $1=self._assert_equals_(i,(5));
  411. $ctx1.sendIdx["assert:equals:"]=1;
  412. i=(0);
  413. _st((function(){
  414. return smalltalk.withContext(function($ctx2) {
  415. i=_st(i).__plus((1));
  416. i;
  417. return _st(i).__lt((5));
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  419. $2=self._assert_equals_(i,(5));
  420. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  421. args: [],
  422. 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",
  423. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  424. referencedClasses: []
  425. }),
  426. smalltalk.BlockClosureTest);
  427. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testEquality",
  431. category: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15,$19,$18,$17,$22,$23,$21,$20;
  436. $2=(0).__eq(false);
  437. $ctx1.sendIdx["="]=1;
  438. $1=self._deny_($2);
  439. $ctx1.sendIdx["deny:"]=1;
  440. $4=false.__eq((0));
  441. $ctx1.sendIdx["="]=2;
  442. $3=self._deny_($4);
  443. $ctx1.sendIdx["deny:"]=2;
  444. $6="".__eq(false);
  445. $ctx1.sendIdx["="]=3;
  446. $5=self._deny_($6);
  447. $ctx1.sendIdx["deny:"]=3;
  448. $8=false.__eq("");
  449. $ctx1.sendIdx["="]=4;
  450. $7=self._deny_($8);
  451. $ctx1.sendIdx["deny:"]=4;
  452. $10=true.__eq(true);
  453. $ctx1.sendIdx["="]=5;
  454. $9=self._assert_($10);
  455. $ctx1.sendIdx["assert:"]=1;
  456. $12=false.__eq(true);
  457. $ctx1.sendIdx["="]=6;
  458. $11=self._deny_($12);
  459. $ctx1.sendIdx["deny:"]=5;
  460. $14=true.__eq(false);
  461. $ctx1.sendIdx["="]=7;
  462. $13=self._deny_($14);
  463. $16=false.__eq(false);
  464. $ctx1.sendIdx["="]=8;
  465. $15=self._assert_($16);
  466. $ctx1.sendIdx["assert:"]=2;
  467. $19=true._yourself();
  468. $ctx1.sendIdx["yourself"]=1;
  469. $18=_st($19).__eq(true);
  470. $ctx1.sendIdx["="]=9;
  471. $17=self._assert_($18);
  472. $ctx1.sendIdx["assert:"]=3;
  473. $22=true._yourself();
  474. $ctx1.sendIdx["yourself"]=2;
  475. $23=true._yourself();
  476. $21=_st($22).__eq($23);
  477. $20=self._assert_($21);
  478. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  479. args: [],
  480. 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)",
  481. messageSends: ["deny:", "=", "assert:", "yourself"],
  482. referencedClasses: []
  483. }),
  484. smalltalk.BooleanTest);
  485. smalltalk.addMethod(
  486. smalltalk.method({
  487. selector: "testIdentity",
  488. category: 'tests',
  489. fn: function (){
  490. var self=this;
  491. return smalltalk.withContext(function($ctx1) {
  492. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15,$19,$18,$17,$22,$23,$21,$20;
  493. $2=(0).__eq_eq(false);
  494. $ctx1.sendIdx["=="]=1;
  495. $1=self._deny_($2);
  496. $ctx1.sendIdx["deny:"]=1;
  497. $4=false.__eq_eq((0));
  498. $ctx1.sendIdx["=="]=2;
  499. $3=self._deny_($4);
  500. $ctx1.sendIdx["deny:"]=2;
  501. $6="".__eq_eq(false);
  502. $ctx1.sendIdx["=="]=3;
  503. $5=self._deny_($6);
  504. $ctx1.sendIdx["deny:"]=3;
  505. $8=false.__eq_eq("");
  506. $ctx1.sendIdx["=="]=4;
  507. $7=self._deny_($8);
  508. $ctx1.sendIdx["deny:"]=4;
  509. $10=true.__eq_eq(true);
  510. $ctx1.sendIdx["=="]=5;
  511. $9=self._assert_($10);
  512. $ctx1.sendIdx["assert:"]=1;
  513. $12=false.__eq_eq(true);
  514. $ctx1.sendIdx["=="]=6;
  515. $11=self._deny_($12);
  516. $ctx1.sendIdx["deny:"]=5;
  517. $14=true.__eq_eq(false);
  518. $ctx1.sendIdx["=="]=7;
  519. $13=self._deny_($14);
  520. $16=false.__eq_eq(false);
  521. $ctx1.sendIdx["=="]=8;
  522. $15=self._assert_($16);
  523. $ctx1.sendIdx["assert:"]=2;
  524. $19=true._yourself();
  525. $ctx1.sendIdx["yourself"]=1;
  526. $18=_st($19).__eq_eq(true);
  527. $ctx1.sendIdx["=="]=9;
  528. $17=self._assert_($18);
  529. $ctx1.sendIdx["assert:"]=3;
  530. $22=true._yourself();
  531. $ctx1.sendIdx["yourself"]=2;
  532. $23=true._yourself();
  533. $21=_st($22).__eq_eq($23);
  534. $20=self._assert_($21);
  535. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  536. args: [],
  537. 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",
  538. messageSends: ["deny:", "==", "assert:", "yourself"],
  539. referencedClasses: []
  540. }),
  541. smalltalk.BooleanTest);
  542. smalltalk.addMethod(
  543. smalltalk.method({
  544. selector: "testIfTrueIfFalse",
  545. category: 'tests',
  546. fn: function (){
  547. var self=this;
  548. return smalltalk.withContext(function($ctx1) {
  549. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  550. if(smalltalk.assert(true)){
  551. $2="alternative block";
  552. };
  553. $1=self._assert_equals_($2,"alternative block");
  554. $ctx1.sendIdx["assert:equals:"]=1;
  555. if(! smalltalk.assert(true)){
  556. $4="alternative block";
  557. };
  558. $3=self._assert_equals_($4,nil);
  559. $ctx1.sendIdx["assert:equals:"]=2;
  560. if(smalltalk.assert(false)){
  561. $6="alternative block";
  562. };
  563. $5=self._assert_equals_($6,nil);
  564. $ctx1.sendIdx["assert:equals:"]=3;
  565. if(! smalltalk.assert(false)){
  566. $8="alternative block";
  567. };
  568. $7=self._assert_equals_($8,"alternative block");
  569. $ctx1.sendIdx["assert:equals:"]=4;
  570. if(smalltalk.assert(false)){
  571. $10="alternative block";
  572. } else {
  573. $10="alternative block2";
  574. };
  575. $9=self._assert_equals_($10,"alternative block2");
  576. $ctx1.sendIdx["assert:equals:"]=5;
  577. if(smalltalk.assert(false)){
  578. $12="alternative block2";
  579. } else {
  580. $12="alternative block";
  581. };
  582. $11=self._assert_equals_($12,"alternative block");
  583. $ctx1.sendIdx["assert:equals:"]=6;
  584. if(smalltalk.assert(true)){
  585. $14="alternative block";
  586. } else {
  587. $14="alternative block2";
  588. };
  589. $13=self._assert_equals_($14,"alternative block");
  590. $ctx1.sendIdx["assert:equals:"]=7;
  591. if(smalltalk.assert(true)){
  592. $16="alternative block2";
  593. } else {
  594. $16="alternative block";
  595. };
  596. $15=self._assert_equals_($16,"alternative block2");
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. 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'.",
  600. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalseWithBoxing",
  607. category: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10,$15,$14,$13,$18,$17,$16,$21,$20,$19,$24,$23,$22;
  612. $3=true._yourself();
  613. $ctx1.sendIdx["yourself"]=1;
  614. if(smalltalk.assert($3)){
  615. $2="alternative block";
  616. };
  617. $1=self._assert_equals_($2,"alternative block");
  618. $ctx1.sendIdx["assert:equals:"]=1;
  619. $6=true._yourself();
  620. $ctx1.sendIdx["yourself"]=2;
  621. if(! smalltalk.assert($6)){
  622. $5="alternative block";
  623. };
  624. $4=self._assert_equals_($5,nil);
  625. $ctx1.sendIdx["assert:equals:"]=2;
  626. $9=false._yourself();
  627. $ctx1.sendIdx["yourself"]=3;
  628. if(smalltalk.assert($9)){
  629. $8="alternative block";
  630. };
  631. $7=self._assert_equals_($8,nil);
  632. $ctx1.sendIdx["assert:equals:"]=3;
  633. $12=false._yourself();
  634. $ctx1.sendIdx["yourself"]=4;
  635. if(! smalltalk.assert($12)){
  636. $11="alternative block";
  637. };
  638. $10=self._assert_equals_($11,"alternative block");
  639. $ctx1.sendIdx["assert:equals:"]=4;
  640. $15=false._yourself();
  641. $ctx1.sendIdx["yourself"]=5;
  642. if(smalltalk.assert($15)){
  643. $14="alternative block";
  644. } else {
  645. $14="alternative block2";
  646. };
  647. $13=self._assert_equals_($14,"alternative block2");
  648. $ctx1.sendIdx["assert:equals:"]=5;
  649. $18=false._yourself();
  650. $ctx1.sendIdx["yourself"]=6;
  651. if(smalltalk.assert($18)){
  652. $17="alternative block2";
  653. } else {
  654. $17="alternative block";
  655. };
  656. $16=self._assert_equals_($17,"alternative block");
  657. $ctx1.sendIdx["assert:equals:"]=6;
  658. $21=true._yourself();
  659. $ctx1.sendIdx["yourself"]=7;
  660. if(smalltalk.assert($21)){
  661. $20="alternative block";
  662. } else {
  663. $20="alternative block2";
  664. };
  665. $19=self._assert_equals_($20,"alternative block");
  666. $ctx1.sendIdx["assert:equals:"]=7;
  667. $24=true._yourself();
  668. if(smalltalk.assert($24)){
  669. $23="alternative block2";
  670. } else {
  671. $23="alternative block";
  672. };
  673. $22=self._assert_equals_($23,"alternative block2");
  674. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  675. args: [],
  676. 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'.",
  677. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  678. referencedClasses: []
  679. }),
  680. smalltalk.BooleanTest);
  681. smalltalk.addMethod(
  682. smalltalk.method({
  683. selector: "testLogic",
  684. category: 'tests',
  685. fn: function (){
  686. var self=this;
  687. return smalltalk.withContext(function($ctx1) {
  688. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$26,$24,$23;
  689. $1=true.__and(true);
  690. $ctx1.sendIdx["&"]=1;
  691. self._assert_($1);
  692. $ctx1.sendIdx["assert:"]=1;
  693. $2=true.__and(false);
  694. $ctx1.sendIdx["&"]=2;
  695. self._deny_($2);
  696. $ctx1.sendIdx["deny:"]=1;
  697. $3=false.__and(true);
  698. $ctx1.sendIdx["&"]=3;
  699. self._deny_($3);
  700. $ctx1.sendIdx["deny:"]=2;
  701. $5=false.__and(false);
  702. $ctx1.sendIdx["&"]=4;
  703. $4=self._deny_($5);
  704. $ctx1.sendIdx["deny:"]=3;
  705. $6=true.__or(true);
  706. $ctx1.sendIdx["|"]=1;
  707. self._assert_($6);
  708. $ctx1.sendIdx["assert:"]=2;
  709. $7=true.__or(false);
  710. $ctx1.sendIdx["|"]=2;
  711. self._assert_($7);
  712. $ctx1.sendIdx["assert:"]=3;
  713. $8=false.__or(true);
  714. $ctx1.sendIdx["|"]=3;
  715. self._assert_($8);
  716. $ctx1.sendIdx["assert:"]=4;
  717. $10=false.__or(false);
  718. $ctx1.sendIdx["|"]=4;
  719. $9=self._deny_($10);
  720. $ctx1.sendIdx["deny:"]=4;
  721. $12=(1).__gt((0));
  722. $ctx1.sendIdx[">"]=1;
  723. $11=true.__and($12);
  724. $ctx1.sendIdx["&"]=5;
  725. self._assert_($11);
  726. $ctx1.sendIdx["assert:"]=5;
  727. $14=(1).__gt((0));
  728. $ctx1.sendIdx[">"]=2;
  729. $13=_st($14).__and(false);
  730. $ctx1.sendIdx["&"]=6;
  731. self._deny_($13);
  732. $ctx1.sendIdx["deny:"]=5;
  733. $17=(1).__gt((0));
  734. $ctx1.sendIdx[">"]=3;
  735. $18=(1).__gt((2));
  736. $ctx1.sendIdx[">"]=4;
  737. $16=_st($17).__and($18);
  738. $15=self._deny_($16);
  739. $20=(1).__gt((0));
  740. $ctx1.sendIdx[">"]=5;
  741. $19=false.__or($20);
  742. $ctx1.sendIdx["|"]=5;
  743. self._assert_($19);
  744. $ctx1.sendIdx["assert:"]=6;
  745. $22=(1).__gt((0));
  746. $ctx1.sendIdx[">"]=6;
  747. $21=_st($22).__or(false);
  748. $ctx1.sendIdx["|"]=6;
  749. self._assert_($21);
  750. $ctx1.sendIdx["assert:"]=7;
  751. $25=(1).__gt((0));
  752. $ctx1.sendIdx[">"]=7;
  753. $26=(1).__gt((2));
  754. $24=_st($25).__or($26);
  755. $23=self._assert_($24);
  756. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  757. args: [],
  758. 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))",
  759. messageSends: ["assert:", "&", "deny:", "|", ">"],
  760. referencedClasses: []
  761. }),
  762. smalltalk.BooleanTest);
  763. smalltalk.addMethod(
  764. smalltalk.method({
  765. selector: "testLogicKeywords",
  766. category: 'tests',
  767. fn: function (){
  768. var self=this;
  769. return smalltalk.withContext(function($ctx1) {
  770. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  771. $1=true._and_((function(){
  772. return smalltalk.withContext(function($ctx2) {
  773. return true;
  774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  775. $ctx1.sendIdx["and:"]=1;
  776. self._assert_($1);
  777. $ctx1.sendIdx["assert:"]=1;
  778. $2=true._and_((function(){
  779. return smalltalk.withContext(function($ctx2) {
  780. return false;
  781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  782. $ctx1.sendIdx["and:"]=2;
  783. self._deny_($2);
  784. $ctx1.sendIdx["deny:"]=1;
  785. $3=false._and_((function(){
  786. return smalltalk.withContext(function($ctx2) {
  787. return true;
  788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  789. $ctx1.sendIdx["and:"]=3;
  790. self._deny_($3);
  791. $ctx1.sendIdx["deny:"]=2;
  792. $5=false._and_((function(){
  793. return smalltalk.withContext(function($ctx2) {
  794. return false;
  795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  796. $ctx1.sendIdx["and:"]=4;
  797. $4=self._deny_($5);
  798. $ctx1.sendIdx["deny:"]=3;
  799. $6=true._or_((function(){
  800. return smalltalk.withContext(function($ctx2) {
  801. return true;
  802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  803. $ctx1.sendIdx["or:"]=1;
  804. self._assert_($6);
  805. $ctx1.sendIdx["assert:"]=2;
  806. $7=true._or_((function(){
  807. return smalltalk.withContext(function($ctx2) {
  808. return false;
  809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  810. $ctx1.sendIdx["or:"]=2;
  811. self._assert_($7);
  812. $ctx1.sendIdx["assert:"]=3;
  813. $8=false._or_((function(){
  814. return smalltalk.withContext(function($ctx2) {
  815. return true;
  816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  817. $ctx1.sendIdx["or:"]=3;
  818. self._assert_($8);
  819. $ctx1.sendIdx["assert:"]=4;
  820. $10=false._or_((function(){
  821. return smalltalk.withContext(function($ctx2) {
  822. return false;
  823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  824. $ctx1.sendIdx["or:"]=4;
  825. $9=self._deny_($10);
  826. $ctx1.sendIdx["deny:"]=4;
  827. $11=true._and_((function(){
  828. return smalltalk.withContext(function($ctx2) {
  829. return (1).__gt((0));
  830. $ctx2.sendIdx[">"]=1;
  831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  832. $ctx1.sendIdx["and:"]=5;
  833. self._assert_($11);
  834. $ctx1.sendIdx["assert:"]=5;
  835. $13=(1).__gt((0));
  836. $ctx1.sendIdx[">"]=2;
  837. $12=_st($13)._and_((function(){
  838. return smalltalk.withContext(function($ctx2) {
  839. return false;
  840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  841. $ctx1.sendIdx["and:"]=6;
  842. self._deny_($12);
  843. $ctx1.sendIdx["deny:"]=5;
  844. $16=(1).__gt((0));
  845. $ctx1.sendIdx[">"]=3;
  846. $15=_st($16)._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return (1).__gt((2));
  849. $ctx2.sendIdx[">"]=4;
  850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  851. $14=self._deny_($15);
  852. $17=false._or_((function(){
  853. return smalltalk.withContext(function($ctx2) {
  854. return (1).__gt((0));
  855. $ctx2.sendIdx[">"]=5;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  857. $ctx1.sendIdx["or:"]=5;
  858. self._assert_($17);
  859. $ctx1.sendIdx["assert:"]=6;
  860. $19=(1).__gt((0));
  861. $ctx1.sendIdx[">"]=6;
  862. $18=_st($19)._or_((function(){
  863. return smalltalk.withContext(function($ctx2) {
  864. return false;
  865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  866. $ctx1.sendIdx["or:"]=6;
  867. self._assert_($18);
  868. $ctx1.sendIdx["assert:"]=7;
  869. $22=(1).__gt((0));
  870. $ctx1.sendIdx[">"]=7;
  871. $21=_st($22)._or_((function(){
  872. return smalltalk.withContext(function($ctx2) {
  873. return (1).__gt((2));
  874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  875. $20=self._assert_($21);
  876. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  877. args: [],
  878. 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 ])",
  879. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.BooleanTest);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "testNonBooleanError",
  886. category: 'tests',
  887. fn: function (){
  888. var self=this;
  889. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  890. return smalltalk.withContext(function($ctx1) {
  891. self._should_raise_((function(){
  892. return smalltalk.withContext(function($ctx2) {
  893. if(smalltalk.assert("")){
  894. } else {
  895. };
  896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  897. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  898. args: [],
  899. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  900. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  901. referencedClasses: ["NonBooleanReceiver"]
  902. }),
  903. smalltalk.BooleanTest);
  904. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  905. smalltalk.addMethod(
  906. smalltalk.method({
  907. selector: "setUp",
  908. category: 'running',
  909. fn: function (){
  910. var self=this;
  911. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  912. return smalltalk.withContext(function($ctx1) {
  913. self["@builder"]=_st($ClassBuilder())._new();
  914. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  915. args: [],
  916. source: "setUp\x0a\x09builder := ClassBuilder new",
  917. messageSends: ["new"],
  918. referencedClasses: ["ClassBuilder"]
  919. }),
  920. smalltalk.ClassBuilderTest);
  921. smalltalk.addMethod(
  922. smalltalk.method({
  923. selector: "tearDown",
  924. category: 'running',
  925. fn: function (){
  926. var self=this;
  927. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  928. return smalltalk.withContext(function($ctx1) {
  929. var $1;
  930. $1=self["@theClass"];
  931. if(($receiver = $1) == nil || $receiver == null){
  932. $1;
  933. } else {
  934. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  935. self["@theClass"]=nil;
  936. self["@theClass"];
  937. };
  938. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  939. args: [],
  940. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  941. messageSends: ["ifNotNil:", "removeClass:", "current"],
  942. referencedClasses: ["Smalltalk"]
  943. }),
  944. smalltalk.ClassBuilderTest);
  945. smalltalk.addMethod(
  946. smalltalk.method({
  947. selector: "testClassCopy",
  948. category: 'tests',
  949. fn: function (){
  950. var self=this;
  951. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  952. return smalltalk.withContext(function($ctx1) {
  953. var $3,$4,$2,$1,$7,$8,$6,$5,$9,$12,$13,$11,$10,$16,$15,$18,$17,$14;
  954. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  955. $3=_st(self["@theClass"])._superclass();
  956. $ctx1.sendIdx["superclass"]=1;
  957. $4=_st($ObjectMock())._superclass();
  958. $2=_st($3).__eq_eq($4);
  959. $ctx1.sendIdx["=="]=1;
  960. $1=self._assert_($2);
  961. $ctx1.sendIdx["assert:"]=1;
  962. $7=_st(self["@theClass"])._instanceVariableNames();
  963. $ctx1.sendIdx["instanceVariableNames"]=1;
  964. $8=_st($ObjectMock())._instanceVariableNames();
  965. $6=_st($7).__eq_eq($8);
  966. $ctx1.sendIdx["=="]=2;
  967. $5=self._assert_($6);
  968. $ctx1.sendIdx["assert:"]=2;
  969. $9=self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  970. $ctx1.sendIdx["assert:equals:"]=1;
  971. $12=_st(self["@theClass"])._package();
  972. $ctx1.sendIdx["package"]=1;
  973. $13=_st($ObjectMock())._package();
  974. $11=_st($12).__eq_eq($13);
  975. $10=self._assert_($11);
  976. $16=_st(self["@theClass"])._methodDictionary();
  977. $ctx1.sendIdx["methodDictionary"]=1;
  978. $15=_st($16)._keys();
  979. $ctx1.sendIdx["keys"]=1;
  980. $18=_st($ObjectMock())._methodDictionary();
  981. $17=_st($18)._keys();
  982. $14=self._assert_equals_($15,$17);
  983. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  984. args: [],
  985. 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",
  986. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  987. referencedClasses: ["ObjectMock"]
  988. }),
  989. smalltalk.ClassBuilderTest);
  990. smalltalk.addMethod(
  991. smalltalk.method({
  992. selector: "testClassMigration",
  993. category: 'tests',
  994. fn: function (){
  995. var self=this;
  996. var instance,oldClass;
  997. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  998. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  999. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1000. return smalltalk.withContext(function($ctx1) {
  1001. var $2,$1,$3,$5,$4,$7,$6,$9,$8,$10,$12,$13,$11,$15,$16,$14,$18,$17,$21,$20,$19,$25,$27,$26,$24,$23,$22,$28;
  1002. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1003. $2=_st($Smalltalk())._current();
  1004. $ctx1.sendIdx["current"]=1;
  1005. $1=_st($2)._at_("ObjectMock2");
  1006. $ctx1.sendIdx["at:"]=1;
  1007. instance=_st($1)._new();
  1008. $3=$ObjectMock();
  1009. $5=_st($Smalltalk())._current();
  1010. $ctx1.sendIdx["current"]=2;
  1011. $4=_st($5)._at_("ObjectMock2");
  1012. $ctx1.sendIdx["at:"]=2;
  1013. _st($3)._subclass_instanceVariableNames_package_($4,"","Kernel-Tests");
  1014. $7=_st(oldClass).__eq_eq($ObjectMock2());
  1015. $ctx1.sendIdx["=="]=1;
  1016. $6=self._deny_($7);
  1017. $ctx1.sendIdx["deny:"]=1;
  1018. $9=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1019. $ctx1.sendIdx["=="]=2;
  1020. $8=self._assert_($9);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $10=self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1023. $ctx1.sendIdx["assert:"]=2;
  1024. $12=_st($ObjectMock2())._selectors();
  1025. $ctx1.sendIdx["selectors"]=1;
  1026. $13=_st(oldClass)._selectors();
  1027. $11=self._assert_equals_($12,$13);
  1028. $ctx1.sendIdx["assert:equals:"]=1;
  1029. $15=_st($ObjectMock2())._comment();
  1030. $ctx1.sendIdx["comment"]=1;
  1031. $16=_st(oldClass)._comment();
  1032. $14=self._assert_equals_($15,$16);
  1033. $ctx1.sendIdx["assert:equals:"]=2;
  1034. $18=_st(_st($ObjectMock2())._package())._name();
  1035. $ctx1.sendIdx["name"]=1;
  1036. $17=self._assert_equals_($18,"Kernel-Tests");
  1037. $21=_st(instance)._class();
  1038. $ctx1.sendIdx["class"]=1;
  1039. $20=_st($21).__eq_eq($ObjectMock2());
  1040. $19=self._deny_($20);
  1041. $25=_st($Smalltalk())._current();
  1042. $ctx1.sendIdx["current"]=3;
  1043. $27=_st(instance)._class();
  1044. $26=_st($27)._name();
  1045. $24=_st($25)._at_($26);
  1046. $23=_st($24)._isNil();
  1047. $22=self._assert_($23);
  1048. $28=_st($Smalltalk())._current();
  1049. _st($28)._removeClass_($ObjectMock2());
  1050. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1051. args: [],
  1052. 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",
  1053. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1054. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1055. }),
  1056. smalltalk.ClassBuilderTest);
  1057. smalltalk.addMethod(
  1058. smalltalk.method({
  1059. selector: "testClassMigrationWithClassInstanceVariables",
  1060. category: 'tests',
  1061. fn: function (){
  1062. var self=this;
  1063. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1064. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1065. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1066. return smalltalk.withContext(function($ctx1) {
  1067. var $1,$2,$4,$3,$6,$5,$7;
  1068. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1069. $1=_st($ObjectMock2())._class();
  1070. $ctx1.sendIdx["class"]=1;
  1071. _st($1)._instanceVariableNames_("foo bar");
  1072. $2=$ObjectMock();
  1073. $4=_st($Smalltalk())._current();
  1074. $ctx1.sendIdx["current"]=1;
  1075. $3=_st($4)._at_("ObjectMock2");
  1076. _st($2)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1077. $6=_st($ObjectMock2())._class();
  1078. $5=_st($6)._instanceVariableNames();
  1079. self._assert_equals_($5,["foo", "bar"]);
  1080. $7=_st($Smalltalk())._current();
  1081. _st($7)._removeClass_($ObjectMock2());
  1082. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1083. args: [],
  1084. 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",
  1085. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1086. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1087. }),
  1088. smalltalk.ClassBuilderTest);
  1089. smalltalk.addMethod(
  1090. smalltalk.method({
  1091. selector: "testClassMigrationWithSubclasses",
  1092. category: 'tests',
  1093. fn: function (){
  1094. var self=this;
  1095. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1096. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1097. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1098. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1099. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1100. return smalltalk.withContext(function($ctx1) {
  1101. var $1,$2,$4,$6,$5,$3,$9,$8,$7,$12,$11,$10,$15,$14,$13,$16;
  1102. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1103. $1=_st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1104. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1105. $2=_st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1106. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1107. $4=$ObjectMock();
  1108. $6=_st($Smalltalk())._current();
  1109. $ctx1.sendIdx["current"]=1;
  1110. $5=_st($6)._at_("ObjectMock2");
  1111. $3=_st($4)._subclass_instanceVariableNames_package_($5,"","Kernel-Tests");
  1112. $9=_st($ObjectMock())._subclasses();
  1113. $ctx1.sendIdx["subclasses"]=1;
  1114. $8=_st($9)._includes_($ObjectMock2());
  1115. $ctx1.sendIdx["includes:"]=1;
  1116. $7=self._assert_($8);
  1117. $ctx1.sendIdx["assert:"]=1;
  1118. $12=_st($ObjectMock2())._subclasses();
  1119. $ctx1.sendIdx["subclasses"]=2;
  1120. $11=_st($12)._includes_($ObjectMock3());
  1121. $ctx1.sendIdx["includes:"]=2;
  1122. $10=self._assert_($11);
  1123. $ctx1.sendIdx["assert:"]=2;
  1124. $15=_st($ObjectMock3())._subclasses();
  1125. $14=_st($15)._includes_($ObjectMock4());
  1126. $13=self._assert_($14);
  1127. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1128. return smalltalk.withContext(function($ctx2) {
  1129. $16=_st($Smalltalk())._current();
  1130. return _st($16)._removeClass_(each);
  1131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1132. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1133. args: [],
  1134. 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 ]",
  1135. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1136. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1137. }),
  1138. smalltalk.ClassBuilderTest);
  1139. smalltalk.addMethod(
  1140. smalltalk.method({
  1141. selector: "testInstanceVariableNames",
  1142. category: 'tests',
  1143. fn: function (){
  1144. var self=this;
  1145. return smalltalk.withContext(function($ctx1) {
  1146. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1147. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1148. args: [],
  1149. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1150. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1151. referencedClasses: []
  1152. }),
  1153. smalltalk.ClassBuilderTest);
  1154. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1155. smalltalk.addMethod(
  1156. smalltalk.method({
  1157. selector: "assertSameContents:as:",
  1158. category: 'convenience',
  1159. fn: function (aCollection,anotherCollection){
  1160. var self=this;
  1161. return smalltalk.withContext(function($ctx1) {
  1162. var $3,$4,$2,$1,$6,$7,$5;
  1163. $3=_st(aCollection)._size();
  1164. $ctx1.sendIdx["size"]=1;
  1165. $4=_st(anotherCollection)._size();
  1166. $2=_st($3).__eq($4);
  1167. $ctx1.sendIdx["="]=1;
  1168. $1=self._assert_($2);
  1169. $ctx1.sendIdx["assert:"]=1;
  1170. _st(aCollection)._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. $6=_st(aCollection)._occurrencesOf_(each);
  1173. $ctx2.sendIdx["occurrencesOf:"]=1;
  1174. $7=_st(anotherCollection)._occurrencesOf_(each);
  1175. $5=_st($6).__eq($7);
  1176. return self._assert_($5);
  1177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1178. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1179. args: ["aCollection", "anotherCollection"],
  1180. 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)) ]",
  1181. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1182. referencedClasses: []
  1183. }),
  1184. smalltalk.CollectionTest);
  1185. smalltalk.addMethod(
  1186. smalltalk.method({
  1187. selector: "collection",
  1188. category: 'accessing',
  1189. fn: function (){
  1190. var self=this;
  1191. return smalltalk.withContext(function($ctx1) {
  1192. var $1;
  1193. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  1194. return $1;
  1195. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1196. args: [],
  1197. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  1198. messageSends: ["withAll:", "collectionClass", "defaultValues"],
  1199. referencedClasses: []
  1200. }),
  1201. smalltalk.CollectionTest);
  1202. smalltalk.addMethod(
  1203. smalltalk.method({
  1204. selector: "collectionClass",
  1205. category: 'accessing',
  1206. fn: function (){
  1207. var self=this;
  1208. return smalltalk.withContext(function($ctx1) {
  1209. var $1;
  1210. $1=_st(self._class())._collectionClass();
  1211. return $1;
  1212. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1213. args: [],
  1214. source: "collectionClass\x0a\x09^ self class collectionClass",
  1215. messageSends: ["collectionClass", "class"],
  1216. referencedClasses: []
  1217. }),
  1218. smalltalk.CollectionTest);
  1219. smalltalk.addMethod(
  1220. smalltalk.method({
  1221. selector: "collectionWithDuplicates",
  1222. category: 'accessing',
  1223. fn: function (){
  1224. var self=this;
  1225. return smalltalk.withContext(function($ctx1) {
  1226. var $1;
  1227. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  1228. return $1;
  1229. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1230. args: [],
  1231. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  1232. messageSends: ["withAll:", "collectionClass"],
  1233. referencedClasses: []
  1234. }),
  1235. smalltalk.CollectionTest);
  1236. smalltalk.addMethod(
  1237. smalltalk.method({
  1238. selector: "defaultValues",
  1239. category: 'accessing',
  1240. fn: function (){
  1241. var self=this;
  1242. return smalltalk.withContext(function($ctx1) {
  1243. var $1;
  1244. $1=[(1), (2), (3), (-4)];
  1245. return $1;
  1246. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  1247. args: [],
  1248. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  1249. messageSends: [],
  1250. referencedClasses: []
  1251. }),
  1252. smalltalk.CollectionTest);
  1253. smalltalk.addMethod(
  1254. smalltalk.method({
  1255. selector: "isCollectionReadOnly",
  1256. category: 'testing',
  1257. fn: function (){
  1258. var self=this;
  1259. return smalltalk.withContext(function($ctx1) {
  1260. return false;
  1261. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1262. args: [],
  1263. source: "isCollectionReadOnly\x0a\x09^ false",
  1264. messageSends: [],
  1265. referencedClasses: []
  1266. }),
  1267. smalltalk.CollectionTest);
  1268. smalltalk.addMethod(
  1269. smalltalk.method({
  1270. selector: "testAsArray",
  1271. category: 'tests',
  1272. fn: function (){
  1273. var self=this;
  1274. return smalltalk.withContext(function($ctx1) {
  1275. var $1,$3,$2;
  1276. $1=self._collection();
  1277. $ctx1.sendIdx["collection"]=1;
  1278. $3=self._collection();
  1279. $2=_st($3)._asArray();
  1280. self._assertSameContents_as_($1,$2);
  1281. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1282. args: [],
  1283. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1284. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1285. referencedClasses: []
  1286. }),
  1287. smalltalk.CollectionTest);
  1288. smalltalk.addMethod(
  1289. smalltalk.method({
  1290. selector: "testAsOrderedCollection",
  1291. category: 'tests',
  1292. fn: function (){
  1293. var self=this;
  1294. return smalltalk.withContext(function($ctx1) {
  1295. var $1,$3,$2;
  1296. $1=self._collection();
  1297. $ctx1.sendIdx["collection"]=1;
  1298. $3=self._collection();
  1299. $2=_st($3)._asOrderedCollection();
  1300. self._assertSameContents_as_($1,$2);
  1301. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1302. args: [],
  1303. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1304. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.CollectionTest);
  1308. smalltalk.addMethod(
  1309. smalltalk.method({
  1310. selector: "testAsSet",
  1311. category: 'tests',
  1312. fn: function (){
  1313. var self=this;
  1314. var c,set;
  1315. return smalltalk.withContext(function($ctx1) {
  1316. c=self._collectionWithDuplicates();
  1317. set=_st(c)._asSet();
  1318. self._assert_equals_(_st(set)._size(),(5));
  1319. _st(c)._do_((function(each){
  1320. return smalltalk.withContext(function($ctx2) {
  1321. return self._assert_(_st(set)._includes_(each));
  1322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1323. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1324. args: [],
  1325. 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) ]",
  1326. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1327. referencedClasses: []
  1328. }),
  1329. smalltalk.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "testCollect",
  1333. category: 'tests',
  1334. fn: function (){
  1335. var self=this;
  1336. var newCollection;
  1337. return smalltalk.withContext(function($ctx1) {
  1338. newCollection=[(1), (2), (3), (4)];
  1339. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1340. return smalltalk.withContext(function($ctx2) {
  1341. return _st(each)._abs();
  1342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1343. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1344. args: [],
  1345. 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",
  1346. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1347. referencedClasses: []
  1348. }),
  1349. smalltalk.CollectionTest);
  1350. smalltalk.addMethod(
  1351. smalltalk.method({
  1352. selector: "testDetect",
  1353. category: 'tests',
  1354. fn: function (){
  1355. var self=this;
  1356. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1357. return smalltalk.withContext(function($ctx1) {
  1358. var $2,$1,$3;
  1359. $2=self._collection();
  1360. $ctx1.sendIdx["collection"]=1;
  1361. $1=_st($2)._detect_((function(each){
  1362. return smalltalk.withContext(function($ctx2) {
  1363. return _st(each).__lt((0));
  1364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1365. $ctx1.sendIdx["detect:"]=1;
  1366. self._assert_equals_($1,(-4));
  1367. self._should_raise_((function(){
  1368. return smalltalk.withContext(function($ctx2) {
  1369. $3=self._collection();
  1370. return _st($3)._detect_((function(each){
  1371. return smalltalk.withContext(function($ctx3) {
  1372. return _st(each).__eq((6));
  1373. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1375. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1376. args: [],
  1377. 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",
  1378. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1379. referencedClasses: ["Error"]
  1380. }),
  1381. smalltalk.CollectionTest);
  1382. smalltalk.addMethod(
  1383. smalltalk.method({
  1384. selector: "testDo",
  1385. category: 'tests',
  1386. fn: function (){
  1387. var self=this;
  1388. var newCollection;
  1389. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1390. return smalltalk.withContext(function($ctx1) {
  1391. var $1,$2;
  1392. newCollection=_st($OrderedCollection())._new();
  1393. $1=self._collection();
  1394. $ctx1.sendIdx["collection"]=1;
  1395. _st($1)._do_((function(each){
  1396. return smalltalk.withContext(function($ctx2) {
  1397. return _st(newCollection)._add_(each);
  1398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1399. $2=self._collection();
  1400. self._assertSameContents_as_($2,newCollection);
  1401. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1402. args: [],
  1403. 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",
  1404. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1405. referencedClasses: ["OrderedCollection"]
  1406. }),
  1407. smalltalk.CollectionTest);
  1408. smalltalk.addMethod(
  1409. smalltalk.method({
  1410. selector: "testIsEmpty",
  1411. category: 'tests',
  1412. fn: function (){
  1413. var self=this;
  1414. return smalltalk.withContext(function($ctx1) {
  1415. var $1,$2;
  1416. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1417. $ctx1.sendIdx["isEmpty"]=1;
  1418. self._assert_($1);
  1419. $2=_st(self._collection())._isEmpty();
  1420. self._deny_($2);
  1421. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1422. args: [],
  1423. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1424. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1425. referencedClasses: []
  1426. }),
  1427. smalltalk.CollectionTest);
  1428. smalltalk.addMethod(
  1429. smalltalk.method({
  1430. selector: "testSelect",
  1431. category: 'tests',
  1432. fn: function (){
  1433. var self=this;
  1434. var newCollection;
  1435. return smalltalk.withContext(function($ctx1) {
  1436. newCollection=[(2), (-4)];
  1437. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1438. return smalltalk.withContext(function($ctx2) {
  1439. return _st(each)._even();
  1440. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1441. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1442. args: [],
  1443. 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",
  1444. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1445. referencedClasses: []
  1446. }),
  1447. smalltalk.CollectionTest);
  1448. smalltalk.addMethod(
  1449. smalltalk.method({
  1450. selector: "testSize",
  1451. category: 'tests',
  1452. fn: function (){
  1453. var self=this;
  1454. return smalltalk.withContext(function($ctx1) {
  1455. var $2,$1,$4,$3;
  1456. $2=_st(_st(self._collectionClass())._new())._size();
  1457. $ctx1.sendIdx["size"]=1;
  1458. $1=self._assert_equals_($2,(0));
  1459. $ctx1.sendIdx["assert:equals:"]=1;
  1460. $4=_st(self._collection())._size();
  1461. $3=self._assert_equals_($4,(4));
  1462. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1463. args: [],
  1464. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1465. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1466. referencedClasses: []
  1467. }),
  1468. smalltalk.CollectionTest);
  1469. smalltalk.addMethod(
  1470. smalltalk.method({
  1471. selector: "collectionClass",
  1472. category: 'accessing',
  1473. fn: function (){
  1474. var self=this;
  1475. return smalltalk.withContext(function($ctx1) {
  1476. return nil;
  1477. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1478. args: [],
  1479. source: "collectionClass\x0a\x09^ nil",
  1480. messageSends: [],
  1481. referencedClasses: []
  1482. }),
  1483. smalltalk.CollectionTest.klass);
  1484. smalltalk.addMethod(
  1485. smalltalk.method({
  1486. selector: "isAbstract",
  1487. category: 'testing',
  1488. fn: function (){
  1489. var self=this;
  1490. return smalltalk.withContext(function($ctx1) {
  1491. var $1;
  1492. $1=_st(self._collectionClass())._isNil();
  1493. return $1;
  1494. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1495. args: [],
  1496. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1497. messageSends: ["isNil", "collectionClass"],
  1498. referencedClasses: []
  1499. }),
  1500. smalltalk.CollectionTest.klass);
  1501. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1502. smalltalk.addMethod(
  1503. smalltalk.method({
  1504. selector: "testAt",
  1505. category: 'tests',
  1506. fn: function (){
  1507. var self=this;
  1508. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1509. return smalltalk.withContext(function($ctx1) {
  1510. var $2,$1,$3;
  1511. $2=self._collection();
  1512. $ctx1.sendIdx["collection"]=1;
  1513. $1=_st($2)._at_((4));
  1514. $ctx1.sendIdx["at:"]=1;
  1515. self._assert_equals_($1,(-4));
  1516. self._should_raise_((function(){
  1517. return smalltalk.withContext(function($ctx2) {
  1518. $3=self._collection();
  1519. return _st($3)._at_((5));
  1520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1522. args: [],
  1523. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1524. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1525. referencedClasses: ["Error"]
  1526. }),
  1527. smalltalk.IndexableCollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testAtIfAbsent",
  1531. category: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. return smalltalk.withContext(function($ctx1) {
  1535. var $2,$5,$4,$3,$1;
  1536. $2=self._collection();
  1537. $ctx1.sendIdx["collection"]=1;
  1538. $5=self._collection();
  1539. $4=_st($5)._size();
  1540. $3=_st($4).__plus((1));
  1541. $1=_st($2)._at_ifAbsent_($3,(function(){
  1542. return smalltalk.withContext(function($ctx2) {
  1543. return "none";
  1544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1545. self._assert_equals_($1,"none");
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1547. args: [],
  1548. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1549. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1550. referencedClasses: []
  1551. }),
  1552. smalltalk.IndexableCollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testContains",
  1556. category: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var collection;
  1560. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $2,$3,$5,$4,$1,$7,$6;
  1563. collection=self._collection();
  1564. $ctx1.sendIdx["collection"]=1;
  1565. $2=self._collection();
  1566. $ctx1.sendIdx["collection"]=2;
  1567. $1=_st($2)._contains_((function(each){
  1568. return smalltalk.withContext(function($ctx2) {
  1569. $3=each;
  1570. $5=self._collection();
  1571. $ctx2.sendIdx["collection"]=3;
  1572. $4=_st($5)._first();
  1573. return _st($3).__eq($4);
  1574. $ctx2.sendIdx["="]=1;
  1575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1576. $ctx1.sendIdx["contains:"]=1;
  1577. self._assert_($1);
  1578. $7=self._collection();
  1579. $6=_st($7)._contains_((function(each){
  1580. return smalltalk.withContext(function($ctx2) {
  1581. return _st(each).__eq(_st($Object())._new());
  1582. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1583. self._deny_($6);
  1584. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1585. args: [],
  1586. 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 ])",
  1587. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1588. referencedClasses: ["Object"]
  1589. }),
  1590. smalltalk.IndexableCollectionTest);
  1591. smalltalk.addMethod(
  1592. smalltalk.method({
  1593. selector: "testIndexOf",
  1594. category: 'tests',
  1595. fn: function (){
  1596. var self=this;
  1597. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1598. return smalltalk.withContext(function($ctx1) {
  1599. var $3,$2,$1,$4,$7,$6,$5;
  1600. $3=self._collection();
  1601. $ctx1.sendIdx["collection"]=1;
  1602. $2=_st($3)._indexOf_((2));
  1603. $ctx1.sendIdx["indexOf:"]=1;
  1604. $1=self._assert_equals_($2,(2));
  1605. $ctx1.sendIdx["assert:equals:"]=1;
  1606. self._should_raise_((function(){
  1607. return smalltalk.withContext(function($ctx2) {
  1608. $4=self._collection();
  1609. $ctx2.sendIdx["collection"]=2;
  1610. return _st($4)._indexOf_((999));
  1611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1612. $7=self._collection();
  1613. $6=_st($7)._indexOf_ifAbsent_((999),(function(){
  1614. return smalltalk.withContext(function($ctx2) {
  1615. return "sentinel";
  1616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1617. $5=self._assert_equals_($6,"sentinel");
  1618. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1619. args: [],
  1620. 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'",
  1621. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1622. referencedClasses: ["Error"]
  1623. }),
  1624. smalltalk.IndexableCollectionTest);
  1625. smalltalk.addMethod(
  1626. smalltalk.method({
  1627. selector: "testWithIndexDo",
  1628. category: 'tests',
  1629. fn: function (){
  1630. var self=this;
  1631. var collection;
  1632. return smalltalk.withContext(function($ctx1) {
  1633. var $1;
  1634. collection=self._collection();
  1635. $ctx1.sendIdx["collection"]=1;
  1636. $1=self._collection();
  1637. _st($1)._withIndexDo_((function(each,index){
  1638. return smalltalk.withContext(function($ctx2) {
  1639. return self._assert_equals_(_st(collection)._at_(index),each);
  1640. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1641. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1642. args: [],
  1643. 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 ]",
  1644. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1645. referencedClasses: []
  1646. }),
  1647. smalltalk.IndexableCollectionTest);
  1648. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1649. smalltalk.addMethod(
  1650. smalltalk.method({
  1651. selector: "collection",
  1652. category: 'accessing',
  1653. fn: function (){
  1654. var self=this;
  1655. return smalltalk.withContext(function($ctx1) {
  1656. var $2,$3,$4,$5,$1;
  1657. $2="b".__minus_gt((1));
  1658. $ctx1.sendIdx["->"]=1;
  1659. $3="a".__minus_gt((2));
  1660. $ctx1.sendIdx["->"]=2;
  1661. $4="c".__minus_gt((3));
  1662. $ctx1.sendIdx["->"]=3;
  1663. $5="d".__minus_gt((-4));
  1664. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5]);
  1665. return $1;
  1666. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1667. args: [],
  1668. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1669. messageSends: ["->"],
  1670. referencedClasses: []
  1671. }),
  1672. smalltalk.HashedCollectionTest);
  1673. smalltalk.addMethod(
  1674. smalltalk.method({
  1675. selector: "collectionWithDuplicates",
  1676. category: 'accessing',
  1677. fn: function (){
  1678. var self=this;
  1679. return smalltalk.withContext(function($ctx1) {
  1680. var $2,$3,$4,$5,$6,$7,$8,$1;
  1681. $2="b".__minus_gt((1));
  1682. $ctx1.sendIdx["->"]=1;
  1683. $3="a".__minus_gt((2));
  1684. $ctx1.sendIdx["->"]=2;
  1685. $4="c".__minus_gt((3));
  1686. $ctx1.sendIdx["->"]=3;
  1687. $5="d".__minus_gt((-4));
  1688. $ctx1.sendIdx["->"]=4;
  1689. $6="e".__minus_gt((1));
  1690. $ctx1.sendIdx["->"]=5;
  1691. $7="f".__minus_gt((2));
  1692. $ctx1.sendIdx["->"]=6;
  1693. $8="g".__minus_gt((10));
  1694. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,$8]);
  1695. return $1;
  1696. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1697. args: [],
  1698. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1699. messageSends: ["->"],
  1700. referencedClasses: []
  1701. }),
  1702. smalltalk.HashedCollectionTest);
  1703. smalltalk.addMethod(
  1704. smalltalk.method({
  1705. selector: "testAsDictionary",
  1706. category: 'tests',
  1707. fn: function (){
  1708. var self=this;
  1709. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1710. return smalltalk.withContext(function($ctx1) {
  1711. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1712. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1713. args: [],
  1714. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1715. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1716. referencedClasses: ["Dictionary"]
  1717. }),
  1718. smalltalk.HashedCollectionTest);
  1719. smalltalk.addMethod(
  1720. smalltalk.method({
  1721. selector: "testAt",
  1722. category: 'tests',
  1723. fn: function (){
  1724. var self=this;
  1725. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1726. return smalltalk.withContext(function($ctx1) {
  1727. var $2,$1,$3;
  1728. $2=self._collection();
  1729. $ctx1.sendIdx["collection"]=1;
  1730. $1=_st($2)._at_("a");
  1731. $ctx1.sendIdx["at:"]=1;
  1732. self._assert_equals_($1,(2));
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $3=self._collection();
  1736. return _st($3)._at_((5));
  1737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1738. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1739. args: [],
  1740. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1741. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1742. referencedClasses: ["Error"]
  1743. }),
  1744. smalltalk.HashedCollectionTest);
  1745. smalltalk.addMethod(
  1746. smalltalk.method({
  1747. selector: "testContains",
  1748. category: 'tests',
  1749. fn: function (){
  1750. var self=this;
  1751. var collection;
  1752. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1753. return smalltalk.withContext(function($ctx1) {
  1754. var $2,$3,$6,$5,$4,$1,$8,$7;
  1755. collection=self._collection();
  1756. $ctx1.sendIdx["collection"]=1;
  1757. $2=self._collection();
  1758. $ctx1.sendIdx["collection"]=2;
  1759. $1=_st($2)._contains_((function(each){
  1760. return smalltalk.withContext(function($ctx2) {
  1761. $3=each;
  1762. $6=self._collection();
  1763. $ctx2.sendIdx["collection"]=3;
  1764. $5=_st($6)._values();
  1765. $4=_st($5)._first();
  1766. return _st($3).__eq($4);
  1767. $ctx2.sendIdx["="]=1;
  1768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1769. $ctx1.sendIdx["contains:"]=1;
  1770. self._assert_($1);
  1771. $8=self._collection();
  1772. $7=_st($8)._contains_((function(each){
  1773. return smalltalk.withContext(function($ctx2) {
  1774. return _st(each).__eq(_st($Object())._new());
  1775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1776. self._deny_($7);
  1777. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1778. args: [],
  1779. 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 ])",
  1780. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1781. referencedClasses: ["Object"]
  1782. }),
  1783. smalltalk.HashedCollectionTest);
  1784. smalltalk.addMethod(
  1785. smalltalk.method({
  1786. selector: "testFrom",
  1787. category: 'tests',
  1788. fn: function (){
  1789. var self=this;
  1790. var associations;
  1791. return smalltalk.withContext(function($ctx1) {
  1792. var $1,$2,$3,$5,$6,$4;
  1793. $1="a".__minus_gt((1));
  1794. $ctx1.sendIdx["->"]=1;
  1795. $2="b".__minus_gt((2));
  1796. $ctx1.sendIdx["->"]=2;
  1797. associations=[$1,$2];
  1798. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  1799. $5="a".__minus_gt((1));
  1800. $ctx1.sendIdx["->"]=3;
  1801. $6="b".__minus_gt((2));
  1802. $4=smalltalk.HashedCollection._from_([$5,$6]);
  1803. self._assertSameContents_as_($3,$4);
  1804. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1805. args: [],
  1806. 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 }.",
  1807. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1808. referencedClasses: []
  1809. }),
  1810. smalltalk.HashedCollectionTest);
  1811. smalltalk.addMethod(
  1812. smalltalk.method({
  1813. selector: "testIndexOf",
  1814. category: 'tests',
  1815. fn: function (){
  1816. var self=this;
  1817. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1818. return smalltalk.withContext(function($ctx1) {
  1819. var $3,$2,$1,$4,$7,$6,$5;
  1820. $3=self._collection();
  1821. $ctx1.sendIdx["collection"]=1;
  1822. $2=_st($3)._indexOf_((2));
  1823. $ctx1.sendIdx["indexOf:"]=1;
  1824. $1=self._assert_equals_($2,"a");
  1825. $ctx1.sendIdx["assert:equals:"]=1;
  1826. self._should_raise_((function(){
  1827. return smalltalk.withContext(function($ctx2) {
  1828. $4=self._collection();
  1829. $ctx2.sendIdx["collection"]=2;
  1830. return _st($4)._indexOf_((999));
  1831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1832. $7=self._collection();
  1833. $6=_st($7)._indexOf_ifAbsent_((999),(function(){
  1834. return smalltalk.withContext(function($ctx2) {
  1835. return "sentinel";
  1836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1837. $5=self._assert_equals_($6,"sentinel");
  1838. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1839. args: [],
  1840. 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'",
  1841. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1842. referencedClasses: ["Error"]
  1843. }),
  1844. smalltalk.HashedCollectionTest);
  1845. smalltalk.addMethod(
  1846. smalltalk.method({
  1847. selector: "testNewFromPairs",
  1848. category: 'tests',
  1849. fn: function (){
  1850. var self=this;
  1851. var flattenedAssociations;
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $1,$3,$4,$2;
  1854. flattenedAssociations=["a",(1),"b",(2)];
  1855. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  1856. $3="a".__minus_gt((1));
  1857. $ctx1.sendIdx["->"]=1;
  1858. $4="b".__minus_gt((2));
  1859. $2=smalltalk.HashedCollection._from_([$3,$4]);
  1860. self._assertSameContents_as_($1,$2);
  1861. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1862. args: [],
  1863. 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 }.",
  1864. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1865. referencedClasses: []
  1866. }),
  1867. smalltalk.HashedCollectionTest);
  1868. smalltalk.addMethod(
  1869. smalltalk.method({
  1870. selector: "collectionClass",
  1871. category: 'accessing',
  1872. fn: function (){
  1873. var self=this;
  1874. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1875. return smalltalk.withContext(function($ctx1) {
  1876. var $1;
  1877. $1=$HashedCollection();
  1878. return $1;
  1879. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1880. args: [],
  1881. source: "collectionClass\x0a\x09^ HashedCollection",
  1882. messageSends: [],
  1883. referencedClasses: ["HashedCollection"]
  1884. }),
  1885. smalltalk.HashedCollectionTest.klass);
  1886. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1887. smalltalk.addMethod(
  1888. smalltalk.method({
  1889. selector: "collection",
  1890. category: 'accessing',
  1891. fn: function (){
  1892. var self=this;
  1893. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1894. return smalltalk.withContext(function($ctx1) {
  1895. var $2,$3,$1;
  1896. $2=_st($Dictionary())._new();
  1897. _st($2)._at_put_((1),(1));
  1898. $ctx1.sendIdx["at:put:"]=1;
  1899. _st($2)._at_put_("a",(2));
  1900. $ctx1.sendIdx["at:put:"]=2;
  1901. _st($2)._at_put_(true,(3));
  1902. $ctx1.sendIdx["at:put:"]=3;
  1903. _st($2)._at_put_((4),(-4));
  1904. $3=_st($2)._yourself();
  1905. $1=$3;
  1906. return $1;
  1907. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1908. args: [],
  1909. 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",
  1910. messageSends: ["at:put:", "new", "yourself"],
  1911. referencedClasses: ["Dictionary"]
  1912. }),
  1913. smalltalk.DictionaryTest);
  1914. smalltalk.addMethod(
  1915. smalltalk.method({
  1916. selector: "collectionWithDuplicates",
  1917. category: 'accessing',
  1918. fn: function (){
  1919. var self=this;
  1920. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1921. return smalltalk.withContext(function($ctx1) {
  1922. var $2,$3,$1;
  1923. $2=_st($Dictionary())._new();
  1924. _st($2)._at_put_((1),(1));
  1925. $ctx1.sendIdx["at:put:"]=1;
  1926. _st($2)._at_put_("a",(2));
  1927. $ctx1.sendIdx["at:put:"]=2;
  1928. _st($2)._at_put_(true,(3));
  1929. $ctx1.sendIdx["at:put:"]=3;
  1930. _st($2)._at_put_((4),(-4));
  1931. $ctx1.sendIdx["at:put:"]=4;
  1932. _st($2)._at_put_("b",(1));
  1933. $ctx1.sendIdx["at:put:"]=5;
  1934. _st($2)._at_put_((3),(3));
  1935. $ctx1.sendIdx["at:put:"]=6;
  1936. _st($2)._at_put_(false,(12));
  1937. $3=_st($2)._yourself();
  1938. $1=$3;
  1939. return $1;
  1940. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1941. args: [],
  1942. 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",
  1943. messageSends: ["at:put:", "new", "yourself"],
  1944. referencedClasses: ["Dictionary"]
  1945. }),
  1946. smalltalk.DictionaryTest);
  1947. smalltalk.addMethod(
  1948. smalltalk.method({
  1949. selector: "testAccessing",
  1950. category: 'tests',
  1951. fn: function (){
  1952. var self=this;
  1953. var d;
  1954. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1955. return smalltalk.withContext(function($ctx1) {
  1956. var $1,$3,$2,$5,$4,$8,$7,$6,$10,$9,$12,$11,$13,$15,$14,$17,$18,$16,$21,$22,$20,$19,$25,$26,$24,$23,$29,$30,$28,$27;
  1957. d=_st($Dictionary())._new();
  1958. $1=_st(d)._at_put_("hello","world");
  1959. $ctx1.sendIdx["at:put:"]=1;
  1960. $3=_st(d)._at_("hello");
  1961. $ctx1.sendIdx["at:"]=1;
  1962. $2=self._assert_equals_($3,"world");
  1963. $ctx1.sendIdx["assert:equals:"]=1;
  1964. $5=_st(d)._at_ifAbsent_("hello",(function(){
  1965. return smalltalk.withContext(function($ctx2) {
  1966. return nil;
  1967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1968. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1969. $4=self._assert_equals_($5,"world");
  1970. $ctx1.sendIdx["assert:equals:"]=2;
  1971. $8=_st(d)._at_ifAbsent_("foo",(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return nil;
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1975. $7=_st($8).__eq("world");
  1976. $6=self._deny_($7);
  1977. $ctx1.sendIdx["deny:"]=1;
  1978. $10=_st(d)._includesKey_("hello");
  1979. $ctx1.sendIdx["includesKey:"]=1;
  1980. $9=self._assert_($10);
  1981. $ctx1.sendIdx["assert:"]=1;
  1982. $12=_st(d)._includesKey_("foo");
  1983. $ctx1.sendIdx["includesKey:"]=2;
  1984. $11=self._deny_($12);
  1985. $ctx1.sendIdx["deny:"]=2;
  1986. $13=_st(d)._at_put_((1),(2));
  1987. $ctx1.sendIdx["at:put:"]=2;
  1988. $15=_st(d)._at_((1));
  1989. $ctx1.sendIdx["at:"]=2;
  1990. $14=self._assert_equals_($15,(2));
  1991. $ctx1.sendIdx["assert:equals:"]=3;
  1992. $17=d;
  1993. $18=(1).__at((3));
  1994. $ctx1.sendIdx["@"]=1;
  1995. $16=_st($17)._at_put_($18,(3));
  1996. $21=d;
  1997. $22=(1).__at((3));
  1998. $ctx1.sendIdx["@"]=2;
  1999. $20=_st($21)._at_($22);
  2000. $19=self._assert_equals_($20,(3));
  2001. $25=d;
  2002. $26=(1).__at((3));
  2003. $ctx1.sendIdx["@"]=3;
  2004. $24=_st($25)._includesKey_($26);
  2005. $ctx1.sendIdx["includesKey:"]=3;
  2006. $23=self._assert_($24);
  2007. $29=d;
  2008. $30=(3).__at((1));
  2009. $28=_st($29)._includesKey_($30);
  2010. $27=self._deny_($28);
  2011. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2012. args: [],
  2013. 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)",
  2014. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2015. referencedClasses: ["Dictionary"]
  2016. }),
  2017. smalltalk.DictionaryTest);
  2018. smalltalk.addMethod(
  2019. smalltalk.method({
  2020. selector: "testAsHashedCollection",
  2021. category: 'tests',
  2022. fn: function (){
  2023. var self=this;
  2024. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2025. return smalltalk.withContext(function($ctx1) {
  2026. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2027. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2028. args: [],
  2029. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2030. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2031. referencedClasses: ["HashedCollection"]
  2032. }),
  2033. smalltalk.DictionaryTest);
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "testDynamicDictionaries",
  2037. category: 'tests',
  2038. fn: function (){
  2039. var self=this;
  2040. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2041. return smalltalk.withContext(function($ctx1) {
  2042. var $3,$2,$1,$5,$6,$4;
  2043. $3="hello".__minus_gt((1));
  2044. $ctx1.sendIdx["->"]=1;
  2045. $2=smalltalk.HashedCollection._from_([$3]);
  2046. $1=_st($2)._asDictionary();
  2047. $5=$Dictionary();
  2048. $6="hello".__minus_gt((1));
  2049. $4=_st($5)._with_($6);
  2050. self._assert_equals_($1,$4);
  2051. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2052. args: [],
  2053. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2054. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2055. referencedClasses: ["Dictionary"]
  2056. }),
  2057. smalltalk.DictionaryTest);
  2058. smalltalk.addMethod(
  2059. smalltalk.method({
  2060. selector: "testEquality",
  2061. category: 'tests',
  2062. fn: function (){
  2063. var self=this;
  2064. var d1,d2;
  2065. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2066. return smalltalk.withContext(function($ctx1) {
  2067. var $3,$4,$2,$1,$5,$6,$7,$8,$10,$9,$11,$12,$14,$13,$15,$16,$18,$17,$19,$20,$22,$21;
  2068. $3=_st($Dictionary())._new();
  2069. $ctx1.sendIdx["new"]=1;
  2070. $4=_st($Dictionary())._new();
  2071. $ctx1.sendIdx["new"]=2;
  2072. $2=_st($3).__eq($4);
  2073. $ctx1.sendIdx["="]=1;
  2074. $1=self._assert_($2);
  2075. $ctx1.sendIdx["assert:"]=1;
  2076. $5=_st($Dictionary())._new();
  2077. $ctx1.sendIdx["new"]=3;
  2078. _st($5)._at_put_((1),(2));
  2079. $ctx1.sendIdx["at:put:"]=1;
  2080. $6=_st($5)._yourself();
  2081. $ctx1.sendIdx["yourself"]=1;
  2082. d1=$6;
  2083. $7=_st($Dictionary())._new();
  2084. $ctx1.sendIdx["new"]=4;
  2085. _st($7)._at_put_((1),(2));
  2086. $ctx1.sendIdx["at:put:"]=2;
  2087. $8=_st($7)._yourself();
  2088. $ctx1.sendIdx["yourself"]=2;
  2089. d2=$8;
  2090. $10=_st(d1).__eq(d2);
  2091. $ctx1.sendIdx["="]=2;
  2092. $9=self._assert_($10);
  2093. $11=_st($Dictionary())._new();
  2094. $ctx1.sendIdx["new"]=5;
  2095. _st($11)._at_put_((1),(3));
  2096. $ctx1.sendIdx["at:put:"]=3;
  2097. $12=_st($11)._yourself();
  2098. $ctx1.sendIdx["yourself"]=3;
  2099. d2=$12;
  2100. $14=_st(d1).__eq(d2);
  2101. $ctx1.sendIdx["="]=3;
  2102. $13=self._deny_($14);
  2103. $ctx1.sendIdx["deny:"]=1;
  2104. $15=_st($Dictionary())._new();
  2105. $ctx1.sendIdx["new"]=6;
  2106. _st($15)._at_put_((2),(2));
  2107. $ctx1.sendIdx["at:put:"]=4;
  2108. $16=_st($15)._yourself();
  2109. $ctx1.sendIdx["yourself"]=4;
  2110. d2=$16;
  2111. $18=_st(d1).__eq(d2);
  2112. $ctx1.sendIdx["="]=4;
  2113. $17=self._deny_($18);
  2114. $ctx1.sendIdx["deny:"]=2;
  2115. $19=_st($Dictionary())._new();
  2116. _st($19)._at_put_((1),(2));
  2117. $ctx1.sendIdx["at:put:"]=5;
  2118. _st($19)._at_put_((3),(4));
  2119. $20=_st($19)._yourself();
  2120. d2=$20;
  2121. $22=_st(d1).__eq(d2);
  2122. $21=self._deny_($22);
  2123. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2124. args: [],
  2125. 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.",
  2126. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2127. referencedClasses: ["Dictionary"]
  2128. }),
  2129. smalltalk.DictionaryTest);
  2130. smalltalk.addMethod(
  2131. smalltalk.method({
  2132. selector: "testIfAbsent",
  2133. category: 'tests',
  2134. fn: function (){
  2135. var self=this;
  2136. var d,visited;
  2137. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2138. return smalltalk.withContext(function($ctx1) {
  2139. visited=false;
  2140. d=_st($Dictionary())._new();
  2141. _st(d)._at_ifAbsent_("hello",(function(){
  2142. return smalltalk.withContext(function($ctx2) {
  2143. visited=true;
  2144. return visited;
  2145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2146. self._assert_(visited);
  2147. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2148. args: [],
  2149. 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.",
  2150. messageSends: ["new", "at:ifAbsent:", "assert:"],
  2151. referencedClasses: ["Dictionary"]
  2152. }),
  2153. smalltalk.DictionaryTest);
  2154. smalltalk.addMethod(
  2155. smalltalk.method({
  2156. selector: "testIfPresent",
  2157. category: 'tests',
  2158. fn: function (){
  2159. var self=this;
  2160. var d,visited,absent;
  2161. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2162. return smalltalk.withContext(function($ctx1) {
  2163. var $1;
  2164. visited=false;
  2165. d=_st($Dictionary())._new();
  2166. _st(d)._at_put_("hello","world");
  2167. $1=_st(d)._at_ifPresent_("hello",(function(value){
  2168. return smalltalk.withContext(function($ctx2) {
  2169. visited=value;
  2170. return visited;
  2171. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2172. $ctx1.sendIdx["at:ifPresent:"]=1;
  2173. self._assert_equals_(visited,"world");
  2174. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2175. return smalltalk.withContext(function($ctx2) {
  2176. visited=value;
  2177. return visited;
  2178. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2179. self._assert_(_st(absent)._isNil());
  2180. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2181. args: [],
  2182. 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.",
  2183. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2184. referencedClasses: ["Dictionary"]
  2185. }),
  2186. smalltalk.DictionaryTest);
  2187. smalltalk.addMethod(
  2188. smalltalk.method({
  2189. selector: "testIfPresentIfAbsent",
  2190. category: 'tests',
  2191. fn: function (){
  2192. var self=this;
  2193. var d,visited;
  2194. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2195. return smalltalk.withContext(function($ctx1) {
  2196. var $1,$2;
  2197. visited=false;
  2198. d=_st($Dictionary())._new();
  2199. _st(d)._at_put_("hello","world");
  2200. $1=_st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2201. return smalltalk.withContext(function($ctx2) {
  2202. visited=value;
  2203. return visited;
  2204. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2205. return smalltalk.withContext(function($ctx2) {
  2206. visited=true;
  2207. return visited;
  2208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2209. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2210. self._assert_equals_(visited,"world");
  2211. $2=_st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2212. return smalltalk.withContext(function($ctx2) {
  2213. visited=value;
  2214. return visited;
  2215. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2216. return smalltalk.withContext(function($ctx2) {
  2217. visited=true;
  2218. return visited;
  2219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2220. self._assert_(visited);
  2221. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2222. args: [],
  2223. 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.",
  2224. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2225. referencedClasses: ["Dictionary"]
  2226. }),
  2227. smalltalk.DictionaryTest);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "testKeys",
  2231. category: 'tests',
  2232. fn: function (){
  2233. var self=this;
  2234. var d;
  2235. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2236. return smalltalk.withContext(function($ctx1) {
  2237. var $1,$2,$3;
  2238. d=_st($Dictionary())._new();
  2239. $1=_st(d)._at_put_((1),(2));
  2240. $ctx1.sendIdx["at:put:"]=1;
  2241. $2=_st(d)._at_put_((2),(3));
  2242. $ctx1.sendIdx["at:put:"]=2;
  2243. $3=_st(d)._at_put_((3),(4));
  2244. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2245. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2246. args: [],
  2247. 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)",
  2248. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2249. referencedClasses: ["Dictionary"]
  2250. }),
  2251. smalltalk.DictionaryTest);
  2252. smalltalk.addMethod(
  2253. smalltalk.method({
  2254. selector: "testPointKey",
  2255. category: 'tests',
  2256. fn: function (){
  2257. var self=this;
  2258. var d;
  2259. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2260. return smalltalk.withContext(function($ctx1) {
  2261. var $2,$3,$1,$6,$7,$5,$4,$9,$10,$8,$13,$14,$12,$11,$15,$16,$19,$20,$18,$17,$22,$23,$21;
  2262. d=_st($Dictionary())._new();
  2263. $2=d;
  2264. $3=(1).__at((1));
  2265. $ctx1.sendIdx["@"]=1;
  2266. $1=_st($2)._at_put_($3,"foo");
  2267. $ctx1.sendIdx["at:put:"]=1;
  2268. $6=d;
  2269. $7=(1).__at((1));
  2270. $ctx1.sendIdx["@"]=2;
  2271. $5=_st($6)._at_($7);
  2272. $ctx1.sendIdx["at:"]=1;
  2273. $4=self._assert_equals_($5,"foo");
  2274. $ctx1.sendIdx["assert:equals:"]=1;
  2275. $9=d;
  2276. $10=(1).__at((1));
  2277. $ctx1.sendIdx["@"]=3;
  2278. $8=_st($9)._at_put_($10,"bar");
  2279. $13=d;
  2280. $14=(1).__at((1));
  2281. $ctx1.sendIdx["@"]=4;
  2282. $12=_st($13)._at_($14);
  2283. $11=self._assert_equals_($12,"bar");
  2284. $ctx1.sendIdx["assert:equals:"]=2;
  2285. $15=d;
  2286. $16=(1).__at((1));
  2287. $ctx1.sendIdx["@"]=5;
  2288. _st($15)._removeKey_($16);
  2289. $19=d;
  2290. $20=(1).__at((1));
  2291. $ctx1.sendIdx["@"]=6;
  2292. $18=_st($19)._at_ifAbsent_($20,(function(){
  2293. return smalltalk.withContext(function($ctx2) {
  2294. return "baz";
  2295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2296. $17=self._assert_equals_($18,"baz");
  2297. $22=d;
  2298. $23=(1).__at((1));
  2299. $21=_st($22)._includesKey_($23);
  2300. self._deny_($21);
  2301. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2302. args: [],
  2303. 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)",
  2304. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2305. referencedClasses: ["Dictionary"]
  2306. }),
  2307. smalltalk.DictionaryTest);
  2308. smalltalk.addMethod(
  2309. smalltalk.method({
  2310. selector: "testPrintString",
  2311. category: 'tests',
  2312. fn: function (){
  2313. var self=this;
  2314. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2315. return smalltalk.withContext(function($ctx1) {
  2316. var $2,$3,$1;
  2317. $2=_st($Dictionary())._new();
  2318. _st($2)._at_put_("firstname","James");
  2319. $ctx1.sendIdx["at:put:"]=1;
  2320. _st($2)._at_put_("lastname","Bond");
  2321. $3=_st($2)._printString();
  2322. $1=$3;
  2323. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2324. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2325. args: [],
  2326. 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'')'",
  2327. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2328. referencedClasses: ["Dictionary"]
  2329. }),
  2330. smalltalk.DictionaryTest);
  2331. smalltalk.addMethod(
  2332. smalltalk.method({
  2333. selector: "testRemoveKey",
  2334. category: 'tests',
  2335. fn: function (){
  2336. var self=this;
  2337. var d,key;
  2338. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2339. return smalltalk.withContext(function($ctx1) {
  2340. var $1,$2,$3,$5,$4,$7,$6,$8;
  2341. d=_st($Dictionary())._new();
  2342. $1=_st(d)._at_put_((1),(2));
  2343. $ctx1.sendIdx["at:put:"]=1;
  2344. $2=_st(d)._at_put_((2),(3));
  2345. $ctx1.sendIdx["at:put:"]=2;
  2346. $3=_st(d)._at_put_((3),(4));
  2347. key=(2);
  2348. $5=_st(d)._keys();
  2349. $ctx1.sendIdx["keys"]=1;
  2350. $4=self._assert_equals_($5,[(1), (2), (3)]);
  2351. $ctx1.sendIdx["assert:equals:"]=1;
  2352. _st(d)._removeKey_(key);
  2353. $7=_st(d)._keys();
  2354. $6=self._assert_equals_($7,[(1), (3)]);
  2355. $ctx1.sendIdx["assert:equals:"]=2;
  2356. $8=self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2357. self._deny_(_st(d)._includesKey_((2)));
  2358. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2359. args: [],
  2360. 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)",
  2361. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2362. referencedClasses: ["Dictionary"]
  2363. }),
  2364. smalltalk.DictionaryTest);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "testRemoveKeyIfAbsent",
  2368. category: 'tests',
  2369. fn: function (){
  2370. var self=this;
  2371. var d,key;
  2372. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2373. return smalltalk.withContext(function($ctx1) {
  2374. var $1,$2,$3,$4,$6,$5,$8,$7;
  2375. d=_st($Dictionary())._new();
  2376. $1=_st(d)._at_put_((1),(2));
  2377. $ctx1.sendIdx["at:put:"]=1;
  2378. $2=_st(d)._at_put_((2),(3));
  2379. $ctx1.sendIdx["at:put:"]=2;
  2380. $3=_st(d)._at_put_((3),(4));
  2381. key=(2);
  2382. $4=self._assert_equals_(_st(d)._removeKey_(key),(3));
  2383. $ctx1.sendIdx["assert:equals:"]=1;
  2384. key=(3);
  2385. $6=_st(d)._removeKey_ifAbsent_(key,(function(){
  2386. return smalltalk.withContext(function($ctx2) {
  2387. return (42);
  2388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2389. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2390. $5=self._assert_equals_($6,(4));
  2391. $ctx1.sendIdx["assert:equals:"]=2;
  2392. key="why";
  2393. $8=_st(d)._removeKey_ifAbsent_(key,(function(){
  2394. return smalltalk.withContext(function($ctx2) {
  2395. return (42);
  2396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2397. $7=self._assert_equals_($8,(42));
  2398. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2399. args: [],
  2400. 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.",
  2401. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2402. referencedClasses: ["Dictionary"]
  2403. }),
  2404. smalltalk.DictionaryTest);
  2405. smalltalk.addMethod(
  2406. smalltalk.method({
  2407. selector: "testSize",
  2408. category: 'tests',
  2409. fn: function (){
  2410. var self=this;
  2411. var d;
  2412. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2413. return smalltalk.withContext(function($ctx1) {
  2414. var $2,$1,$3,$5,$4,$6,$8,$7;
  2415. d=_st($Dictionary())._new();
  2416. $2=_st(d)._size();
  2417. $ctx1.sendIdx["size"]=1;
  2418. $1=self._assert_equals_($2,(0));
  2419. $ctx1.sendIdx["assert:equals:"]=1;
  2420. $3=_st(d)._at_put_((1),(2));
  2421. $ctx1.sendIdx["at:put:"]=1;
  2422. $5=_st(d)._size();
  2423. $ctx1.sendIdx["size"]=2;
  2424. $4=self._assert_equals_($5,(1));
  2425. $ctx1.sendIdx["assert:equals:"]=2;
  2426. $6=_st(d)._at_put_((2),(3));
  2427. $8=_st(d)._size();
  2428. $7=self._assert_equals_($8,(2));
  2429. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2430. args: [],
  2431. 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.",
  2432. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2433. referencedClasses: ["Dictionary"]
  2434. }),
  2435. smalltalk.DictionaryTest);
  2436. smalltalk.addMethod(
  2437. smalltalk.method({
  2438. selector: "testValues",
  2439. category: 'tests',
  2440. fn: function (){
  2441. var self=this;
  2442. var d;
  2443. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2444. return smalltalk.withContext(function($ctx1) {
  2445. var $1,$2,$3;
  2446. d=_st($Dictionary())._new();
  2447. $1=_st(d)._at_put_((1),(2));
  2448. $ctx1.sendIdx["at:put:"]=1;
  2449. $2=_st(d)._at_put_((2),(3));
  2450. $ctx1.sendIdx["at:put:"]=2;
  2451. $3=_st(d)._at_put_((3),(4));
  2452. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2453. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2454. args: [],
  2455. 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)",
  2456. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2457. referencedClasses: ["Dictionary"]
  2458. }),
  2459. smalltalk.DictionaryTest);
  2460. smalltalk.addMethod(
  2461. smalltalk.method({
  2462. selector: "collectionClass",
  2463. category: 'accessing',
  2464. fn: function (){
  2465. var self=this;
  2466. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2467. return smalltalk.withContext(function($ctx1) {
  2468. var $1;
  2469. $1=$Dictionary();
  2470. return $1;
  2471. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2472. args: [],
  2473. source: "collectionClass\x0a\x09^ Dictionary",
  2474. messageSends: [],
  2475. referencedClasses: ["Dictionary"]
  2476. }),
  2477. smalltalk.DictionaryTest.klass);
  2478. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2479. smalltalk.addMethod(
  2480. smalltalk.method({
  2481. selector: "testFirst",
  2482. category: 'tests',
  2483. fn: function (){
  2484. var self=this;
  2485. return smalltalk.withContext(function($ctx1) {
  2486. var $2,$1,$4,$3;
  2487. $2=self._collection();
  2488. $ctx1.sendIdx["collection"]=1;
  2489. $1=_st($2)._first();
  2490. $4=self._collection();
  2491. $3=_st($4)._at_((1));
  2492. self._assert_equals_($1,$3);
  2493. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  2494. args: [],
  2495. source: "testFirst\x0a\x09self assert: (self collection first) equals: (self collection at: 1)",
  2496. messageSends: ["assert:equals:", "first", "collection", "at:"],
  2497. referencedClasses: []
  2498. }),
  2499. smalltalk.SequenceableCollectionTest);
  2500. smalltalk.addMethod(
  2501. smalltalk.method({
  2502. selector: "testFourth",
  2503. category: 'tests',
  2504. fn: function (){
  2505. var self=this;
  2506. return smalltalk.withContext(function($ctx1) {
  2507. var $2,$1,$4,$3;
  2508. $2=self._collection();
  2509. $ctx1.sendIdx["collection"]=1;
  2510. $1=_st($2)._fourth();
  2511. $4=self._collection();
  2512. $3=_st($4)._at_((4));
  2513. self._assert_equals_($1,$3);
  2514. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  2515. args: [],
  2516. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  2517. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  2518. referencedClasses: []
  2519. }),
  2520. smalltalk.SequenceableCollectionTest);
  2521. smalltalk.addMethod(
  2522. smalltalk.method({
  2523. selector: "testLast",
  2524. category: 'tests',
  2525. fn: function (){
  2526. var self=this;
  2527. return smalltalk.withContext(function($ctx1) {
  2528. var $2,$1,$4,$6,$5,$3;
  2529. $2=self._collection();
  2530. $ctx1.sendIdx["collection"]=1;
  2531. $1=_st($2)._last();
  2532. $4=self._collection();
  2533. $ctx1.sendIdx["collection"]=2;
  2534. $6=self._collection();
  2535. $5=_st($6)._size();
  2536. $3=_st($4)._at_($5);
  2537. self._assert_equals_($1,$3);
  2538. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  2539. args: [],
  2540. source: "testLast\x0a\x09self assert: (self collection last) equals: (self collection at: self collection size)",
  2541. messageSends: ["assert:equals:", "last", "collection", "at:", "size"],
  2542. referencedClasses: []
  2543. }),
  2544. smalltalk.SequenceableCollectionTest);
  2545. smalltalk.addMethod(
  2546. smalltalk.method({
  2547. selector: "testSecond",
  2548. category: 'tests',
  2549. fn: function (){
  2550. var self=this;
  2551. return smalltalk.withContext(function($ctx1) {
  2552. var $2,$1,$4,$3;
  2553. $2=self._collection();
  2554. $ctx1.sendIdx["collection"]=1;
  2555. $1=_st($2)._second();
  2556. $4=self._collection();
  2557. $3=_st($4)._at_((2));
  2558. self._assert_equals_($1,$3);
  2559. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  2560. args: [],
  2561. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  2562. messageSends: ["assert:equals:", "second", "collection", "at:"],
  2563. referencedClasses: []
  2564. }),
  2565. smalltalk.SequenceableCollectionTest);
  2566. smalltalk.addMethod(
  2567. smalltalk.method({
  2568. selector: "testThird",
  2569. category: 'tests',
  2570. fn: function (){
  2571. var self=this;
  2572. return smalltalk.withContext(function($ctx1) {
  2573. var $2,$1,$4,$3;
  2574. $2=self._collection();
  2575. $ctx1.sendIdx["collection"]=1;
  2576. $1=_st($2)._third();
  2577. $4=self._collection();
  2578. $3=_st($4)._at_((3));
  2579. self._assert_equals_($1,$3);
  2580. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  2581. args: [],
  2582. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  2583. messageSends: ["assert:equals:", "third", "collection", "at:"],
  2584. referencedClasses: []
  2585. }),
  2586. smalltalk.SequenceableCollectionTest);
  2587. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2588. smalltalk.addMethod(
  2589. smalltalk.method({
  2590. selector: "testAdd",
  2591. category: 'tests',
  2592. fn: function (){
  2593. var self=this;
  2594. var array;
  2595. return smalltalk.withContext(function($ctx1) {
  2596. array=self._collection();
  2597. _st(array)._add_((6));
  2598. self._assert_equals_(_st(array)._last(),(6));
  2599. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  2600. args: [],
  2601. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  2602. messageSends: ["collection", "add:", "assert:equals:", "last"],
  2603. referencedClasses: []
  2604. }),
  2605. smalltalk.ArrayTest);
  2606. smalltalk.addMethod(
  2607. smalltalk.method({
  2608. selector: "testAddFirst",
  2609. category: 'tests',
  2610. fn: function (){
  2611. var self=this;
  2612. return smalltalk.withContext(function($ctx1) {
  2613. var $1,$2;
  2614. $1=self._collection();
  2615. _st($1)._addFirst_((0));
  2616. $2=_st($1)._yourself();
  2617. self._assert_equals_(_st($2)._first(),(0));
  2618. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2619. args: [],
  2620. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  2621. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  2622. referencedClasses: []
  2623. }),
  2624. smalltalk.ArrayTest);
  2625. smalltalk.addMethod(
  2626. smalltalk.method({
  2627. selector: "testAtIfAbsent",
  2628. category: 'tests',
  2629. fn: function (){
  2630. var self=this;
  2631. var array;
  2632. return smalltalk.withContext(function($ctx1) {
  2633. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  2634. array=["hello", "world"];
  2635. $2=_st(array)._at_((1));
  2636. $ctx1.sendIdx["at:"]=1;
  2637. $1=self._assert_equals_($2,"hello");
  2638. $ctx1.sendIdx["assert:equals:"]=1;
  2639. $4=_st(array)._at_((2));
  2640. $3=self._assert_equals_($4,"world");
  2641. $ctx1.sendIdx["assert:equals:"]=2;
  2642. $6=_st(array)._at_ifAbsent_((2),(function(){
  2643. return smalltalk.withContext(function($ctx2) {
  2644. return "not found";
  2645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2646. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2647. $5=self._assert_equals_($6,"world");
  2648. $ctx1.sendIdx["assert:equals:"]=3;
  2649. $8=_st(array)._at_ifAbsent_((0),(function(){
  2650. return smalltalk.withContext(function($ctx2) {
  2651. return "not found";
  2652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2653. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2654. $7=self._assert_equals_($8,"not found");
  2655. $ctx1.sendIdx["assert:equals:"]=4;
  2656. $10=_st(array)._at_ifAbsent_((-10),(function(){
  2657. return smalltalk.withContext(function($ctx2) {
  2658. return "not found";
  2659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2660. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2661. $9=self._assert_equals_($10,"not found");
  2662. $ctx1.sendIdx["assert:equals:"]=5;
  2663. $12=_st(array)._at_ifAbsent_((3),(function(){
  2664. return smalltalk.withContext(function($ctx2) {
  2665. return "not found";
  2666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2667. $11=self._assert_equals_($12,"not found");
  2668. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2669. args: [],
  2670. 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'.",
  2671. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2672. referencedClasses: []
  2673. }),
  2674. smalltalk.ArrayTest);
  2675. smalltalk.addMethod(
  2676. smalltalk.method({
  2677. selector: "testFirstN",
  2678. category: 'tests',
  2679. fn: function (){
  2680. var self=this;
  2681. return smalltalk.withContext(function($ctx1) {
  2682. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2683. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2684. args: [],
  2685. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2686. messageSends: ["assert:equals:", "first:"],
  2687. referencedClasses: []
  2688. }),
  2689. smalltalk.ArrayTest);
  2690. smalltalk.addMethod(
  2691. smalltalk.method({
  2692. selector: "testIfEmpty",
  2693. category: 'tests',
  2694. fn: function (){
  2695. var self=this;
  2696. return smalltalk.withContext(function($ctx1) {
  2697. self._assert_equals_(""._ifEmpty_((function(){
  2698. return smalltalk.withContext(function($ctx2) {
  2699. return "zork";
  2700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2701. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2702. args: [],
  2703. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  2704. messageSends: ["assert:equals:", "ifEmpty:"],
  2705. referencedClasses: []
  2706. }),
  2707. smalltalk.ArrayTest);
  2708. smalltalk.addMethod(
  2709. smalltalk.method({
  2710. selector: "testPrintString",
  2711. category: 'tests',
  2712. fn: function (){
  2713. var self=this;
  2714. var array;
  2715. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2716. return smalltalk.withContext(function($ctx1) {
  2717. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10,$11,$13,$12,$14,$16,$15,$17,$19,$18;
  2718. array=_st($Array())._new();
  2719. $2=_st(array)._printString();
  2720. $ctx1.sendIdx["printString"]=1;
  2721. $1=self._assert_equals_($2,"an Array ()");
  2722. $ctx1.sendIdx["assert:equals:"]=1;
  2723. $3=array;
  2724. _st($3)._add_((1));
  2725. $ctx1.sendIdx["add:"]=1;
  2726. $4=_st($3)._add_((3));
  2727. $ctx1.sendIdx["add:"]=2;
  2728. $6=_st(array)._printString();
  2729. $ctx1.sendIdx["printString"]=2;
  2730. $5=self._assert_equals_($6,"an Array (1 3)");
  2731. $ctx1.sendIdx["assert:equals:"]=2;
  2732. $7=_st(array)._add_("foo");
  2733. $9=_st(array)._printString();
  2734. $ctx1.sendIdx["printString"]=3;
  2735. $8=self._assert_equals_($9,"an Array (1 3 'foo')");
  2736. $ctx1.sendIdx["assert:equals:"]=3;
  2737. $10=array;
  2738. _st($10)._remove_((1));
  2739. $ctx1.sendIdx["remove:"]=1;
  2740. $11=_st($10)._remove_((3));
  2741. $13=_st(array)._printString();
  2742. $ctx1.sendIdx["printString"]=4;
  2743. $12=self._assert_equals_($13,"an Array ('foo')");
  2744. $ctx1.sendIdx["assert:equals:"]=4;
  2745. $14=_st(array)._addLast_((3));
  2746. $ctx1.sendIdx["addLast:"]=1;
  2747. $16=_st(array)._printString();
  2748. $ctx1.sendIdx["printString"]=5;
  2749. $15=self._assert_equals_($16,"an Array ('foo' 3)");
  2750. $ctx1.sendIdx["assert:equals:"]=5;
  2751. $17=_st(array)._addLast_((3));
  2752. $19=_st(array)._printString();
  2753. $18=self._assert_equals_($19,"an Array ('foo' 3 3)");
  2754. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  2755. args: [],
  2756. 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)'.",
  2757. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  2758. referencedClasses: ["Array"]
  2759. }),
  2760. smalltalk.ArrayTest);
  2761. smalltalk.addMethod(
  2762. smalltalk.method({
  2763. selector: "testRemove",
  2764. category: 'tests',
  2765. fn: function (){
  2766. var self=this;
  2767. var array;
  2768. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2769. return smalltalk.withContext(function($ctx1) {
  2770. var $1;
  2771. array=[(1), (2), (3), (4), (5)];
  2772. $1=_st(array)._remove_((3));
  2773. $ctx1.sendIdx["remove:"]=1;
  2774. self._assert_equals_(array,[(1), (2), (4), (5)]);
  2775. self._should_raise_((function(){
  2776. return smalltalk.withContext(function($ctx2) {
  2777. return _st(array)._remove_((3));
  2778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2779. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  2780. args: [],
  2781. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  2782. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  2783. referencedClasses: ["Error"]
  2784. }),
  2785. smalltalk.ArrayTest);
  2786. smalltalk.addMethod(
  2787. smalltalk.method({
  2788. selector: "testRemoveFromTo",
  2789. category: 'tests',
  2790. fn: function (){
  2791. var self=this;
  2792. return smalltalk.withContext(function($ctx1) {
  2793. var $2,$1,$4,$3,$6,$5;
  2794. $2=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  2795. $ctx1.sendIdx["removeFrom:to:"]=1;
  2796. $1=self._assert_equals_($2,[(4)]);
  2797. $ctx1.sendIdx["assert:equals:"]=1;
  2798. $4=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  2799. $ctx1.sendIdx["removeFrom:to:"]=2;
  2800. $3=self._assert_equals_($4,[(1), (4)]);
  2801. $ctx1.sendIdx["assert:equals:"]=2;
  2802. $6=[(1), (2), (3), (4)]._removeFrom_to_((2),(4));
  2803. $5=self._assert_equals_($6,[(1)]);
  2804. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  2805. args: [],
  2806. 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)",
  2807. messageSends: ["assert:equals:", "removeFrom:to:"],
  2808. referencedClasses: []
  2809. }),
  2810. smalltalk.ArrayTest);
  2811. smalltalk.addMethod(
  2812. smalltalk.method({
  2813. selector: "testRemoveIndex",
  2814. category: 'tests',
  2815. fn: function (){
  2816. var self=this;
  2817. return smalltalk.withContext(function($ctx1) {
  2818. var $2,$1,$4,$3,$6,$5;
  2819. $2=[(1), (2), (3), (4)]._removeIndex_((2));
  2820. $ctx1.sendIdx["removeIndex:"]=1;
  2821. $1=self._assert_equals_($2,[(1), (3), (4)]);
  2822. $ctx1.sendIdx["assert:equals:"]=1;
  2823. $4=[(1), (2), (3), (4)]._removeIndex_((1));
  2824. $ctx1.sendIdx["removeIndex:"]=2;
  2825. $3=self._assert_equals_($4,[(2), (3), (4)]);
  2826. $ctx1.sendIdx["assert:equals:"]=2;
  2827. $6=["hello"]._removeIndex_((1));
  2828. $5=self._assert_equals_($6,[]);
  2829. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2830. args: [],
  2831. 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: #()",
  2832. messageSends: ["assert:equals:", "removeIndex:"],
  2833. referencedClasses: []
  2834. }),
  2835. smalltalk.ArrayTest);
  2836. smalltalk.addMethod(
  2837. smalltalk.method({
  2838. selector: "testRemoveLast",
  2839. category: 'tests',
  2840. fn: function (){
  2841. var self=this;
  2842. var array;
  2843. return smalltalk.withContext(function($ctx1) {
  2844. array=[(1), (2)];
  2845. _st(array)._removeLast();
  2846. self._assert_equals_(_st(array)._last(),(1));
  2847. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  2848. args: [],
  2849. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  2850. messageSends: ["removeLast", "assert:equals:", "last"],
  2851. referencedClasses: []
  2852. }),
  2853. smalltalk.ArrayTest);
  2854. smalltalk.addMethod(
  2855. smalltalk.method({
  2856. selector: "testReversed",
  2857. category: 'tests',
  2858. fn: function (){
  2859. var self=this;
  2860. var array;
  2861. return smalltalk.withContext(function($ctx1) {
  2862. array=[(5), (4), (3), (2), (1)];
  2863. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  2864. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  2865. args: [],
  2866. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  2867. messageSends: ["assert:equals:", "reversed"],
  2868. referencedClasses: []
  2869. }),
  2870. smalltalk.ArrayTest);
  2871. smalltalk.addMethod(
  2872. smalltalk.method({
  2873. selector: "testSort",
  2874. category: 'tests',
  2875. fn: function (){
  2876. var self=this;
  2877. var array;
  2878. return smalltalk.withContext(function($ctx1) {
  2879. array=[(3), (1), (4), (5), (2)];
  2880. _st(array)._sort();
  2881. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  2882. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  2883. args: [],
  2884. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  2885. messageSends: ["sort", "assert:equals:"],
  2886. referencedClasses: []
  2887. }),
  2888. smalltalk.ArrayTest);
  2889. smalltalk.addMethod(
  2890. smalltalk.method({
  2891. selector: "collectionClass",
  2892. category: 'accessing',
  2893. fn: function (){
  2894. var self=this;
  2895. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2896. return smalltalk.withContext(function($ctx1) {
  2897. var $1;
  2898. $1=$Array();
  2899. return $1;
  2900. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2901. args: [],
  2902. source: "collectionClass\x0a\x09^ Array",
  2903. messageSends: [],
  2904. referencedClasses: ["Array"]
  2905. }),
  2906. smalltalk.ArrayTest.klass);
  2907. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2908. smalltalk.addMethod(
  2909. smalltalk.method({
  2910. selector: "collection",
  2911. category: 'accessing',
  2912. fn: function (){
  2913. var self=this;
  2914. return smalltalk.withContext(function($ctx1) {
  2915. return "hello";
  2916. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2917. args: [],
  2918. source: "collection\x0a\x09^'hello'",
  2919. messageSends: [],
  2920. referencedClasses: []
  2921. }),
  2922. smalltalk.StringTest);
  2923. smalltalk.addMethod(
  2924. smalltalk.method({
  2925. selector: "collectionWithDuplicates",
  2926. category: 'accessing',
  2927. fn: function (){
  2928. var self=this;
  2929. return smalltalk.withContext(function($ctx1) {
  2930. return "abbaerte";
  2931. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2932. args: [],
  2933. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2934. messageSends: [],
  2935. referencedClasses: []
  2936. }),
  2937. smalltalk.StringTest);
  2938. smalltalk.addMethod(
  2939. smalltalk.method({
  2940. selector: "testAddRemove",
  2941. category: 'tests',
  2942. fn: function (){
  2943. var self=this;
  2944. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2945. return smalltalk.withContext(function($ctx1) {
  2946. var $1,$2;
  2947. $1=self._should_raise_((function(){
  2948. return smalltalk.withContext(function($ctx2) {
  2949. return "hello"._add_("a");
  2950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2951. $ctx1.sendIdx["should:raise:"]=1;
  2952. $2=self._should_raise_((function(){
  2953. return smalltalk.withContext(function($ctx2) {
  2954. return "hello"._remove_("h");
  2955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2956. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2957. args: [],
  2958. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2959. messageSends: ["should:raise:", "add:", "remove:"],
  2960. referencedClasses: ["Error"]
  2961. }),
  2962. smalltalk.StringTest);
  2963. smalltalk.addMethod(
  2964. smalltalk.method({
  2965. selector: "testAsArray",
  2966. category: 'tests',
  2967. fn: function (){
  2968. var self=this;
  2969. return smalltalk.withContext(function($ctx1) {
  2970. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2971. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2972. args: [],
  2973. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2974. messageSends: ["assert:equals:", "asArray"],
  2975. referencedClasses: []
  2976. }),
  2977. smalltalk.StringTest);
  2978. smalltalk.addMethod(
  2979. smalltalk.method({
  2980. selector: "testAsLowerCase",
  2981. category: 'tests',
  2982. fn: function (){
  2983. var self=this;
  2984. return smalltalk.withContext(function($ctx1) {
  2985. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  2986. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  2987. args: [],
  2988. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  2989. messageSends: ["assert:equals:", "asLowercase"],
  2990. referencedClasses: []
  2991. }),
  2992. smalltalk.StringTest);
  2993. smalltalk.addMethod(
  2994. smalltalk.method({
  2995. selector: "testAsNumber",
  2996. category: 'tests',
  2997. fn: function (){
  2998. var self=this;
  2999. return smalltalk.withContext(function($ctx1) {
  3000. var $2,$1,$4,$3,$6,$5;
  3001. $2="3"._asNumber();
  3002. $ctx1.sendIdx["asNumber"]=1;
  3003. $1=self._assert_equals_($2,(3));
  3004. $ctx1.sendIdx["assert:equals:"]=1;
  3005. $4="-3"._asNumber();
  3006. $ctx1.sendIdx["asNumber"]=2;
  3007. $3=self._assert_equals_($4,(-3));
  3008. $ctx1.sendIdx["assert:equals:"]=2;
  3009. $6="-1.5"._asNumber();
  3010. $5=self._assert_equals_($6,(-1.5));
  3011. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  3012. args: [],
  3013. 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.",
  3014. messageSends: ["assert:equals:", "asNumber"],
  3015. referencedClasses: []
  3016. }),
  3017. smalltalk.StringTest);
  3018. smalltalk.addMethod(
  3019. smalltalk.method({
  3020. selector: "testAsUpperCase",
  3021. category: 'tests',
  3022. fn: function (){
  3023. var self=this;
  3024. return smalltalk.withContext(function($ctx1) {
  3025. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3026. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3027. args: [],
  3028. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3029. messageSends: ["assert:equals:", "asUppercase"],
  3030. referencedClasses: []
  3031. }),
  3032. smalltalk.StringTest);
  3033. smalltalk.addMethod(
  3034. smalltalk.method({
  3035. selector: "testAsciiValue",
  3036. category: 'tests',
  3037. fn: function (){
  3038. var self=this;
  3039. var characterA,characterU;
  3040. return smalltalk.withContext(function($ctx1) {
  3041. var $2,$1,$4,$3;
  3042. characterA="A";
  3043. characterU="U";
  3044. $2=_st(characterA)._asciiValue();
  3045. $ctx1.sendIdx["asciiValue"]=1;
  3046. $1=self._assert_equals_($2,(65));
  3047. $ctx1.sendIdx["assert:equals:"]=1;
  3048. $4=_st(characterU)._asciiValue();
  3049. $3=self._assert_equals_($4,(85));
  3050. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3051. args: [],
  3052. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  3053. messageSends: ["assert:equals:", "asciiValue"],
  3054. referencedClasses: []
  3055. }),
  3056. smalltalk.StringTest);
  3057. smalltalk.addMethod(
  3058. smalltalk.method({
  3059. selector: "testAt",
  3060. category: 'tests',
  3061. fn: function (){
  3062. var self=this;
  3063. return smalltalk.withContext(function($ctx1) {
  3064. var $2,$1,$4,$3,$5;
  3065. $2="hello"._at_((1));
  3066. $ctx1.sendIdx["at:"]=1;
  3067. $1=self._assert_equals_($2,"h");
  3068. $ctx1.sendIdx["assert:equals:"]=1;
  3069. $4="hello"._at_((5));
  3070. $3=self._assert_equals_($4,"o");
  3071. $ctx1.sendIdx["assert:equals:"]=2;
  3072. $5=self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  3073. return smalltalk.withContext(function($ctx2) {
  3074. return nil;
  3075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  3076. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  3077. args: [],
  3078. 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",
  3079. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  3080. referencedClasses: []
  3081. }),
  3082. smalltalk.StringTest);
  3083. smalltalk.addMethod(
  3084. smalltalk.method({
  3085. selector: "testAtPut",
  3086. category: 'tests',
  3087. fn: function (){
  3088. var self=this;
  3089. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3090. return smalltalk.withContext(function($ctx1) {
  3091. self._should_raise_((function(){
  3092. return smalltalk.withContext(function($ctx2) {
  3093. return "hello"._at_put_((1),"a");
  3094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3095. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3096. args: [],
  3097. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  3098. messageSends: ["should:raise:", "at:put:"],
  3099. referencedClasses: ["Error"]
  3100. }),
  3101. smalltalk.StringTest);
  3102. smalltalk.addMethod(
  3103. smalltalk.method({
  3104. selector: "testCapitalized",
  3105. category: 'tests',
  3106. fn: function (){
  3107. var self=this;
  3108. return smalltalk.withContext(function($ctx1) {
  3109. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9;
  3110. $2="test"._capitalized();
  3111. $ctx1.sendIdx["capitalized"]=1;
  3112. $1=self._assert_equals_($2,"Test");
  3113. $ctx1.sendIdx["assert:equals:"]=1;
  3114. $4="Test"._capitalized();
  3115. $ctx1.sendIdx["capitalized"]=2;
  3116. $3=self._assert_equals_($4,"Test");
  3117. $ctx1.sendIdx["assert:equals:"]=2;
  3118. $6=""._capitalized();
  3119. $5=self._assert_equals_($6,"");
  3120. $ctx1.sendIdx["assert:equals:"]=3;
  3121. $8="Test"._isCapitalized();
  3122. $ctx1.sendIdx["isCapitalized"]=1;
  3123. $7=self._assert_equals_($8,true);
  3124. $ctx1.sendIdx["assert:equals:"]=4;
  3125. $10="test"._isCapitalized();
  3126. $9=self._assert_equals_($10,false);
  3127. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3128. args: [],
  3129. 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.",
  3130. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3131. referencedClasses: []
  3132. }),
  3133. smalltalk.StringTest);
  3134. smalltalk.addMethod(
  3135. smalltalk.method({
  3136. selector: "testCharCodeAt",
  3137. category: 'tests',
  3138. fn: function (){
  3139. var self=this;
  3140. return smalltalk.withContext(function($ctx1) {
  3141. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  3142. $2="jackie"._charCodeAt_((1));
  3143. $ctx1.sendIdx["charCodeAt:"]=1;
  3144. $1=self._assert_equals_($2,(106));
  3145. $ctx1.sendIdx["assert:equals:"]=1;
  3146. $4="jackie"._charCodeAt_((2));
  3147. $ctx1.sendIdx["charCodeAt:"]=2;
  3148. $3=self._assert_equals_($4,(97));
  3149. $ctx1.sendIdx["assert:equals:"]=2;
  3150. $6="jackie"._charCodeAt_((3));
  3151. $ctx1.sendIdx["charCodeAt:"]=3;
  3152. $5=self._assert_equals_($6,(99));
  3153. $ctx1.sendIdx["assert:equals:"]=3;
  3154. $8="jackie"._charCodeAt_((4));
  3155. $ctx1.sendIdx["charCodeAt:"]=4;
  3156. $7=self._assert_equals_($8,(107));
  3157. $ctx1.sendIdx["assert:equals:"]=4;
  3158. $10="jackie"._charCodeAt_((5));
  3159. $ctx1.sendIdx["charCodeAt:"]=5;
  3160. $9=self._assert_equals_($10,(105));
  3161. $ctx1.sendIdx["assert:equals:"]=5;
  3162. $12="jackie"._charCodeAt_((6));
  3163. $11=self._assert_equals_($12,(101));
  3164. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3165. args: [],
  3166. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  3167. messageSends: ["assert:equals:", "charCodeAt:"],
  3168. referencedClasses: []
  3169. }),
  3170. smalltalk.StringTest);
  3171. smalltalk.addMethod(
  3172. smalltalk.method({
  3173. selector: "testCollect",
  3174. category: 'tests',
  3175. fn: function (){
  3176. var self=this;
  3177. var newCollection;
  3178. return smalltalk.withContext(function($ctx1) {
  3179. newCollection="hheelllloo";
  3180. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3181. return smalltalk.withContext(function($ctx2) {
  3182. return _st(each).__comma(each);
  3183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3184. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3185. args: [],
  3186. 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",
  3187. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3188. referencedClasses: []
  3189. }),
  3190. smalltalk.StringTest);
  3191. smalltalk.addMethod(
  3192. smalltalk.method({
  3193. selector: "testCopyFromTo",
  3194. category: 'tests',
  3195. fn: function (){
  3196. var self=this;
  3197. return smalltalk.withContext(function($ctx1) {
  3198. self._assert_equals_("jackie"._copyFrom_to_((1),(3)),"jac");
  3199. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3200. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3201. args: [],
  3202. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3203. messageSends: ["assert:equals:", "copyFrom:to:"],
  3204. referencedClasses: []
  3205. }),
  3206. smalltalk.StringTest);
  3207. smalltalk.addMethod(
  3208. smalltalk.method({
  3209. selector: "testCopyWithoutAll",
  3210. category: 'tests',
  3211. fn: function (){
  3212. var self=this;
  3213. return smalltalk.withContext(function($ctx1) {
  3214. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3215. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3216. args: [],
  3217. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3218. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3219. referencedClasses: []
  3220. }),
  3221. smalltalk.StringTest);
  3222. smalltalk.addMethod(
  3223. smalltalk.method({
  3224. selector: "testDetect",
  3225. category: 'tests',
  3226. fn: function (){
  3227. var self=this;
  3228. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3229. return smalltalk.withContext(function($ctx1) {
  3230. var $2,$1,$3;
  3231. $2=self._collection();
  3232. $ctx1.sendIdx["collection"]=1;
  3233. $1=_st($2)._detect_((function(each){
  3234. return smalltalk.withContext(function($ctx2) {
  3235. return _st(each).__eq("h");
  3236. $ctx2.sendIdx["="]=1;
  3237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3238. $ctx1.sendIdx["detect:"]=1;
  3239. self._assert_equals_($1,"h");
  3240. self._should_raise_((function(){
  3241. return smalltalk.withContext(function($ctx2) {
  3242. $3=self._collection();
  3243. return _st($3)._detect_((function(each){
  3244. return smalltalk.withContext(function($ctx3) {
  3245. return _st(each).__eq((6));
  3246. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3248. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3249. args: [],
  3250. 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",
  3251. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3252. referencedClasses: ["Error"]
  3253. }),
  3254. smalltalk.StringTest);
  3255. smalltalk.addMethod(
  3256. smalltalk.method({
  3257. selector: "testEquality",
  3258. category: 'tests',
  3259. fn: function (){
  3260. var self=this;
  3261. return smalltalk.withContext(function($ctx1) {
  3262. var $1,$3,$2,$5,$4,$7,$6,$9,$8,$11,$10;
  3263. $1=self._assert_equals_("hello","hello");
  3264. $ctx1.sendIdx["assert:equals:"]=1;
  3265. $3="hello".__eq("world");
  3266. $ctx1.sendIdx["="]=1;
  3267. $2=self._deny_($3);
  3268. $ctx1.sendIdx["deny:"]=1;
  3269. $5="hello".__eq([]._at_ifAbsent_((1),(function(){
  3270. return smalltalk.withContext(function($ctx2) {
  3271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3272. $ctx1.sendIdx["="]=2;
  3273. $4=self._deny_($5);
  3274. $ctx1.sendIdx["deny:"]=2;
  3275. $7="hello"._yourself();
  3276. $ctx1.sendIdx["yourself"]=1;
  3277. $6=self._assert_equals_("hello",$7);
  3278. $ctx1.sendIdx["assert:equals:"]=2;
  3279. $9="hello"._yourself();
  3280. $8=self._assert_equals_($9,"hello");
  3281. $11="".__eq((0));
  3282. $10=self._deny_($11);
  3283. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3284. args: [],
  3285. 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",
  3286. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3287. referencedClasses: []
  3288. }),
  3289. smalltalk.StringTest);
  3290. smalltalk.addMethod(
  3291. smalltalk.method({
  3292. selector: "testIdentity",
  3293. category: 'tests',
  3294. fn: function (){
  3295. var self=this;
  3296. return smalltalk.withContext(function($ctx1) {
  3297. var $2,$1,$4,$3,$7,$6,$5,$10,$9,$8,$12,$11;
  3298. $2="hello".__eq_eq("hello");
  3299. $ctx1.sendIdx["=="]=1;
  3300. $1=self._assert_($2);
  3301. $ctx1.sendIdx["assert:"]=1;
  3302. $4="hello".__eq_eq("world");
  3303. $ctx1.sendIdx["=="]=2;
  3304. $3=self._deny_($4);
  3305. $ctx1.sendIdx["deny:"]=1;
  3306. $7="hello"._yourself();
  3307. $ctx1.sendIdx["yourself"]=1;
  3308. $6="hello".__eq_eq($7);
  3309. $ctx1.sendIdx["=="]=3;
  3310. $5=self._assert_($6);
  3311. $ctx1.sendIdx["assert:"]=2;
  3312. $10="hello"._yourself();
  3313. $9=_st($10).__eq_eq("hello");
  3314. $ctx1.sendIdx["=="]=4;
  3315. $8=self._assert_($9);
  3316. $12="".__eq_eq((0));
  3317. $11=self._deny_($12);
  3318. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3319. args: [],
  3320. 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",
  3321. messageSends: ["assert:", "==", "deny:", "yourself"],
  3322. referencedClasses: []
  3323. }),
  3324. smalltalk.StringTest);
  3325. smalltalk.addMethod(
  3326. smalltalk.method({
  3327. selector: "testIdentityHash",
  3328. category: 'tests',
  3329. fn: function (){
  3330. var self=this;
  3331. return smalltalk.withContext(function($ctx1) {
  3332. var $1,$2,$4,$5,$3;
  3333. $1="foo"._identityHash();
  3334. $ctx1.sendIdx["identityHash"]=1;
  3335. $2="foo"._identityHash();
  3336. $ctx1.sendIdx["identityHash"]=2;
  3337. self._assert_equals_($1,$2);
  3338. $4="foo"._identityHash();
  3339. $ctx1.sendIdx["identityHash"]=3;
  3340. $5="bar"._identityHash();
  3341. $3=_st($4).__eq($5);
  3342. self._deny_($3);
  3343. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3344. args: [],
  3345. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3346. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3347. referencedClasses: []
  3348. }),
  3349. smalltalk.StringTest);
  3350. smalltalk.addMethod(
  3351. smalltalk.method({
  3352. selector: "testIncludesSubString",
  3353. category: 'tests',
  3354. fn: function (){
  3355. var self=this;
  3356. return smalltalk.withContext(function($ctx1) {
  3357. var $1,$2;
  3358. $1="amber"._includesSubString_("ber");
  3359. $ctx1.sendIdx["includesSubString:"]=1;
  3360. self._assert_($1);
  3361. $2="amber"._includesSubString_("zork");
  3362. self._deny_($2);
  3363. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3364. args: [],
  3365. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3366. messageSends: ["assert:", "includesSubString:", "deny:"],
  3367. referencedClasses: []
  3368. }),
  3369. smalltalk.StringTest);
  3370. smalltalk.addMethod(
  3371. smalltalk.method({
  3372. selector: "testIndexOf",
  3373. category: 'tests',
  3374. fn: function (){
  3375. var self=this;
  3376. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3377. return smalltalk.withContext(function($ctx1) {
  3378. var $3,$2,$1,$4,$7,$6,$5;
  3379. $3=self._collection();
  3380. $ctx1.sendIdx["collection"]=1;
  3381. $2=_st($3)._indexOf_("e");
  3382. $ctx1.sendIdx["indexOf:"]=1;
  3383. $1=self._assert_equals_($2,(2));
  3384. $ctx1.sendIdx["assert:equals:"]=1;
  3385. self._should_raise_((function(){
  3386. return smalltalk.withContext(function($ctx2) {
  3387. $4=self._collection();
  3388. $ctx2.sendIdx["collection"]=2;
  3389. return _st($4)._indexOf_((999));
  3390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3391. $7=self._collection();
  3392. $6=_st($7)._indexOf_ifAbsent_((999),(function(){
  3393. return smalltalk.withContext(function($ctx2) {
  3394. return "sentinel";
  3395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3396. $5=self._assert_equals_($6,"sentinel");
  3397. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3398. args: [],
  3399. 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'",
  3400. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3401. referencedClasses: ["Error"]
  3402. }),
  3403. smalltalk.StringTest);
  3404. smalltalk.addMethod(
  3405. smalltalk.method({
  3406. selector: "testIsVowel",
  3407. category: 'tests',
  3408. fn: function (){
  3409. var self=this;
  3410. var vowel,consonant;
  3411. return smalltalk.withContext(function($ctx1) {
  3412. vowel="u";
  3413. consonant="z";
  3414. self._assert_equals_(_st(vowel)._isVowel(),true);
  3415. self._assert_equals_(_st(consonant)._isVowel(),false);
  3416. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3417. args: [],
  3418. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  3419. messageSends: ["assert:equals:", "isVowel"],
  3420. referencedClasses: []
  3421. }),
  3422. smalltalk.StringTest);
  3423. smalltalk.addMethod(
  3424. smalltalk.method({
  3425. selector: "testJoin",
  3426. category: 'tests',
  3427. fn: function (){
  3428. var self=this;
  3429. return smalltalk.withContext(function($ctx1) {
  3430. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3431. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3432. args: [],
  3433. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3434. messageSends: ["assert:equals:", "join:"],
  3435. referencedClasses: []
  3436. }),
  3437. smalltalk.StringTest);
  3438. smalltalk.addMethod(
  3439. smalltalk.method({
  3440. selector: "testReversed",
  3441. category: 'tests',
  3442. fn: function (){
  3443. var self=this;
  3444. return smalltalk.withContext(function($ctx1) {
  3445. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3446. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3447. args: [],
  3448. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3449. messageSends: ["assert:equals:", "reversed"],
  3450. referencedClasses: []
  3451. }),
  3452. smalltalk.StringTest);
  3453. smalltalk.addMethod(
  3454. smalltalk.method({
  3455. selector: "testSelect",
  3456. category: 'tests',
  3457. fn: function (){
  3458. var self=this;
  3459. var newCollection;
  3460. return smalltalk.withContext(function($ctx1) {
  3461. newCollection="o";
  3462. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3463. return smalltalk.withContext(function($ctx2) {
  3464. return _st(each).__eq("o");
  3465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3466. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3467. args: [],
  3468. 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",
  3469. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3470. referencedClasses: []
  3471. }),
  3472. smalltalk.StringTest);
  3473. smalltalk.addMethod(
  3474. smalltalk.method({
  3475. selector: "testSize",
  3476. category: 'tests',
  3477. fn: function (){
  3478. var self=this;
  3479. return smalltalk.withContext(function($ctx1) {
  3480. var $2,$1,$4,$3;
  3481. $2="smalltalk"._size();
  3482. $ctx1.sendIdx["size"]=1;
  3483. $1=self._assert_equals_($2,(9));
  3484. $ctx1.sendIdx["assert:equals:"]=1;
  3485. $4=""._size();
  3486. $3=self._assert_equals_($4,(0));
  3487. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3488. args: [],
  3489. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3490. messageSends: ["assert:equals:", "size"],
  3491. referencedClasses: []
  3492. }),
  3493. smalltalk.StringTest);
  3494. smalltalk.addMethod(
  3495. smalltalk.method({
  3496. selector: "testStreamContents",
  3497. category: 'tests',
  3498. fn: function (){
  3499. var self=this;
  3500. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3501. return smalltalk.withContext(function($ctx1) {
  3502. var $1,$2;
  3503. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3504. return smalltalk.withContext(function($ctx2) {
  3505. $1=aStream;
  3506. _st($1)._nextPutAll_("hello");
  3507. $ctx2.sendIdx["nextPutAll:"]=1;
  3508. _st($1)._space();
  3509. $2=_st($1)._nextPutAll_("world");
  3510. return $2;
  3511. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3512. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3513. args: [],
  3514. 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'",
  3515. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3516. referencedClasses: ["String"]
  3517. }),
  3518. smalltalk.StringTest);
  3519. smalltalk.addMethod(
  3520. smalltalk.method({
  3521. selector: "testSubStrings",
  3522. category: 'tests',
  3523. fn: function (){
  3524. var self=this;
  3525. return smalltalk.withContext(function($ctx1) {
  3526. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3527. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3528. args: [],
  3529. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3530. messageSends: ["assert:equals:", "subStrings:"],
  3531. referencedClasses: []
  3532. }),
  3533. smalltalk.StringTest);
  3534. smalltalk.addMethod(
  3535. smalltalk.method({
  3536. selector: "testTrim",
  3537. category: 'tests',
  3538. fn: function (){
  3539. var self=this;
  3540. return smalltalk.withContext(function($ctx1) {
  3541. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3542. self._assert_equals_("jackie "._trimRight(),"jackie");
  3543. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3544. args: [],
  3545. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3546. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3547. referencedClasses: []
  3548. }),
  3549. smalltalk.StringTest);
  3550. smalltalk.addMethod(
  3551. smalltalk.method({
  3552. selector: "collectionClass",
  3553. category: 'accessing',
  3554. fn: function (){
  3555. var self=this;
  3556. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3557. return smalltalk.withContext(function($ctx1) {
  3558. var $1;
  3559. $1=$String();
  3560. return $1;
  3561. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3562. args: [],
  3563. source: "collectionClass\x0a\x09^ String",
  3564. messageSends: [],
  3565. referencedClasses: ["String"]
  3566. }),
  3567. smalltalk.StringTest.klass);
  3568. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3569. smalltalk.addMethod(
  3570. smalltalk.method({
  3571. selector: "testShow",
  3572. category: 'tests',
  3573. fn: function (){
  3574. var self=this;
  3575. var originalTranscript;
  3576. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3577. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3578. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3579. return smalltalk.withContext(function($ctx1) {
  3580. var $1,$2,$3,$4;
  3581. originalTranscript=_st($Transcript())._current();
  3582. $1=_st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3583. $ctx1.sendIdx["register:"]=1;
  3584. $2=self._shouldnt_raise_((function(){
  3585. return smalltalk.withContext(function($ctx2) {
  3586. return _st($Transcript())._show_("Hello console!");
  3587. $ctx2.sendIdx["show:"]=1;
  3588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3589. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3590. $3=self._shouldnt_raise_((function(){
  3591. return smalltalk.withContext(function($ctx2) {
  3592. return _st($Transcript())._show_(console);
  3593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3594. $4=_st($Transcript())._register_(originalTranscript);
  3595. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3596. args: [],
  3597. 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.",
  3598. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3599. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3600. }),
  3601. smalltalk.ConsoleTranscriptTest);
  3602. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3603. smalltalk.addMethod(
  3604. smalltalk.method({
  3605. selector: "jsObject",
  3606. category: 'accessing',
  3607. fn: function (){
  3608. var self=this;
  3609. return smalltalk.withContext(function($ctx1) {
  3610. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3611. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3612. args: [],
  3613. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3614. messageSends: [],
  3615. referencedClasses: []
  3616. }),
  3617. smalltalk.JSObjectProxyTest);
  3618. smalltalk.addMethod(
  3619. smalltalk.method({
  3620. selector: "testAtIfAbsent",
  3621. category: 'tests',
  3622. fn: function (){
  3623. var self=this;
  3624. var testObject;
  3625. return smalltalk.withContext(function($ctx1) {
  3626. var $2,$1,$4,$3,$6,$5,$8,$7;
  3627. testObject=self._jsObject();
  3628. $2=_st(testObject)._at_ifAbsent_("abc",(function(){
  3629. return smalltalk.withContext(function($ctx2) {
  3630. return "Property does not exist";
  3631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3632. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3633. $1=self._assert_equals_($2,"Property does not exist");
  3634. $ctx1.sendIdx["assert:equals:"]=1;
  3635. $4=_st(testObject)._at_ifAbsent_("e",(function(){
  3636. return smalltalk.withContext(function($ctx2) {
  3637. return "Property does not exist";
  3638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3639. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3640. $3=self._assert_equals_($4,nil);
  3641. $ctx1.sendIdx["assert:equals:"]=2;
  3642. $6=_st(testObject)._at_ifAbsent_("a",(function(){
  3643. return smalltalk.withContext(function($ctx2) {
  3644. return "Property does not exist";
  3645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3646. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3647. $5=self._assert_equals_($6,(1));
  3648. $ctx1.sendIdx["assert:equals:"]=3;
  3649. $8=_st(testObject)._at_ifAbsent_("f",(function(){
  3650. return smalltalk.withContext(function($ctx2) {
  3651. return "Property does not exist";
  3652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3653. $7=self._assert_equals_($8,nil);
  3654. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3655. args: [],
  3656. 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.",
  3657. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3658. referencedClasses: []
  3659. }),
  3660. smalltalk.JSObjectProxyTest);
  3661. smalltalk.addMethod(
  3662. smalltalk.method({
  3663. selector: "testAtIfPresent",
  3664. category: 'tests',
  3665. fn: function (){
  3666. var self=this;
  3667. var testObject;
  3668. return smalltalk.withContext(function($ctx1) {
  3669. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10;
  3670. testObject=self._jsObject();
  3671. $2=_st(testObject)._at_ifPresent_("abc",(function(x){
  3672. return smalltalk.withContext(function($ctx2) {
  3673. $3=_st(x)._asString();
  3674. $ctx2.sendIdx["asString"]=1;
  3675. return "hello ".__comma($3);
  3676. $ctx2.sendIdx[","]=1;
  3677. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3678. $ctx1.sendIdx["at:ifPresent:"]=1;
  3679. $1=self._assert_equals_($2,nil);
  3680. $ctx1.sendIdx["assert:equals:"]=1;
  3681. $5=_st(testObject)._at_ifPresent_("e",(function(x){
  3682. return smalltalk.withContext(function($ctx2) {
  3683. $6=_st(x)._asString();
  3684. $ctx2.sendIdx["asString"]=2;
  3685. return "hello ".__comma($6);
  3686. $ctx2.sendIdx[","]=2;
  3687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3688. $ctx1.sendIdx["at:ifPresent:"]=2;
  3689. $4=self._assert_equals_($5,"hello nil");
  3690. $ctx1.sendIdx["assert:equals:"]=2;
  3691. $8=_st(testObject)._at_ifPresent_("a",(function(x){
  3692. return smalltalk.withContext(function($ctx2) {
  3693. $9=_st(x)._asString();
  3694. $ctx2.sendIdx["asString"]=3;
  3695. return "hello ".__comma($9);
  3696. $ctx2.sendIdx[","]=3;
  3697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3698. $ctx1.sendIdx["at:ifPresent:"]=3;
  3699. $7=self._assert_equals_($8,"hello 1");
  3700. $ctx1.sendIdx["assert:equals:"]=3;
  3701. $11=_st(testObject)._at_ifPresent_("f",(function(x){
  3702. return smalltalk.withContext(function($ctx2) {
  3703. $12=_st(x)._asString();
  3704. return "hello ".__comma($12);
  3705. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})}));
  3706. $10=self._assert_equals_($11,"hello nil");
  3707. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3708. args: [],
  3709. 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'.",
  3710. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3711. referencedClasses: []
  3712. }),
  3713. smalltalk.JSObjectProxyTest);
  3714. smalltalk.addMethod(
  3715. smalltalk.method({
  3716. selector: "testAtIfPresentIfAbsent",
  3717. category: 'tests',
  3718. fn: function (){
  3719. var self=this;
  3720. var testObject;
  3721. return smalltalk.withContext(function($ctx1) {
  3722. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10;
  3723. testObject=self._jsObject();
  3724. $2=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  3725. return smalltalk.withContext(function($ctx2) {
  3726. $3=_st(x)._asString();
  3727. $ctx2.sendIdx["asString"]=1;
  3728. return "hello ".__comma($3);
  3729. $ctx2.sendIdx[","]=1;
  3730. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  3731. return smalltalk.withContext(function($ctx2) {
  3732. return "not present";
  3733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3734. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  3735. $1=self._assert_equals_($2,"not present");
  3736. $ctx1.sendIdx["assert:equals:"]=1;
  3737. $5=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  3738. return smalltalk.withContext(function($ctx2) {
  3739. $6=_st(x)._asString();
  3740. $ctx2.sendIdx["asString"]=2;
  3741. return "hello ".__comma($6);
  3742. $ctx2.sendIdx[","]=2;
  3743. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  3744. return smalltalk.withContext(function($ctx2) {
  3745. return "not present";
  3746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3747. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  3748. $4=self._assert_equals_($5,"hello nil");
  3749. $ctx1.sendIdx["assert:equals:"]=2;
  3750. $8=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  3751. return smalltalk.withContext(function($ctx2) {
  3752. $9=_st(x)._asString();
  3753. $ctx2.sendIdx["asString"]=3;
  3754. return "hello ".__comma($9);
  3755. $ctx2.sendIdx[","]=3;
  3756. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  3757. return smalltalk.withContext(function($ctx2) {
  3758. return "not present";
  3759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3760. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  3761. $7=self._assert_equals_($8,"hello 1");
  3762. $ctx1.sendIdx["assert:equals:"]=3;
  3763. $11=_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  3764. return smalltalk.withContext(function($ctx2) {
  3765. $12=_st(x)._asString();
  3766. return "hello ".__comma($12);
  3767. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  3768. return smalltalk.withContext(function($ctx2) {
  3769. return "not present";
  3770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  3771. $10=self._assert_equals_($11,"hello nil");
  3772. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3773. args: [],
  3774. 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'.",
  3775. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  3776. referencedClasses: []
  3777. }),
  3778. smalltalk.JSObjectProxyTest);
  3779. smalltalk.addMethod(
  3780. smalltalk.method({
  3781. selector: "testDNU",
  3782. category: 'tests',
  3783. fn: function (){
  3784. var self=this;
  3785. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3786. return smalltalk.withContext(function($ctx1) {
  3787. self._should_raise_((function(){
  3788. return smalltalk.withContext(function($ctx2) {
  3789. return _st(self._jsObject())._foo();
  3790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3791. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  3792. args: [],
  3793. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  3794. messageSends: ["should:raise:", "foo", "jsObject"],
  3795. referencedClasses: ["MessageNotUnderstood"]
  3796. }),
  3797. smalltalk.JSObjectProxyTest);
  3798. smalltalk.addMethod(
  3799. smalltalk.method({
  3800. selector: "testMessageSend",
  3801. category: 'tests',
  3802. fn: function (){
  3803. var self=this;
  3804. return smalltalk.withContext(function($ctx1) {
  3805. var $3,$2,$1,$6,$5,$4,$9,$8,$7;
  3806. $3=self._jsObject();
  3807. $ctx1.sendIdx["jsObject"]=1;
  3808. $2=_st($3)._a();
  3809. $1=self._assert_equals_($2,(1));
  3810. $ctx1.sendIdx["assert:equals:"]=1;
  3811. $6=self._jsObject();
  3812. $ctx1.sendIdx["jsObject"]=2;
  3813. $5=_st($6)._b();
  3814. $4=self._assert_equals_($5,(2));
  3815. $ctx1.sendIdx["assert:equals:"]=2;
  3816. $9=self._jsObject();
  3817. $8=_st($9)._c_((3));
  3818. $7=self._assert_equals_($8,(3));
  3819. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  3820. args: [],
  3821. 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",
  3822. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  3823. referencedClasses: []
  3824. }),
  3825. smalltalk.JSObjectProxyTest);
  3826. smalltalk.addMethod(
  3827. smalltalk.method({
  3828. selector: "testMethodWithArguments",
  3829. category: 'tests',
  3830. fn: function (){
  3831. var self=this;
  3832. return smalltalk.withContext(function($ctx1) {
  3833. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  3834. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  3835. args: [],
  3836. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  3837. messageSends: ["assert:equals:", "c:", "jsObject"],
  3838. referencedClasses: []
  3839. }),
  3840. smalltalk.JSObjectProxyTest);
  3841. smalltalk.addMethod(
  3842. smalltalk.method({
  3843. selector: "testPrinting",
  3844. category: 'tests',
  3845. fn: function (){
  3846. var self=this;
  3847. return smalltalk.withContext(function($ctx1) {
  3848. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  3849. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  3850. args: [],
  3851. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  3852. messageSends: ["assert:equals:", "printString", "jsObject"],
  3853. referencedClasses: []
  3854. }),
  3855. smalltalk.JSObjectProxyTest);
  3856. smalltalk.addMethod(
  3857. smalltalk.method({
  3858. selector: "testPropertyThatReturnsEmptyString",
  3859. category: 'tests',
  3860. fn: function (){
  3861. var self=this;
  3862. var object;
  3863. return smalltalk.withContext(function($ctx1) {
  3864. var $2,$1,$4,$3;
  3865. object=self._jsObject();
  3866. $2=_st(object)._d();
  3867. $ctx1.sendIdx["d"]=1;
  3868. $1=self._assert_equals_($2,"");
  3869. $ctx1.sendIdx["assert:equals:"]=1;
  3870. _st(object)._d_("hello");
  3871. $4=_st(object)._d();
  3872. $3=self._assert_equals_($4,"hello");
  3873. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  3874. args: [],
  3875. 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'",
  3876. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  3877. referencedClasses: []
  3878. }),
  3879. smalltalk.JSObjectProxyTest);
  3880. smalltalk.addMethod(
  3881. smalltalk.method({
  3882. selector: "testPropertyThatReturnsUndefined",
  3883. category: 'tests',
  3884. fn: function (){
  3885. var self=this;
  3886. var object;
  3887. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3888. return smalltalk.withContext(function($ctx1) {
  3889. var $2,$1;
  3890. object=self._jsObject();
  3891. self._shouldnt_raise_((function(){
  3892. return smalltalk.withContext(function($ctx2) {
  3893. return _st(object)._e();
  3894. $ctx2.sendIdx["e"]=1;
  3895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3896. $2=_st(object)._e();
  3897. $1=_st($2)._isNil();
  3898. self._assert_($1);
  3899. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  3900. args: [],
  3901. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  3902. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  3903. referencedClasses: ["MessageNotUnderstood"]
  3904. }),
  3905. smalltalk.JSObjectProxyTest);
  3906. smalltalk.addMethod(
  3907. smalltalk.method({
  3908. selector: "testValue",
  3909. category: 'tests',
  3910. fn: function (){
  3911. var self=this;
  3912. var testObject;
  3913. return smalltalk.withContext(function($ctx1) {
  3914. var $3,$2,$1,$5,$4;
  3915. testObject=self._jsObject();
  3916. $3=_st(testObject)._value();
  3917. $ctx1.sendIdx["value"]=1;
  3918. $2=_st($3)._printString();
  3919. $1=self._assert_equals_($2,"[object Object]");
  3920. $ctx1.sendIdx["assert:equals:"]=1;
  3921. _st(testObject)._at_put_("value","aValue");
  3922. $5=_st(testObject)._value();
  3923. $4=self._assert_equals_($5,"aValue");
  3924. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3925. args: [],
  3926. 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'",
  3927. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  3928. referencedClasses: []
  3929. }),
  3930. smalltalk.JSObjectProxyTest);
  3931. smalltalk.addMethod(
  3932. smalltalk.method({
  3933. selector: "testYourself",
  3934. category: 'tests',
  3935. fn: function (){
  3936. var self=this;
  3937. var object;
  3938. return smalltalk.withContext(function($ctx1) {
  3939. var $1,$2;
  3940. $1=self._jsObject();
  3941. _st($1)._d_("test");
  3942. $2=_st($1)._yourself();
  3943. object=$2;
  3944. self._assert_equals_(_st(object)._d(),"test");
  3945. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  3946. args: [],
  3947. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  3948. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  3949. referencedClasses: []
  3950. }),
  3951. smalltalk.JSObjectProxyTest);
  3952. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3953. smalltalk.addMethod(
  3954. smalltalk.method({
  3955. selector: "testCatchingException",
  3956. category: 'tests',
  3957. fn: function (){
  3958. var self=this;
  3959. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3960. return smalltalk.withContext(function($ctx1) {
  3961. _st((function(){
  3962. return smalltalk.withContext(function($ctx2) {
  3963. return self._throwException();
  3964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  3965. return smalltalk.withContext(function($ctx2) {
  3966. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  3967. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  3968. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  3969. args: [],
  3970. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  3971. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  3972. referencedClasses: ["Error"]
  3973. }),
  3974. smalltalk.JavaScriptExceptionTest);
  3975. smalltalk.addMethod(
  3976. smalltalk.method({
  3977. selector: "testRaisingException",
  3978. category: 'tests',
  3979. fn: function (){
  3980. var self=this;
  3981. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3982. return smalltalk.withContext(function($ctx1) {
  3983. self._should_raise_((function(){
  3984. return smalltalk.withContext(function($ctx2) {
  3985. return self._throwException();
  3986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  3987. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  3988. args: [],
  3989. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  3990. messageSends: ["should:raise:", "throwException"],
  3991. referencedClasses: ["JavaScriptException"]
  3992. }),
  3993. smalltalk.JavaScriptExceptionTest);
  3994. smalltalk.addMethod(
  3995. smalltalk.method({
  3996. selector: "throwException",
  3997. category: 'helpers',
  3998. fn: function (){
  3999. var self=this;
  4000. return smalltalk.withContext(function($ctx1) {
  4001. throw 'test';
  4002. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  4003. args: [],
  4004. source: "throwException\x0a\x09<throw 'test'>",
  4005. messageSends: [],
  4006. referencedClasses: []
  4007. }),
  4008. smalltalk.JavaScriptExceptionTest);
  4009. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4010. smalltalk.addMethod(
  4011. smalltalk.method({
  4012. selector: "testValue",
  4013. category: 'tests',
  4014. fn: function (){
  4015. var self=this;
  4016. var messageSend;
  4017. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4019. return smalltalk.withContext(function($ctx1) {
  4020. var $1,$2,$3,$4;
  4021. $1=_st($MessageSend())._new();
  4022. $ctx1.sendIdx["new"]=1;
  4023. $2=$1;
  4024. $3=_st($Object())._new();
  4025. _st($2)._receiver_($3);
  4026. _st($1)._selector_("asString");
  4027. $4=_st($1)._yourself();
  4028. messageSend=$4;
  4029. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4030. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4031. args: [],
  4032. 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'",
  4033. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4034. referencedClasses: ["MessageSend", "Object"]
  4035. }),
  4036. smalltalk.MessageSendTest);
  4037. smalltalk.addMethod(
  4038. smalltalk.method({
  4039. selector: "testValueWithArguments",
  4040. category: 'tests',
  4041. fn: function (){
  4042. var self=this;
  4043. var messageSend;
  4044. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4045. return smalltalk.withContext(function($ctx1) {
  4046. var $1,$2,$3,$4;
  4047. $1=_st($MessageSend())._new();
  4048. _st($1)._receiver_((2));
  4049. _st($1)._selector_("+");
  4050. $2=_st($1)._yourself();
  4051. messageSend=$2;
  4052. $3=self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4053. $ctx1.sendIdx["assert:equals:"]=1;
  4054. $4=self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4055. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4056. args: [],
  4057. 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",
  4058. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4059. referencedClasses: ["MessageSend"]
  4060. }),
  4061. smalltalk.MessageSendTest);
  4062. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4063. smalltalk.addMethod(
  4064. smalltalk.method({
  4065. selector: "codeGeneratorClass",
  4066. category: 'accessing',
  4067. fn: function (){
  4068. var self=this;
  4069. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4070. return smalltalk.withContext(function($ctx1) {
  4071. var $1;
  4072. $1=$CodeGenerator();
  4073. return $1;
  4074. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4075. args: [],
  4076. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4077. messageSends: [],
  4078. referencedClasses: ["CodeGenerator"]
  4079. }),
  4080. smalltalk.MethodInheritanceTest);
  4081. smalltalk.addMethod(
  4082. smalltalk.method({
  4083. selector: "compiler",
  4084. category: 'factory',
  4085. fn: function (){
  4086. var self=this;
  4087. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4088. return smalltalk.withContext(function($ctx1) {
  4089. var $2,$3,$1;
  4090. $2=_st($Compiler())._new();
  4091. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4092. $3=_st($2)._yourself();
  4093. $1=$3;
  4094. return $1;
  4095. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4096. args: [],
  4097. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4098. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4099. referencedClasses: ["Compiler"]
  4100. }),
  4101. smalltalk.MethodInheritanceTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "deinstallBottom",
  4105. category: 'testing',
  4106. fn: function (){
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4110. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4111. args: [],
  4112. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4113. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4114. referencedClasses: []
  4115. }),
  4116. smalltalk.MethodInheritanceTest);
  4117. smalltalk.addMethod(
  4118. smalltalk.method({
  4119. selector: "deinstallMiddle",
  4120. category: 'testing',
  4121. fn: function (){
  4122. var self=this;
  4123. return smalltalk.withContext(function($ctx1) {
  4124. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4125. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4126. args: [],
  4127. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4128. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4129. referencedClasses: []
  4130. }),
  4131. smalltalk.MethodInheritanceTest);
  4132. smalltalk.addMethod(
  4133. smalltalk.method({
  4134. selector: "deinstallTop",
  4135. category: 'testing',
  4136. fn: function (){
  4137. var self=this;
  4138. return smalltalk.withContext(function($ctx1) {
  4139. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4140. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4141. args: [],
  4142. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4143. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4144. referencedClasses: []
  4145. }),
  4146. smalltalk.MethodInheritanceTest);
  4147. smalltalk.addMethod(
  4148. smalltalk.method({
  4149. selector: "installBottom:",
  4150. category: 'testing',
  4151. fn: function (aString){
  4152. var self=this;
  4153. return smalltalk.withContext(function($ctx1) {
  4154. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  4155. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4156. args: ["aString"],
  4157. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  4158. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  4159. referencedClasses: []
  4160. }),
  4161. smalltalk.MethodInheritanceTest);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "installMiddle:",
  4165. category: 'testing',
  4166. fn: function (aString){
  4167. var self=this;
  4168. return smalltalk.withContext(function($ctx1) {
  4169. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  4170. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4171. args: ["aString"],
  4172. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  4173. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  4174. referencedClasses: []
  4175. }),
  4176. smalltalk.MethodInheritanceTest);
  4177. smalltalk.addMethod(
  4178. smalltalk.method({
  4179. selector: "installTop:",
  4180. category: 'testing',
  4181. fn: function (aString){
  4182. var self=this;
  4183. return smalltalk.withContext(function($ctx1) {
  4184. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  4185. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4186. args: ["aString"],
  4187. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  4188. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  4189. referencedClasses: []
  4190. }),
  4191. smalltalk.MethodInheritanceTest);
  4192. smalltalk.addMethod(
  4193. smalltalk.method({
  4194. selector: "setUp",
  4195. category: 'initialization',
  4196. fn: function (){
  4197. var self=this;
  4198. return smalltalk.withContext(function($ctx1) {
  4199. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4200. $ctx1.sendIdx["new"]=1;
  4201. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4202. $ctx1.sendIdx["new"]=2;
  4203. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4204. self["@method"]=nil;
  4205. self["@performBlock"]=(function(){
  4206. return smalltalk.withContext(function($ctx2) {
  4207. return self._error_("performBlock not initialized");
  4208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4209. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4210. args: [],
  4211. 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' ]",
  4212. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4213. referencedClasses: []
  4214. }),
  4215. smalltalk.MethodInheritanceTest);
  4216. smalltalk.addMethod(
  4217. smalltalk.method({
  4218. selector: "shouldMNU",
  4219. category: 'testing',
  4220. fn: function (){
  4221. var self=this;
  4222. return smalltalk.withContext(function($ctx1) {
  4223. self._shouldMNUTop();
  4224. self._shouldMNUMiddle();
  4225. self._shouldMNUBottom();
  4226. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4227. args: [],
  4228. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4229. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4230. referencedClasses: []
  4231. }),
  4232. smalltalk.MethodInheritanceTest);
  4233. smalltalk.addMethod(
  4234. smalltalk.method({
  4235. selector: "shouldMNUBottom",
  4236. category: 'testing',
  4237. fn: function (){
  4238. var self=this;
  4239. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4240. return smalltalk.withContext(function($ctx1) {
  4241. self._should_raise_((function(){
  4242. return smalltalk.withContext(function($ctx2) {
  4243. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4245. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4246. args: [],
  4247. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4248. messageSends: ["should:raise:", "value:"],
  4249. referencedClasses: ["MessageNotUnderstood"]
  4250. }),
  4251. smalltalk.MethodInheritanceTest);
  4252. smalltalk.addMethod(
  4253. smalltalk.method({
  4254. selector: "shouldMNUMiddle",
  4255. category: 'testing',
  4256. fn: function (){
  4257. var self=this;
  4258. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4259. return smalltalk.withContext(function($ctx1) {
  4260. self._should_raise_((function(){
  4261. return smalltalk.withContext(function($ctx2) {
  4262. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4264. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4265. args: [],
  4266. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4267. messageSends: ["should:raise:", "value:"],
  4268. referencedClasses: ["MessageNotUnderstood"]
  4269. }),
  4270. smalltalk.MethodInheritanceTest);
  4271. smalltalk.addMethod(
  4272. smalltalk.method({
  4273. selector: "shouldMNUTop",
  4274. category: 'testing',
  4275. fn: function (){
  4276. var self=this;
  4277. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4278. return smalltalk.withContext(function($ctx1) {
  4279. self._should_raise_((function(){
  4280. return smalltalk.withContext(function($ctx2) {
  4281. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4283. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4284. args: [],
  4285. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4286. messageSends: ["should:raise:", "value:"],
  4287. referencedClasses: ["MessageNotUnderstood"]
  4288. }),
  4289. smalltalk.MethodInheritanceTest);
  4290. smalltalk.addMethod(
  4291. smalltalk.method({
  4292. selector: "shouldReturn:",
  4293. category: 'testing',
  4294. fn: function (anObject){
  4295. var self=this;
  4296. var result;
  4297. return smalltalk.withContext(function($ctx1) {
  4298. var $1,$2,$3;
  4299. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4300. $ctx1.sendIdx["value:"]=1;
  4301. $1=self._assert_equals_(["top",anObject],["top",result]);
  4302. $ctx1.sendIdx["assert:equals:"]=1;
  4303. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4304. $ctx1.sendIdx["value:"]=2;
  4305. $2=self._assert_equals_(["middle",anObject],["middle",result]);
  4306. $ctx1.sendIdx["assert:equals:"]=2;
  4307. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4308. $3=self._assert_equals_(["bottom",anObject],["bottom",result]);
  4309. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4310. args: ["anObject"],
  4311. 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 }",
  4312. messageSends: ["value:", "assert:equals:"],
  4313. referencedClasses: []
  4314. }),
  4315. smalltalk.MethodInheritanceTest);
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "shouldReturn:and:and:",
  4319. category: 'testing',
  4320. fn: function (anObject,anObject2,anObject3){
  4321. var self=this;
  4322. var result;
  4323. return smalltalk.withContext(function($ctx1) {
  4324. var $1,$2,$3;
  4325. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4326. $ctx1.sendIdx["value:"]=1;
  4327. $1=self._assert_equals_(["top",anObject],["top",result]);
  4328. $ctx1.sendIdx["assert:equals:"]=1;
  4329. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4330. $ctx1.sendIdx["value:"]=2;
  4331. $2=self._assert_equals_(["middle",anObject2],["middle",result]);
  4332. $ctx1.sendIdx["assert:equals:"]=2;
  4333. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4334. $3=self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4335. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4336. args: ["anObject", "anObject2", "anObject3"],
  4337. 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 }",
  4338. messageSends: ["value:", "assert:equals:"],
  4339. referencedClasses: []
  4340. }),
  4341. smalltalk.MethodInheritanceTest);
  4342. smalltalk.addMethod(
  4343. smalltalk.method({
  4344. selector: "targetClassBottom",
  4345. category: 'accessing',
  4346. fn: function (){
  4347. var self=this;
  4348. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4349. return smalltalk.withContext(function($ctx1) {
  4350. var $1;
  4351. $1=$JavaScriptException();
  4352. return $1;
  4353. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4354. args: [],
  4355. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4356. messageSends: [],
  4357. referencedClasses: ["JavaScriptException"]
  4358. }),
  4359. smalltalk.MethodInheritanceTest);
  4360. smalltalk.addMethod(
  4361. smalltalk.method({
  4362. selector: "targetClassMiddle",
  4363. category: 'accessing',
  4364. fn: function (){
  4365. var self=this;
  4366. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4367. return smalltalk.withContext(function($ctx1) {
  4368. var $1;
  4369. $1=$Error();
  4370. return $1;
  4371. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4372. args: [],
  4373. source: "targetClassMiddle\x0a\x09^ Error",
  4374. messageSends: [],
  4375. referencedClasses: ["Error"]
  4376. }),
  4377. smalltalk.MethodInheritanceTest);
  4378. smalltalk.addMethod(
  4379. smalltalk.method({
  4380. selector: "targetClassTop",
  4381. category: 'accessing',
  4382. fn: function (){
  4383. var self=this;
  4384. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4385. return smalltalk.withContext(function($ctx1) {
  4386. var $1;
  4387. $1=$Object();
  4388. return $1;
  4389. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4390. args: [],
  4391. source: "targetClassTop\x0a\x09^ Object",
  4392. messageSends: [],
  4393. referencedClasses: ["Object"]
  4394. }),
  4395. smalltalk.MethodInheritanceTest);
  4396. smalltalk.addMethod(
  4397. smalltalk.method({
  4398. selector: "tearDown",
  4399. category: 'initialization',
  4400. fn: function (){
  4401. var self=this;
  4402. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4403. return smalltalk.withContext(function($ctx1) {
  4404. var $1,$2,$3;
  4405. $1=_st((function(){
  4406. return smalltalk.withContext(function($ctx2) {
  4407. return self._deinstallTop();
  4408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4409. return smalltalk.withContext(function($ctx2) {
  4410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4411. $ctx1.sendIdx["on:do:"]=1;
  4412. $2=_st((function(){
  4413. return smalltalk.withContext(function($ctx2) {
  4414. return self._deinstallMiddle();
  4415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4416. return smalltalk.withContext(function($ctx2) {
  4417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4418. $ctx1.sendIdx["on:do:"]=2;
  4419. $3=_st((function(){
  4420. return smalltalk.withContext(function($ctx2) {
  4421. return self._deinstallBottom();
  4422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4423. return smalltalk.withContext(function($ctx2) {
  4424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4425. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4426. args: [],
  4427. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [].\x0a\x09[ self deinstallMiddle ] on: Error do: [].\x0a\x09[ self deinstallBottom ] on: Error do: []",
  4428. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4429. referencedClasses: ["Error"]
  4430. }),
  4431. smalltalk.MethodInheritanceTest);
  4432. smalltalk.addMethod(
  4433. smalltalk.method({
  4434. selector: "testMNU11",
  4435. category: 'tests',
  4436. fn: function (){
  4437. var self=this;
  4438. return smalltalk.withContext(function($ctx1) {
  4439. var $1,$2,$3,$4;
  4440. self["@performBlock"]=(function(x){
  4441. return smalltalk.withContext(function($ctx2) {
  4442. return _st(x)._foo();
  4443. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4444. $1=self._shouldMNU();
  4445. $ctx1.sendIdx["shouldMNU"]=1;
  4446. $2=self._installTop_("foo ^ false");
  4447. $ctx1.sendIdx["installTop:"]=1;
  4448. $3=self._installTop_("foo ^ true");
  4449. self._deinstallTop();
  4450. $4=self._shouldMNU();
  4451. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4452. args: [],
  4453. 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",
  4454. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4455. referencedClasses: []
  4456. }),
  4457. smalltalk.MethodInheritanceTest);
  4458. smalltalk.addMethod(
  4459. smalltalk.method({
  4460. selector: "testMNU22",
  4461. category: 'tests',
  4462. fn: function (){
  4463. var self=this;
  4464. return smalltalk.withContext(function($ctx1) {
  4465. var $1,$2,$3,$4;
  4466. self["@performBlock"]=(function(x){
  4467. return smalltalk.withContext(function($ctx2) {
  4468. return _st(x)._foo();
  4469. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4470. $1=self._shouldMNU();
  4471. $ctx1.sendIdx["shouldMNU"]=1;
  4472. $2=self._installMiddle_("foo ^ false");
  4473. $ctx1.sendIdx["installMiddle:"]=1;
  4474. $3=self._installMiddle_("foo ^ true");
  4475. self._deinstallMiddle();
  4476. $4=self._shouldMNU();
  4477. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4478. args: [],
  4479. 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",
  4480. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4481. referencedClasses: []
  4482. }),
  4483. smalltalk.MethodInheritanceTest);
  4484. smalltalk.addMethod(
  4485. smalltalk.method({
  4486. selector: "testReturns1",
  4487. category: 'tests',
  4488. fn: function (){
  4489. var self=this;
  4490. return smalltalk.withContext(function($ctx1) {
  4491. var $1,$2,$3,$4;
  4492. self["@performBlock"]=(function(x){
  4493. return smalltalk.withContext(function($ctx2) {
  4494. return _st(x)._foo();
  4495. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4496. $1=self._installTop_("foo ^ false");
  4497. $ctx1.sendIdx["installTop:"]=1;
  4498. $2=self._shouldReturn_(false);
  4499. $ctx1.sendIdx["shouldReturn:"]=1;
  4500. $3=self._installTop_("foo ^ true");
  4501. $4=self._shouldReturn_(true);
  4502. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4503. args: [],
  4504. 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",
  4505. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4506. referencedClasses: []
  4507. }),
  4508. smalltalk.MethodInheritanceTest);
  4509. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4510. smalltalk.addMethod(
  4511. smalltalk.method({
  4512. selector: "testAbs",
  4513. category: 'tests',
  4514. fn: function (){
  4515. var self=this;
  4516. return smalltalk.withContext(function($ctx1) {
  4517. var $2,$1,$4,$3;
  4518. $2=(4)._abs();
  4519. $ctx1.sendIdx["abs"]=1;
  4520. $1=self._assert_equals_($2,(4));
  4521. $ctx1.sendIdx["assert:equals:"]=1;
  4522. $4=(-4)._abs();
  4523. $3=self._assert_equals_($4,(4));
  4524. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4525. args: [],
  4526. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4527. messageSends: ["assert:equals:", "abs"],
  4528. referencedClasses: []
  4529. }),
  4530. smalltalk.NumberTest);
  4531. smalltalk.addMethod(
  4532. smalltalk.method({
  4533. selector: "testArithmetic",
  4534. category: 'tests',
  4535. fn: function (){
  4536. var self=this;
  4537. return smalltalk.withContext(function($ctx1) {
  4538. var $2,$1,$4,$3,$6,$5,$7,$9,$8,$10,$11,$14,$13,$12,$17,$16,$15;
  4539. $2=(1.5).__plus((1));
  4540. $ctx1.sendIdx["+"]=1;
  4541. $1=self._assert_equals_($2,(2.5));
  4542. $ctx1.sendIdx["assert:equals:"]=1;
  4543. $4=(2).__minus((1));
  4544. $ctx1.sendIdx["-"]=1;
  4545. $3=self._assert_equals_($4,(1));
  4546. $ctx1.sendIdx["assert:equals:"]=2;
  4547. $6=(-2).__minus((1));
  4548. $5=self._assert_equals_($6,(-3));
  4549. $ctx1.sendIdx["assert:equals:"]=3;
  4550. $7=self._assert_equals_((12).__slash((2)),(6));
  4551. $ctx1.sendIdx["assert:equals:"]=4;
  4552. $9=(3).__star((4));
  4553. $ctx1.sendIdx["*"]=1;
  4554. $8=self._assert_equals_($9,(12));
  4555. $ctx1.sendIdx["assert:equals:"]=5;
  4556. $10=self._assert_equals_((7).__slash_slash((2)),(3));
  4557. $ctx1.sendIdx["assert:equals:"]=6;
  4558. $11=self._assert_equals_((7).__backslash_backslash((2)),(1));
  4559. $ctx1.sendIdx["assert:equals:"]=7;
  4560. $14=(1).__plus((2));
  4561. $ctx1.sendIdx["+"]=2;
  4562. $13=_st($14).__star((3));
  4563. $ctx1.sendIdx["*"]=2;
  4564. $12=self._assert_equals_($13,(9));
  4565. $ctx1.sendIdx["assert:equals:"]=8;
  4566. $17=(2).__star((3));
  4567. $16=(1).__plus($17);
  4568. $15=self._assert_equals_($16,(7));
  4569. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4570. args: [],
  4571. 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",
  4572. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4573. referencedClasses: []
  4574. }),
  4575. smalltalk.NumberTest);
  4576. smalltalk.addMethod(
  4577. smalltalk.method({
  4578. selector: "testAsNumber",
  4579. category: 'tests',
  4580. fn: function (){
  4581. var self=this;
  4582. return smalltalk.withContext(function($ctx1) {
  4583. self._assert_equals_((3)._asNumber(),(3));
  4584. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4585. args: [],
  4586. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4587. messageSends: ["assert:equals:", "asNumber"],
  4588. referencedClasses: []
  4589. }),
  4590. smalltalk.NumberTest);
  4591. smalltalk.addMethod(
  4592. smalltalk.method({
  4593. selector: "testCeiling",
  4594. category: 'tests',
  4595. fn: function (){
  4596. var self=this;
  4597. return smalltalk.withContext(function($ctx1) {
  4598. var $2,$1,$4,$3,$6,$5;
  4599. $2=(1.2)._ceiling();
  4600. $ctx1.sendIdx["ceiling"]=1;
  4601. $1=self._assert_equals_($2,(2));
  4602. $ctx1.sendIdx["assert:equals:"]=1;
  4603. $4=(-1.2)._ceiling();
  4604. $ctx1.sendIdx["ceiling"]=2;
  4605. $3=self._assert_equals_($4,(-1));
  4606. $ctx1.sendIdx["assert:equals:"]=2;
  4607. $6=(1)._ceiling();
  4608. $5=self._assert_equals_($6,(1));
  4609. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4610. args: [],
  4611. 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.",
  4612. messageSends: ["assert:equals:", "ceiling"],
  4613. referencedClasses: []
  4614. }),
  4615. smalltalk.NumberTest);
  4616. smalltalk.addMethod(
  4617. smalltalk.method({
  4618. selector: "testComparison",
  4619. category: 'tests',
  4620. fn: function (){
  4621. var self=this;
  4622. return smalltalk.withContext(function($ctx1) {
  4623. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  4624. $2=(3).__gt((2));
  4625. $ctx1.sendIdx[">"]=1;
  4626. $1=self._assert_($2);
  4627. $ctx1.sendIdx["assert:"]=1;
  4628. $4=(2).__lt((3));
  4629. $ctx1.sendIdx["<"]=1;
  4630. $3=self._assert_($4);
  4631. $ctx1.sendIdx["assert:"]=2;
  4632. $6=(3).__lt((2));
  4633. $5=self._deny_($6);
  4634. $ctx1.sendIdx["deny:"]=1;
  4635. $8=(2).__gt((3));
  4636. $7=self._deny_($8);
  4637. $10=(3).__gt_eq((3));
  4638. $ctx1.sendIdx[">="]=1;
  4639. $9=self._assert_($10);
  4640. $ctx1.sendIdx["assert:"]=3;
  4641. $12=(3.1).__gt_eq((3));
  4642. $11=self._assert_($12);
  4643. $ctx1.sendIdx["assert:"]=4;
  4644. $14=(3).__lt_eq((3));
  4645. $ctx1.sendIdx["<="]=1;
  4646. $13=self._assert_($14);
  4647. $ctx1.sendIdx["assert:"]=5;
  4648. $16=(3).__lt_eq((3.1));
  4649. $15=self._assert_($16);
  4650. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4651. args: [],
  4652. 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",
  4653. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4654. referencedClasses: []
  4655. }),
  4656. smalltalk.NumberTest);
  4657. smalltalk.addMethod(
  4658. smalltalk.method({
  4659. selector: "testCopying",
  4660. category: 'tests',
  4661. fn: function (){
  4662. var self=this;
  4663. return smalltalk.withContext(function($ctx1) {
  4664. var $2,$1,$4,$3;
  4665. $2=_st((1)._copy()).__eq_eq((1));
  4666. $ctx1.sendIdx["=="]=1;
  4667. $1=self._assert_($2);
  4668. $ctx1.sendIdx["assert:"]=1;
  4669. $4=_st((1)._deepCopy()).__eq_eq((1));
  4670. $3=self._assert_($4);
  4671. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4672. args: [],
  4673. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4674. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4675. referencedClasses: []
  4676. }),
  4677. smalltalk.NumberTest);
  4678. smalltalk.addMethod(
  4679. smalltalk.method({
  4680. selector: "testEquality",
  4681. category: 'tests',
  4682. fn: function (){
  4683. var self=this;
  4684. return smalltalk.withContext(function($ctx1) {
  4685. var $2,$1,$4,$3,$6,$5,$9,$8,$7,$12,$11,$10,$15,$16,$14,$13,$18,$17,$20,$19,$22,$21,$24,$23;
  4686. $2=(1).__eq((1));
  4687. $ctx1.sendIdx["="]=1;
  4688. $1=self._assert_($2);
  4689. $ctx1.sendIdx["assert:"]=1;
  4690. $4=(0).__eq((0));
  4691. $ctx1.sendIdx["="]=2;
  4692. $3=self._assert_($4);
  4693. $ctx1.sendIdx["assert:"]=2;
  4694. $6=(1).__eq((0));
  4695. $ctx1.sendIdx["="]=3;
  4696. $5=self._deny_($6);
  4697. $ctx1.sendIdx["deny:"]=1;
  4698. $9=(1)._yourself();
  4699. $ctx1.sendIdx["yourself"]=1;
  4700. $8=_st($9).__eq((1));
  4701. $ctx1.sendIdx["="]=4;
  4702. $7=self._assert_($8);
  4703. $ctx1.sendIdx["assert:"]=3;
  4704. $12=(1)._yourself();
  4705. $ctx1.sendIdx["yourself"]=2;
  4706. $11=(1).__eq($12);
  4707. $ctx1.sendIdx["="]=5;
  4708. $10=self._assert_($11);
  4709. $ctx1.sendIdx["assert:"]=4;
  4710. $15=(1)._yourself();
  4711. $ctx1.sendIdx["yourself"]=3;
  4712. $16=(1)._yourself();
  4713. $14=_st($15).__eq($16);
  4714. $ctx1.sendIdx["="]=6;
  4715. $13=self._assert_($14);
  4716. $18=(0).__eq(false);
  4717. $ctx1.sendIdx["="]=7;
  4718. $17=self._deny_($18);
  4719. $ctx1.sendIdx["deny:"]=2;
  4720. $20=false.__eq((0));
  4721. $ctx1.sendIdx["="]=8;
  4722. $19=self._deny_($20);
  4723. $ctx1.sendIdx["deny:"]=3;
  4724. $22="".__eq((0));
  4725. $ctx1.sendIdx["="]=9;
  4726. $21=self._deny_($22);
  4727. $ctx1.sendIdx["deny:"]=4;
  4728. $24=(0).__eq("");
  4729. $23=self._deny_($24);
  4730. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4731. args: [],
  4732. 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 = ''",
  4733. messageSends: ["assert:", "=", "deny:", "yourself"],
  4734. referencedClasses: []
  4735. }),
  4736. smalltalk.NumberTest);
  4737. smalltalk.addMethod(
  4738. smalltalk.method({
  4739. selector: "testFloor",
  4740. category: 'tests',
  4741. fn: function (){
  4742. var self=this;
  4743. return smalltalk.withContext(function($ctx1) {
  4744. var $2,$1,$4,$3,$6,$5;
  4745. $2=(1.2)._floor();
  4746. $ctx1.sendIdx["floor"]=1;
  4747. $1=self._assert_equals_($2,(1));
  4748. $ctx1.sendIdx["assert:equals:"]=1;
  4749. $4=(-1.2)._floor();
  4750. $ctx1.sendIdx["floor"]=2;
  4751. $3=self._assert_equals_($4,(-2));
  4752. $ctx1.sendIdx["assert:equals:"]=2;
  4753. $6=(1)._floor();
  4754. $5=self._assert_equals_($6,(1));
  4755. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4756. args: [],
  4757. 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.",
  4758. messageSends: ["assert:equals:", "floor"],
  4759. referencedClasses: []
  4760. }),
  4761. smalltalk.NumberTest);
  4762. smalltalk.addMethod(
  4763. smalltalk.method({
  4764. selector: "testHexNumbers",
  4765. category: 'tests',
  4766. fn: function (){
  4767. var self=this;
  4768. return smalltalk.withContext(function($ctx1) {
  4769. var $1,$3,$2,$5,$4,$7,$6,$9,$8,$11,$10,$13,$12;
  4770. $1=self._assert_equals_((9),(9));
  4771. $ctx1.sendIdx["assert:equals:"]=1;
  4772. $3=(10)._truncated();
  4773. $ctx1.sendIdx["truncated"]=1;
  4774. $2=self._assert_equals_($3,(10));
  4775. $ctx1.sendIdx["assert:equals:"]=2;
  4776. $5=(11)._truncated();
  4777. $ctx1.sendIdx["truncated"]=2;
  4778. $4=self._assert_equals_($5,(11));
  4779. $ctx1.sendIdx["assert:equals:"]=3;
  4780. $7=(12)._truncated();
  4781. $ctx1.sendIdx["truncated"]=3;
  4782. $6=self._assert_equals_($7,(12));
  4783. $ctx1.sendIdx["assert:equals:"]=4;
  4784. $9=(13)._truncated();
  4785. $ctx1.sendIdx["truncated"]=4;
  4786. $8=self._assert_equals_($9,(13));
  4787. $ctx1.sendIdx["assert:equals:"]=5;
  4788. $11=(14)._truncated();
  4789. $ctx1.sendIdx["truncated"]=5;
  4790. $10=self._assert_equals_($11,(14));
  4791. $ctx1.sendIdx["assert:equals:"]=6;
  4792. $13=(15)._truncated();
  4793. $12=self._assert_equals_($13,(15));
  4794. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4795. args: [],
  4796. 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",
  4797. messageSends: ["assert:equals:", "truncated"],
  4798. referencedClasses: []
  4799. }),
  4800. smalltalk.NumberTest);
  4801. smalltalk.addMethod(
  4802. smalltalk.method({
  4803. selector: "testIdentity",
  4804. category: 'tests',
  4805. fn: function (){
  4806. var self=this;
  4807. return smalltalk.withContext(function($ctx1) {
  4808. var $2,$1,$4,$3,$6,$5,$9,$8,$7,$12,$11,$10,$15,$16,$14,$13,$18,$17;
  4809. $2=(1).__eq_eq((1));
  4810. $ctx1.sendIdx["=="]=1;
  4811. $1=self._assert_($2);
  4812. $ctx1.sendIdx["assert:"]=1;
  4813. $4=(0).__eq_eq((0));
  4814. $ctx1.sendIdx["=="]=2;
  4815. $3=self._assert_($4);
  4816. $ctx1.sendIdx["assert:"]=2;
  4817. $6=(1).__eq_eq((0));
  4818. $ctx1.sendIdx["=="]=3;
  4819. $5=self._deny_($6);
  4820. $ctx1.sendIdx["deny:"]=1;
  4821. $9=(1)._yourself();
  4822. $ctx1.sendIdx["yourself"]=1;
  4823. $8=_st($9).__eq_eq((1));
  4824. $ctx1.sendIdx["=="]=4;
  4825. $7=self._assert_($8);
  4826. $ctx1.sendIdx["assert:"]=3;
  4827. $12=(1)._yourself();
  4828. $ctx1.sendIdx["yourself"]=2;
  4829. $11=(1).__eq_eq($12);
  4830. $ctx1.sendIdx["=="]=5;
  4831. $10=self._assert_($11);
  4832. $ctx1.sendIdx["assert:"]=4;
  4833. $15=(1)._yourself();
  4834. $ctx1.sendIdx["yourself"]=3;
  4835. $16=(1)._yourself();
  4836. $14=_st($15).__eq_eq($16);
  4837. $ctx1.sendIdx["=="]=6;
  4838. $13=self._assert_($14);
  4839. $18=(1).__eq_eq((2));
  4840. $17=self._deny_($18);
  4841. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4842. args: [],
  4843. 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",
  4844. messageSends: ["assert:", "==", "deny:", "yourself"],
  4845. referencedClasses: []
  4846. }),
  4847. smalltalk.NumberTest);
  4848. smalltalk.addMethod(
  4849. smalltalk.method({
  4850. selector: "testInvalidHexNumbers",
  4851. category: 'tests',
  4852. fn: function (){
  4853. var self=this;
  4854. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4855. return smalltalk.withContext(function($ctx1) {
  4856. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41;
  4857. $1=self._should_raise_((function(){
  4858. return smalltalk.withContext(function($ctx2) {
  4859. return (16)._rG();
  4860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4861. $ctx1.sendIdx["should:raise:"]=1;
  4862. $2=self._should_raise_((function(){
  4863. return smalltalk.withContext(function($ctx2) {
  4864. return (16)._rg();
  4865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4866. $ctx1.sendIdx["should:raise:"]=2;
  4867. $3=self._should_raise_((function(){
  4868. return smalltalk.withContext(function($ctx2) {
  4869. return (16)._rH();
  4870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4871. $ctx1.sendIdx["should:raise:"]=3;
  4872. $4=self._should_raise_((function(){
  4873. return smalltalk.withContext(function($ctx2) {
  4874. return (16)._rh();
  4875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4876. $ctx1.sendIdx["should:raise:"]=4;
  4877. $5=self._should_raise_((function(){
  4878. return smalltalk.withContext(function($ctx2) {
  4879. return (16)._rI();
  4880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4881. $ctx1.sendIdx["should:raise:"]=5;
  4882. $6=self._should_raise_((function(){
  4883. return smalltalk.withContext(function($ctx2) {
  4884. return (16)._ri();
  4885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  4886. $ctx1.sendIdx["should:raise:"]=6;
  4887. $7=self._should_raise_((function(){
  4888. return smalltalk.withContext(function($ctx2) {
  4889. return (16)._rJ();
  4890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  4891. $ctx1.sendIdx["should:raise:"]=7;
  4892. $8=self._should_raise_((function(){
  4893. return smalltalk.withContext(function($ctx2) {
  4894. return (16)._rj();
  4895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  4896. $ctx1.sendIdx["should:raise:"]=8;
  4897. $9=self._should_raise_((function(){
  4898. return smalltalk.withContext(function($ctx2) {
  4899. return (16)._rK();
  4900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  4901. $ctx1.sendIdx["should:raise:"]=9;
  4902. $10=self._should_raise_((function(){
  4903. return smalltalk.withContext(function($ctx2) {
  4904. return (16)._rk();
  4905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  4906. $ctx1.sendIdx["should:raise:"]=10;
  4907. $11=self._should_raise_((function(){
  4908. return smalltalk.withContext(function($ctx2) {
  4909. return (16)._rL();
  4910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  4911. $ctx1.sendIdx["should:raise:"]=11;
  4912. $12=self._should_raise_((function(){
  4913. return smalltalk.withContext(function($ctx2) {
  4914. return (16)._rl();
  4915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  4916. $ctx1.sendIdx["should:raise:"]=12;
  4917. $13=self._should_raise_((function(){
  4918. return smalltalk.withContext(function($ctx2) {
  4919. return (16)._rM();
  4920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  4921. $ctx1.sendIdx["should:raise:"]=13;
  4922. $14=self._should_raise_((function(){
  4923. return smalltalk.withContext(function($ctx2) {
  4924. return (16)._rm();
  4925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  4926. $ctx1.sendIdx["should:raise:"]=14;
  4927. $15=self._should_raise_((function(){
  4928. return smalltalk.withContext(function($ctx2) {
  4929. return (16)._rN();
  4930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  4931. $ctx1.sendIdx["should:raise:"]=15;
  4932. $16=self._should_raise_((function(){
  4933. return smalltalk.withContext(function($ctx2) {
  4934. return (16)._rn();
  4935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  4936. $ctx1.sendIdx["should:raise:"]=16;
  4937. $17=self._should_raise_((function(){
  4938. return smalltalk.withContext(function($ctx2) {
  4939. return (16)._rO();
  4940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  4941. $ctx1.sendIdx["should:raise:"]=17;
  4942. $18=self._should_raise_((function(){
  4943. return smalltalk.withContext(function($ctx2) {
  4944. return (16)._ro();
  4945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  4946. $ctx1.sendIdx["should:raise:"]=18;
  4947. $19=self._should_raise_((function(){
  4948. return smalltalk.withContext(function($ctx2) {
  4949. return (16)._rP();
  4950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  4951. $ctx1.sendIdx["should:raise:"]=19;
  4952. $20=self._should_raise_((function(){
  4953. return smalltalk.withContext(function($ctx2) {
  4954. return (16)._rp();
  4955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  4956. $ctx1.sendIdx["should:raise:"]=20;
  4957. $21=self._should_raise_((function(){
  4958. return smalltalk.withContext(function($ctx2) {
  4959. return (16)._rQ();
  4960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  4961. $ctx1.sendIdx["should:raise:"]=21;
  4962. $22=self._should_raise_((function(){
  4963. return smalltalk.withContext(function($ctx2) {
  4964. return (16)._rq();
  4965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  4966. $ctx1.sendIdx["should:raise:"]=22;
  4967. $23=self._should_raise_((function(){
  4968. return smalltalk.withContext(function($ctx2) {
  4969. return (16)._rR();
  4970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  4971. $ctx1.sendIdx["should:raise:"]=23;
  4972. $24=self._should_raise_((function(){
  4973. return smalltalk.withContext(function($ctx2) {
  4974. return (16)._rr();
  4975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  4976. $ctx1.sendIdx["should:raise:"]=24;
  4977. $25=self._should_raise_((function(){
  4978. return smalltalk.withContext(function($ctx2) {
  4979. return (16)._rS();
  4980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  4981. $ctx1.sendIdx["should:raise:"]=25;
  4982. $26=self._should_raise_((function(){
  4983. return smalltalk.withContext(function($ctx2) {
  4984. return (16)._rs();
  4985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  4986. $ctx1.sendIdx["should:raise:"]=26;
  4987. $27=self._should_raise_((function(){
  4988. return smalltalk.withContext(function($ctx2) {
  4989. return (16)._rT();
  4990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  4991. $ctx1.sendIdx["should:raise:"]=27;
  4992. $28=self._should_raise_((function(){
  4993. return smalltalk.withContext(function($ctx2) {
  4994. return (16)._rt();
  4995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  4996. $ctx1.sendIdx["should:raise:"]=28;
  4997. $29=self._should_raise_((function(){
  4998. return smalltalk.withContext(function($ctx2) {
  4999. return (16)._rU();
  5000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5001. $ctx1.sendIdx["should:raise:"]=29;
  5002. $30=self._should_raise_((function(){
  5003. return smalltalk.withContext(function($ctx2) {
  5004. return (16)._ru();
  5005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5006. $ctx1.sendIdx["should:raise:"]=30;
  5007. $31=self._should_raise_((function(){
  5008. return smalltalk.withContext(function($ctx2) {
  5009. return (16)._rV();
  5010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  5011. $ctx1.sendIdx["should:raise:"]=31;
  5012. $32=self._should_raise_((function(){
  5013. return smalltalk.withContext(function($ctx2) {
  5014. return (16)._rv();
  5015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  5016. $ctx1.sendIdx["should:raise:"]=32;
  5017. $33=self._should_raise_((function(){
  5018. return smalltalk.withContext(function($ctx2) {
  5019. return (16)._rW();
  5020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  5021. $ctx1.sendIdx["should:raise:"]=33;
  5022. $34=self._should_raise_((function(){
  5023. return smalltalk.withContext(function($ctx2) {
  5024. return (16)._rw();
  5025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  5026. $ctx1.sendIdx["should:raise:"]=34;
  5027. $35=self._should_raise_((function(){
  5028. return smalltalk.withContext(function($ctx2) {
  5029. return (16)._rX();
  5030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5031. $ctx1.sendIdx["should:raise:"]=35;
  5032. $36=self._should_raise_((function(){
  5033. return smalltalk.withContext(function($ctx2) {
  5034. return (16)._rx();
  5035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5036. $ctx1.sendIdx["should:raise:"]=36;
  5037. $37=self._should_raise_((function(){
  5038. return smalltalk.withContext(function($ctx2) {
  5039. return (16)._rY();
  5040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5041. $ctx1.sendIdx["should:raise:"]=37;
  5042. $38=self._should_raise_((function(){
  5043. return smalltalk.withContext(function($ctx2) {
  5044. return (16)._ry();
  5045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5046. $ctx1.sendIdx["should:raise:"]=38;
  5047. $39=self._should_raise_((function(){
  5048. return smalltalk.withContext(function($ctx2) {
  5049. return (16)._rZ();
  5050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5051. $ctx1.sendIdx["should:raise:"]=39;
  5052. $40=self._should_raise_((function(){
  5053. return smalltalk.withContext(function($ctx2) {
  5054. return (16)._rz();
  5055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5056. $ctx1.sendIdx["should:raise:"]=40;
  5057. $41=self._should_raise_((function(){
  5058. return smalltalk.withContext(function($ctx2) {
  5059. return (11259375)._Z();
  5060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5061. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5062. args: [],
  5063. 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.",
  5064. 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"],
  5065. referencedClasses: ["MessageNotUnderstood"]
  5066. }),
  5067. smalltalk.NumberTest);
  5068. smalltalk.addMethod(
  5069. smalltalk.method({
  5070. selector: "testLog",
  5071. category: 'tests',
  5072. fn: function (){
  5073. var self=this;
  5074. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5075. return smalltalk.withContext(function($ctx1) {
  5076. var $1,$2,$3;
  5077. $1=self._assert_equals_((10000)._log(),(4));
  5078. $ctx1.sendIdx["assert:equals:"]=1;
  5079. $2=self._assert_equals_((512)._log_((2)),(9));
  5080. $ctx1.sendIdx["assert:equals:"]=2;
  5081. $3=self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5082. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5083. args: [],
  5084. 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.",
  5085. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5086. referencedClasses: ["Number"]
  5087. }),
  5088. smalltalk.NumberTest);
  5089. smalltalk.addMethod(
  5090. smalltalk.method({
  5091. selector: "testMinMax",
  5092. category: 'tests',
  5093. fn: function (){
  5094. var self=this;
  5095. return smalltalk.withContext(function($ctx1) {
  5096. var $1,$2;
  5097. $1=self._assert_equals_((2)._max_((5)),(5));
  5098. $ctx1.sendIdx["assert:equals:"]=1;
  5099. $2=self._assert_equals_((2)._min_((5)),(2));
  5100. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5101. args: [],
  5102. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5103. messageSends: ["assert:equals:", "max:", "min:"],
  5104. referencedClasses: []
  5105. }),
  5106. smalltalk.NumberTest);
  5107. smalltalk.addMethod(
  5108. smalltalk.method({
  5109. selector: "testNegated",
  5110. category: 'tests',
  5111. fn: function (){
  5112. var self=this;
  5113. return smalltalk.withContext(function($ctx1) {
  5114. var $2,$1,$4,$3;
  5115. $2=(3)._negated();
  5116. $ctx1.sendIdx["negated"]=1;
  5117. $1=self._assert_equals_($2,(-3));
  5118. $ctx1.sendIdx["assert:equals:"]=1;
  5119. $4=(-3)._negated();
  5120. $3=self._assert_equals_($4,(3));
  5121. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5122. args: [],
  5123. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5124. messageSends: ["assert:equals:", "negated"],
  5125. referencedClasses: []
  5126. }),
  5127. smalltalk.NumberTest);
  5128. smalltalk.addMethod(
  5129. smalltalk.method({
  5130. selector: "testPrintShowingDecimalPlaces",
  5131. category: 'tests',
  5132. fn: function (){
  5133. var self=this;
  5134. return smalltalk.withContext(function($ctx1) {
  5135. var $2,$1,$4,$3,$7,$6,$5,$9,$8,$11,$10,$14,$13,$12,$17,$16,$15,$19,$18,$21,$20,$24,$23,$22,$26,$25,$28,$27,$30,$29;
  5136. $2=(23)._printShowingDecimalPlaces_((2));
  5137. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5138. $1=self._assert_equals_($2,"23.00");
  5139. $ctx1.sendIdx["assert:equals:"]=1;
  5140. $4=(23.5698)._printShowingDecimalPlaces_((2));
  5141. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5142. $3=self._assert_equals_($4,"23.57");
  5143. $ctx1.sendIdx["assert:equals:"]=2;
  5144. $7=(234.567)._negated();
  5145. $ctx1.sendIdx["negated"]=1;
  5146. $6=_st($7)._printShowingDecimalPlaces_((5));
  5147. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5148. $5=self._assert_equals_($6,"-234.56700");
  5149. $ctx1.sendIdx["assert:equals:"]=3;
  5150. $9=(23.4567)._printShowingDecimalPlaces_((0));
  5151. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5152. $8=self._assert_equals_($9,"23");
  5153. $ctx1.sendIdx["assert:equals:"]=4;
  5154. $11=(23.5567)._printShowingDecimalPlaces_((0));
  5155. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5156. $10=self._assert_equals_($11,"24");
  5157. $ctx1.sendIdx["assert:equals:"]=5;
  5158. $14=(23.4567)._negated();
  5159. $ctx1.sendIdx["negated"]=2;
  5160. $13=_st($14)._printShowingDecimalPlaces_((0));
  5161. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5162. $12=self._assert_equals_($13,"-23");
  5163. $ctx1.sendIdx["assert:equals:"]=6;
  5164. $17=(23.5567)._negated();
  5165. $ctx1.sendIdx["negated"]=3;
  5166. $16=_st($17)._printShowingDecimalPlaces_((0));
  5167. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5168. $15=self._assert_equals_($16,"-24");
  5169. $ctx1.sendIdx["assert:equals:"]=7;
  5170. $19=(100000000)._printShowingDecimalPlaces_((1));
  5171. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5172. $18=self._assert_equals_($19,"100000000.0");
  5173. $ctx1.sendIdx["assert:equals:"]=8;
  5174. $21=(0.98)._printShowingDecimalPlaces_((5));
  5175. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5176. $20=self._assert_equals_($21,"0.98000");
  5177. $ctx1.sendIdx["assert:equals:"]=9;
  5178. $24=(0.98)._negated();
  5179. $23=_st($24)._printShowingDecimalPlaces_((2));
  5180. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5181. $22=self._assert_equals_($23,"-0.98");
  5182. $ctx1.sendIdx["assert:equals:"]=10;
  5183. $26=(2.567)._printShowingDecimalPlaces_((2));
  5184. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5185. $25=self._assert_equals_($26,"2.57");
  5186. $ctx1.sendIdx["assert:equals:"]=11;
  5187. $28=(-2.567)._printShowingDecimalPlaces_((2));
  5188. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5189. $27=self._assert_equals_($28,"-2.57");
  5190. $ctx1.sendIdx["assert:equals:"]=12;
  5191. $30=(0)._printShowingDecimalPlaces_((2));
  5192. $29=self._assert_equals_($30,"0.00");
  5193. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5194. args: [],
  5195. 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'.",
  5196. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5197. referencedClasses: []
  5198. }),
  5199. smalltalk.NumberTest);
  5200. smalltalk.addMethod(
  5201. smalltalk.method({
  5202. selector: "testRaisedTo",
  5203. category: 'tests',
  5204. fn: function (){
  5205. var self=this;
  5206. return smalltalk.withContext(function($ctx1) {
  5207. var $2,$1,$4,$3,$6,$5,$8,$7,$9;
  5208. $2=(2)._raisedTo_((4));
  5209. $ctx1.sendIdx["raisedTo:"]=1;
  5210. $1=self._assert_equals_($2,(16));
  5211. $ctx1.sendIdx["assert:equals:"]=1;
  5212. $4=(2)._raisedTo_((0));
  5213. $ctx1.sendIdx["raisedTo:"]=2;
  5214. $3=self._assert_equals_($4,(1));
  5215. $ctx1.sendIdx["assert:equals:"]=2;
  5216. $6=(2)._raisedTo_((-3));
  5217. $ctx1.sendIdx["raisedTo:"]=3;
  5218. $5=self._assert_equals_($6,(0.125));
  5219. $ctx1.sendIdx["assert:equals:"]=3;
  5220. $8=(4)._raisedTo_((0.5));
  5221. $7=self._assert_equals_($8,(2));
  5222. $ctx1.sendIdx["assert:equals:"]=4;
  5223. $9=self._assert_equals_((2).__star_star((4)),(16));
  5224. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5225. args: [],
  5226. 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.",
  5227. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5228. referencedClasses: []
  5229. }),
  5230. smalltalk.NumberTest);
  5231. smalltalk.addMethod(
  5232. smalltalk.method({
  5233. selector: "testRounded",
  5234. category: 'tests',
  5235. fn: function (){
  5236. var self=this;
  5237. return smalltalk.withContext(function($ctx1) {
  5238. var $2,$1,$4,$3,$6,$5;
  5239. $2=(3)._rounded();
  5240. $ctx1.sendIdx["rounded"]=1;
  5241. $1=self._assert_equals_($2,(3));
  5242. $ctx1.sendIdx["assert:equals:"]=1;
  5243. $4=(3.212)._rounded();
  5244. $ctx1.sendIdx["rounded"]=2;
  5245. $3=self._assert_equals_($4,(3));
  5246. $ctx1.sendIdx["assert:equals:"]=2;
  5247. $6=(3.51)._rounded();
  5248. $5=self._assert_equals_($6,(4));
  5249. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5250. args: [],
  5251. 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",
  5252. messageSends: ["assert:equals:", "rounded"],
  5253. referencedClasses: []
  5254. }),
  5255. smalltalk.NumberTest);
  5256. smalltalk.addMethod(
  5257. smalltalk.method({
  5258. selector: "testSign",
  5259. category: 'tests',
  5260. fn: function (){
  5261. var self=this;
  5262. return smalltalk.withContext(function($ctx1) {
  5263. var $2,$1,$4,$3,$6,$5;
  5264. $2=(5)._sign();
  5265. $ctx1.sendIdx["sign"]=1;
  5266. $1=self._assert_equals_($2,(1));
  5267. $ctx1.sendIdx["assert:equals:"]=1;
  5268. $4=(0)._sign();
  5269. $ctx1.sendIdx["sign"]=2;
  5270. $3=self._assert_equals_($4,(0));
  5271. $ctx1.sendIdx["assert:equals:"]=2;
  5272. $6=(-1.4)._sign();
  5273. $5=self._assert_equals_($6,(-1));
  5274. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5275. args: [],
  5276. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5277. messageSends: ["assert:equals:", "sign"],
  5278. referencedClasses: []
  5279. }),
  5280. smalltalk.NumberTest);
  5281. smalltalk.addMethod(
  5282. smalltalk.method({
  5283. selector: "testSqrt",
  5284. category: 'tests',
  5285. fn: function (){
  5286. var self=this;
  5287. return smalltalk.withContext(function($ctx1) {
  5288. var $2,$1,$4,$3;
  5289. $2=(4)._sqrt();
  5290. $ctx1.sendIdx["sqrt"]=1;
  5291. $1=self._assert_equals_($2,(2));
  5292. $ctx1.sendIdx["assert:equals:"]=1;
  5293. $4=(16)._sqrt();
  5294. $3=self._assert_equals_($4,(4));
  5295. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5296. args: [],
  5297. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5298. messageSends: ["assert:equals:", "sqrt"],
  5299. referencedClasses: []
  5300. }),
  5301. smalltalk.NumberTest);
  5302. smalltalk.addMethod(
  5303. smalltalk.method({
  5304. selector: "testSquared",
  5305. category: 'tests',
  5306. fn: function (){
  5307. var self=this;
  5308. return smalltalk.withContext(function($ctx1) {
  5309. self._assert_equals_((4)._squared(),(16));
  5310. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5311. args: [],
  5312. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5313. messageSends: ["assert:equals:", "squared"],
  5314. referencedClasses: []
  5315. }),
  5316. smalltalk.NumberTest);
  5317. smalltalk.addMethod(
  5318. smalltalk.method({
  5319. selector: "testTimesRepeat",
  5320. category: 'tests',
  5321. fn: function (){
  5322. var self=this;
  5323. var i;
  5324. return smalltalk.withContext(function($ctx1) {
  5325. var $1,$2,$3,$4;
  5326. i=(0);
  5327. $1=(0)._timesRepeat_((function(){
  5328. return smalltalk.withContext(function($ctx2) {
  5329. i=_st(i).__plus((1));
  5330. $ctx2.sendIdx["+"]=1;
  5331. return i;
  5332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5333. $ctx1.sendIdx["timesRepeat:"]=1;
  5334. $2=self._assert_equals_(i,(0));
  5335. $ctx1.sendIdx["assert:equals:"]=1;
  5336. $3=(5)._timesRepeat_((function(){
  5337. return smalltalk.withContext(function($ctx2) {
  5338. i=_st(i).__plus((1));
  5339. return i;
  5340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5341. $4=self._assert_equals_(i,(5));
  5342. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5343. args: [],
  5344. 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",
  5345. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5346. referencedClasses: []
  5347. }),
  5348. smalltalk.NumberTest);
  5349. smalltalk.addMethod(
  5350. smalltalk.method({
  5351. selector: "testTo",
  5352. category: 'tests',
  5353. fn: function (){
  5354. var self=this;
  5355. return smalltalk.withContext(function($ctx1) {
  5356. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5357. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5358. args: [],
  5359. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5360. messageSends: ["assert:equals:", "to:"],
  5361. referencedClasses: []
  5362. }),
  5363. smalltalk.NumberTest);
  5364. smalltalk.addMethod(
  5365. smalltalk.method({
  5366. selector: "testToBy",
  5367. category: 'tests',
  5368. fn: function (){
  5369. var self=this;
  5370. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5371. return smalltalk.withContext(function($ctx1) {
  5372. var $1;
  5373. $1=(0)._to_by_((6),(2));
  5374. $ctx1.sendIdx["to:by:"]=1;
  5375. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5376. self._should_raise_((function(){
  5377. return smalltalk.withContext(function($ctx2) {
  5378. return (1)._to_by_((4),(0));
  5379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5380. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5381. args: [],
  5382. 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",
  5383. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5384. referencedClasses: ["Error"]
  5385. }),
  5386. smalltalk.NumberTest);
  5387. smalltalk.addMethod(
  5388. smalltalk.method({
  5389. selector: "testTrigonometry",
  5390. category: 'tests',
  5391. fn: function (){
  5392. var self=this;
  5393. return smalltalk.withContext(function($ctx1) {
  5394. var $1,$2,$3,$4,$5,$6;
  5395. $1=self._assert_equals_((0)._cos(),(1));
  5396. $ctx1.sendIdx["assert:equals:"]=1;
  5397. $2=self._assert_equals_((0)._sin(),(0));
  5398. $ctx1.sendIdx["assert:equals:"]=2;
  5399. $3=self._assert_equals_((0)._tan(),(0));
  5400. $ctx1.sendIdx["assert:equals:"]=3;
  5401. $4=self._assert_equals_((1)._arcCos(),(0));
  5402. $ctx1.sendIdx["assert:equals:"]=4;
  5403. $5=self._assert_equals_((0)._arcSin(),(0));
  5404. $ctx1.sendIdx["assert:equals:"]=5;
  5405. $6=self._assert_equals_((0)._arcTan(),(0));
  5406. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5407. args: [],
  5408. 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.",
  5409. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5410. referencedClasses: []
  5411. }),
  5412. smalltalk.NumberTest);
  5413. smalltalk.addMethod(
  5414. smalltalk.method({
  5415. selector: "testTruncated",
  5416. category: 'tests',
  5417. fn: function (){
  5418. var self=this;
  5419. return smalltalk.withContext(function($ctx1) {
  5420. var $2,$1,$4,$3,$6,$5;
  5421. $2=(3)._truncated();
  5422. $ctx1.sendIdx["truncated"]=1;
  5423. $1=self._assert_equals_($2,(3));
  5424. $ctx1.sendIdx["assert:equals:"]=1;
  5425. $4=(3.212)._truncated();
  5426. $ctx1.sendIdx["truncated"]=2;
  5427. $3=self._assert_equals_($4,(3));
  5428. $ctx1.sendIdx["assert:equals:"]=2;
  5429. $6=(3.51)._truncated();
  5430. $5=self._assert_equals_($6,(3));
  5431. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5432. args: [],
  5433. 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",
  5434. messageSends: ["assert:equals:", "truncated"],
  5435. referencedClasses: []
  5436. }),
  5437. smalltalk.NumberTest);
  5438. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5439. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5440. smalltalk.addMethod(
  5441. smalltalk.method({
  5442. selector: "foo",
  5443. category: 'not yet classified',
  5444. fn: function (){
  5445. var self=this;
  5446. return smalltalk.withContext(function($ctx1) {
  5447. var $1;
  5448. $1=self["@foo"];
  5449. return $1;
  5450. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5451. args: [],
  5452. source: "foo\x0a\x09^foo",
  5453. messageSends: [],
  5454. referencedClasses: []
  5455. }),
  5456. smalltalk.ObjectMock);
  5457. smalltalk.addMethod(
  5458. smalltalk.method({
  5459. selector: "foo:",
  5460. category: 'not yet classified',
  5461. fn: function (anObject){
  5462. var self=this;
  5463. return smalltalk.withContext(function($ctx1) {
  5464. self["@foo"]=anObject;
  5465. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5466. args: ["anObject"],
  5467. source: "foo: anObject\x0a\x09foo := anObject",
  5468. messageSends: [],
  5469. referencedClasses: []
  5470. }),
  5471. smalltalk.ObjectMock);
  5472. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5473. smalltalk.addMethod(
  5474. smalltalk.method({
  5475. selector: "notDefined",
  5476. category: 'tests',
  5477. fn: function (){
  5478. var self=this;
  5479. return smalltalk.withContext(function($ctx1) {
  5480. return void 0;;
  5481. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5482. args: [],
  5483. source: "notDefined\x0a\x09<return void 0;>",
  5484. messageSends: [],
  5485. referencedClasses: []
  5486. }),
  5487. smalltalk.ObjectTest);
  5488. smalltalk.addMethod(
  5489. smalltalk.method({
  5490. selector: "testBasicAccess",
  5491. category: 'tests',
  5492. fn: function (){
  5493. var self=this;
  5494. var o;
  5495. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5496. return smalltalk.withContext(function($ctx1) {
  5497. var $2,$1,$4,$3;
  5498. o=_st($Object())._new();
  5499. _st(o)._basicAt_put_("a",(1));
  5500. $2=_st(o)._basicAt_("a");
  5501. $ctx1.sendIdx["basicAt:"]=1;
  5502. $1=self._assert_equals_($2,(1));
  5503. $ctx1.sendIdx["assert:equals:"]=1;
  5504. $4=_st(o)._basicAt_("b");
  5505. $3=self._assert_equals_($4,nil);
  5506. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5507. args: [],
  5508. 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",
  5509. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5510. referencedClasses: ["Object"]
  5511. }),
  5512. smalltalk.ObjectTest);
  5513. smalltalk.addMethod(
  5514. smalltalk.method({
  5515. selector: "testBasicPerform",
  5516. category: 'tests',
  5517. fn: function (){
  5518. var self=this;
  5519. var o;
  5520. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5521. return smalltalk.withContext(function($ctx1) {
  5522. var $1,$2,$3,$4;
  5523. o=_st($Object())._new();
  5524. $1=_st(o)._basicAt_put_("func",(function(){
  5525. return smalltalk.withContext(function($ctx2) {
  5526. return "hello";
  5527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5528. $ctx1.sendIdx["basicAt:put:"]=1;
  5529. $2=_st(o)._basicAt_put_("func2",(function(a){
  5530. return smalltalk.withContext(function($ctx2) {
  5531. return _st(a).__plus((1));
  5532. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5533. $3=self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5534. $ctx1.sendIdx["assert:equals:"]=1;
  5535. $4=self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5536. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5537. args: [],
  5538. 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",
  5539. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5540. referencedClasses: ["Object"]
  5541. }),
  5542. smalltalk.ObjectTest);
  5543. smalltalk.addMethod(
  5544. smalltalk.method({
  5545. selector: "testDNU",
  5546. category: 'tests',
  5547. fn: function (){
  5548. var self=this;
  5549. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5550. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5551. return smalltalk.withContext(function($ctx1) {
  5552. self._should_raise_((function(){
  5553. return smalltalk.withContext(function($ctx2) {
  5554. return _st(_st($Object())._new())._foo();
  5555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5556. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5557. args: [],
  5558. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  5559. messageSends: ["should:raise:", "foo", "new"],
  5560. referencedClasses: ["Object", "MessageNotUnderstood"]
  5561. }),
  5562. smalltalk.ObjectTest);
  5563. smalltalk.addMethod(
  5564. smalltalk.method({
  5565. selector: "testEquality",
  5566. category: 'tests',
  5567. fn: function (){
  5568. var self=this;
  5569. var o;
  5570. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5571. return smalltalk.withContext(function($ctx1) {
  5572. var $2,$3,$1,$5,$4,$8,$7,$6,$11,$12,$10,$9;
  5573. o=_st($Object())._new();
  5574. $ctx1.sendIdx["new"]=1;
  5575. $2=o;
  5576. $3=_st($Object())._new();
  5577. $1=_st($2).__eq($3);
  5578. $ctx1.sendIdx["="]=1;
  5579. self._deny_($1);
  5580. $5=_st(o).__eq(o);
  5581. $ctx1.sendIdx["="]=2;
  5582. $4=self._assert_($5);
  5583. $ctx1.sendIdx["assert:"]=1;
  5584. $8=_st(o)._yourself();
  5585. $ctx1.sendIdx["yourself"]=1;
  5586. $7=_st($8).__eq(o);
  5587. $ctx1.sendIdx["="]=3;
  5588. $6=self._assert_($7);
  5589. $ctx1.sendIdx["assert:"]=2;
  5590. $11=o;
  5591. $12=_st(o)._yourself();
  5592. $10=_st($11).__eq($12);
  5593. $9=self._assert_($10);
  5594. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5595. args: [],
  5596. 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)",
  5597. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5598. referencedClasses: ["Object"]
  5599. }),
  5600. smalltalk.ObjectTest);
  5601. smalltalk.addMethod(
  5602. smalltalk.method({
  5603. selector: "testHalt",
  5604. category: 'tests',
  5605. fn: function (){
  5606. var self=this;
  5607. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5608. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5609. return smalltalk.withContext(function($ctx1) {
  5610. self._should_raise_((function(){
  5611. return smalltalk.withContext(function($ctx2) {
  5612. return _st(_st($Object())._new())._halt();
  5613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5614. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5615. args: [],
  5616. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  5617. messageSends: ["should:raise:", "halt", "new"],
  5618. referencedClasses: ["Object", "Error"]
  5619. }),
  5620. smalltalk.ObjectTest);
  5621. smalltalk.addMethod(
  5622. smalltalk.method({
  5623. selector: "testIdentity",
  5624. category: 'tests',
  5625. fn: function (){
  5626. var self=this;
  5627. var o;
  5628. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5629. return smalltalk.withContext(function($ctx1) {
  5630. var $2,$3,$1,$5,$4,$8,$7,$6,$11,$12,$10,$9;
  5631. o=_st($Object())._new();
  5632. $ctx1.sendIdx["new"]=1;
  5633. $2=o;
  5634. $3=_st($Object())._new();
  5635. $1=_st($2).__eq_eq($3);
  5636. $ctx1.sendIdx["=="]=1;
  5637. self._deny_($1);
  5638. $5=_st(o).__eq_eq(o);
  5639. $ctx1.sendIdx["=="]=2;
  5640. $4=self._assert_($5);
  5641. $ctx1.sendIdx["assert:"]=1;
  5642. $8=_st(o)._yourself();
  5643. $ctx1.sendIdx["yourself"]=1;
  5644. $7=_st($8).__eq_eq(o);
  5645. $ctx1.sendIdx["=="]=3;
  5646. $6=self._assert_($7);
  5647. $ctx1.sendIdx["assert:"]=2;
  5648. $11=o;
  5649. $12=_st(o)._yourself();
  5650. $10=_st($11).__eq_eq($12);
  5651. $9=self._assert_($10);
  5652. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5653. args: [],
  5654. 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",
  5655. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5656. referencedClasses: ["Object"]
  5657. }),
  5658. smalltalk.ObjectTest);
  5659. smalltalk.addMethod(
  5660. smalltalk.method({
  5661. selector: "testIfNil",
  5662. category: 'tests',
  5663. fn: function (){
  5664. var self=this;
  5665. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5666. return smalltalk.withContext(function($ctx1) {
  5667. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  5668. $3=_st($Object())._new();
  5669. $ctx1.sendIdx["new"]=1;
  5670. $2=_st($3)._isNil();
  5671. $1=self._deny_($2);
  5672. $ctx1.sendIdx["deny:"]=1;
  5673. $7=_st($Object())._new();
  5674. $ctx1.sendIdx["new"]=2;
  5675. if(($receiver = $7) == nil || $receiver == null){
  5676. $6=true;
  5677. } else {
  5678. $6=$7;
  5679. };
  5680. $5=_st($6).__eq(true);
  5681. $4=self._deny_($5);
  5682. $10=_st($Object())._new();
  5683. $ctx1.sendIdx["new"]=3;
  5684. if(($receiver = $10) == nil || $receiver == null){
  5685. $9=$10;
  5686. } else {
  5687. $9=true;
  5688. };
  5689. $8=self._assert_equals_($9,true);
  5690. $ctx1.sendIdx["assert:equals:"]=1;
  5691. $13=_st($Object())._new();
  5692. $ctx1.sendIdx["new"]=4;
  5693. if(($receiver = $13) == nil || $receiver == null){
  5694. $12=false;
  5695. } else {
  5696. $12=true;
  5697. };
  5698. $11=self._assert_equals_($12,true);
  5699. $ctx1.sendIdx["assert:equals:"]=2;
  5700. $16=_st($Object())._new();
  5701. if(($receiver = $16) == nil || $receiver == null){
  5702. $15=false;
  5703. } else {
  5704. $15=true;
  5705. };
  5706. $14=self._assert_equals_($15,true);
  5707. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5708. args: [],
  5709. 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",
  5710. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5711. referencedClasses: ["Object"]
  5712. }),
  5713. smalltalk.ObjectTest);
  5714. smalltalk.addMethod(
  5715. smalltalk.method({
  5716. selector: "testInstVars",
  5717. category: 'tests',
  5718. fn: function (){
  5719. var self=this;
  5720. var o;
  5721. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5722. return smalltalk.withContext(function($ctx1) {
  5723. var $2,$1,$4,$3,$6,$5;
  5724. o=_st($ObjectMock())._new();
  5725. $2=_st(o)._instVarAt_("foo");
  5726. $ctx1.sendIdx["instVarAt:"]=1;
  5727. $1=self._assert_equals_($2,nil);
  5728. $ctx1.sendIdx["assert:equals:"]=1;
  5729. _st(o)._instVarAt_put_("foo",(1));
  5730. $4=_st(o)._instVarAt_("foo");
  5731. $ctx1.sendIdx["instVarAt:"]=2;
  5732. $3=self._assert_equals_($4,(1));
  5733. $ctx1.sendIdx["assert:equals:"]=2;
  5734. $6=_st(o)._instVarAt_("foo");
  5735. $5=self._assert_equals_($6,(1));
  5736. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5737. args: [],
  5738. 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",
  5739. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5740. referencedClasses: ["ObjectMock"]
  5741. }),
  5742. smalltalk.ObjectTest);
  5743. smalltalk.addMethod(
  5744. smalltalk.method({
  5745. selector: "testNilUndefined",
  5746. category: 'tests',
  5747. fn: function (){
  5748. var self=this;
  5749. return smalltalk.withContext(function($ctx1) {
  5750. self._assert_equals_(self._notDefined(),nil);
  5751. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5752. args: [],
  5753. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5754. messageSends: ["assert:equals:", "notDefined"],
  5755. referencedClasses: []
  5756. }),
  5757. smalltalk.ObjectTest);
  5758. smalltalk.addMethod(
  5759. smalltalk.method({
  5760. selector: "testYourself",
  5761. category: 'tests',
  5762. fn: function (){
  5763. var self=this;
  5764. var o;
  5765. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5766. return smalltalk.withContext(function($ctx1) {
  5767. o=_st($ObjectMock())._new();
  5768. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5769. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5770. args: [],
  5771. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5772. messageSends: ["new", "assert:", "==", "yourself"],
  5773. referencedClasses: ["ObjectMock"]
  5774. }),
  5775. smalltalk.ObjectTest);
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "testidentityHash",
  5779. category: 'tests',
  5780. fn: function (){
  5781. var self=this;
  5782. var o1,o2;
  5783. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5784. return smalltalk.withContext(function($ctx1) {
  5785. var $2,$3,$1,$5,$6,$4;
  5786. o1=_st($Object())._new();
  5787. $ctx1.sendIdx["new"]=1;
  5788. o2=_st($Object())._new();
  5789. $2=_st(o1)._identityHash();
  5790. $ctx1.sendIdx["identityHash"]=1;
  5791. $3=_st(o1)._identityHash();
  5792. $ctx1.sendIdx["identityHash"]=2;
  5793. $1=_st($2).__eq_eq($3);
  5794. $ctx1.sendIdx["=="]=1;
  5795. self._assert_($1);
  5796. $5=_st(o1)._identityHash();
  5797. $ctx1.sendIdx["identityHash"]=3;
  5798. $6=_st(o2)._identityHash();
  5799. $4=_st($5).__eq_eq($6);
  5800. self._deny_($4);
  5801. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5802. args: [],
  5803. 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",
  5804. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5805. referencedClasses: ["Object"]
  5806. }),
  5807. smalltalk.ObjectTest);
  5808. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5809. smalltalk.addMethod(
  5810. smalltalk.method({
  5811. selector: "testAccessing",
  5812. category: 'tests',
  5813. fn: function (){
  5814. var self=this;
  5815. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5816. return smalltalk.withContext(function($ctx1) {
  5817. var $3,$2,$1,$6,$5,$4,$10,$9,$8,$7,$14,$13,$12,$11;
  5818. $3=_st($Point())._x_y_((3),(4));
  5819. $ctx1.sendIdx["x:y:"]=1;
  5820. $2=_st($3)._x();
  5821. $ctx1.sendIdx["x"]=1;
  5822. $1=self._assert_equals_($2,(3));
  5823. $ctx1.sendIdx["assert:equals:"]=1;
  5824. $6=_st($Point())._x_y_((3),(4));
  5825. $5=_st($6)._y();
  5826. $ctx1.sendIdx["y"]=1;
  5827. $4=self._assert_equals_($5,(4));
  5828. $ctx1.sendIdx["assert:equals:"]=2;
  5829. $10=_st($Point())._new();
  5830. $ctx1.sendIdx["new"]=1;
  5831. $9=_st($10)._x_((3));
  5832. $8=_st($9)._x();
  5833. $7=self._assert_equals_($8,(3));
  5834. $ctx1.sendIdx["assert:equals:"]=3;
  5835. $14=_st($Point())._new();
  5836. $13=_st($14)._y_((4));
  5837. $12=_st($13)._y();
  5838. $11=self._assert_equals_($12,(4));
  5839. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5840. args: [],
  5841. 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",
  5842. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5843. referencedClasses: ["Point"]
  5844. }),
  5845. smalltalk.PointTest);
  5846. smalltalk.addMethod(
  5847. smalltalk.method({
  5848. selector: "testArithmetic",
  5849. category: 'tests',
  5850. fn: function (){
  5851. var self=this;
  5852. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5853. return smalltalk.withContext(function($ctx1) {
  5854. var $3,$4,$2,$5,$1,$8,$9,$7,$10,$6,$13,$14,$12,$15,$11,$18,$19,$17,$20,$16;
  5855. $3=(3).__at((4));
  5856. $ctx1.sendIdx["@"]=1;
  5857. $4=(3).__at((4));
  5858. $ctx1.sendIdx["@"]=2;
  5859. $2=_st($3).__star($4);
  5860. $5=_st($Point())._x_y_((9),(16));
  5861. $ctx1.sendIdx["x:y:"]=1;
  5862. $1=self._assert_equals_($2,$5);
  5863. $ctx1.sendIdx["assert:equals:"]=1;
  5864. $8=(3).__at((4));
  5865. $ctx1.sendIdx["@"]=3;
  5866. $9=(3).__at((4));
  5867. $ctx1.sendIdx["@"]=4;
  5868. $7=_st($8).__plus($9);
  5869. $10=_st($Point())._x_y_((6),(8));
  5870. $ctx1.sendIdx["x:y:"]=2;
  5871. $6=self._assert_equals_($7,$10);
  5872. $ctx1.sendIdx["assert:equals:"]=2;
  5873. $13=(3).__at((4));
  5874. $ctx1.sendIdx["@"]=5;
  5875. $14=(3).__at((4));
  5876. $ctx1.sendIdx["@"]=6;
  5877. $12=_st($13).__minus($14);
  5878. $15=_st($Point())._x_y_((0),(0));
  5879. $ctx1.sendIdx["x:y:"]=3;
  5880. $11=self._assert_equals_($12,$15);
  5881. $ctx1.sendIdx["assert:equals:"]=3;
  5882. $18=(6).__at((8));
  5883. $ctx1.sendIdx["@"]=7;
  5884. $19=(3).__at((4));
  5885. $17=_st($18).__slash($19);
  5886. $20=_st($Point())._x_y_((2),(2));
  5887. $16=self._assert_equals_($17,$20);
  5888. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5889. args: [],
  5890. 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)",
  5891. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5892. referencedClasses: ["Point"]
  5893. }),
  5894. smalltalk.PointTest);
  5895. smalltalk.addMethod(
  5896. smalltalk.method({
  5897. selector: "testAt",
  5898. category: 'tests',
  5899. fn: function (){
  5900. var self=this;
  5901. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5902. return smalltalk.withContext(function($ctx1) {
  5903. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5904. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5905. args: [],
  5906. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5907. messageSends: ["assert:equals:", "@", "x:y:"],
  5908. referencedClasses: ["Point"]
  5909. }),
  5910. smalltalk.PointTest);
  5911. smalltalk.addMethod(
  5912. smalltalk.method({
  5913. selector: "testEgality",
  5914. category: 'tests',
  5915. fn: function (){
  5916. var self=this;
  5917. return smalltalk.withContext(function($ctx1) {
  5918. var $2,$3,$1,$5,$6,$4;
  5919. $2=(3).__at((4));
  5920. $ctx1.sendIdx["@"]=1;
  5921. $3=(3).__at((4));
  5922. $ctx1.sendIdx["@"]=2;
  5923. $1=_st($2).__eq($3);
  5924. $ctx1.sendIdx["="]=1;
  5925. self._assert_($1);
  5926. $5=(3).__at((5));
  5927. $ctx1.sendIdx["@"]=3;
  5928. $6=(3).__at((6));
  5929. $4=_st($5).__eq($6);
  5930. self._deny_($4);
  5931. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  5932. args: [],
  5933. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  5934. messageSends: ["assert:", "=", "@", "deny:"],
  5935. referencedClasses: []
  5936. }),
  5937. smalltalk.PointTest);
  5938. smalltalk.addMethod(
  5939. smalltalk.method({
  5940. selector: "testNew",
  5941. category: 'tests',
  5942. fn: function (){
  5943. var self=this;
  5944. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5945. return smalltalk.withContext(function($ctx1) {
  5946. var $4,$3,$2,$1,$9,$8,$7,$6,$5,$13,$12,$11,$10,$18,$17,$16,$15,$14;
  5947. $4=_st($Point())._new();
  5948. $ctx1.sendIdx["new"]=1;
  5949. $3=_st($4)._x_((3));
  5950. $ctx1.sendIdx["x:"]=1;
  5951. $2=_st($3)._y();
  5952. $ctx1.sendIdx["y"]=1;
  5953. $1=self._assert_equals_($2,nil);
  5954. $ctx1.sendIdx["assert:equals:"]=1;
  5955. $9=_st($Point())._new();
  5956. $ctx1.sendIdx["new"]=2;
  5957. $8=_st($9)._x_((3));
  5958. $7=_st($8)._x();
  5959. $ctx1.sendIdx["x"]=1;
  5960. $6=_st($7).__eq((0));
  5961. $ctx1.sendIdx["="]=1;
  5962. $5=self._deny_($6);
  5963. $ctx1.sendIdx["deny:"]=1;
  5964. $13=_st($Point())._new();
  5965. $ctx1.sendIdx["new"]=3;
  5966. $12=_st($13)._y_((4));
  5967. $ctx1.sendIdx["y:"]=1;
  5968. $11=_st($12)._x();
  5969. $10=self._assert_equals_($11,nil);
  5970. $18=_st($Point())._new();
  5971. $17=_st($18)._y_((4));
  5972. $16=_st($17)._y();
  5973. $15=_st($16).__eq((0));
  5974. $14=self._deny_($15);
  5975. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  5976. args: [],
  5977. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  5978. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  5979. referencedClasses: ["Point"]
  5980. }),
  5981. smalltalk.PointTest);
  5982. smalltalk.addMethod(
  5983. smalltalk.method({
  5984. selector: "testTranslateBy",
  5985. category: 'tests',
  5986. fn: function (){
  5987. var self=this;
  5988. return smalltalk.withContext(function($ctx1) {
  5989. var $3,$4,$2,$5,$1,$8,$10,$9,$7,$11,$6,$14,$15,$13,$16,$12,$19,$21,$20,$18,$22,$17;
  5990. $3=(3).__at((3));
  5991. $ctx1.sendIdx["@"]=1;
  5992. $4=(0).__at((1));
  5993. $ctx1.sendIdx["@"]=2;
  5994. $2=_st($3)._translateBy_($4);
  5995. $ctx1.sendIdx["translateBy:"]=1;
  5996. $5=(3).__at((4));
  5997. $ctx1.sendIdx["@"]=3;
  5998. $1=self._assert_equals_($2,$5);
  5999. $ctx1.sendIdx["assert:equals:"]=1;
  6000. $8=(3).__at((3));
  6001. $ctx1.sendIdx["@"]=4;
  6002. $10=(1)._negated();
  6003. $ctx1.sendIdx["negated"]=1;
  6004. $9=(0).__at($10);
  6005. $ctx1.sendIdx["@"]=5;
  6006. $7=_st($8)._translateBy_($9);
  6007. $ctx1.sendIdx["translateBy:"]=2;
  6008. $11=(3).__at((2));
  6009. $ctx1.sendIdx["@"]=6;
  6010. $6=self._assert_equals_($7,$11);
  6011. $ctx1.sendIdx["assert:equals:"]=2;
  6012. $14=(3).__at((3));
  6013. $ctx1.sendIdx["@"]=7;
  6014. $15=(2).__at((3));
  6015. $ctx1.sendIdx["@"]=8;
  6016. $13=_st($14)._translateBy_($15);
  6017. $ctx1.sendIdx["translateBy:"]=3;
  6018. $16=(5).__at((6));
  6019. $ctx1.sendIdx["@"]=9;
  6020. $12=self._assert_equals_($13,$16);
  6021. $ctx1.sendIdx["assert:equals:"]=3;
  6022. $19=(3).__at((3));
  6023. $ctx1.sendIdx["@"]=10;
  6024. $21=(3)._negated();
  6025. $20=_st($21).__at((0));
  6026. $ctx1.sendIdx["@"]=11;
  6027. $18=_st($19)._translateBy_($20);
  6028. $22=(0).__at((3));
  6029. $17=self._assert_equals_($18,$22);
  6030. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6031. args: [],
  6032. 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.",
  6033. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6034. referencedClasses: []
  6035. }),
  6036. smalltalk.PointTest);
  6037. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6038. smalltalk.addMethod(
  6039. smalltalk.method({
  6040. selector: "testNextIfAbsent",
  6041. category: 'tests',
  6042. fn: function (){
  6043. var self=this;
  6044. var queue;
  6045. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6046. return smalltalk.withContext(function($ctx1) {
  6047. var $2,$1,$4,$3;
  6048. queue=_st($Queue())._new();
  6049. _st(queue)._nextPut_("index1");
  6050. $2=_st(queue)._nextIfAbsent_("empty");
  6051. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6052. $1=_st($2).__eq("index1");
  6053. $ctx1.sendIdx["="]=1;
  6054. self._assert_($1);
  6055. $4=_st(queue)._nextIfAbsent_("empty");
  6056. $3=_st($4).__eq("index1");
  6057. self._deny_($3);
  6058. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6059. args: [],
  6060. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  6061. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6062. referencedClasses: ["Queue"]
  6063. }),
  6064. smalltalk.QueueTest);
  6065. smalltalk.addMethod(
  6066. smalltalk.method({
  6067. selector: "testQueueNext",
  6068. category: 'tests',
  6069. fn: function (){
  6070. var self=this;
  6071. var queue;
  6072. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6073. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6074. return smalltalk.withContext(function($ctx1) {
  6075. var $1,$2,$4,$3,$6,$5;
  6076. queue=_st($Queue())._new();
  6077. $1=queue;
  6078. _st($1)._nextPut_("index1");
  6079. $ctx1.sendIdx["nextPut:"]=1;
  6080. $2=_st($1)._nextPut_("index2");
  6081. $4=_st(queue)._next();
  6082. $ctx1.sendIdx["next"]=1;
  6083. $3=_st($4).__eq("index1");
  6084. $ctx1.sendIdx["="]=1;
  6085. self._assert_($3);
  6086. $6=_st(queue)._next();
  6087. $ctx1.sendIdx["next"]=2;
  6088. $5=_st($6).__eq("index");
  6089. self._deny_($5);
  6090. self._should_raise_((function(){
  6091. return smalltalk.withContext(function($ctx2) {
  6092. return _st(queue)._next();
  6093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6094. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6095. args: [],
  6096. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  6097. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6098. referencedClasses: ["Queue", "Error"]
  6099. }),
  6100. smalltalk.QueueTest);
  6101. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6102. smalltalk.addMethod(
  6103. smalltalk.method({
  6104. selector: "testAtRandomNumber",
  6105. category: 'tests',
  6106. fn: function (){
  6107. var self=this;
  6108. var val;
  6109. return smalltalk.withContext(function($ctx1) {
  6110. (100)._timesRepeat_((function(){
  6111. return smalltalk.withContext(function($ctx2) {
  6112. val=(10)._atRandom();
  6113. val;
  6114. self._assert_(_st(val).__gt((0)));
  6115. return self._assert_(_st(val).__lt((11)));
  6116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6117. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6118. args: [],
  6119. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  6120. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6121. referencedClasses: []
  6122. }),
  6123. smalltalk.RandomTest);
  6124. smalltalk.addMethod(
  6125. smalltalk.method({
  6126. selector: "testAtRandomSequenceableCollection",
  6127. category: 'tests',
  6128. fn: function (){
  6129. var self=this;
  6130. var val;
  6131. return smalltalk.withContext(function($ctx1) {
  6132. (100)._timesRepeat_((function(){
  6133. return smalltalk.withContext(function($ctx2) {
  6134. val="abc"._atRandom();
  6135. val;
  6136. return self._assert_(_st(_st(_st(val).__eq("a")).__or(_st(val).__eq("b"))).__or(_st(val).__eq("c")));
  6137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6138. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6139. args: [],
  6140. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  6141. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6142. referencedClasses: []
  6143. }),
  6144. smalltalk.RandomTest);
  6145. smalltalk.addMethod(
  6146. smalltalk.method({
  6147. selector: "textNext",
  6148. category: 'tests',
  6149. fn: function (){
  6150. var self=this;
  6151. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6152. return smalltalk.withContext(function($ctx1) {
  6153. var $1;
  6154. (10000)._timesRepeat_((function(){
  6155. var current,next;
  6156. return smalltalk.withContext(function($ctx2) {
  6157. next=_st(_st($Random())._new())._next();
  6158. next;
  6159. self._assert_(_st(next).__gt_eq((0)));
  6160. $ctx2.sendIdx["assert:"]=1;
  6161. self._assert_(_st(next).__lt((1)));
  6162. $1=_st(current).__eq(next);
  6163. $ctx2.sendIdx["="]=1;
  6164. self._deny_($1);
  6165. return _st(next).__eq(current);
  6166. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6167. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6168. args: [],
  6169. 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]",
  6170. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6171. referencedClasses: ["Random"]
  6172. }),
  6173. smalltalk.RandomTest);
  6174. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6175. smalltalk.addMethod(
  6176. smalltalk.method({
  6177. selector: "testAddRemove",
  6178. category: 'tests',
  6179. fn: function (){
  6180. var self=this;
  6181. var set;
  6182. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6183. return smalltalk.withContext(function($ctx1) {
  6184. var $1,$2,$4,$3,$5,$7,$6,$8;
  6185. set=_st($Set())._new();
  6186. $1=self._assert_(_st(set)._isEmpty());
  6187. $ctx1.sendIdx["assert:"]=1;
  6188. $2=_st(set)._add_((3));
  6189. $ctx1.sendIdx["add:"]=1;
  6190. $4=_st(set)._includes_((3));
  6191. $ctx1.sendIdx["includes:"]=1;
  6192. $3=self._assert_($4);
  6193. $ctx1.sendIdx["assert:"]=2;
  6194. $5=_st(set)._add_((5));
  6195. $7=_st(set)._includes_((5));
  6196. $ctx1.sendIdx["includes:"]=2;
  6197. $6=self._assert_($7);
  6198. _st(set)._remove_((3));
  6199. $8=_st(set)._includes_((3));
  6200. self._deny_($8);
  6201. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6202. args: [],
  6203. 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)",
  6204. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6205. referencedClasses: ["Set"]
  6206. }),
  6207. smalltalk.SetTest);
  6208. smalltalk.addMethod(
  6209. smalltalk.method({
  6210. selector: "testAt",
  6211. category: 'tests',
  6212. fn: function (){
  6213. var self=this;
  6214. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6215. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6216. return smalltalk.withContext(function($ctx1) {
  6217. self._should_raise_((function(){
  6218. return smalltalk.withContext(function($ctx2) {
  6219. return _st(_st($Set())._new())._at_put_((1),(2));
  6220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6221. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6222. args: [],
  6223. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  6224. messageSends: ["should:raise:", "at:put:", "new"],
  6225. referencedClasses: ["Set", "Error"]
  6226. }),
  6227. smalltalk.SetTest);
  6228. smalltalk.addMethod(
  6229. smalltalk.method({
  6230. selector: "testCollect",
  6231. category: 'tests',
  6232. fn: function (){
  6233. var self=this;
  6234. return smalltalk.withContext(function($ctx1) {
  6235. var $2,$1,$3;
  6236. $2=[(5), (6), (8)]._asSet();
  6237. $ctx1.sendIdx["asSet"]=1;
  6238. $1=_st($2)._collect_((function(x){
  6239. return smalltalk.withContext(function($ctx2) {
  6240. return _st(x).__backslash_backslash((3));
  6241. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6242. $3=[(0), (2)]._asSet();
  6243. self._assert_equals_($1,$3);
  6244. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6245. args: [],
  6246. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6247. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6248. referencedClasses: []
  6249. }),
  6250. smalltalk.SetTest);
  6251. smalltalk.addMethod(
  6252. smalltalk.method({
  6253. selector: "testComparing",
  6254. category: 'tests',
  6255. fn: function (){
  6256. var self=this;
  6257. return smalltalk.withContext(function($ctx1) {
  6258. var $2,$3,$1,$5,$6,$4,$9,$10,$8,$7,$13,$14,$12,$11;
  6259. $2=[(0), (2)]._asSet();
  6260. $ctx1.sendIdx["asSet"]=1;
  6261. $3=[(0), (2)]._asSet();
  6262. $ctx1.sendIdx["asSet"]=2;
  6263. $1=self._assert_equals_($2,$3);
  6264. $ctx1.sendIdx["assert:equals:"]=1;
  6265. $5=[(2), (0)]._asSet();
  6266. $ctx1.sendIdx["asSet"]=3;
  6267. $6=[(0), (2)]._asSet();
  6268. $ctx1.sendIdx["asSet"]=4;
  6269. $4=self._assert_equals_($5,$6);
  6270. $9=[(0), (2), (3)]._asSet();
  6271. $ctx1.sendIdx["asSet"]=5;
  6272. $10=[(0), (2)]._asSet();
  6273. $ctx1.sendIdx["asSet"]=6;
  6274. $8=_st($9).__eq($10);
  6275. $ctx1.sendIdx["="]=1;
  6276. $7=self._deny_($8);
  6277. $ctx1.sendIdx["deny:"]=1;
  6278. $13=[(1), (2)]._asSet();
  6279. $ctx1.sendIdx["asSet"]=7;
  6280. $14=[(0), (2)]._asSet();
  6281. $12=_st($13).__eq($14);
  6282. $11=self._deny_($12);
  6283. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6284. args: [],
  6285. 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",
  6286. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6287. referencedClasses: []
  6288. }),
  6289. smalltalk.SetTest);
  6290. smalltalk.addMethod(
  6291. smalltalk.method({
  6292. selector: "testPrintString",
  6293. category: 'tests',
  6294. fn: function (){
  6295. var self=this;
  6296. var set;
  6297. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6298. return smalltalk.withContext(function($ctx1) {
  6299. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10,$11,$13,$12,$14,$16,$15,$17,$19,$18;
  6300. set=_st($Set())._new();
  6301. $2=_st(set)._printString();
  6302. $ctx1.sendIdx["printString"]=1;
  6303. $1=self._assert_equals_($2,"a Set ()");
  6304. $ctx1.sendIdx["assert:equals:"]=1;
  6305. $3=set;
  6306. _st($3)._add_((1));
  6307. $ctx1.sendIdx["add:"]=1;
  6308. $4=_st($3)._add_((3));
  6309. $ctx1.sendIdx["add:"]=2;
  6310. $6=_st(set)._printString();
  6311. $ctx1.sendIdx["printString"]=2;
  6312. $5=self._assert_equals_($6,"a Set (1 3)");
  6313. $ctx1.sendIdx["assert:equals:"]=2;
  6314. $7=_st(set)._add_("foo");
  6315. $ctx1.sendIdx["add:"]=3;
  6316. $9=_st(set)._printString();
  6317. $ctx1.sendIdx["printString"]=3;
  6318. $8=self._assert_equals_($9,"a Set (1 3 'foo')");
  6319. $ctx1.sendIdx["assert:equals:"]=3;
  6320. $10=set;
  6321. _st($10)._remove_((1));
  6322. $ctx1.sendIdx["remove:"]=1;
  6323. $11=_st($10)._remove_((3));
  6324. $13=_st(set)._printString();
  6325. $ctx1.sendIdx["printString"]=4;
  6326. $12=self._assert_equals_($13,"a Set ('foo')");
  6327. $ctx1.sendIdx["assert:equals:"]=4;
  6328. $14=_st(set)._add_((3));
  6329. $ctx1.sendIdx["add:"]=4;
  6330. $16=_st(set)._printString();
  6331. $ctx1.sendIdx["printString"]=5;
  6332. $15=self._assert_equals_($16,"a Set ('foo' 3)");
  6333. $ctx1.sendIdx["assert:equals:"]=5;
  6334. $17=_st(set)._add_((3));
  6335. $19=_st(set)._printString();
  6336. $18=self._assert_equals_($19,"a Set ('foo' 3)");
  6337. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6338. args: [],
  6339. 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)'",
  6340. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6341. referencedClasses: ["Set"]
  6342. }),
  6343. smalltalk.SetTest);
  6344. smalltalk.addMethod(
  6345. smalltalk.method({
  6346. selector: "testSize",
  6347. category: 'tests',
  6348. fn: function (){
  6349. var self=this;
  6350. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6351. return smalltalk.withContext(function($ctx1) {
  6352. var $2,$1,$5,$4,$3,$8,$7,$6;
  6353. $2=_st(_st($Set())._new())._size();
  6354. $ctx1.sendIdx["size"]=1;
  6355. $1=self._assert_equals_($2,(0));
  6356. $ctx1.sendIdx["assert:equals:"]=1;
  6357. $5=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6358. $ctx1.sendIdx["withAll:"]=1;
  6359. $4=_st($5)._size();
  6360. $ctx1.sendIdx["size"]=2;
  6361. $3=self._assert_equals_($4,(4));
  6362. $ctx1.sendIdx["assert:equals:"]=2;
  6363. $8=_st($Set())._withAll_([(1), (1), (1), (1)]);
  6364. $7=_st($8)._size();
  6365. $6=self._assert_equals_($7,(1));
  6366. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6367. args: [],
  6368. 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",
  6369. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6370. referencedClasses: ["Set"]
  6371. }),
  6372. smalltalk.SetTest);
  6373. smalltalk.addMethod(
  6374. smalltalk.method({
  6375. selector: "testUnboxedObjects",
  6376. category: 'tests',
  6377. fn: function (){
  6378. var self=this;
  6379. return smalltalk.withContext(function($ctx1) {
  6380. var $4,$5,$3,$2,$1;
  6381. $4="foo"._yourself();
  6382. $ctx1.sendIdx["yourself"]=1;
  6383. $5="foo"._yourself();
  6384. $3=[$4,$5];
  6385. $2=_st($3)._asSet();
  6386. $1=_st($2)._asArray();
  6387. self._assert_equals_($1,["foo"]);
  6388. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6389. args: [],
  6390. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6391. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6392. referencedClasses: []
  6393. }),
  6394. smalltalk.SetTest);
  6395. smalltalk.addMethod(
  6396. smalltalk.method({
  6397. selector: "testUnicity",
  6398. category: 'tests',
  6399. fn: function (){
  6400. var self=this;
  6401. var set;
  6402. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6403. return smalltalk.withContext(function($ctx1) {
  6404. var $1,$2,$3,$5,$4,$6,$8,$7,$9;
  6405. set=_st($Set())._new();
  6406. $1=_st(set)._add_((21));
  6407. $ctx1.sendIdx["add:"]=1;
  6408. $2=_st(set)._add_("hello");
  6409. $ctx1.sendIdx["add:"]=2;
  6410. $3=_st(set)._add_((21));
  6411. $ctx1.sendIdx["add:"]=3;
  6412. $5=_st(set)._size();
  6413. $ctx1.sendIdx["size"]=1;
  6414. $4=self._assert_equals_($5,(2));
  6415. $ctx1.sendIdx["assert:equals:"]=1;
  6416. $6=_st(set)._add_("hello");
  6417. $8=_st(set)._size();
  6418. $7=self._assert_equals_($8,(2));
  6419. $ctx1.sendIdx["assert:equals:"]=2;
  6420. $9=self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6421. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6422. args: [],
  6423. 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')",
  6424. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6425. referencedClasses: ["Set"]
  6426. }),
  6427. smalltalk.SetTest);
  6428. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6429. smalltalk.addMethod(
  6430. smalltalk.method({
  6431. selector: "collectionClass",
  6432. category: 'accessing',
  6433. fn: function (){
  6434. var self=this;
  6435. return smalltalk.withContext(function($ctx1) {
  6436. var $1;
  6437. $1=_st(self._class())._collectionClass();
  6438. return $1;
  6439. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6440. args: [],
  6441. source: "collectionClass\x0a\x09^ self class collectionClass",
  6442. messageSends: ["collectionClass", "class"],
  6443. referencedClasses: []
  6444. }),
  6445. smalltalk.StreamTest);
  6446. smalltalk.addMethod(
  6447. smalltalk.method({
  6448. selector: "newCollection",
  6449. category: 'accessing',
  6450. fn: function (){
  6451. var self=this;
  6452. return smalltalk.withContext(function($ctx1) {
  6453. var $1;
  6454. $1=_st(self._collectionClass())._new();
  6455. return $1;
  6456. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6457. args: [],
  6458. source: "newCollection\x0a\x09^ self collectionClass new",
  6459. messageSends: ["new", "collectionClass"],
  6460. referencedClasses: []
  6461. }),
  6462. smalltalk.StreamTest);
  6463. smalltalk.addMethod(
  6464. smalltalk.method({
  6465. selector: "newStream",
  6466. category: 'accessing',
  6467. fn: function (){
  6468. var self=this;
  6469. return smalltalk.withContext(function($ctx1) {
  6470. var $1;
  6471. $1=_st(_st(self._collectionClass())._new())._stream();
  6472. return $1;
  6473. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6474. args: [],
  6475. source: "newStream\x0a\x09^ self collectionClass new stream",
  6476. messageSends: ["stream", "new", "collectionClass"],
  6477. referencedClasses: []
  6478. }),
  6479. smalltalk.StreamTest);
  6480. smalltalk.addMethod(
  6481. smalltalk.method({
  6482. selector: "testAtStartAtEnd",
  6483. category: 'tests',
  6484. fn: function (){
  6485. var self=this;
  6486. var stream;
  6487. return smalltalk.withContext(function($ctx1) {
  6488. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  6489. stream=self._newStream();
  6490. $2=_st(stream)._atStart();
  6491. $ctx1.sendIdx["atStart"]=1;
  6492. $1=self._assert_($2);
  6493. $ctx1.sendIdx["assert:"]=1;
  6494. $4=_st(stream)._atEnd();
  6495. $ctx1.sendIdx["atEnd"]=1;
  6496. $3=self._assert_($4);
  6497. $ctx1.sendIdx["assert:"]=2;
  6498. _st(stream)._nextPutAll_(self._newCollection());
  6499. $6=_st(stream)._atEnd();
  6500. $ctx1.sendIdx["atEnd"]=2;
  6501. $5=self._assert_($6);
  6502. $8=_st(stream)._atStart();
  6503. $ctx1.sendIdx["atStart"]=2;
  6504. $7=self._deny_($8);
  6505. $ctx1.sendIdx["deny:"]=1;
  6506. _st(stream)._position_((1));
  6507. $10=_st(stream)._atEnd();
  6508. $9=self._deny_($10);
  6509. $ctx1.sendIdx["deny:"]=2;
  6510. $12=_st(stream)._atStart();
  6511. $11=self._deny_($12);
  6512. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6513. args: [],
  6514. 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",
  6515. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6516. referencedClasses: []
  6517. }),
  6518. smalltalk.StreamTest);
  6519. smalltalk.addMethod(
  6520. smalltalk.method({
  6521. selector: "testContents",
  6522. category: 'tests',
  6523. fn: function (){
  6524. var self=this;
  6525. var stream;
  6526. return smalltalk.withContext(function($ctx1) {
  6527. var $1,$2,$3,$4;
  6528. stream=self._newStream();
  6529. $1=stream;
  6530. $2=self._newCollection();
  6531. $ctx1.sendIdx["newCollection"]=1;
  6532. _st($1)._nextPutAll_($2);
  6533. $3=_st(stream)._contents();
  6534. $4=self._newCollection();
  6535. self._assert_equals_($3,$4);
  6536. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6537. args: [],
  6538. 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",
  6539. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6540. referencedClasses: []
  6541. }),
  6542. smalltalk.StreamTest);
  6543. smalltalk.addMethod(
  6544. smalltalk.method({
  6545. selector: "testIsEmpty",
  6546. category: 'tests',
  6547. fn: function (){
  6548. var self=this;
  6549. var stream;
  6550. return smalltalk.withContext(function($ctx1) {
  6551. var $1,$2;
  6552. stream=self._newStream();
  6553. $1=_st(stream)._isEmpty();
  6554. $ctx1.sendIdx["isEmpty"]=1;
  6555. self._assert_($1);
  6556. _st(stream)._nextPutAll_(self._newCollection());
  6557. $2=_st(stream)._isEmpty();
  6558. self._deny_($2);
  6559. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6560. args: [],
  6561. 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",
  6562. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6563. referencedClasses: []
  6564. }),
  6565. smalltalk.StreamTest);
  6566. smalltalk.addMethod(
  6567. smalltalk.method({
  6568. selector: "testPosition",
  6569. category: 'tests',
  6570. fn: function (){
  6571. var self=this;
  6572. var collection,stream;
  6573. return smalltalk.withContext(function($ctx1) {
  6574. var $2,$1,$4,$3,$5,$7,$6,$8,$10,$9;
  6575. collection=self._newCollection();
  6576. stream=self._newStream();
  6577. _st(stream)._nextPutAll_(collection);
  6578. $2=_st(stream)._position();
  6579. $ctx1.sendIdx["position"]=1;
  6580. $1=self._assert_equals_($2,_st(collection)._size());
  6581. $ctx1.sendIdx["assert:equals:"]=1;
  6582. _st(stream)._position_((0));
  6583. $4=_st(stream)._position();
  6584. $ctx1.sendIdx["position"]=2;
  6585. $3=self._assert_equals_($4,(0));
  6586. $ctx1.sendIdx["assert:equals:"]=2;
  6587. $5=_st(stream)._next();
  6588. $ctx1.sendIdx["next"]=1;
  6589. $7=_st(stream)._position();
  6590. $ctx1.sendIdx["position"]=3;
  6591. $6=self._assert_equals_($7,(1));
  6592. $ctx1.sendIdx["assert:equals:"]=3;
  6593. $8=_st(stream)._next();
  6594. $10=_st(stream)._position();
  6595. $9=self._assert_equals_($10,(2));
  6596. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6597. args: [],
  6598. 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",
  6599. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6600. referencedClasses: []
  6601. }),
  6602. smalltalk.StreamTest);
  6603. smalltalk.addMethod(
  6604. smalltalk.method({
  6605. selector: "testReading",
  6606. category: 'tests',
  6607. fn: function (){
  6608. var self=this;
  6609. var stream,collection;
  6610. return smalltalk.withContext(function($ctx1) {
  6611. var $1,$2,$3,$5,$4;
  6612. collection=self._newCollection();
  6613. stream=self._newStream();
  6614. $1=stream;
  6615. _st($1)._nextPutAll_(collection);
  6616. $2=_st($1)._position_((0));
  6617. _st(collection)._do_((function(each){
  6618. return smalltalk.withContext(function($ctx2) {
  6619. $3=_st(stream)._next();
  6620. $ctx2.sendIdx["next"]=1;
  6621. return self._assert_equals_($3,each);
  6622. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6623. $5=_st(stream)._next();
  6624. $4=_st($5)._isNil();
  6625. self._assert_($4);
  6626. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6627. args: [],
  6628. 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",
  6629. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6630. referencedClasses: []
  6631. }),
  6632. smalltalk.StreamTest);
  6633. smalltalk.addMethod(
  6634. smalltalk.method({
  6635. selector: "testStreamContents",
  6636. category: 'tests',
  6637. fn: function (){
  6638. var self=this;
  6639. return smalltalk.withContext(function($ctx1) {
  6640. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6641. args: [],
  6642. source: "testStreamContents",
  6643. messageSends: [],
  6644. referencedClasses: []
  6645. }),
  6646. smalltalk.StreamTest);
  6647. smalltalk.addMethod(
  6648. smalltalk.method({
  6649. selector: "testWrite",
  6650. category: 'tests',
  6651. fn: function (){
  6652. var self=this;
  6653. var stream,collection;
  6654. return smalltalk.withContext(function($ctx1) {
  6655. collection=self._newCollection();
  6656. stream=self._newStream();
  6657. _st(collection)._do_((function(each){
  6658. return smalltalk.withContext(function($ctx2) {
  6659. return _st(stream).__lt_lt(each);
  6660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6661. self._assert_equals_(_st(stream)._contents(),collection);
  6662. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6663. args: [],
  6664. 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",
  6665. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6666. referencedClasses: []
  6667. }),
  6668. smalltalk.StreamTest);
  6669. smalltalk.addMethod(
  6670. smalltalk.method({
  6671. selector: "testWriting",
  6672. category: 'tests',
  6673. fn: function (){
  6674. var self=this;
  6675. var stream,collection;
  6676. return smalltalk.withContext(function($ctx1) {
  6677. var $2,$1,$4,$3;
  6678. collection=self._newCollection();
  6679. stream=self._newStream();
  6680. $ctx1.sendIdx["newStream"]=1;
  6681. _st(collection)._do_((function(each){
  6682. return smalltalk.withContext(function($ctx2) {
  6683. return _st(stream)._nextPut_(each);
  6684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6685. $2=_st(stream)._contents();
  6686. $ctx1.sendIdx["contents"]=1;
  6687. $1=self._assert_equals_($2,collection);
  6688. $ctx1.sendIdx["assert:equals:"]=1;
  6689. stream=self._newStream();
  6690. _st(stream)._nextPutAll_(collection);
  6691. $4=_st(stream)._contents();
  6692. $3=self._assert_equals_($4,collection);
  6693. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6694. args: [],
  6695. 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",
  6696. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6697. referencedClasses: []
  6698. }),
  6699. smalltalk.StreamTest);
  6700. smalltalk.addMethod(
  6701. smalltalk.method({
  6702. selector: "collectionClass",
  6703. category: 'accessing',
  6704. fn: function (){
  6705. var self=this;
  6706. return smalltalk.withContext(function($ctx1) {
  6707. return nil;
  6708. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6709. args: [],
  6710. source: "collectionClass\x0a\x09^ nil",
  6711. messageSends: [],
  6712. referencedClasses: []
  6713. }),
  6714. smalltalk.StreamTest.klass);
  6715. smalltalk.addMethod(
  6716. smalltalk.method({
  6717. selector: "isAbstract",
  6718. category: 'testing',
  6719. fn: function (){
  6720. var self=this;
  6721. return smalltalk.withContext(function($ctx1) {
  6722. var $1;
  6723. $1=_st(self._collectionClass())._isNil();
  6724. return $1;
  6725. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6726. args: [],
  6727. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6728. messageSends: ["isNil", "collectionClass"],
  6729. referencedClasses: []
  6730. }),
  6731. smalltalk.StreamTest.klass);
  6732. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6733. smalltalk.addMethod(
  6734. smalltalk.method({
  6735. selector: "newCollection",
  6736. category: 'accessing',
  6737. fn: function (){
  6738. var self=this;
  6739. return smalltalk.withContext(function($ctx1) {
  6740. var $1;
  6741. $1=[true,(1),(3).__at((4)),"foo"];
  6742. return $1;
  6743. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6744. args: [],
  6745. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6746. messageSends: ["@"],
  6747. referencedClasses: []
  6748. }),
  6749. smalltalk.ArrayStreamTest);
  6750. smalltalk.addMethod(
  6751. smalltalk.method({
  6752. selector: "collectionClass",
  6753. category: 'accessing',
  6754. fn: function (){
  6755. var self=this;
  6756. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6757. return smalltalk.withContext(function($ctx1) {
  6758. var $1;
  6759. $1=$Array();
  6760. return $1;
  6761. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6762. args: [],
  6763. source: "collectionClass\x0a\x09^ Array",
  6764. messageSends: [],
  6765. referencedClasses: ["Array"]
  6766. }),
  6767. smalltalk.ArrayStreamTest.klass);
  6768. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6769. smalltalk.addMethod(
  6770. smalltalk.method({
  6771. selector: "newCollection",
  6772. category: 'accessing',
  6773. fn: function (){
  6774. var self=this;
  6775. return smalltalk.withContext(function($ctx1) {
  6776. return "hello world";
  6777. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6778. args: [],
  6779. source: "newCollection\x0a\x09^ 'hello world'",
  6780. messageSends: [],
  6781. referencedClasses: []
  6782. }),
  6783. smalltalk.StringStreamTest);
  6784. smalltalk.addMethod(
  6785. smalltalk.method({
  6786. selector: "collectionClass",
  6787. category: 'accessing',
  6788. fn: function (){
  6789. var self=this;
  6790. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6791. return smalltalk.withContext(function($ctx1) {
  6792. var $1;
  6793. $1=$String();
  6794. return $1;
  6795. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6796. args: [],
  6797. source: "collectionClass\x0a\x09^ String",
  6798. messageSends: [],
  6799. referencedClasses: ["String"]
  6800. }),
  6801. smalltalk.StringStreamTest.klass);
  6802. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6803. smalltalk.addMethod(
  6804. smalltalk.method({
  6805. selector: "testCopying",
  6806. category: 'tests',
  6807. fn: function (){
  6808. var self=this;
  6809. return smalltalk.withContext(function($ctx1) {
  6810. self._assert_equals_(nil._copy(),nil);
  6811. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6812. args: [],
  6813. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6814. messageSends: ["assert:equals:", "copy"],
  6815. referencedClasses: []
  6816. }),
  6817. smalltalk.UndefinedTest);
  6818. smalltalk.addMethod(
  6819. smalltalk.method({
  6820. selector: "testDeepCopy",
  6821. category: 'tests',
  6822. fn: function (){
  6823. var self=this;
  6824. return smalltalk.withContext(function($ctx1) {
  6825. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6826. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6827. args: [],
  6828. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6829. messageSends: ["assert:", "=", "deepCopy"],
  6830. referencedClasses: []
  6831. }),
  6832. smalltalk.UndefinedTest);
  6833. smalltalk.addMethod(
  6834. smalltalk.method({
  6835. selector: "testIfNil",
  6836. category: 'tests',
  6837. fn: function (){
  6838. var self=this;
  6839. return smalltalk.withContext(function($ctx1) {
  6840. var $2,$1,$5,$4,$3,$7,$6,$10,$9,$8;
  6841. if(($receiver = nil) == nil || $receiver == null){
  6842. $2=true;
  6843. } else {
  6844. $2=nil;
  6845. };
  6846. $1=self._assert_equals_($2,true);
  6847. $ctx1.sendIdx["assert:equals:"]=1;
  6848. if(($receiver = nil) == nil || $receiver == null){
  6849. $5=nil;
  6850. } else {
  6851. $5=true;
  6852. };
  6853. $4=_st($5).__eq(true);
  6854. $ctx1.sendIdx["="]=1;
  6855. $3=self._deny_($4);
  6856. $ctx1.sendIdx["deny:"]=1;
  6857. if(($receiver = nil) == nil || $receiver == null){
  6858. $7=true;
  6859. } else {
  6860. $7=false;
  6861. };
  6862. $6=self._assert_equals_($7,true);
  6863. if(($receiver = nil) == nil || $receiver == null){
  6864. $10=false;
  6865. } else {
  6866. $10=true;
  6867. };
  6868. $9=_st($10).__eq(true);
  6869. $8=self._deny_($9);
  6870. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6871. args: [],
  6872. 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",
  6873. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6874. referencedClasses: []
  6875. }),
  6876. smalltalk.UndefinedTest);
  6877. smalltalk.addMethod(
  6878. smalltalk.method({
  6879. selector: "testIsNil",
  6880. category: 'tests',
  6881. fn: function (){
  6882. var self=this;
  6883. return smalltalk.withContext(function($ctx1) {
  6884. self._assert_(nil._isNil());
  6885. self._deny_(nil._notNil());
  6886. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6887. args: [],
  6888. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6889. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6890. referencedClasses: []
  6891. }),
  6892. smalltalk.UndefinedTest);
  6893. });