1
0

Kernel-Tests.js 322 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. 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.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. globals.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. globals.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. globals.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. globals.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. globals.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. globals.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  197. args: [],
  198. 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 protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. globals.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return (3);
  212. }))._ensure_((function(){
  213. return (4);
  214. })),(3));
  215. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  216. args: [],
  217. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  218. messageSends: ["assert:equals:", "ensure:"],
  219. referencedClasses: []
  220. }),
  221. globals.BlockClosureTest);
  222. smalltalk.addMethod(
  223. smalltalk.method({
  224. selector: "testEnsureRaises",
  225. protocol: 'tests',
  226. fn: function (){
  227. var self=this;
  228. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  229. return smalltalk.withContext(function($ctx1) {
  230. self._should_raise_((function(){
  231. return smalltalk.withContext(function($ctx2) {
  232. return _st((function(){
  233. return smalltalk.withContext(function($ctx3) {
  234. return _st(_st($Error())._new())._signal();
  235. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  236. return true;
  237. }));
  238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  239. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  240. args: [],
  241. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  242. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  243. referencedClasses: ["Error"]
  244. }),
  245. globals.BlockClosureTest);
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "testExceptionSemantics",
  249. protocol: 'tests',
  250. fn: function (){
  251. var self=this;
  252. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  253. return smalltalk.withContext(function($ctx1) {
  254. self._timeout_((100));
  255. _st(self._async_((function(){
  256. return smalltalk.withContext(function($ctx2) {
  257. return _st((function(){
  258. return smalltalk.withContext(function($ctx3) {
  259. self._assert_(true);
  260. _st($Error())._signal();
  261. self._deny_(true);
  262. return self._finished();
  263. $ctx3.sendIdx["finished"]=1;
  264. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  265. return smalltalk.withContext(function($ctx3) {
  266. return self._finished();
  267. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  269. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  270. args: [],
  271. 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",
  272. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  273. referencedClasses: ["Error"]
  274. }),
  275. globals.BlockClosureTest);
  276. smalltalk.addMethod(
  277. smalltalk.method({
  278. selector: "testNewWithValues",
  279. protocol: 'tests',
  280. fn: function (){
  281. var self=this;
  282. return smalltalk.withContext(function($ctx1) {
  283. function TestConstructor(arg1, arg2, arg3) {}
  284. TestConstructor.prototype.name = 'theTestPrototype';
  285. var wrappedConstructor = _st(TestConstructor);
  286. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  287. self._assert_(result instanceof TestConstructor);
  288. self._assert_equals_(result.name, 'theTestPrototype');
  289. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  290. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  291. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  292. args: [],
  293. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  294. messageSends: [],
  295. referencedClasses: []
  296. }),
  297. globals.BlockClosureTest);
  298. smalltalk.addMethod(
  299. smalltalk.method({
  300. selector: "testNumArgs",
  301. protocol: 'tests',
  302. fn: function (){
  303. var self=this;
  304. return smalltalk.withContext(function($ctx1) {
  305. var $1;
  306. $1=_st((function(){
  307. }))._numArgs();
  308. $ctx1.sendIdx["numArgs"]=1;
  309. self._assert_equals_($1,(0));
  310. $ctx1.sendIdx["assert:equals:"]=1;
  311. self._assert_equals_(_st((function(a,b){
  312. }))._numArgs(),(2));
  313. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  314. args: [],
  315. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  316. messageSends: ["assert:equals:", "numArgs"],
  317. referencedClasses: []
  318. }),
  319. globals.BlockClosureTest);
  320. smalltalk.addMethod(
  321. smalltalk.method({
  322. selector: "testOnDo",
  323. protocol: 'tests',
  324. fn: function (){
  325. var self=this;
  326. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  327. return smalltalk.withContext(function($ctx1) {
  328. self._assert_(_st((function(){
  329. return smalltalk.withContext(function($ctx2) {
  330. return _st(_st($Error())._new())._signal();
  331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  332. return true;
  333. })));
  334. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  335. args: [],
  336. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  337. messageSends: ["assert:", "on:do:", "signal", "new"],
  338. referencedClasses: ["Error"]
  339. }),
  340. globals.BlockClosureTest);
  341. smalltalk.addMethod(
  342. smalltalk.method({
  343. selector: "testValue",
  344. protocol: 'tests',
  345. fn: function (){
  346. var self=this;
  347. return smalltalk.withContext(function($ctx1) {
  348. var $1;
  349. $1=_st((function(){
  350. return smalltalk.withContext(function($ctx2) {
  351. return (1).__plus((1));
  352. $ctx2.sendIdx["+"]=1;
  353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  354. $ctx1.sendIdx["value"]=1;
  355. self._assert_equals_($1,(2));
  356. $ctx1.sendIdx["assert:equals:"]=1;
  357. self._assert_equals_(_st((function(x){
  358. return smalltalk.withContext(function($ctx2) {
  359. return _st(x).__plus((1));
  360. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  361. $ctx1.sendIdx["assert:equals:"]=2;
  362. self._assert_equals_(_st((function(x,y){
  363. return smalltalk.withContext(function($ctx2) {
  364. return _st(x).__star(y);
  365. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  366. $ctx1.sendIdx["assert:equals:"]=3;
  367. self._assert_equals_(_st((function(a,b,c){
  368. return (1);
  369. }))._value(),(1));
  370. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  371. args: [],
  372. 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",
  373. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  374. referencedClasses: []
  375. }),
  376. globals.BlockClosureTest);
  377. smalltalk.addMethod(
  378. smalltalk.method({
  379. selector: "testValueWithPossibleArguments",
  380. protocol: 'tests',
  381. fn: function (){
  382. var self=this;
  383. return smalltalk.withContext(function($ctx1) {
  384. var $1,$2;
  385. $1=_st((function(){
  386. return (1);
  387. }))._valueWithPossibleArguments_([(3), (4)]);
  388. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  389. self._assert_equals_($1,(1));
  390. $ctx1.sendIdx["assert:equals:"]=1;
  391. $2=_st((function(a){
  392. return smalltalk.withContext(function($ctx2) {
  393. return _st(a).__plus((4));
  394. $ctx2.sendIdx["+"]=1;
  395. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  396. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  397. self._assert_equals_($2,(7));
  398. $ctx1.sendIdx["assert:equals:"]=2;
  399. self._assert_equals_(_st((function(a,b){
  400. return smalltalk.withContext(function($ctx2) {
  401. return _st(a).__plus(b);
  402. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  403. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  404. args: [],
  405. 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.",
  406. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  407. referencedClasses: []
  408. }),
  409. globals.BlockClosureTest);
  410. smalltalk.addMethod(
  411. smalltalk.method({
  412. selector: "testWhileFalse",
  413. protocol: 'tests',
  414. fn: function (){
  415. var self=this;
  416. var i;
  417. return smalltalk.withContext(function($ctx1) {
  418. i=(0);
  419. _st((function(){
  420. return smalltalk.withContext(function($ctx2) {
  421. return _st(i).__gt((5));
  422. $ctx2.sendIdx[">"]=1;
  423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  424. return smalltalk.withContext(function($ctx2) {
  425. i=_st(i).__plus((1));
  426. $ctx2.sendIdx["+"]=1;
  427. return i;
  428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  429. self._assert_equals_(i,(6));
  430. $ctx1.sendIdx["assert:equals:"]=1;
  431. i=(0);
  432. _st((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. i;
  436. return _st(i).__gt((5));
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  438. self._assert_equals_(i,(6));
  439. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  440. args: [],
  441. 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",
  442. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  443. referencedClasses: []
  444. }),
  445. globals.BlockClosureTest);
  446. smalltalk.addMethod(
  447. smalltalk.method({
  448. selector: "testWhileTrue",
  449. protocol: 'tests',
  450. fn: function (){
  451. var self=this;
  452. var i;
  453. return smalltalk.withContext(function($ctx1) {
  454. i=(0);
  455. _st((function(){
  456. return smalltalk.withContext(function($ctx2) {
  457. return _st(i).__lt((5));
  458. $ctx2.sendIdx["<"]=1;
  459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  460. return smalltalk.withContext(function($ctx2) {
  461. i=_st(i).__plus((1));
  462. $ctx2.sendIdx["+"]=1;
  463. return i;
  464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  465. self._assert_equals_(i,(5));
  466. $ctx1.sendIdx["assert:equals:"]=1;
  467. i=(0);
  468. _st((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. i;
  472. return _st(i).__lt((5));
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  474. self._assert_equals_(i,(5));
  475. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  476. args: [],
  477. 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",
  478. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  479. referencedClasses: []
  480. }),
  481. globals.BlockClosureTest);
  482. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  483. smalltalk.addMethod(
  484. smalltalk.method({
  485. selector: "testEquality",
  486. protocol: 'tests',
  487. fn: function (){
  488. var self=this;
  489. return smalltalk.withContext(function($ctx1) {
  490. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  491. $1=(0).__eq(false);
  492. $ctx1.sendIdx["="]=1;
  493. self._deny_($1);
  494. $ctx1.sendIdx["deny:"]=1;
  495. $2=false.__eq((0));
  496. $ctx1.sendIdx["="]=2;
  497. self._deny_($2);
  498. $ctx1.sendIdx["deny:"]=2;
  499. $3="".__eq(false);
  500. $ctx1.sendIdx["="]=3;
  501. self._deny_($3);
  502. $ctx1.sendIdx["deny:"]=3;
  503. $4=false.__eq("");
  504. $ctx1.sendIdx["="]=4;
  505. self._deny_($4);
  506. $ctx1.sendIdx["deny:"]=4;
  507. $5=true.__eq(true);
  508. $ctx1.sendIdx["="]=5;
  509. self._assert_($5);
  510. $ctx1.sendIdx["assert:"]=1;
  511. $6=false.__eq(true);
  512. $ctx1.sendIdx["="]=6;
  513. self._deny_($6);
  514. $ctx1.sendIdx["deny:"]=5;
  515. $7=true.__eq(false);
  516. $ctx1.sendIdx["="]=7;
  517. self._deny_($7);
  518. $8=false.__eq(false);
  519. $ctx1.sendIdx["="]=8;
  520. self._assert_($8);
  521. $ctx1.sendIdx["assert:"]=2;
  522. $10=true._yourself();
  523. $ctx1.sendIdx["yourself"]=1;
  524. $9=_st($10).__eq(true);
  525. $ctx1.sendIdx["="]=9;
  526. self._assert_($9);
  527. $ctx1.sendIdx["assert:"]=3;
  528. $12=true._yourself();
  529. $ctx1.sendIdx["yourself"]=2;
  530. $11=_st($12).__eq(true._yourself());
  531. self._assert_($11);
  532. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  533. args: [],
  534. 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)",
  535. messageSends: ["deny:", "=", "assert:", "yourself"],
  536. referencedClasses: []
  537. }),
  538. globals.BooleanTest);
  539. smalltalk.addMethod(
  540. smalltalk.method({
  541. selector: "testIdentity",
  542. protocol: 'tests',
  543. fn: function (){
  544. var self=this;
  545. return smalltalk.withContext(function($ctx1) {
  546. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  547. $1=(0).__eq_eq(false);
  548. $ctx1.sendIdx["=="]=1;
  549. self._deny_($1);
  550. $ctx1.sendIdx["deny:"]=1;
  551. $2=false.__eq_eq((0));
  552. $ctx1.sendIdx["=="]=2;
  553. self._deny_($2);
  554. $ctx1.sendIdx["deny:"]=2;
  555. $3="".__eq_eq(false);
  556. $ctx1.sendIdx["=="]=3;
  557. self._deny_($3);
  558. $ctx1.sendIdx["deny:"]=3;
  559. $4=false.__eq_eq("");
  560. $ctx1.sendIdx["=="]=4;
  561. self._deny_($4);
  562. $ctx1.sendIdx["deny:"]=4;
  563. $5=true.__eq_eq(true);
  564. $ctx1.sendIdx["=="]=5;
  565. self._assert_($5);
  566. $ctx1.sendIdx["assert:"]=1;
  567. $6=false.__eq_eq(true);
  568. $ctx1.sendIdx["=="]=6;
  569. self._deny_($6);
  570. $ctx1.sendIdx["deny:"]=5;
  571. $7=true.__eq_eq(false);
  572. $ctx1.sendIdx["=="]=7;
  573. self._deny_($7);
  574. $8=false.__eq_eq(false);
  575. $ctx1.sendIdx["=="]=8;
  576. self._assert_($8);
  577. $ctx1.sendIdx["assert:"]=2;
  578. $10=true._yourself();
  579. $ctx1.sendIdx["yourself"]=1;
  580. $9=_st($10).__eq_eq(true);
  581. $ctx1.sendIdx["=="]=9;
  582. self._assert_($9);
  583. $ctx1.sendIdx["assert:"]=3;
  584. $12=true._yourself();
  585. $ctx1.sendIdx["yourself"]=2;
  586. $11=_st($12).__eq_eq(true._yourself());
  587. self._assert_($11);
  588. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  589. args: [],
  590. 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",
  591. messageSends: ["deny:", "==", "assert:", "yourself"],
  592. referencedClasses: []
  593. }),
  594. globals.BooleanTest);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "testIfTrueIfFalse",
  598. protocol: 'tests',
  599. fn: function (){
  600. var self=this;
  601. return smalltalk.withContext(function($ctx1) {
  602. var $1,$2,$3,$4,$5,$6,$7,$8;
  603. if(smalltalk.assert(true)){
  604. $1="alternative block";
  605. };
  606. self._assert_equals_($1,"alternative block");
  607. $ctx1.sendIdx["assert:equals:"]=1;
  608. if(! smalltalk.assert(true)){
  609. $2="alternative block";
  610. };
  611. self._assert_equals_($2,nil);
  612. $ctx1.sendIdx["assert:equals:"]=2;
  613. if(smalltalk.assert(false)){
  614. $3="alternative block";
  615. };
  616. self._assert_equals_($3,nil);
  617. $ctx1.sendIdx["assert:equals:"]=3;
  618. if(! smalltalk.assert(false)){
  619. $4="alternative block";
  620. };
  621. self._assert_equals_($4,"alternative block");
  622. $ctx1.sendIdx["assert:equals:"]=4;
  623. if(smalltalk.assert(false)){
  624. $5="alternative block";
  625. } else {
  626. $5="alternative block2";
  627. };
  628. self._assert_equals_($5,"alternative block2");
  629. $ctx1.sendIdx["assert:equals:"]=5;
  630. if(smalltalk.assert(false)){
  631. $6="alternative block2";
  632. } else {
  633. $6="alternative block";
  634. };
  635. self._assert_equals_($6,"alternative block");
  636. $ctx1.sendIdx["assert:equals:"]=6;
  637. if(smalltalk.assert(true)){
  638. $7="alternative block";
  639. } else {
  640. $7="alternative block2";
  641. };
  642. self._assert_equals_($7,"alternative block");
  643. $ctx1.sendIdx["assert:equals:"]=7;
  644. if(smalltalk.assert(true)){
  645. $8="alternative block2";
  646. } else {
  647. $8="alternative block";
  648. };
  649. self._assert_equals_($8,"alternative block2");
  650. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  651. args: [],
  652. 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'.",
  653. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  654. referencedClasses: []
  655. }),
  656. globals.BooleanTest);
  657. smalltalk.addMethod(
  658. smalltalk.method({
  659. selector: "testIfTrueIfFalseWithBoxing",
  660. protocol: 'tests',
  661. fn: function (){
  662. var self=this;
  663. return smalltalk.withContext(function($ctx1) {
  664. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  665. $2=true._yourself();
  666. $ctx1.sendIdx["yourself"]=1;
  667. if(smalltalk.assert($2)){
  668. $1="alternative block";
  669. };
  670. self._assert_equals_($1,"alternative block");
  671. $ctx1.sendIdx["assert:equals:"]=1;
  672. $4=true._yourself();
  673. $ctx1.sendIdx["yourself"]=2;
  674. if(! smalltalk.assert($4)){
  675. $3="alternative block";
  676. };
  677. self._assert_equals_($3,nil);
  678. $ctx1.sendIdx["assert:equals:"]=2;
  679. $6=false._yourself();
  680. $ctx1.sendIdx["yourself"]=3;
  681. if(smalltalk.assert($6)){
  682. $5="alternative block";
  683. };
  684. self._assert_equals_($5,nil);
  685. $ctx1.sendIdx["assert:equals:"]=3;
  686. $8=false._yourself();
  687. $ctx1.sendIdx["yourself"]=4;
  688. if(! smalltalk.assert($8)){
  689. $7="alternative block";
  690. };
  691. self._assert_equals_($7,"alternative block");
  692. $ctx1.sendIdx["assert:equals:"]=4;
  693. $10=false._yourself();
  694. $ctx1.sendIdx["yourself"]=5;
  695. if(smalltalk.assert($10)){
  696. $9="alternative block";
  697. } else {
  698. $9="alternative block2";
  699. };
  700. self._assert_equals_($9,"alternative block2");
  701. $ctx1.sendIdx["assert:equals:"]=5;
  702. $12=false._yourself();
  703. $ctx1.sendIdx["yourself"]=6;
  704. if(smalltalk.assert($12)){
  705. $11="alternative block2";
  706. } else {
  707. $11="alternative block";
  708. };
  709. self._assert_equals_($11,"alternative block");
  710. $ctx1.sendIdx["assert:equals:"]=6;
  711. $14=true._yourself();
  712. $ctx1.sendIdx["yourself"]=7;
  713. if(smalltalk.assert($14)){
  714. $13="alternative block";
  715. } else {
  716. $13="alternative block2";
  717. };
  718. self._assert_equals_($13,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=7;
  720. $16=true._yourself();
  721. if(smalltalk.assert($16)){
  722. $15="alternative block2";
  723. } else {
  724. $15="alternative block";
  725. };
  726. self._assert_equals_($15,"alternative block2");
  727. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  728. args: [],
  729. 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'.",
  730. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  731. referencedClasses: []
  732. }),
  733. globals.BooleanTest);
  734. smalltalk.addMethod(
  735. smalltalk.method({
  736. selector: "testLogic",
  737. protocol: 'tests',
  738. fn: function (){
  739. var self=this;
  740. return smalltalk.withContext(function($ctx1) {
  741. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  742. $1=true.__and(true);
  743. $ctx1.sendIdx["&"]=1;
  744. self._assert_($1);
  745. $ctx1.sendIdx["assert:"]=1;
  746. $2=true.__and(false);
  747. $ctx1.sendIdx["&"]=2;
  748. self._deny_($2);
  749. $ctx1.sendIdx["deny:"]=1;
  750. $3=false.__and(true);
  751. $ctx1.sendIdx["&"]=3;
  752. self._deny_($3);
  753. $ctx1.sendIdx["deny:"]=2;
  754. $5=false.__and(false);
  755. $ctx1.sendIdx["&"]=4;
  756. $4=self._deny_($5);
  757. $ctx1.sendIdx["deny:"]=3;
  758. $6=true.__or(true);
  759. $ctx1.sendIdx["|"]=1;
  760. self._assert_($6);
  761. $ctx1.sendIdx["assert:"]=2;
  762. $7=true.__or(false);
  763. $ctx1.sendIdx["|"]=2;
  764. self._assert_($7);
  765. $ctx1.sendIdx["assert:"]=3;
  766. $8=false.__or(true);
  767. $ctx1.sendIdx["|"]=3;
  768. self._assert_($8);
  769. $ctx1.sendIdx["assert:"]=4;
  770. $10=false.__or(false);
  771. $ctx1.sendIdx["|"]=4;
  772. $9=self._deny_($10);
  773. $ctx1.sendIdx["deny:"]=4;
  774. $12=(1).__gt((0));
  775. $ctx1.sendIdx[">"]=1;
  776. $11=true.__and($12);
  777. $ctx1.sendIdx["&"]=5;
  778. self._assert_($11);
  779. $ctx1.sendIdx["assert:"]=5;
  780. $14=(1).__gt((0));
  781. $ctx1.sendIdx[">"]=2;
  782. $13=_st($14).__and(false);
  783. $ctx1.sendIdx["&"]=6;
  784. self._deny_($13);
  785. $ctx1.sendIdx["deny:"]=5;
  786. $17=(1).__gt((0));
  787. $ctx1.sendIdx[">"]=3;
  788. $18=(1).__gt((2));
  789. $ctx1.sendIdx[">"]=4;
  790. $16=_st($17).__and($18);
  791. $15=self._deny_($16);
  792. $20=(1).__gt((0));
  793. $ctx1.sendIdx[">"]=5;
  794. $19=false.__or($20);
  795. $ctx1.sendIdx["|"]=5;
  796. self._assert_($19);
  797. $ctx1.sendIdx["assert:"]=6;
  798. $22=(1).__gt((0));
  799. $ctx1.sendIdx[">"]=6;
  800. $21=_st($22).__or(false);
  801. $ctx1.sendIdx["|"]=6;
  802. self._assert_($21);
  803. $ctx1.sendIdx["assert:"]=7;
  804. $25=(1).__gt((0));
  805. $ctx1.sendIdx[">"]=7;
  806. $24=_st($25).__or((1).__gt((2)));
  807. $23=self._assert_($24);
  808. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  809. args: [],
  810. 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))",
  811. messageSends: ["assert:", "&", "deny:", "|", ">"],
  812. referencedClasses: []
  813. }),
  814. globals.BooleanTest);
  815. smalltalk.addMethod(
  816. smalltalk.method({
  817. selector: "testLogicKeywords",
  818. protocol: 'tests',
  819. fn: function (){
  820. var self=this;
  821. return smalltalk.withContext(function($ctx1) {
  822. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  823. $1=true._and_((function(){
  824. return true;
  825. }));
  826. $ctx1.sendIdx["and:"]=1;
  827. self._assert_($1);
  828. $ctx1.sendIdx["assert:"]=1;
  829. $2=true._and_((function(){
  830. return false;
  831. }));
  832. $ctx1.sendIdx["and:"]=2;
  833. self._deny_($2);
  834. $ctx1.sendIdx["deny:"]=1;
  835. $3=false._and_((function(){
  836. return true;
  837. }));
  838. $ctx1.sendIdx["and:"]=3;
  839. self._deny_($3);
  840. $ctx1.sendIdx["deny:"]=2;
  841. $5=false._and_((function(){
  842. return false;
  843. }));
  844. $ctx1.sendIdx["and:"]=4;
  845. $4=self._deny_($5);
  846. $ctx1.sendIdx["deny:"]=3;
  847. $6=true._or_((function(){
  848. return true;
  849. }));
  850. $ctx1.sendIdx["or:"]=1;
  851. self._assert_($6);
  852. $ctx1.sendIdx["assert:"]=2;
  853. $7=true._or_((function(){
  854. return false;
  855. }));
  856. $ctx1.sendIdx["or:"]=2;
  857. self._assert_($7);
  858. $ctx1.sendIdx["assert:"]=3;
  859. $8=false._or_((function(){
  860. return true;
  861. }));
  862. $ctx1.sendIdx["or:"]=3;
  863. self._assert_($8);
  864. $ctx1.sendIdx["assert:"]=4;
  865. $10=false._or_((function(){
  866. return false;
  867. }));
  868. $ctx1.sendIdx["or:"]=4;
  869. $9=self._deny_($10);
  870. $ctx1.sendIdx["deny:"]=4;
  871. $11=true._and_((function(){
  872. return smalltalk.withContext(function($ctx2) {
  873. return (1).__gt((0));
  874. $ctx2.sendIdx[">"]=1;
  875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  876. $ctx1.sendIdx["and:"]=5;
  877. self._assert_($11);
  878. $ctx1.sendIdx["assert:"]=5;
  879. $13=(1).__gt((0));
  880. $ctx1.sendIdx[">"]=2;
  881. $12=_st($13)._and_((function(){
  882. return false;
  883. }));
  884. $ctx1.sendIdx["and:"]=6;
  885. self._deny_($12);
  886. $ctx1.sendIdx["deny:"]=5;
  887. $16=(1).__gt((0));
  888. $ctx1.sendIdx[">"]=3;
  889. $15=_st($16)._and_((function(){
  890. return smalltalk.withContext(function($ctx2) {
  891. return (1).__gt((2));
  892. $ctx2.sendIdx[">"]=4;
  893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  894. $14=self._deny_($15);
  895. $17=false._or_((function(){
  896. return smalltalk.withContext(function($ctx2) {
  897. return (1).__gt((0));
  898. $ctx2.sendIdx[">"]=5;
  899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  900. $ctx1.sendIdx["or:"]=5;
  901. self._assert_($17);
  902. $ctx1.sendIdx["assert:"]=6;
  903. $19=(1).__gt((0));
  904. $ctx1.sendIdx[">"]=6;
  905. $18=_st($19)._or_((function(){
  906. return false;
  907. }));
  908. $ctx1.sendIdx["or:"]=6;
  909. self._assert_($18);
  910. $ctx1.sendIdx["assert:"]=7;
  911. $22=(1).__gt((0));
  912. $ctx1.sendIdx[">"]=7;
  913. $21=_st($22)._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((2));
  916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  917. $20=self._assert_($21);
  918. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  919. args: [],
  920. 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 ])",
  921. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  922. referencedClasses: []
  923. }),
  924. globals.BooleanTest);
  925. smalltalk.addMethod(
  926. smalltalk.method({
  927. selector: "testNonBooleanError",
  928. protocol: 'tests',
  929. fn: function (){
  930. var self=this;
  931. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  932. return smalltalk.withContext(function($ctx1) {
  933. self._should_raise_((function(){
  934. return smalltalk.withContext(function($ctx2) {
  935. if(smalltalk.assert("")){
  936. } else {
  937. };
  938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  939. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  940. args: [],
  941. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  942. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  943. referencedClasses: ["NonBooleanReceiver"]
  944. }),
  945. globals.BooleanTest);
  946. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  947. smalltalk.addMethod(
  948. smalltalk.method({
  949. selector: "setUp",
  950. protocol: 'running',
  951. fn: function (){
  952. var self=this;
  953. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  954. return smalltalk.withContext(function($ctx1) {
  955. self["@builder"]=_st($ClassBuilder())._new();
  956. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  957. args: [],
  958. source: "setUp\x0a\x09builder := ClassBuilder new",
  959. messageSends: ["new"],
  960. referencedClasses: ["ClassBuilder"]
  961. }),
  962. globals.ClassBuilderTest);
  963. smalltalk.addMethod(
  964. smalltalk.method({
  965. selector: "tearDown",
  966. protocol: 'running',
  967. fn: function (){
  968. var self=this;
  969. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  970. return smalltalk.withContext(function($ctx1) {
  971. var $1;
  972. $1=self["@theClass"];
  973. if(($receiver = $1) == nil || $receiver == null){
  974. $1;
  975. } else {
  976. _st($Smalltalk())._removeClass_(self["@theClass"]);
  977. self["@theClass"]=nil;
  978. self["@theClass"];
  979. };
  980. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  981. args: [],
  982. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  983. messageSends: ["ifNotNil:", "removeClass:"],
  984. referencedClasses: ["Smalltalk"]
  985. }),
  986. globals.ClassBuilderTest);
  987. smalltalk.addMethod(
  988. smalltalk.method({
  989. selector: "testClassCopy",
  990. protocol: 'tests',
  991. fn: function (){
  992. var self=this;
  993. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  994. return smalltalk.withContext(function($ctx1) {
  995. var $2,$1,$4,$3,$6,$5,$8,$7;
  996. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  997. $2=_st(self["@theClass"])._superclass();
  998. $ctx1.sendIdx["superclass"]=1;
  999. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1000. $ctx1.sendIdx["=="]=1;
  1001. self._assert_($1);
  1002. $ctx1.sendIdx["assert:"]=1;
  1003. $4=_st(self["@theClass"])._instanceVariableNames();
  1004. $ctx1.sendIdx["instanceVariableNames"]=1;
  1005. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1006. $ctx1.sendIdx["=="]=2;
  1007. self._assert_($3);
  1008. $ctx1.sendIdx["assert:"]=2;
  1009. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1010. $ctx1.sendIdx["assert:equals:"]=1;
  1011. $6=_st(self["@theClass"])._package();
  1012. $ctx1.sendIdx["package"]=1;
  1013. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1014. self._assert_($5);
  1015. $8=_st(self["@theClass"])._methodDictionary();
  1016. $ctx1.sendIdx["methodDictionary"]=1;
  1017. $7=_st($8)._keys();
  1018. $ctx1.sendIdx["keys"]=1;
  1019. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1020. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1021. args: [],
  1022. 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",
  1023. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1024. referencedClasses: ["ObjectMock"]
  1025. }),
  1026. globals.ClassBuilderTest);
  1027. smalltalk.addMethod(
  1028. smalltalk.method({
  1029. selector: "testClassMigration",
  1030. protocol: 'tests',
  1031. fn: function (){
  1032. var self=this;
  1033. var instance,oldClass;
  1034. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1035. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1036. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1037. return smalltalk.withContext(function($ctx1) {
  1038. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1039. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1040. $2=_st($Smalltalk())._globals();
  1041. $ctx1.sendIdx["globals"]=1;
  1042. $1=_st($2)._at_("ObjectMock2");
  1043. $ctx1.sendIdx["at:"]=1;
  1044. instance=_st($1)._new();
  1045. $4=_st($Smalltalk())._globals();
  1046. $ctx1.sendIdx["globals"]=2;
  1047. $3=_st($4)._at_("ObjectMock2");
  1048. $ctx1.sendIdx["at:"]=2;
  1049. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1050. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1051. $ctx1.sendIdx["=="]=1;
  1052. self._deny_($5);
  1053. $ctx1.sendIdx["deny:"]=1;
  1054. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1055. $ctx1.sendIdx["=="]=2;
  1056. self._assert_($6);
  1057. $ctx1.sendIdx["assert:"]=1;
  1058. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1059. $ctx1.sendIdx["assert:"]=2;
  1060. $7=_st($ObjectMock2())._selectors();
  1061. $ctx1.sendIdx["selectors"]=1;
  1062. self._assert_equals_($7,_st(oldClass)._selectors());
  1063. $ctx1.sendIdx["assert:equals:"]=1;
  1064. $8=_st($ObjectMock2())._comment();
  1065. $ctx1.sendIdx["comment"]=1;
  1066. self._assert_equals_($8,_st(oldClass)._comment());
  1067. $ctx1.sendIdx["assert:equals:"]=2;
  1068. $9=_st(_st($ObjectMock2())._package())._name();
  1069. $ctx1.sendIdx["name"]=1;
  1070. self._assert_equals_($9,"Kernel-Tests");
  1071. $11=_st(instance)._class();
  1072. $ctx1.sendIdx["class"]=1;
  1073. $10=_st($11).__eq_eq($ObjectMock2());
  1074. self._deny_($10);
  1075. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1076. _st($Smalltalk())._removeClass_($ObjectMock2());
  1077. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1078. args: [],
  1079. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals 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 globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1080. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1081. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1082. }),
  1083. globals.ClassBuilderTest);
  1084. smalltalk.addMethod(
  1085. smalltalk.method({
  1086. selector: "testClassMigrationWithClassInstanceVariables",
  1087. protocol: 'tests',
  1088. fn: function (){
  1089. var self=this;
  1090. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1091. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1092. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1093. return smalltalk.withContext(function($ctx1) {
  1094. var $1;
  1095. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1096. $1=_st($ObjectMock2())._class();
  1097. $ctx1.sendIdx["class"]=1;
  1098. _st($1)._instanceVariableNames_("foo bar");
  1099. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1100. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1101. _st($Smalltalk())._removeClass_($ObjectMock2());
  1102. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1103. args: [],
  1104. 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 globals 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 removeClass: ObjectMock2",
  1105. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1106. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1107. }),
  1108. globals.ClassBuilderTest);
  1109. smalltalk.addMethod(
  1110. smalltalk.method({
  1111. selector: "testClassMigrationWithSubclasses",
  1112. protocol: 'tests',
  1113. fn: function (){
  1114. var self=this;
  1115. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1116. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1117. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1118. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1119. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1120. return smalltalk.withContext(function($ctx1) {
  1121. var $2,$1,$4,$3;
  1122. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1123. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1124. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1125. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1126. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1127. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1128. $2=_st($ObjectMock())._subclasses();
  1129. $ctx1.sendIdx["subclasses"]=1;
  1130. $1=_st($2)._includes_($ObjectMock2());
  1131. $ctx1.sendIdx["includes:"]=1;
  1132. self._assert_($1);
  1133. $ctx1.sendIdx["assert:"]=1;
  1134. $4=_st($ObjectMock2())._subclasses();
  1135. $ctx1.sendIdx["subclasses"]=2;
  1136. $3=_st($4)._includes_($ObjectMock3());
  1137. $ctx1.sendIdx["includes:"]=2;
  1138. self._assert_($3);
  1139. $ctx1.sendIdx["assert:"]=2;
  1140. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1141. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1142. return smalltalk.withContext(function($ctx2) {
  1143. return _st($Smalltalk())._removeClass_(each);
  1144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1145. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1146. args: [],
  1147. 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 globals 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 removeClass: each ]",
  1148. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1149. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1150. }),
  1151. globals.ClassBuilderTest);
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "testInstanceVariableNames",
  1155. protocol: 'tests',
  1156. fn: function (){
  1157. var self=this;
  1158. return smalltalk.withContext(function($ctx1) {
  1159. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1160. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1161. args: [],
  1162. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1163. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1164. referencedClasses: []
  1165. }),
  1166. globals.ClassBuilderTest);
  1167. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1168. smalltalk.addMethod(
  1169. smalltalk.method({
  1170. selector: "assertSameContents:as:",
  1171. protocol: 'convenience',
  1172. fn: function (aCollection,anotherCollection){
  1173. var self=this;
  1174. return smalltalk.withContext(function($ctx1) {
  1175. var $2,$1,$4,$3;
  1176. $2=_st(aCollection)._size();
  1177. $ctx1.sendIdx["size"]=1;
  1178. $1=_st($2).__eq(_st(anotherCollection)._size());
  1179. $ctx1.sendIdx["="]=1;
  1180. self._assert_($1);
  1181. $ctx1.sendIdx["assert:"]=1;
  1182. _st(aCollection)._do_((function(each){
  1183. return smalltalk.withContext(function($ctx2) {
  1184. $4=_st(aCollection)._occurrencesOf_(each);
  1185. $ctx2.sendIdx["occurrencesOf:"]=1;
  1186. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1187. return self._assert_($3);
  1188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1189. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1190. args: ["aCollection", "anotherCollection"],
  1191. 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)) ]",
  1192. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1193. referencedClasses: []
  1194. }),
  1195. globals.CollectionTest);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "collection",
  1199. protocol: 'fixture',
  1200. fn: function (){
  1201. var self=this;
  1202. return smalltalk.withContext(function($ctx1) {
  1203. self._subclassResponsibility();
  1204. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1205. args: [],
  1206. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1207. messageSends: ["subclassResponsibility"],
  1208. referencedClasses: []
  1209. }),
  1210. globals.CollectionTest);
  1211. smalltalk.addMethod(
  1212. smalltalk.method({
  1213. selector: "collectionClass",
  1214. protocol: 'fixture',
  1215. fn: function (){
  1216. var self=this;
  1217. return smalltalk.withContext(function($ctx1) {
  1218. var $1;
  1219. $1=_st(self._class())._collectionClass();
  1220. return $1;
  1221. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1222. args: [],
  1223. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1224. messageSends: ["collectionClass", "class"],
  1225. referencedClasses: []
  1226. }),
  1227. globals.CollectionTest);
  1228. smalltalk.addMethod(
  1229. smalltalk.method({
  1230. selector: "collectionOfPrintStrings",
  1231. protocol: 'fixture',
  1232. fn: function (){
  1233. var self=this;
  1234. return smalltalk.withContext(function($ctx1) {
  1235. self._subclassResponsibility();
  1236. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1237. args: [],
  1238. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1239. messageSends: ["subclassResponsibility"],
  1240. referencedClasses: []
  1241. }),
  1242. globals.CollectionTest);
  1243. smalltalk.addMethod(
  1244. smalltalk.method({
  1245. selector: "collectionSize",
  1246. protocol: 'fixture',
  1247. fn: function (){
  1248. var self=this;
  1249. return smalltalk.withContext(function($ctx1) {
  1250. self._subclassResponsibility();
  1251. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1252. args: [],
  1253. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1254. messageSends: ["subclassResponsibility"],
  1255. referencedClasses: []
  1256. }),
  1257. globals.CollectionTest);
  1258. smalltalk.addMethod(
  1259. smalltalk.method({
  1260. selector: "collectionWithDuplicates",
  1261. protocol: 'fixture',
  1262. fn: function (){
  1263. var self=this;
  1264. return smalltalk.withContext(function($ctx1) {
  1265. self._subclassResponsibility();
  1266. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1267. args: [],
  1268. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1269. messageSends: ["subclassResponsibility"],
  1270. referencedClasses: []
  1271. }),
  1272. globals.CollectionTest);
  1273. smalltalk.addMethod(
  1274. smalltalk.method({
  1275. selector: "collectionWithNewValue",
  1276. protocol: 'fixture',
  1277. fn: function (){
  1278. var self=this;
  1279. return smalltalk.withContext(function($ctx1) {
  1280. self._subclassResponsibility();
  1281. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1282. args: [],
  1283. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1284. messageSends: ["subclassResponsibility"],
  1285. referencedClasses: []
  1286. }),
  1287. globals.CollectionTest);
  1288. smalltalk.addMethod(
  1289. smalltalk.method({
  1290. selector: "isCollectionReadOnly",
  1291. protocol: 'testing',
  1292. fn: function (){
  1293. var self=this;
  1294. return false;
  1295. },
  1296. args: [],
  1297. source: "isCollectionReadOnly\x0a\x09^ false",
  1298. messageSends: [],
  1299. referencedClasses: []
  1300. }),
  1301. globals.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "sampleNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return "N";
  1309. },
  1310. args: [],
  1311. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1312. messageSends: [],
  1313. referencedClasses: []
  1314. }),
  1315. globals.CollectionTest);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "sampleNewValueAsCollection",
  1319. protocol: 'fixture',
  1320. fn: function (){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) {
  1323. var $1;
  1324. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1325. return $1;
  1326. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1327. args: [],
  1328. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1329. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1330. referencedClasses: []
  1331. }),
  1332. globals.CollectionTest);
  1333. smalltalk.addMethod(
  1334. smalltalk.method({
  1335. selector: "testAddAll",
  1336. protocol: 'tests',
  1337. fn: function (){
  1338. var self=this;
  1339. return smalltalk.withContext(function($ctx1) {
  1340. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1341. $2=self._collection();
  1342. $ctx1.sendIdx["collection"]=1;
  1343. $3=$2;
  1344. $5=self._collectionClass();
  1345. $ctx1.sendIdx["collectionClass"]=1;
  1346. $4=_st($5)._new();
  1347. $ctx1.sendIdx["new"]=1;
  1348. _st($3)._addAll_($4);
  1349. $ctx1.sendIdx["addAll:"]=1;
  1350. $6=_st($2)._yourself();
  1351. $ctx1.sendIdx["yourself"]=1;
  1352. $1=$6;
  1353. $7=self._collection();
  1354. $ctx1.sendIdx["collection"]=2;
  1355. self._assert_equals_($1,$7);
  1356. $ctx1.sendIdx["assert:equals:"]=1;
  1357. $10=self._collectionClass();
  1358. $ctx1.sendIdx["collectionClass"]=2;
  1359. $9=_st($10)._new();
  1360. $ctx1.sendIdx["new"]=2;
  1361. $11=$9;
  1362. $12=self._collection();
  1363. $ctx1.sendIdx["collection"]=3;
  1364. _st($11)._addAll_($12);
  1365. $ctx1.sendIdx["addAll:"]=2;
  1366. $13=_st($9)._yourself();
  1367. $ctx1.sendIdx["yourself"]=2;
  1368. $8=$13;
  1369. $14=self._collection();
  1370. $ctx1.sendIdx["collection"]=4;
  1371. self._assert_equals_($8,$14);
  1372. $ctx1.sendIdx["assert:equals:"]=2;
  1373. $17=self._collectionClass();
  1374. $ctx1.sendIdx["collectionClass"]=3;
  1375. $16=_st($17)._new();
  1376. $ctx1.sendIdx["new"]=3;
  1377. $18=$16;
  1378. $20=self._collectionClass();
  1379. $ctx1.sendIdx["collectionClass"]=4;
  1380. $19=_st($20)._new();
  1381. $ctx1.sendIdx["new"]=4;
  1382. _st($18)._addAll_($19);
  1383. $ctx1.sendIdx["addAll:"]=3;
  1384. $21=_st($16)._yourself();
  1385. $ctx1.sendIdx["yourself"]=3;
  1386. $15=$21;
  1387. self._assert_equals_($15,_st(self._collectionClass())._new());
  1388. $ctx1.sendIdx["assert:equals:"]=3;
  1389. $23=self._collection();
  1390. $ctx1.sendIdx["collection"]=5;
  1391. $24=$23;
  1392. $25=self._sampleNewValueAsCollection();
  1393. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1394. _st($24)._addAll_($25);
  1395. $ctx1.sendIdx["addAll:"]=4;
  1396. $26=_st($23)._yourself();
  1397. $ctx1.sendIdx["yourself"]=4;
  1398. $22=$26;
  1399. $27=self._collectionWithNewValue();
  1400. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1401. self._assert_equals_($22,$27);
  1402. $28=self._sampleNewValueAsCollection();
  1403. _st($28)._addAll_(self._collection());
  1404. $29=_st($28)._yourself();
  1405. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1406. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1407. args: [],
  1408. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1409. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1410. referencedClasses: []
  1411. }),
  1412. globals.CollectionTest);
  1413. smalltalk.addMethod(
  1414. smalltalk.method({
  1415. selector: "testAllSatisfy",
  1416. protocol: 'tests',
  1417. fn: function (){
  1418. var self=this;
  1419. var collection,anyOne;
  1420. return smalltalk.withContext(function($ctx1) {
  1421. var $1;
  1422. collection=self._collection();
  1423. anyOne=_st(collection)._anyOne();
  1424. $1=_st(collection)._allSatisfy_((function(each){
  1425. return smalltalk.withContext(function($ctx2) {
  1426. return _st(collection)._includes_(each);
  1427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1428. $ctx1.sendIdx["allSatisfy:"]=1;
  1429. self._assert_($1);
  1430. self._deny_(_st(collection)._allSatisfy_((function(each){
  1431. return smalltalk.withContext(function($ctx2) {
  1432. return _st(each).__tild_eq(anyOne);
  1433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1434. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1435. args: [],
  1436. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1437. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1438. referencedClasses: []
  1439. }),
  1440. globals.CollectionTest);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "testAnyOne",
  1444. protocol: 'tests',
  1445. fn: function (){
  1446. var self=this;
  1447. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1448. return smalltalk.withContext(function($ctx1) {
  1449. var $2,$1;
  1450. self._should_raise_((function(){
  1451. return smalltalk.withContext(function($ctx2) {
  1452. return _st(_st(self._collectionClass())._new())._anyOne();
  1453. $ctx2.sendIdx["anyOne"]=1;
  1454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1455. $2=self._collection();
  1456. $ctx1.sendIdx["collection"]=1;
  1457. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1458. self._assert_($1);
  1459. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1460. args: [],
  1461. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1462. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1463. referencedClasses: ["Error"]
  1464. }),
  1465. globals.CollectionTest);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "testAnySatisfy",
  1469. protocol: 'tests',
  1470. fn: function (){
  1471. var self=this;
  1472. var anyOne;
  1473. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1474. return smalltalk.withContext(function($ctx1) {
  1475. var $1,$3,$2;
  1476. $1=self._collection();
  1477. $ctx1.sendIdx["collection"]=1;
  1478. anyOne=_st($1)._anyOne();
  1479. $3=self._collection();
  1480. $ctx1.sendIdx["collection"]=2;
  1481. $2=_st($3)._anySatisfy_((function(each){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(each).__eq(anyOne);
  1484. $ctx2.sendIdx["="]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1486. $ctx1.sendIdx["anySatisfy:"]=1;
  1487. self._assert_($2);
  1488. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1489. return smalltalk.withContext(function($ctx2) {
  1490. return _st(each).__eq(_st($Object())._new());
  1491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1492. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1493. args: [],
  1494. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1495. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1496. referencedClasses: ["Object"]
  1497. }),
  1498. globals.CollectionTest);
  1499. smalltalk.addMethod(
  1500. smalltalk.method({
  1501. selector: "testAsArray",
  1502. protocol: 'tests',
  1503. fn: function (){
  1504. var self=this;
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1510. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1511. args: [],
  1512. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1513. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1514. referencedClasses: []
  1515. }),
  1516. globals.CollectionTest);
  1517. smalltalk.addMethod(
  1518. smalltalk.method({
  1519. selector: "testAsOrderedCollection",
  1520. protocol: 'tests',
  1521. fn: function (){
  1522. var self=this;
  1523. return smalltalk.withContext(function($ctx1) {
  1524. var $1;
  1525. $1=self._collection();
  1526. $ctx1.sendIdx["collection"]=1;
  1527. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1529. args: [],
  1530. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1531. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1532. referencedClasses: []
  1533. }),
  1534. globals.CollectionTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testAsSet",
  1538. protocol: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. var c,set;
  1542. return smalltalk.withContext(function($ctx1) {
  1543. c=self._collectionWithDuplicates();
  1544. set=_st(c)._asSet();
  1545. self._assert_equals_(_st(set)._size(),(5));
  1546. _st(c)._do_((function(each){
  1547. return smalltalk.withContext(function($ctx2) {
  1548. return self._assert_(_st(set)._includes_(each));
  1549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1550. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1551. args: [],
  1552. 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) ]",
  1553. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1554. referencedClasses: []
  1555. }),
  1556. globals.CollectionTest);
  1557. smalltalk.addMethod(
  1558. smalltalk.method({
  1559. selector: "testCollect",
  1560. protocol: 'tests',
  1561. fn: function (){
  1562. var self=this;
  1563. return smalltalk.withContext(function($ctx1) {
  1564. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1565. $2=self._collection();
  1566. $ctx1.sendIdx["collection"]=1;
  1567. $1=_st($2)._collect_((function(each){
  1568. return each;
  1569. }));
  1570. $ctx1.sendIdx["collect:"]=1;
  1571. $3=self._collection();
  1572. $ctx1.sendIdx["collection"]=2;
  1573. self._assert_equals_($1,$3);
  1574. $ctx1.sendIdx["assert:equals:"]=1;
  1575. $5=self._collectionWithNewValue();
  1576. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1577. $4=_st($5)._collect_((function(each){
  1578. return each;
  1579. }));
  1580. $ctx1.sendIdx["collect:"]=2;
  1581. self._assert_equals_($4,self._collectionWithNewValue());
  1582. $ctx1.sendIdx["assert:equals:"]=2;
  1583. $8=self._collectionClass();
  1584. $ctx1.sendIdx["collectionClass"]=1;
  1585. $7=_st($8)._new();
  1586. $ctx1.sendIdx["new"]=1;
  1587. $6=_st($7)._collect_((function(each){
  1588. return smalltalk.withContext(function($ctx2) {
  1589. return _st(each)._printString();
  1590. $ctx2.sendIdx["printString"]=1;
  1591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1592. $ctx1.sendIdx["collect:"]=3;
  1593. self._assert_equals_($6,_st(self._collectionClass())._new());
  1594. $ctx1.sendIdx["assert:equals:"]=3;
  1595. $11=self._collection();
  1596. $ctx1.sendIdx["collection"]=3;
  1597. $10=_st($11)._collect_((function(){
  1598. return smalltalk.withContext(function($ctx2) {
  1599. return self._sampleNewValue();
  1600. $ctx2.sendIdx["sampleNewValue"]=1;
  1601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1602. $ctx1.sendIdx["collect:"]=4;
  1603. $9=_st($10)._detect_((function(){
  1604. return true;
  1605. }));
  1606. self._assert_equals_($9,self._sampleNewValue());
  1607. $ctx1.sendIdx["assert:equals:"]=4;
  1608. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1609. return smalltalk.withContext(function($ctx2) {
  1610. return _st(each)._printString();
  1611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1612. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1613. args: [],
  1614. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1615. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1616. referencedClasses: []
  1617. }),
  1618. globals.CollectionTest);
  1619. smalltalk.addMethod(
  1620. smalltalk.method({
  1621. selector: "testComma",
  1622. protocol: 'tests',
  1623. fn: function (){
  1624. var self=this;
  1625. return smalltalk.withContext(function($ctx1) {
  1626. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1627. $2=self._collection();
  1628. $ctx1.sendIdx["collection"]=1;
  1629. $4=self._collectionClass();
  1630. $ctx1.sendIdx["collectionClass"]=1;
  1631. $3=_st($4)._new();
  1632. $ctx1.sendIdx["new"]=1;
  1633. $1=_st($2).__comma($3);
  1634. $ctx1.sendIdx[","]=1;
  1635. $5=self._collection();
  1636. $ctx1.sendIdx["collection"]=2;
  1637. self._assert_equals_($1,$5);
  1638. $ctx1.sendIdx["assert:equals:"]=1;
  1639. $8=self._collectionClass();
  1640. $ctx1.sendIdx["collectionClass"]=2;
  1641. $7=_st($8)._new();
  1642. $ctx1.sendIdx["new"]=2;
  1643. $9=self._collection();
  1644. $ctx1.sendIdx["collection"]=3;
  1645. $6=_st($7).__comma($9);
  1646. $ctx1.sendIdx[","]=2;
  1647. $10=self._collection();
  1648. $ctx1.sendIdx["collection"]=4;
  1649. self._assert_equals_($6,$10);
  1650. $ctx1.sendIdx["assert:equals:"]=2;
  1651. $13=self._collectionClass();
  1652. $ctx1.sendIdx["collectionClass"]=3;
  1653. $12=_st($13)._new();
  1654. $ctx1.sendIdx["new"]=3;
  1655. $15=self._collectionClass();
  1656. $ctx1.sendIdx["collectionClass"]=4;
  1657. $14=_st($15)._new();
  1658. $ctx1.sendIdx["new"]=4;
  1659. $11=_st($12).__comma($14);
  1660. $ctx1.sendIdx[","]=3;
  1661. self._assert_equals_($11,_st(self._collectionClass())._new());
  1662. $ctx1.sendIdx["assert:equals:"]=3;
  1663. $17=self._collection();
  1664. $ctx1.sendIdx["collection"]=5;
  1665. $18=self._sampleNewValueAsCollection();
  1666. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1667. $16=_st($17).__comma($18);
  1668. $ctx1.sendIdx[","]=4;
  1669. $19=self._collectionWithNewValue();
  1670. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1671. self._assert_equals_($16,$19);
  1672. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1673. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1674. args: [],
  1675. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1676. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1677. referencedClasses: []
  1678. }),
  1679. globals.CollectionTest);
  1680. smalltalk.addMethod(
  1681. smalltalk.method({
  1682. selector: "testDetect",
  1683. protocol: 'tests',
  1684. fn: function (){
  1685. var self=this;
  1686. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1687. return smalltalk.withContext(function($ctx1) {
  1688. var $1,$2,$3,$4,$6,$5,$7;
  1689. self._shouldnt_raise_((function(){
  1690. return smalltalk.withContext(function($ctx2) {
  1691. $1=self._collection();
  1692. $ctx2.sendIdx["collection"]=1;
  1693. return _st($1)._detect_((function(){
  1694. return true;
  1695. }));
  1696. $ctx2.sendIdx["detect:"]=1;
  1697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1698. self._should_raise_((function(){
  1699. return smalltalk.withContext(function($ctx2) {
  1700. $2=self._collection();
  1701. $ctx2.sendIdx["collection"]=2;
  1702. return _st($2)._detect_((function(){
  1703. return false;
  1704. }));
  1705. $ctx2.sendIdx["detect:"]=2;
  1706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1707. $ctx1.sendIdx["should:raise:"]=1;
  1708. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1709. return true;
  1710. }));
  1711. $ctx1.sendIdx["detect:"]=3;
  1712. $4=self._sampleNewValue();
  1713. $ctx1.sendIdx["sampleNewValue"]=1;
  1714. self._assert_equals_($3,$4);
  1715. $ctx1.sendIdx["assert:equals:"]=1;
  1716. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1717. return smalltalk.withContext(function($ctx2) {
  1718. $6=self._sampleNewValue();
  1719. $ctx2.sendIdx["sampleNewValue"]=2;
  1720. return _st(each).__eq($6);
  1721. $ctx2.sendIdx["="]=1;
  1722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1723. $ctx1.sendIdx["detect:"]=4;
  1724. $7=self._sampleNewValue();
  1725. $ctx1.sendIdx["sampleNewValue"]=3;
  1726. self._assert_equals_($5,$7);
  1727. self._should_raise_((function(){
  1728. return smalltalk.withContext(function($ctx2) {
  1729. return _st(self._collection())._detect_((function(each){
  1730. return smalltalk.withContext(function($ctx3) {
  1731. return _st(each).__eq(self._sampleNewValue());
  1732. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1735. args: [],
  1736. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1737. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1738. referencedClasses: ["Error"]
  1739. }),
  1740. globals.CollectionTest);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "testDetectIfNone",
  1744. protocol: 'tests',
  1745. fn: function (){
  1746. var self=this;
  1747. var sentinel;
  1748. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1749. return smalltalk.withContext(function($ctx1) {
  1750. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1751. sentinel=_st($Object())._new();
  1752. $3=self._collection();
  1753. $ctx1.sendIdx["collection"]=1;
  1754. $2=_st($3)._detect_ifNone_((function(){
  1755. return true;
  1756. }),(function(){
  1757. return sentinel;
  1758. }));
  1759. $ctx1.sendIdx["detect:ifNone:"]=1;
  1760. $1=_st($2).__tild_eq(sentinel);
  1761. self._assert_($1);
  1762. $5=self._collection();
  1763. $ctx1.sendIdx["collection"]=2;
  1764. $4=_st($5)._detect_ifNone_((function(){
  1765. return false;
  1766. }),(function(){
  1767. return sentinel;
  1768. }));
  1769. $ctx1.sendIdx["detect:ifNone:"]=2;
  1770. self._assert_equals_($4,sentinel);
  1771. $ctx1.sendIdx["assert:equals:"]=1;
  1772. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1773. return true;
  1774. }),(function(){
  1775. return sentinel;
  1776. }));
  1777. $ctx1.sendIdx["detect:ifNone:"]=3;
  1778. $7=self._sampleNewValue();
  1779. $ctx1.sendIdx["sampleNewValue"]=1;
  1780. self._assert_equals_($6,$7);
  1781. $ctx1.sendIdx["assert:equals:"]=2;
  1782. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1783. return smalltalk.withContext(function($ctx2) {
  1784. $9=self._sampleNewValue();
  1785. $ctx2.sendIdx["sampleNewValue"]=2;
  1786. return _st(each).__eq($9);
  1787. $ctx2.sendIdx["="]=1;
  1788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1789. return sentinel;
  1790. }));
  1791. $ctx1.sendIdx["detect:ifNone:"]=4;
  1792. $10=self._sampleNewValue();
  1793. $ctx1.sendIdx["sampleNewValue"]=3;
  1794. self._assert_equals_($8,$10);
  1795. $ctx1.sendIdx["assert:equals:"]=3;
  1796. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1797. return smalltalk.withContext(function($ctx2) {
  1798. return _st(each).__eq(self._sampleNewValue());
  1799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1800. return sentinel;
  1801. })),sentinel);
  1802. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1803. args: [],
  1804. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1805. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1806. referencedClasses: ["Object"]
  1807. }),
  1808. globals.CollectionTest);
  1809. smalltalk.addMethod(
  1810. smalltalk.method({
  1811. selector: "testDo",
  1812. protocol: 'tests',
  1813. fn: function (){
  1814. var self=this;
  1815. var newCollection;
  1816. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1817. return smalltalk.withContext(function($ctx1) {
  1818. var $1,$2;
  1819. newCollection=_st($OrderedCollection())._new();
  1820. $ctx1.sendIdx["new"]=1;
  1821. $1=self._collection();
  1822. $ctx1.sendIdx["collection"]=1;
  1823. _st($1)._do_((function(each){
  1824. return smalltalk.withContext(function($ctx2) {
  1825. return _st(newCollection)._add_(each);
  1826. $ctx2.sendIdx["add:"]=1;
  1827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1828. $ctx1.sendIdx["do:"]=1;
  1829. self._assertSameContents_as_(self._collection(),newCollection);
  1830. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1831. newCollection=_st($OrderedCollection())._new();
  1832. $2=self._collectionWithDuplicates();
  1833. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1834. _st($2)._do_((function(each){
  1835. return smalltalk.withContext(function($ctx2) {
  1836. return _st(newCollection)._add_(each);
  1837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1838. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1839. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1840. args: [],
  1841. 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.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1842. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1843. referencedClasses: ["OrderedCollection"]
  1844. }),
  1845. globals.CollectionTest);
  1846. smalltalk.addMethod(
  1847. smalltalk.method({
  1848. selector: "testIfEmptyFamily",
  1849. protocol: 'tests',
  1850. fn: function (){
  1851. var self=this;
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1854. $3=self._collectionClass();
  1855. $ctx1.sendIdx["collectionClass"]=1;
  1856. $2=_st($3)._new();
  1857. $ctx1.sendIdx["new"]=1;
  1858. $1=_st($2)._ifEmpty_((function(){
  1859. return (42);
  1860. }));
  1861. $ctx1.sendIdx["ifEmpty:"]=1;
  1862. self._assert_equals_($1,(42));
  1863. $ctx1.sendIdx["assert:equals:"]=1;
  1864. $5=self._collection();
  1865. $ctx1.sendIdx["collection"]=1;
  1866. $4=_st($5)._ifEmpty_((function(){
  1867. return (42);
  1868. }));
  1869. $6=self._collection();
  1870. $ctx1.sendIdx["collection"]=2;
  1871. self._assert_equals_($4,$6);
  1872. $ctx1.sendIdx["assert:equals:"]=2;
  1873. $9=self._collectionClass();
  1874. $ctx1.sendIdx["collectionClass"]=2;
  1875. $8=_st($9)._new();
  1876. $ctx1.sendIdx["new"]=2;
  1877. $7=_st($8)._ifNotEmpty_((function(){
  1878. return (42);
  1879. }));
  1880. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1881. $11=self._collectionClass();
  1882. $ctx1.sendIdx["collectionClass"]=3;
  1883. $10=_st($11)._new();
  1884. $ctx1.sendIdx["new"]=3;
  1885. self._assert_equals_($7,$10);
  1886. $ctx1.sendIdx["assert:equals:"]=3;
  1887. $13=self._collection();
  1888. $ctx1.sendIdx["collection"]=3;
  1889. $12=_st($13)._ifNotEmpty_((function(){
  1890. return (42);
  1891. }));
  1892. self._assert_equals_($12,(42));
  1893. $ctx1.sendIdx["assert:equals:"]=4;
  1894. $16=self._collectionClass();
  1895. $ctx1.sendIdx["collectionClass"]=4;
  1896. $15=_st($16)._new();
  1897. $ctx1.sendIdx["new"]=4;
  1898. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1899. return (42);
  1900. }),(function(){
  1901. return (999);
  1902. }));
  1903. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1904. self._assert_equals_($14,(42));
  1905. $ctx1.sendIdx["assert:equals:"]=5;
  1906. $18=self._collection();
  1907. $ctx1.sendIdx["collection"]=4;
  1908. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1909. return (42);
  1910. }),(function(){
  1911. return (999);
  1912. }));
  1913. self._assert_equals_($17,(999));
  1914. $ctx1.sendIdx["assert:equals:"]=6;
  1915. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1916. return (42);
  1917. }),(function(){
  1918. return (999);
  1919. }));
  1920. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1921. self._assert_equals_($19,(999));
  1922. $ctx1.sendIdx["assert:equals:"]=7;
  1923. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1924. return (42);
  1925. }),(function(){
  1926. return (999);
  1927. })),(42));
  1928. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1929. args: [],
  1930. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1931. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1932. referencedClasses: []
  1933. }),
  1934. globals.CollectionTest);
  1935. smalltalk.addMethod(
  1936. smalltalk.method({
  1937. selector: "testIsEmpty",
  1938. protocol: 'tests',
  1939. fn: function (){
  1940. var self=this;
  1941. return smalltalk.withContext(function($ctx1) {
  1942. var $1;
  1943. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1944. $ctx1.sendIdx["isEmpty"]=1;
  1945. self._assert_($1);
  1946. self._deny_(_st(self._collection())._isEmpty());
  1947. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  1948. args: [],
  1949. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1950. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1951. referencedClasses: []
  1952. }),
  1953. globals.CollectionTest);
  1954. smalltalk.addMethod(
  1955. smalltalk.method({
  1956. selector: "testNoneSatisfy",
  1957. protocol: 'tests',
  1958. fn: function (){
  1959. var self=this;
  1960. var anyOne;
  1961. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1962. return smalltalk.withContext(function($ctx1) {
  1963. var $1,$3,$2;
  1964. $1=self._collection();
  1965. $ctx1.sendIdx["collection"]=1;
  1966. anyOne=_st($1)._anyOne();
  1967. $3=self._collection();
  1968. $ctx1.sendIdx["collection"]=2;
  1969. $2=_st($3)._noneSatisfy_((function(each){
  1970. return smalltalk.withContext(function($ctx2) {
  1971. return _st(each).__eq(anyOne);
  1972. $ctx2.sendIdx["="]=1;
  1973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1974. $ctx1.sendIdx["noneSatisfy:"]=1;
  1975. self._deny_($2);
  1976. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1977. return smalltalk.withContext(function($ctx2) {
  1978. return _st(each).__eq(_st($Object())._new());
  1979. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1980. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1981. args: [],
  1982. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  1983. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1984. referencedClasses: ["Object"]
  1985. }),
  1986. globals.CollectionTest);
  1987. smalltalk.addMethod(
  1988. smalltalk.method({
  1989. selector: "testRemoveAll",
  1990. protocol: 'tests',
  1991. fn: function (){
  1992. var self=this;
  1993. return smalltalk.withContext(function($ctx1) {
  1994. var $1,$2;
  1995. $1=self._collection();
  1996. _st($1)._removeAll();
  1997. $2=_st($1)._yourself();
  1998. self._assert_equals_($2,_st(self._collectionClass())._new());
  1999. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2000. args: [],
  2001. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2002. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2003. referencedClasses: []
  2004. }),
  2005. globals.CollectionTest);
  2006. smalltalk.addMethod(
  2007. smalltalk.method({
  2008. selector: "testSelect",
  2009. protocol: 'tests',
  2010. fn: function (){
  2011. var self=this;
  2012. return smalltalk.withContext(function($ctx1) {
  2013. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2014. $2=self._collection();
  2015. $ctx1.sendIdx["collection"]=1;
  2016. $1=_st($2)._select_((function(){
  2017. return false;
  2018. }));
  2019. $ctx1.sendIdx["select:"]=1;
  2020. $4=self._collectionClass();
  2021. $ctx1.sendIdx["collectionClass"]=1;
  2022. $3=_st($4)._new();
  2023. $ctx1.sendIdx["new"]=1;
  2024. self._assert_equals_($1,$3);
  2025. $ctx1.sendIdx["assert:equals:"]=1;
  2026. $6=self._collection();
  2027. $ctx1.sendIdx["collection"]=2;
  2028. $5=_st($6)._select_((function(){
  2029. return true;
  2030. }));
  2031. $ctx1.sendIdx["select:"]=2;
  2032. $7=self._collection();
  2033. $ctx1.sendIdx["collection"]=3;
  2034. self._assert_equals_($5,$7);
  2035. $ctx1.sendIdx["assert:equals:"]=2;
  2036. $9=self._collectionWithNewValue();
  2037. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2038. $8=_st($9)._select_((function(each){
  2039. return smalltalk.withContext(function($ctx2) {
  2040. $10=self._sampleNewValue();
  2041. $ctx2.sendIdx["sampleNewValue"]=1;
  2042. return _st(each).__eq($10);
  2043. $ctx2.sendIdx["="]=1;
  2044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2045. $ctx1.sendIdx["select:"]=3;
  2046. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2047. $ctx1.sendIdx["assert:equals:"]=3;
  2048. $12=self._collectionWithNewValue();
  2049. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2050. $11=_st($12)._select_((function(each){
  2051. return smalltalk.withContext(function($ctx2) {
  2052. $13=self._sampleNewValue();
  2053. $ctx2.sendIdx["sampleNewValue"]=2;
  2054. return _st(each).__tild_eq($13);
  2055. $ctx2.sendIdx["~="]=1;
  2056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2057. $ctx1.sendIdx["select:"]=4;
  2058. $14=self._collection();
  2059. $ctx1.sendIdx["collection"]=4;
  2060. self._assert_equals_($11,$14);
  2061. $ctx1.sendIdx["assert:equals:"]=4;
  2062. $16=self._collection();
  2063. $ctx1.sendIdx["collection"]=5;
  2064. $15=_st($16)._select_((function(each){
  2065. return smalltalk.withContext(function($ctx2) {
  2066. $17=self._sampleNewValue();
  2067. $ctx2.sendIdx["sampleNewValue"]=3;
  2068. return _st(each).__eq($17);
  2069. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2070. $ctx1.sendIdx["select:"]=5;
  2071. self._assert_equals_($15,_st(self._collectionClass())._new());
  2072. $ctx1.sendIdx["assert:equals:"]=5;
  2073. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return _st(each).__tild_eq(self._sampleNewValue());
  2076. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2077. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2078. args: [],
  2079. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2080. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2081. referencedClasses: []
  2082. }),
  2083. globals.CollectionTest);
  2084. smalltalk.addMethod(
  2085. smalltalk.method({
  2086. selector: "testSize",
  2087. protocol: 'tests',
  2088. fn: function (){
  2089. var self=this;
  2090. return smalltalk.withContext(function($ctx1) {
  2091. var $1,$2;
  2092. $1=_st(_st(self._collectionClass())._new())._size();
  2093. $ctx1.sendIdx["size"]=1;
  2094. self._assert_equals_($1,(0));
  2095. $ctx1.sendIdx["assert:equals:"]=1;
  2096. $2=_st(self._sampleNewValueAsCollection())._size();
  2097. $ctx1.sendIdx["size"]=2;
  2098. self._assert_equals_($2,(1));
  2099. $ctx1.sendIdx["assert:equals:"]=2;
  2100. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2101. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2102. args: [],
  2103. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2104. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2105. referencedClasses: []
  2106. }),
  2107. globals.CollectionTest);
  2108. smalltalk.addMethod(
  2109. smalltalk.method({
  2110. selector: "collectionClass",
  2111. protocol: 'fixture',
  2112. fn: function (){
  2113. var self=this;
  2114. return nil;
  2115. },
  2116. args: [],
  2117. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2118. messageSends: [],
  2119. referencedClasses: []
  2120. }),
  2121. globals.CollectionTest.klass);
  2122. smalltalk.addMethod(
  2123. smalltalk.method({
  2124. selector: "isAbstract",
  2125. protocol: 'testing',
  2126. fn: function (){
  2127. var self=this;
  2128. return smalltalk.withContext(function($ctx1) {
  2129. var $1;
  2130. $1=_st(self._collectionClass())._isNil();
  2131. return $1;
  2132. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2133. args: [],
  2134. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2135. messageSends: ["isNil", "collectionClass"],
  2136. referencedClasses: []
  2137. }),
  2138. globals.CollectionTest.klass);
  2139. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2140. smalltalk.addMethod(
  2141. smalltalk.method({
  2142. selector: "collectionWithNewValue",
  2143. protocol: 'fixture',
  2144. fn: function (){
  2145. var self=this;
  2146. return smalltalk.withContext(function($ctx1) {
  2147. self._subclassResponsibility();
  2148. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2149. args: [],
  2150. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2151. messageSends: ["subclassResponsibility"],
  2152. referencedClasses: []
  2153. }),
  2154. globals.IndexableCollectionTest);
  2155. smalltalk.addMethod(
  2156. smalltalk.method({
  2157. selector: "sampleNewIndex",
  2158. protocol: 'fixture',
  2159. fn: function (){
  2160. var self=this;
  2161. return smalltalk.withContext(function($ctx1) {
  2162. self._subclassResponsibility();
  2163. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2164. args: [],
  2165. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2166. messageSends: ["subclassResponsibility"],
  2167. referencedClasses: []
  2168. }),
  2169. globals.IndexableCollectionTest);
  2170. smalltalk.addMethod(
  2171. smalltalk.method({
  2172. selector: "sampleNonIndexesDo:",
  2173. protocol: 'fixture',
  2174. fn: function (aBlock){
  2175. var self=this;
  2176. return smalltalk.withContext(function($ctx1) {
  2177. self._subclassResponsibility();
  2178. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2179. args: ["aBlock"],
  2180. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2181. messageSends: ["subclassResponsibility"],
  2182. referencedClasses: []
  2183. }),
  2184. globals.IndexableCollectionTest);
  2185. smalltalk.addMethod(
  2186. smalltalk.method({
  2187. selector: "samplesDo:",
  2188. protocol: 'fixture',
  2189. fn: function (aBlock){
  2190. var self=this;
  2191. return smalltalk.withContext(function($ctx1) {
  2192. self._subclassResponsibility();
  2193. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2194. args: ["aBlock"],
  2195. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2196. messageSends: ["subclassResponsibility"],
  2197. referencedClasses: []
  2198. }),
  2199. globals.IndexableCollectionTest);
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "testAt",
  2203. protocol: 'tests',
  2204. fn: function (){
  2205. var self=this;
  2206. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2207. return smalltalk.withContext(function($ctx1) {
  2208. var $1;
  2209. self._nonIndexesDo_((function(each){
  2210. return smalltalk.withContext(function($ctx2) {
  2211. return self._should_raise_((function(){
  2212. return smalltalk.withContext(function($ctx3) {
  2213. $1=self._collection();
  2214. $ctx3.sendIdx["collection"]=1;
  2215. return _st($1)._at_(each);
  2216. $ctx3.sendIdx["at:"]=1;
  2217. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2219. self._samplesDo_((function(index,value){
  2220. return smalltalk.withContext(function($ctx2) {
  2221. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2222. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2223. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2224. args: [],
  2225. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2226. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2227. referencedClasses: ["Error"]
  2228. }),
  2229. globals.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "testAtIfAbsent",
  2233. protocol: 'tests',
  2234. fn: function (){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. var $2,$1,$3;
  2238. self._nonIndexesDo_((function(each){
  2239. return smalltalk.withContext(function($ctx2) {
  2240. $2=self._collection();
  2241. $ctx2.sendIdx["collection"]=1;
  2242. $1=_st($2)._at_ifAbsent_(each,(function(){
  2243. return smalltalk.withContext(function($ctx3) {
  2244. return self._sampleNewValue();
  2245. $ctx3.sendIdx["sampleNewValue"]=1;
  2246. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2247. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2248. $3=self._sampleNewValue();
  2249. $ctx2.sendIdx["sampleNewValue"]=2;
  2250. return self._assert_equals_($1,$3);
  2251. $ctx2.sendIdx["assert:equals:"]=1;
  2252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2253. self._samplesDo_((function(index,value){
  2254. return smalltalk.withContext(function($ctx2) {
  2255. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2256. return smalltalk.withContext(function($ctx3) {
  2257. return self._sampleNewValue();
  2258. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2259. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2260. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2261. args: [],
  2262. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2263. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2264. referencedClasses: []
  2265. }),
  2266. globals.IndexableCollectionTest);
  2267. smalltalk.addMethod(
  2268. smalltalk.method({
  2269. selector: "testAtIfAbsentPut",
  2270. protocol: 'tests',
  2271. fn: function (){
  2272. var self=this;
  2273. var newCollection;
  2274. return smalltalk.withContext(function($ctx1) {
  2275. var $1;
  2276. newCollection=self._collection();
  2277. $ctx1.sendIdx["collection"]=1;
  2278. self._samplesDo_((function(index,value){
  2279. return smalltalk.withContext(function($ctx2) {
  2280. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2281. return smalltalk.withContext(function($ctx3) {
  2282. return self._sampleNewValue();
  2283. $ctx3.sendIdx["sampleNewValue"]=1;
  2284. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2285. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2286. return self._assert_equals_($1,value);
  2287. $ctx2.sendIdx["assert:equals:"]=1;
  2288. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2289. self._assert_equals_(newCollection,self._collection());
  2290. $ctx1.sendIdx["assert:equals:"]=2;
  2291. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2292. return smalltalk.withContext(function($ctx2) {
  2293. return self._sampleNewValue();
  2294. $ctx2.sendIdx["sampleNewValue"]=2;
  2295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2296. $ctx1.sendIdx["assert:equals:"]=3;
  2297. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2298. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2299. args: [],
  2300. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2301. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2302. referencedClasses: []
  2303. }),
  2304. globals.IndexableCollectionTest);
  2305. smalltalk.addMethod(
  2306. smalltalk.method({
  2307. selector: "testAtIfPresent",
  2308. protocol: 'tests',
  2309. fn: function (){
  2310. var self=this;
  2311. var visited,sentinel;
  2312. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2313. return smalltalk.withContext(function($ctx1) {
  2314. var $2,$1,$4,$3;
  2315. sentinel=_st($Object())._new();
  2316. self._nonIndexesDo_((function(each){
  2317. return smalltalk.withContext(function($ctx2) {
  2318. visited=nil;
  2319. visited;
  2320. $2=self._collection();
  2321. $ctx2.sendIdx["collection"]=1;
  2322. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2323. visited=value1;
  2324. visited;
  2325. return sentinel;
  2326. }));
  2327. $ctx2.sendIdx["at:ifPresent:"]=1;
  2328. self._assert_equals_($1,nil);
  2329. $ctx2.sendIdx["assert:equals:"]=1;
  2330. return self._assert_(_st(visited)._isNil());
  2331. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2332. self._samplesDo_((function(index,value){
  2333. return smalltalk.withContext(function($ctx2) {
  2334. visited=nil;
  2335. visited;
  2336. $4=self._collection();
  2337. $ctx2.sendIdx["collection"]=2;
  2338. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2339. visited=value2;
  2340. visited;
  2341. return sentinel;
  2342. }));
  2343. self._assert_equals_($3,sentinel);
  2344. $ctx2.sendIdx["assert:equals:"]=2;
  2345. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2346. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2347. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2348. args: [],
  2349. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2350. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2351. referencedClasses: ["Object"]
  2352. }),
  2353. globals.IndexableCollectionTest);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "testAtIfPresentIfAbsent",
  2357. protocol: 'tests',
  2358. fn: function (){
  2359. var self=this;
  2360. var visited,sentinel;
  2361. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2362. return smalltalk.withContext(function($ctx1) {
  2363. var $2,$1,$3,$5,$4;
  2364. sentinel=_st($Object())._new();
  2365. self._nonIndexesDo_((function(each){
  2366. return smalltalk.withContext(function($ctx2) {
  2367. visited=nil;
  2368. visited;
  2369. $2=self._collection();
  2370. $ctx2.sendIdx["collection"]=1;
  2371. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2372. visited=value1;
  2373. visited;
  2374. return sentinel;
  2375. }),(function(){
  2376. return smalltalk.withContext(function($ctx3) {
  2377. return self._sampleNewValue();
  2378. $ctx3.sendIdx["sampleNewValue"]=1;
  2379. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2380. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2381. $3=self._sampleNewValue();
  2382. $ctx2.sendIdx["sampleNewValue"]=2;
  2383. self._assert_equals_($1,$3);
  2384. $ctx2.sendIdx["assert:equals:"]=1;
  2385. return self._assert_(_st(visited)._isNil());
  2386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2387. self._samplesDo_((function(index,value){
  2388. return smalltalk.withContext(function($ctx2) {
  2389. visited=nil;
  2390. visited;
  2391. $5=self._collection();
  2392. $ctx2.sendIdx["collection"]=2;
  2393. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2394. visited=value2;
  2395. visited;
  2396. return sentinel;
  2397. }),(function(){
  2398. return smalltalk.withContext(function($ctx3) {
  2399. return self._sampleNewValue();
  2400. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2401. self._assert_equals_($4,sentinel);
  2402. $ctx2.sendIdx["assert:equals:"]=2;
  2403. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2404. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2405. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2406. args: [],
  2407. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2408. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2409. referencedClasses: ["Object"]
  2410. }),
  2411. globals.IndexableCollectionTest);
  2412. smalltalk.addMethod(
  2413. smalltalk.method({
  2414. selector: "testAtPut",
  2415. protocol: 'tests',
  2416. fn: function (){
  2417. var self=this;
  2418. var newCollection;
  2419. return smalltalk.withContext(function($ctx1) {
  2420. newCollection=self._collection();
  2421. $ctx1.sendIdx["collection"]=1;
  2422. self._samplesDo_((function(index,value){
  2423. return smalltalk.withContext(function($ctx2) {
  2424. return _st(newCollection)._at_put_(index,value);
  2425. $ctx2.sendIdx["at:put:"]=1;
  2426. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2427. self._assert_equals_(newCollection,self._collection());
  2428. $ctx1.sendIdx["assert:equals:"]=1;
  2429. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2430. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2431. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2432. args: [],
  2433. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2434. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2435. referencedClasses: []
  2436. }),
  2437. globals.IndexableCollectionTest);
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "testEquality",
  2441. protocol: 'tests',
  2442. fn: function (){
  2443. var self=this;
  2444. return smalltalk.withContext(function($ctx1) {
  2445. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2446. $2=self._collectionClass();
  2447. $ctx1.sendIdx["collectionClass"]=1;
  2448. $1=_st($2)._new();
  2449. $ctx1.sendIdx["new"]=1;
  2450. $4=self._collectionClass();
  2451. $ctx1.sendIdx["collectionClass"]=2;
  2452. $3=_st($4)._new();
  2453. $ctx1.sendIdx["new"]=2;
  2454. self._assert_equals_($1,$3);
  2455. $ctx1.sendIdx["assert:equals:"]=1;
  2456. $5=self._collection();
  2457. $ctx1.sendIdx["collection"]=1;
  2458. $6=self._collection();
  2459. $ctx1.sendIdx["collection"]=2;
  2460. self._assert_equals_($5,$6);
  2461. $ctx1.sendIdx["assert:equals:"]=2;
  2462. $7=self._collectionWithNewValue();
  2463. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2464. self._assert_equals_($7,self._collectionWithNewValue());
  2465. $10=self._collectionClass();
  2466. $ctx1.sendIdx["collectionClass"]=3;
  2467. $9=_st($10)._new();
  2468. $ctx1.sendIdx["new"]=3;
  2469. $11=self._collection();
  2470. $ctx1.sendIdx["collection"]=3;
  2471. $8=_st($9).__eq($11);
  2472. $ctx1.sendIdx["="]=1;
  2473. self._deny_($8);
  2474. $ctx1.sendIdx["deny:"]=1;
  2475. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2476. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2477. args: [],
  2478. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2479. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2480. referencedClasses: []
  2481. }),
  2482. globals.IndexableCollectionTest);
  2483. smalltalk.addMethod(
  2484. smalltalk.method({
  2485. selector: "testIndexOf",
  2486. protocol: 'tests',
  2487. fn: function (){
  2488. var self=this;
  2489. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2490. return smalltalk.withContext(function($ctx1) {
  2491. var $1;
  2492. self._should_raise_((function(){
  2493. return smalltalk.withContext(function($ctx2) {
  2494. $1=self._collection();
  2495. $ctx2.sendIdx["collection"]=1;
  2496. return _st($1)._indexOf_(self._sampleNewValue());
  2497. $ctx2.sendIdx["indexOf:"]=1;
  2498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2499. self._samplesDo_((function(index,value){
  2500. return smalltalk.withContext(function($ctx2) {
  2501. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2502. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2503. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2504. args: [],
  2505. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2506. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2507. referencedClasses: ["Error"]
  2508. }),
  2509. globals.IndexableCollectionTest);
  2510. smalltalk.addMethod(
  2511. smalltalk.method({
  2512. selector: "testIndexOfWithNull",
  2513. protocol: 'tests',
  2514. fn: function (){
  2515. var self=this;
  2516. var jsNull;
  2517. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2518. return smalltalk.withContext(function($ctx1) {
  2519. var $1,$2;
  2520. jsNull=_st($JSON())._parse_("null");
  2521. self._samplesDo_((function(index,value){
  2522. return smalltalk.withContext(function($ctx2) {
  2523. $1=self._collection();
  2524. _st($1)._at_put_(index,jsNull);
  2525. $2=_st($1)._indexOf_(jsNull);
  2526. return self._assert_equals_($2,index);
  2527. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2528. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2529. args: [],
  2530. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  2531. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2532. referencedClasses: ["JSON"]
  2533. }),
  2534. globals.IndexableCollectionTest);
  2535. smalltalk.addMethod(
  2536. smalltalk.method({
  2537. selector: "testWithIndexDo",
  2538. protocol: 'tests',
  2539. fn: function (){
  2540. var self=this;
  2541. var collection;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. collection=self._collection();
  2544. $ctx1.sendIdx["collection"]=1;
  2545. _st(self._collection())._withIndexDo_((function(each,index){
  2546. return smalltalk.withContext(function($ctx2) {
  2547. return self._assert_equals_(_st(collection)._at_(index),each);
  2548. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2549. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2550. args: [],
  2551. 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 ]",
  2552. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2553. referencedClasses: []
  2554. }),
  2555. globals.IndexableCollectionTest);
  2556. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2557. smalltalk.addMethod(
  2558. smalltalk.method({
  2559. selector: "collectionKeys",
  2560. protocol: 'fixture',
  2561. fn: function (){
  2562. var self=this;
  2563. return smalltalk.withContext(function($ctx1) {
  2564. self._subclassResponsibility();
  2565. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2566. args: [],
  2567. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2568. messageSends: ["subclassResponsibility"],
  2569. referencedClasses: []
  2570. }),
  2571. globals.AssociativeCollectionTest);
  2572. smalltalk.addMethod(
  2573. smalltalk.method({
  2574. selector: "collectionValues",
  2575. protocol: 'fixture',
  2576. fn: function (){
  2577. var self=this;
  2578. return smalltalk.withContext(function($ctx1) {
  2579. self._subclassResponsibility();
  2580. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2581. args: [],
  2582. source: "collectionValues\x0a\x09self subclassResponsibility",
  2583. messageSends: ["subclassResponsibility"],
  2584. referencedClasses: []
  2585. }),
  2586. globals.AssociativeCollectionTest);
  2587. smalltalk.addMethod(
  2588. smalltalk.method({
  2589. selector: "nonIndexesDo:",
  2590. protocol: 'fixture',
  2591. fn: function (aBlock){
  2592. var self=this;
  2593. return smalltalk.withContext(function($ctx1) {
  2594. _st(aBlock)._value_((5));
  2595. $ctx1.sendIdx["value:"]=1;
  2596. _st(aBlock)._value_("z");
  2597. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2598. args: ["aBlock"],
  2599. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2600. messageSends: ["value:"],
  2601. referencedClasses: []
  2602. }),
  2603. globals.AssociativeCollectionTest);
  2604. smalltalk.addMethod(
  2605. smalltalk.method({
  2606. selector: "sampleNewIndex",
  2607. protocol: 'fixture',
  2608. fn: function (){
  2609. var self=this;
  2610. return "new";
  2611. },
  2612. args: [],
  2613. source: "sampleNewIndex\x0a\x09^ 'new'",
  2614. messageSends: [],
  2615. referencedClasses: []
  2616. }),
  2617. globals.AssociativeCollectionTest);
  2618. smalltalk.addMethod(
  2619. smalltalk.method({
  2620. selector: "samplesDo:",
  2621. protocol: 'fixture',
  2622. fn: function (aBlock){
  2623. var self=this;
  2624. return smalltalk.withContext(function($ctx1) {
  2625. _st(aBlock)._value_value_("a",(2));
  2626. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2627. args: ["aBlock"],
  2628. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2629. messageSends: ["value:value:"],
  2630. referencedClasses: []
  2631. }),
  2632. globals.AssociativeCollectionTest);
  2633. smalltalk.addMethod(
  2634. smalltalk.method({
  2635. selector: "testAddAll",
  2636. protocol: 'tests',
  2637. fn: function (){
  2638. var self=this;
  2639. return smalltalk.withContext(function($ctx1) {
  2640. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2641. globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2642. $2=self._collection();
  2643. $ctx1.sendIdx["collection"]=1;
  2644. $3=$2;
  2645. $4=self._collection();
  2646. $ctx1.sendIdx["collection"]=2;
  2647. _st($3)._addAll_($4);
  2648. $ctx1.sendIdx["addAll:"]=1;
  2649. $5=_st($2)._yourself();
  2650. $ctx1.sendIdx["yourself"]=1;
  2651. $1=$5;
  2652. $6=self._collection();
  2653. $ctx1.sendIdx["collection"]=3;
  2654. self._assert_equals_($1,$6);
  2655. $ctx1.sendIdx["assert:equals:"]=1;
  2656. $8=self._collection();
  2657. $ctx1.sendIdx["collection"]=4;
  2658. $9=$8;
  2659. $10=self._collectionWithNewValue();
  2660. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2661. _st($9)._addAll_($10);
  2662. $ctx1.sendIdx["addAll:"]=2;
  2663. $11=_st($8)._yourself();
  2664. $ctx1.sendIdx["yourself"]=2;
  2665. $7=$11;
  2666. $12=self._collectionWithNewValue();
  2667. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2668. self._assert_equals_($7,$12);
  2669. $ctx1.sendIdx["assert:equals:"]=2;
  2670. $14=self._collectionWithNewValue();
  2671. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2672. _st($14)._addAll_(self._collection());
  2673. $15=_st($14)._yourself();
  2674. $13=$15;
  2675. self._assert_equals_($13,self._collectionWithNewValue());
  2676. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2677. args: [],
  2678. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  2679. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2680. referencedClasses: []
  2681. }),
  2682. globals.AssociativeCollectionTest);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "testAsDictionary",
  2686. protocol: 'tests',
  2687. fn: function (){
  2688. var self=this;
  2689. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2690. return smalltalk.withContext(function($ctx1) {
  2691. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2692. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2693. args: [],
  2694. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2695. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2696. referencedClasses: ["Dictionary"]
  2697. }),
  2698. globals.AssociativeCollectionTest);
  2699. smalltalk.addMethod(
  2700. smalltalk.method({
  2701. selector: "testAsHashedCollection",
  2702. protocol: 'tests',
  2703. fn: function (){
  2704. var self=this;
  2705. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2706. return smalltalk.withContext(function($ctx1) {
  2707. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2708. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2709. args: [],
  2710. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2711. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2712. referencedClasses: ["HashedCollection"]
  2713. }),
  2714. globals.AssociativeCollectionTest);
  2715. smalltalk.addMethod(
  2716. smalltalk.method({
  2717. selector: "testComma",
  2718. protocol: 'tests',
  2719. fn: function (){
  2720. var self=this;
  2721. return smalltalk.withContext(function($ctx1) {
  2722. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2723. globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2724. $2=self._collection();
  2725. $ctx1.sendIdx["collection"]=1;
  2726. $3=self._collection();
  2727. $ctx1.sendIdx["collection"]=2;
  2728. $1=_st($2).__comma($3);
  2729. $ctx1.sendIdx[","]=1;
  2730. $4=self._collection();
  2731. $ctx1.sendIdx["collection"]=3;
  2732. self._assert_equals_($1,$4);
  2733. $ctx1.sendIdx["assert:equals:"]=1;
  2734. $6=self._collection();
  2735. $ctx1.sendIdx["collection"]=4;
  2736. $7=self._collectionWithNewValue();
  2737. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2738. $5=_st($6).__comma($7);
  2739. $ctx1.sendIdx[","]=2;
  2740. $8=self._collectionWithNewValue();
  2741. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2742. self._assert_equals_($5,$8);
  2743. $ctx1.sendIdx["assert:equals:"]=2;
  2744. $10=self._collectionWithNewValue();
  2745. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2746. $9=_st($10).__comma(self._collection());
  2747. self._assert_equals_($9,self._collectionWithNewValue());
  2748. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2749. args: [],
  2750. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  2751. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2752. referencedClasses: []
  2753. }),
  2754. globals.AssociativeCollectionTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testFrom",
  2758. protocol: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. var associations;
  2762. return smalltalk.withContext(function($ctx1) {
  2763. var $1;
  2764. $1="a".__minus_gt((1));
  2765. $ctx1.sendIdx["->"]=1;
  2766. associations=[$1,"b".__minus_gt((2))];
  2767. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2768. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2769. args: [],
  2770. 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 }.",
  2771. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2772. referencedClasses: []
  2773. }),
  2774. globals.AssociativeCollectionTest);
  2775. smalltalk.addMethod(
  2776. smalltalk.method({
  2777. selector: "testKeys",
  2778. protocol: 'tests',
  2779. fn: function (){
  2780. var self=this;
  2781. return smalltalk.withContext(function($ctx1) {
  2782. var $2,$1,$3,$4;
  2783. $2=_st(_st(self._collectionClass())._new())._keys();
  2784. $ctx1.sendIdx["keys"]=1;
  2785. $1=_st($2)._isEmpty();
  2786. self._assert_($1);
  2787. $3=_st(self._collection())._keys();
  2788. $ctx1.sendIdx["keys"]=2;
  2789. $4=self._collectionKeys();
  2790. $ctx1.sendIdx["collectionKeys"]=1;
  2791. self._assertSameContents_as_($3,$4);
  2792. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2793. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2794. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2795. args: [],
  2796. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2797. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2798. referencedClasses: []
  2799. }),
  2800. globals.AssociativeCollectionTest);
  2801. smalltalk.addMethod(
  2802. smalltalk.method({
  2803. selector: "testNewFromPairs",
  2804. protocol: 'tests',
  2805. fn: function (){
  2806. var self=this;
  2807. var flattenedAssociations;
  2808. return smalltalk.withContext(function($ctx1) {
  2809. flattenedAssociations=["a",(1),"b",(2)];
  2810. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2811. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2812. args: [],
  2813. 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 }.",
  2814. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2815. referencedClasses: []
  2816. }),
  2817. globals.AssociativeCollectionTest);
  2818. smalltalk.addMethod(
  2819. smalltalk.method({
  2820. selector: "testPrintString",
  2821. protocol: 'tests',
  2822. fn: function (){
  2823. var self=this;
  2824. return smalltalk.withContext(function($ctx1) {
  2825. var $3,$2,$4,$1,$5;
  2826. $3=self._collectionClass();
  2827. $ctx1.sendIdx["collectionClass"]=1;
  2828. $2=_st($3)._new();
  2829. _st($2)._at_put_("firstname","James");
  2830. $ctx1.sendIdx["at:put:"]=1;
  2831. _st($2)._at_put_("lastname","Bond");
  2832. $4=_st($2)._printString();
  2833. $1=$4;
  2834. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2835. $ctx1.sendIdx[","]=1;
  2836. self._assert_equals_($1,$5);
  2837. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2838. args: [],
  2839. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass 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 ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2840. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2841. referencedClasses: []
  2842. }),
  2843. globals.AssociativeCollectionTest);
  2844. smalltalk.addMethod(
  2845. smalltalk.method({
  2846. selector: "testRemoveKey",
  2847. protocol: 'tests',
  2848. fn: function (){
  2849. var self=this;
  2850. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2851. return smalltalk.withContext(function($ctx1) {
  2852. var $1,$2,$3,$5,$6,$4,$7,$8;
  2853. self._nonIndexesDo_((function(each){
  2854. var collection;
  2855. return smalltalk.withContext(function($ctx2) {
  2856. collection=self._collection();
  2857. $ctx2.sendIdx["collection"]=1;
  2858. collection;
  2859. self._should_raise_((function(){
  2860. return smalltalk.withContext(function($ctx3) {
  2861. return _st(collection)._removeKey_(each);
  2862. $ctx3.sendIdx["removeKey:"]=1;
  2863. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2864. $1=collection;
  2865. $2=self._collection();
  2866. $ctx2.sendIdx["collection"]=2;
  2867. return self._assert_equals_($1,$2);
  2868. $ctx2.sendIdx["assert:equals:"]=1;
  2869. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2870. self._samplesDo_((function(index,value){
  2871. var collection;
  2872. return smalltalk.withContext(function($ctx2) {
  2873. collection=self._collection();
  2874. $ctx2.sendIdx["collection"]=3;
  2875. collection;
  2876. $3=_st(collection)._removeKey_(index);
  2877. $ctx2.sendIdx["removeKey:"]=2;
  2878. self._assert_equals_($3,value);
  2879. $ctx2.sendIdx["assert:equals:"]=2;
  2880. $5=collection;
  2881. $6=self._collection();
  2882. $ctx2.sendIdx["collection"]=4;
  2883. $4=_st($5).__eq($6);
  2884. return self._deny_($4);
  2885. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2886. $7=self._collectionWithNewValue();
  2887. _st($7)._removeKey_(self._sampleNewIndex());
  2888. $8=_st($7)._yourself();
  2889. self._assert_equals_($8,self._collection());
  2890. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2891. args: [],
  2892. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  2893. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2894. referencedClasses: ["Error"]
  2895. }),
  2896. globals.AssociativeCollectionTest);
  2897. smalltalk.addMethod(
  2898. smalltalk.method({
  2899. selector: "testRemoveKeyIfAbsent",
  2900. protocol: 'tests',
  2901. fn: function (){
  2902. var self=this;
  2903. return smalltalk.withContext(function($ctx1) {
  2904. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2905. self._nonIndexesDo_((function(each){
  2906. var collection;
  2907. return smalltalk.withContext(function($ctx2) {
  2908. collection=self._collection();
  2909. $ctx2.sendIdx["collection"]=1;
  2910. collection;
  2911. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2912. return smalltalk.withContext(function($ctx3) {
  2913. return self._sampleNewValue();
  2914. $ctx3.sendIdx["sampleNewValue"]=1;
  2915. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2916. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2917. $2=self._sampleNewValue();
  2918. $ctx2.sendIdx["sampleNewValue"]=2;
  2919. self._assert_equals_($1,$2);
  2920. $ctx2.sendIdx["assert:equals:"]=1;
  2921. $3=collection;
  2922. $4=self._collection();
  2923. $ctx2.sendIdx["collection"]=2;
  2924. return self._assert_equals_($3,$4);
  2925. $ctx2.sendIdx["assert:equals:"]=2;
  2926. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2927. self._samplesDo_((function(index,value){
  2928. var collection;
  2929. return smalltalk.withContext(function($ctx2) {
  2930. collection=self._collection();
  2931. $ctx2.sendIdx["collection"]=3;
  2932. collection;
  2933. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  2934. return smalltalk.withContext(function($ctx3) {
  2935. return self._sampleNewValue();
  2936. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  2937. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  2938. self._assert_equals_($5,value);
  2939. $ctx2.sendIdx["assert:equals:"]=3;
  2940. $7=collection;
  2941. $8=self._collection();
  2942. $ctx2.sendIdx["collection"]=4;
  2943. $6=_st($7).__eq($8);
  2944. return self._deny_($6);
  2945. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2946. $9=self._collectionWithNewValue();
  2947. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  2948. return smalltalk.withContext(function($ctx2) {
  2949. return self._assert_(false);
  2950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  2951. $10=_st($9)._yourself();
  2952. self._assert_equals_($10,self._collection());
  2953. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  2954. args: [],
  2955. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  2956. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  2957. referencedClasses: []
  2958. }),
  2959. globals.AssociativeCollectionTest);
  2960. smalltalk.addMethod(
  2961. smalltalk.method({
  2962. selector: "testValues",
  2963. protocol: 'tests',
  2964. fn: function (){
  2965. var self=this;
  2966. return smalltalk.withContext(function($ctx1) {
  2967. var $2,$1,$3,$4;
  2968. $2=_st(_st(self._collectionClass())._new())._values();
  2969. $ctx1.sendIdx["values"]=1;
  2970. $1=_st($2)._isEmpty();
  2971. self._assert_($1);
  2972. $3=_st(self._collection())._values();
  2973. $ctx1.sendIdx["values"]=2;
  2974. $4=self._collectionValues();
  2975. $ctx1.sendIdx["collectionValues"]=1;
  2976. self._assertSameContents_as_($3,$4);
  2977. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2978. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  2979. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  2980. args: [],
  2981. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  2982. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  2983. referencedClasses: []
  2984. }),
  2985. globals.AssociativeCollectionTest);
  2986. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  2987. smalltalk.addMethod(
  2988. smalltalk.method({
  2989. selector: "collection",
  2990. protocol: 'fixture',
  2991. fn: function (){
  2992. var self=this;
  2993. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2994. return smalltalk.withContext(function($ctx1) {
  2995. var $2,$3,$1;
  2996. $2=_st($Dictionary())._new();
  2997. _st($2)._at_put_((1),(1));
  2998. $ctx1.sendIdx["at:put:"]=1;
  2999. _st($2)._at_put_("a",(2));
  3000. $ctx1.sendIdx["at:put:"]=2;
  3001. _st($2)._at_put_(true,(3));
  3002. $ctx1.sendIdx["at:put:"]=3;
  3003. _st($2)._at_put_((1).__at((3)),(-4));
  3004. $3=_st($2)._yourself();
  3005. $1=$3;
  3006. return $1;
  3007. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3008. args: [],
  3009. 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: 1@3 put: -4;\x0a\x09\x09yourself",
  3010. messageSends: ["at:put:", "new", "@", "yourself"],
  3011. referencedClasses: ["Dictionary"]
  3012. }),
  3013. globals.DictionaryTest);
  3014. smalltalk.addMethod(
  3015. smalltalk.method({
  3016. selector: "collectionKeys",
  3017. protocol: 'fixture',
  3018. fn: function (){
  3019. var self=this;
  3020. return smalltalk.withContext(function($ctx1) {
  3021. var $1;
  3022. $1=[(1),"a",true,(1).__at((3))];
  3023. return $1;
  3024. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3025. args: [],
  3026. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3027. messageSends: ["@"],
  3028. referencedClasses: []
  3029. }),
  3030. globals.DictionaryTest);
  3031. smalltalk.addMethod(
  3032. smalltalk.method({
  3033. selector: "collectionOfPrintStrings",
  3034. protocol: 'fixture',
  3035. fn: function (){
  3036. var self=this;
  3037. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3038. return smalltalk.withContext(function($ctx1) {
  3039. var $2,$3,$1;
  3040. $2=_st($Dictionary())._new();
  3041. _st($2)._at_put_((1),"1");
  3042. $ctx1.sendIdx["at:put:"]=1;
  3043. _st($2)._at_put_("a","2");
  3044. $ctx1.sendIdx["at:put:"]=2;
  3045. _st($2)._at_put_(true,"3");
  3046. $ctx1.sendIdx["at:put:"]=3;
  3047. _st($2)._at_put_((1).__at((3)),"-4");
  3048. $3=_st($2)._yourself();
  3049. $1=$3;
  3050. return $1;
  3051. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3052. args: [],
  3053. source: "collectionOfPrintStrings\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: 1@3 put: '-4';\x0a\x09\x09yourself",
  3054. messageSends: ["at:put:", "new", "@", "yourself"],
  3055. referencedClasses: ["Dictionary"]
  3056. }),
  3057. globals.DictionaryTest);
  3058. smalltalk.addMethod(
  3059. smalltalk.method({
  3060. selector: "collectionSize",
  3061. protocol: 'fixture',
  3062. fn: function (){
  3063. var self=this;
  3064. return (4);
  3065. },
  3066. args: [],
  3067. source: "collectionSize\x0a\x09^ 4",
  3068. messageSends: [],
  3069. referencedClasses: []
  3070. }),
  3071. globals.DictionaryTest);
  3072. smalltalk.addMethod(
  3073. smalltalk.method({
  3074. selector: "collectionValues",
  3075. protocol: 'fixture',
  3076. fn: function (){
  3077. var self=this;
  3078. var $1;
  3079. $1=[(1),(2),(3),(-4)];
  3080. return $1;
  3081. },
  3082. args: [],
  3083. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3084. messageSends: [],
  3085. referencedClasses: []
  3086. }),
  3087. globals.DictionaryTest);
  3088. smalltalk.addMethod(
  3089. smalltalk.method({
  3090. selector: "collectionWithDuplicates",
  3091. protocol: 'fixture',
  3092. fn: function (){
  3093. var self=this;
  3094. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3095. return smalltalk.withContext(function($ctx1) {
  3096. var $2,$3,$1;
  3097. $2=_st($Dictionary())._new();
  3098. _st($2)._at_put_((1),(1));
  3099. $ctx1.sendIdx["at:put:"]=1;
  3100. _st($2)._at_put_("a",(2));
  3101. $ctx1.sendIdx["at:put:"]=2;
  3102. _st($2)._at_put_(true,(3));
  3103. $ctx1.sendIdx["at:put:"]=3;
  3104. _st($2)._at_put_((4),(-4));
  3105. $ctx1.sendIdx["at:put:"]=4;
  3106. _st($2)._at_put_("b",(1));
  3107. $ctx1.sendIdx["at:put:"]=5;
  3108. _st($2)._at_put_((3),(3));
  3109. $ctx1.sendIdx["at:put:"]=6;
  3110. _st($2)._at_put_(false,(12));
  3111. $3=_st($2)._yourself();
  3112. $1=$3;
  3113. return $1;
  3114. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3115. args: [],
  3116. 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",
  3117. messageSends: ["at:put:", "new", "yourself"],
  3118. referencedClasses: ["Dictionary"]
  3119. }),
  3120. globals.DictionaryTest);
  3121. smalltalk.addMethod(
  3122. smalltalk.method({
  3123. selector: "collectionWithNewValue",
  3124. protocol: 'fixture',
  3125. fn: function (){
  3126. var self=this;
  3127. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3128. return smalltalk.withContext(function($ctx1) {
  3129. var $2,$3,$1;
  3130. $2=_st($Dictionary())._new();
  3131. _st($2)._at_put_((1),(1));
  3132. $ctx1.sendIdx["at:put:"]=1;
  3133. _st($2)._at_put_("a",(2));
  3134. $ctx1.sendIdx["at:put:"]=2;
  3135. _st($2)._at_put_(true,(3));
  3136. $ctx1.sendIdx["at:put:"]=3;
  3137. _st($2)._at_put_((1).__at((3)),(-4));
  3138. $ctx1.sendIdx["at:put:"]=4;
  3139. _st($2)._at_put_("new","N");
  3140. $3=_st($2)._yourself();
  3141. $1=$3;
  3142. return $1;
  3143. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3144. args: [],
  3145. source: "collectionWithNewValue\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: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3146. messageSends: ["at:put:", "new", "@", "yourself"],
  3147. referencedClasses: ["Dictionary"]
  3148. }),
  3149. globals.DictionaryTest);
  3150. smalltalk.addMethod(
  3151. smalltalk.method({
  3152. selector: "sampleNewValueAsCollection",
  3153. protocol: 'fixture',
  3154. fn: function (){
  3155. var self=this;
  3156. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3157. return smalltalk.withContext(function($ctx1) {
  3158. var $2,$3,$1;
  3159. $2=_st($Dictionary())._new();
  3160. _st($2)._at_put_("new","N");
  3161. $3=_st($2)._yourself();
  3162. $1=$3;
  3163. return $1;
  3164. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3165. args: [],
  3166. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3167. messageSends: ["at:put:", "new", "yourself"],
  3168. referencedClasses: ["Dictionary"]
  3169. }),
  3170. globals.DictionaryTest);
  3171. smalltalk.addMethod(
  3172. smalltalk.method({
  3173. selector: "samplesDo:",
  3174. protocol: 'fixture',
  3175. fn: function (aBlock){
  3176. var self=this;
  3177. return smalltalk.withContext(function($ctx1) {
  3178. globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3179. _st(aBlock)._value_value_(true,(3));
  3180. $ctx1.sendIdx["value:value:"]=1;
  3181. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3182. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3183. args: ["aBlock"],
  3184. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3185. messageSends: ["samplesDo:", "value:value:", "@"],
  3186. referencedClasses: []
  3187. }),
  3188. globals.DictionaryTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "testAccessing",
  3192. protocol: 'tests',
  3193. fn: function (){
  3194. var self=this;
  3195. var d;
  3196. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3197. return smalltalk.withContext(function($ctx1) {
  3198. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3199. d=_st($Dictionary())._new();
  3200. _st(d)._at_put_("hello","world");
  3201. $ctx1.sendIdx["at:put:"]=1;
  3202. $1=_st(d)._at_("hello");
  3203. $ctx1.sendIdx["at:"]=1;
  3204. self._assert_equals_($1,"world");
  3205. $ctx1.sendIdx["assert:equals:"]=1;
  3206. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3207. return nil;
  3208. }));
  3209. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3210. self._assert_equals_($2,"world");
  3211. $ctx1.sendIdx["assert:equals:"]=2;
  3212. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3213. return nil;
  3214. }))).__eq("world"));
  3215. $ctx1.sendIdx["deny:"]=1;
  3216. $3=_st(d)._includesKey_("hello");
  3217. $ctx1.sendIdx["includesKey:"]=1;
  3218. self._assert_($3);
  3219. $ctx1.sendIdx["assert:"]=1;
  3220. $4=_st(d)._includesKey_("foo");
  3221. $ctx1.sendIdx["includesKey:"]=2;
  3222. self._deny_($4);
  3223. $ctx1.sendIdx["deny:"]=2;
  3224. _st(d)._at_put_((1),(2));
  3225. $ctx1.sendIdx["at:put:"]=2;
  3226. $5=_st(d)._at_((1));
  3227. $ctx1.sendIdx["at:"]=2;
  3228. self._assert_equals_($5,(2));
  3229. $ctx1.sendIdx["assert:equals:"]=3;
  3230. $6=d;
  3231. $7=(1).__at((3));
  3232. $ctx1.sendIdx["@"]=1;
  3233. _st($6)._at_put_($7,(3));
  3234. $9=d;
  3235. $10=(1).__at((3));
  3236. $ctx1.sendIdx["@"]=2;
  3237. $8=_st($9)._at_($10);
  3238. self._assert_equals_($8,(3));
  3239. $12=d;
  3240. $13=(1).__at((3));
  3241. $ctx1.sendIdx["@"]=3;
  3242. $11=_st($12)._includesKey_($13);
  3243. $ctx1.sendIdx["includesKey:"]=3;
  3244. self._assert_($11);
  3245. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3246. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3247. args: [],
  3248. 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)",
  3249. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3250. referencedClasses: ["Dictionary"]
  3251. }),
  3252. globals.DictionaryTest);
  3253. smalltalk.addMethod(
  3254. smalltalk.method({
  3255. selector: "testDynamicDictionaries",
  3256. protocol: 'tests',
  3257. fn: function (){
  3258. var self=this;
  3259. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3260. return smalltalk.withContext(function($ctx1) {
  3261. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3262. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3263. args: [],
  3264. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3265. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3266. referencedClasses: ["Dictionary"]
  3267. }),
  3268. globals.DictionaryTest);
  3269. smalltalk.addMethod(
  3270. smalltalk.method({
  3271. selector: "collectionClass",
  3272. protocol: 'fixture',
  3273. fn: function (){
  3274. var self=this;
  3275. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3276. return $Dictionary();
  3277. },
  3278. args: [],
  3279. source: "collectionClass\x0a\x09^ Dictionary",
  3280. messageSends: [],
  3281. referencedClasses: ["Dictionary"]
  3282. }),
  3283. globals.DictionaryTest.klass);
  3284. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3285. smalltalk.addMethod(
  3286. smalltalk.method({
  3287. selector: "collection",
  3288. protocol: 'fixture',
  3289. fn: function (){
  3290. var self=this;
  3291. var $1;
  3292. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3293. return $1;
  3294. },
  3295. args: [],
  3296. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3297. messageSends: [],
  3298. referencedClasses: []
  3299. }),
  3300. globals.HashedCollectionTest);
  3301. smalltalk.addMethod(
  3302. smalltalk.method({
  3303. selector: "collectionKeys",
  3304. protocol: 'fixture',
  3305. fn: function (){
  3306. var self=this;
  3307. var $1;
  3308. $1=["b","a","c","d"];
  3309. return $1;
  3310. },
  3311. args: [],
  3312. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3313. messageSends: [],
  3314. referencedClasses: []
  3315. }),
  3316. globals.HashedCollectionTest);
  3317. smalltalk.addMethod(
  3318. smalltalk.method({
  3319. selector: "collectionOfPrintStrings",
  3320. protocol: 'fixture',
  3321. fn: function (){
  3322. var self=this;
  3323. var $1;
  3324. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3325. return $1;
  3326. },
  3327. args: [],
  3328. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3329. messageSends: [],
  3330. referencedClasses: []
  3331. }),
  3332. globals.HashedCollectionTest);
  3333. smalltalk.addMethod(
  3334. smalltalk.method({
  3335. selector: "collectionSize",
  3336. protocol: 'fixture',
  3337. fn: function (){
  3338. var self=this;
  3339. return (4);
  3340. },
  3341. args: [],
  3342. source: "collectionSize\x0a\x09^ 4",
  3343. messageSends: [],
  3344. referencedClasses: []
  3345. }),
  3346. globals.HashedCollectionTest);
  3347. smalltalk.addMethod(
  3348. smalltalk.method({
  3349. selector: "collectionValues",
  3350. protocol: 'fixture',
  3351. fn: function (){
  3352. var self=this;
  3353. var $1;
  3354. $1=[(1),(2),(3),(-4)];
  3355. return $1;
  3356. },
  3357. args: [],
  3358. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3359. messageSends: [],
  3360. referencedClasses: []
  3361. }),
  3362. globals.HashedCollectionTest);
  3363. smalltalk.addMethod(
  3364. smalltalk.method({
  3365. selector: "collectionWithDuplicates",
  3366. protocol: 'fixture',
  3367. fn: function (){
  3368. var self=this;
  3369. var $1;
  3370. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3371. return $1;
  3372. },
  3373. args: [],
  3374. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3375. messageSends: [],
  3376. referencedClasses: []
  3377. }),
  3378. globals.HashedCollectionTest);
  3379. smalltalk.addMethod(
  3380. smalltalk.method({
  3381. selector: "collectionWithNewValue",
  3382. protocol: 'fixture',
  3383. fn: function (){
  3384. var self=this;
  3385. var $1;
  3386. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3387. return $1;
  3388. },
  3389. args: [],
  3390. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3391. messageSends: [],
  3392. referencedClasses: []
  3393. }),
  3394. globals.HashedCollectionTest);
  3395. smalltalk.addMethod(
  3396. smalltalk.method({
  3397. selector: "sampleNewValueAsCollection",
  3398. protocol: 'fixture',
  3399. fn: function (){
  3400. var self=this;
  3401. var $1;
  3402. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3403. return $1;
  3404. },
  3405. args: [],
  3406. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3407. messageSends: [],
  3408. referencedClasses: []
  3409. }),
  3410. globals.HashedCollectionTest);
  3411. smalltalk.addMethod(
  3412. smalltalk.method({
  3413. selector: "testDynamicDictionaries",
  3414. protocol: 'tests',
  3415. fn: function (){
  3416. var self=this;
  3417. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3418. return smalltalk.withContext(function($ctx1) {
  3419. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3420. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3421. args: [],
  3422. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3423. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3424. referencedClasses: ["HashedCollection"]
  3425. }),
  3426. globals.HashedCollectionTest);
  3427. smalltalk.addMethod(
  3428. smalltalk.method({
  3429. selector: "collectionClass",
  3430. protocol: 'fixture',
  3431. fn: function (){
  3432. var self=this;
  3433. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3434. return $HashedCollection();
  3435. },
  3436. args: [],
  3437. source: "collectionClass\x0a\x09^ HashedCollection",
  3438. messageSends: [],
  3439. referencedClasses: ["HashedCollection"]
  3440. }),
  3441. globals.HashedCollectionTest.klass);
  3442. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3443. smalltalk.addMethod(
  3444. smalltalk.method({
  3445. selector: "collectionFirst",
  3446. protocol: 'fixture',
  3447. fn: function (){
  3448. var self=this;
  3449. return smalltalk.withContext(function($ctx1) {
  3450. self._subclassResponsibility();
  3451. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3452. args: [],
  3453. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3454. messageSends: ["subclassResponsibility"],
  3455. referencedClasses: []
  3456. }),
  3457. globals.SequenceableCollectionTest);
  3458. smalltalk.addMethod(
  3459. smalltalk.method({
  3460. selector: "collectionFirstTwo",
  3461. protocol: 'fixture',
  3462. fn: function (){
  3463. var self=this;
  3464. return smalltalk.withContext(function($ctx1) {
  3465. self._subclassResponsibility();
  3466. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3467. args: [],
  3468. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3469. messageSends: ["subclassResponsibility"],
  3470. referencedClasses: []
  3471. }),
  3472. globals.SequenceableCollectionTest);
  3473. smalltalk.addMethod(
  3474. smalltalk.method({
  3475. selector: "collectionLast",
  3476. protocol: 'fixture',
  3477. fn: function (){
  3478. var self=this;
  3479. return smalltalk.withContext(function($ctx1) {
  3480. self._subclassResponsibility();
  3481. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3482. args: [],
  3483. source: "collectionLast\x0a\x09self subclassResponsibility",
  3484. messageSends: ["subclassResponsibility"],
  3485. referencedClasses: []
  3486. }),
  3487. globals.SequenceableCollectionTest);
  3488. smalltalk.addMethod(
  3489. smalltalk.method({
  3490. selector: "collectionLastTwo",
  3491. protocol: 'fixture',
  3492. fn: function (){
  3493. var self=this;
  3494. return smalltalk.withContext(function($ctx1) {
  3495. self._subclassResponsibility();
  3496. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3497. args: [],
  3498. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3499. messageSends: ["subclassResponsibility"],
  3500. referencedClasses: []
  3501. }),
  3502. globals.SequenceableCollectionTest);
  3503. smalltalk.addMethod(
  3504. smalltalk.method({
  3505. selector: "nonIndexesDo:",
  3506. protocol: 'fixture',
  3507. fn: function (aBlock){
  3508. var self=this;
  3509. return smalltalk.withContext(function($ctx1) {
  3510. _st(aBlock)._value_((0));
  3511. $ctx1.sendIdx["value:"]=1;
  3512. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3513. $ctx1.sendIdx["value:"]=2;
  3514. _st(aBlock)._value_("z");
  3515. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3516. args: ["aBlock"],
  3517. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3518. messageSends: ["value:", "+", "collectionSize"],
  3519. referencedClasses: []
  3520. }),
  3521. globals.SequenceableCollectionTest);
  3522. smalltalk.addMethod(
  3523. smalltalk.method({
  3524. selector: "samplesDo:",
  3525. protocol: 'fixture',
  3526. fn: function (aBlock){
  3527. var self=this;
  3528. return smalltalk.withContext(function($ctx1) {
  3529. _st(aBlock)._value_value_((1),self._collectionFirst());
  3530. $ctx1.sendIdx["value:value:"]=1;
  3531. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3532. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3533. args: ["aBlock"],
  3534. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3535. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3536. referencedClasses: []
  3537. }),
  3538. globals.SequenceableCollectionTest);
  3539. smalltalk.addMethod(
  3540. smalltalk.method({
  3541. selector: "testBeginsWith",
  3542. protocol: 'tests',
  3543. fn: function (){
  3544. var self=this;
  3545. return smalltalk.withContext(function($ctx1) {
  3546. var $2,$1,$4,$5,$3,$7,$6;
  3547. $2=self._collection();
  3548. $ctx1.sendIdx["collection"]=1;
  3549. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3550. $ctx1.sendIdx["beginsWith:"]=1;
  3551. self._assert_($1);
  3552. $ctx1.sendIdx["assert:"]=1;
  3553. $4=self._collection();
  3554. $ctx1.sendIdx["collection"]=2;
  3555. $5=self._collection();
  3556. $ctx1.sendIdx["collection"]=3;
  3557. $3=_st($4)._beginsWith_($5);
  3558. $ctx1.sendIdx["beginsWith:"]=2;
  3559. self._assert_($3);
  3560. $ctx1.sendIdx["assert:"]=2;
  3561. $7=self._collection();
  3562. $ctx1.sendIdx["collection"]=4;
  3563. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3564. $ctx1.sendIdx["beginsWith:"]=3;
  3565. self._assert_($6);
  3566. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3567. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3568. args: [],
  3569. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  3570. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3571. referencedClasses: []
  3572. }),
  3573. globals.SequenceableCollectionTest);
  3574. smalltalk.addMethod(
  3575. smalltalk.method({
  3576. selector: "testEndsWith",
  3577. protocol: 'tests',
  3578. fn: function (){
  3579. var self=this;
  3580. return smalltalk.withContext(function($ctx1) {
  3581. var $2,$1,$4,$5,$3,$7,$6;
  3582. $2=self._collection();
  3583. $ctx1.sendIdx["collection"]=1;
  3584. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3585. $ctx1.sendIdx["endsWith:"]=1;
  3586. self._assert_($1);
  3587. $ctx1.sendIdx["assert:"]=1;
  3588. $4=self._collection();
  3589. $ctx1.sendIdx["collection"]=2;
  3590. $5=self._collection();
  3591. $ctx1.sendIdx["collection"]=3;
  3592. $3=_st($4)._endsWith_($5);
  3593. $ctx1.sendIdx["endsWith:"]=2;
  3594. self._assert_($3);
  3595. $ctx1.sendIdx["assert:"]=2;
  3596. $7=self._collection();
  3597. $ctx1.sendIdx["collection"]=4;
  3598. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3599. $ctx1.sendIdx["endsWith:"]=3;
  3600. self._assert_($6);
  3601. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3602. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3603. args: [],
  3604. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  3605. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3606. referencedClasses: []
  3607. }),
  3608. globals.SequenceableCollectionTest);
  3609. smalltalk.addMethod(
  3610. smalltalk.method({
  3611. selector: "testFirst",
  3612. protocol: 'tests',
  3613. fn: function (){
  3614. var self=this;
  3615. return smalltalk.withContext(function($ctx1) {
  3616. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3617. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3618. args: [],
  3619. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3620. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3621. referencedClasses: []
  3622. }),
  3623. globals.SequenceableCollectionTest);
  3624. smalltalk.addMethod(
  3625. smalltalk.method({
  3626. selector: "testFirstN",
  3627. protocol: 'tests',
  3628. fn: function (){
  3629. var self=this;
  3630. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3631. return smalltalk.withContext(function($ctx1) {
  3632. var $2,$1,$4,$3,$6,$5,$7;
  3633. $2=self._collection();
  3634. $ctx1.sendIdx["collection"]=1;
  3635. $1=_st($2)._first_((2));
  3636. $ctx1.sendIdx["first:"]=1;
  3637. self._assert_equals_($1,self._collectionFirstTwo());
  3638. $ctx1.sendIdx["assert:equals:"]=1;
  3639. $4=self._collection();
  3640. $ctx1.sendIdx["collection"]=2;
  3641. $3=_st($4)._first_((0));
  3642. $ctx1.sendIdx["first:"]=2;
  3643. self._assert_equals_($3,_st(self._collectionClass())._new());
  3644. $ctx1.sendIdx["assert:equals:"]=2;
  3645. $6=self._collection();
  3646. $ctx1.sendIdx["collection"]=3;
  3647. $5=_st($6)._first_(self._collectionSize());
  3648. $ctx1.sendIdx["first:"]=3;
  3649. $7=self._collection();
  3650. $ctx1.sendIdx["collection"]=4;
  3651. self._assert_equals_($5,$7);
  3652. self._should_raise_((function(){
  3653. return smalltalk.withContext(function($ctx2) {
  3654. return _st(self._collection())._first_((33));
  3655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3656. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3657. args: [],
  3658. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3659. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3660. referencedClasses: ["Error"]
  3661. }),
  3662. globals.SequenceableCollectionTest);
  3663. smalltalk.addMethod(
  3664. smalltalk.method({
  3665. selector: "testFourth",
  3666. protocol: 'tests',
  3667. fn: function (){
  3668. var self=this;
  3669. return smalltalk.withContext(function($ctx1) {
  3670. var $2,$1;
  3671. $2=self._collection();
  3672. $ctx1.sendIdx["collection"]=1;
  3673. $1=_st($2)._fourth();
  3674. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3675. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3676. args: [],
  3677. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3678. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3679. referencedClasses: []
  3680. }),
  3681. globals.SequenceableCollectionTest);
  3682. smalltalk.addMethod(
  3683. smalltalk.method({
  3684. selector: "testIndexOfStartingAt",
  3685. protocol: 'tests',
  3686. fn: function (){
  3687. var self=this;
  3688. var jsNull;
  3689. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3690. return smalltalk.withContext(function($ctx1) {
  3691. var $2,$1,$4,$3;
  3692. jsNull=_st($JSON())._parse_("null");
  3693. self._samplesDo_((function(index,value){
  3694. return smalltalk.withContext(function($ctx2) {
  3695. $2=self._collection();
  3696. $ctx2.sendIdx["collection"]=1;
  3697. $1=_st($2)._indexOf_startingAt_(value,(1));
  3698. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3699. self._assert_equals_($1,index);
  3700. $ctx2.sendIdx["assert:equals:"]=1;
  3701. $4=self._collection();
  3702. $ctx2.sendIdx["collection"]=2;
  3703. $3=_st($4)._indexOf_startingAt_(value,index);
  3704. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3705. self._assert_equals_($3,index);
  3706. $ctx2.sendIdx["assert:equals:"]=2;
  3707. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3708. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3709. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3710. args: [],
  3711. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  3712. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3713. referencedClasses: ["JSON"]
  3714. }),
  3715. globals.SequenceableCollectionTest);
  3716. smalltalk.addMethod(
  3717. smalltalk.method({
  3718. selector: "testIndexOfStartingAtWithNull",
  3719. protocol: 'tests',
  3720. fn: function (){
  3721. var self=this;
  3722. var jsNull;
  3723. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3724. return smalltalk.withContext(function($ctx1) {
  3725. var $1,$2;
  3726. jsNull=_st($JSON())._parse_("null");
  3727. self._samplesDo_((function(index,value){
  3728. var collection;
  3729. return smalltalk.withContext(function($ctx2) {
  3730. collection=self._collection();
  3731. collection;
  3732. _st(collection)._at_put_(index,jsNull);
  3733. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3734. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3735. self._assert_equals_($1,index);
  3736. $ctx2.sendIdx["assert:equals:"]=1;
  3737. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3738. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3739. self._assert_equals_($2,index);
  3740. $ctx2.sendIdx["assert:equals:"]=2;
  3741. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3742. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3743. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3744. args: [],
  3745. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  3746. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3747. referencedClasses: ["JSON"]
  3748. }),
  3749. globals.SequenceableCollectionTest);
  3750. smalltalk.addMethod(
  3751. smalltalk.method({
  3752. selector: "testLast",
  3753. protocol: 'tests',
  3754. fn: function (){
  3755. var self=this;
  3756. return smalltalk.withContext(function($ctx1) {
  3757. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3758. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3759. args: [],
  3760. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3761. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3762. referencedClasses: []
  3763. }),
  3764. globals.SequenceableCollectionTest);
  3765. smalltalk.addMethod(
  3766. smalltalk.method({
  3767. selector: "testLastN",
  3768. protocol: 'tests',
  3769. fn: function (){
  3770. var self=this;
  3771. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3772. return smalltalk.withContext(function($ctx1) {
  3773. var $2,$1,$4,$3,$6,$5,$7;
  3774. $2=self._collection();
  3775. $ctx1.sendIdx["collection"]=1;
  3776. $1=_st($2)._last_((2));
  3777. $ctx1.sendIdx["last:"]=1;
  3778. self._assert_equals_($1,self._collectionLastTwo());
  3779. $ctx1.sendIdx["assert:equals:"]=1;
  3780. $4=self._collection();
  3781. $ctx1.sendIdx["collection"]=2;
  3782. $3=_st($4)._last_((0));
  3783. $ctx1.sendIdx["last:"]=2;
  3784. self._assert_equals_($3,_st(self._collectionClass())._new());
  3785. $ctx1.sendIdx["assert:equals:"]=2;
  3786. $6=self._collection();
  3787. $ctx1.sendIdx["collection"]=3;
  3788. $5=_st($6)._last_(self._collectionSize());
  3789. $ctx1.sendIdx["last:"]=3;
  3790. $7=self._collection();
  3791. $ctx1.sendIdx["collection"]=4;
  3792. self._assert_equals_($5,$7);
  3793. self._should_raise_((function(){
  3794. return smalltalk.withContext(function($ctx2) {
  3795. return _st(self._collection())._last_((33));
  3796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3797. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3798. args: [],
  3799. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3800. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3801. referencedClasses: ["Error"]
  3802. }),
  3803. globals.SequenceableCollectionTest);
  3804. smalltalk.addMethod(
  3805. smalltalk.method({
  3806. selector: "testSecond",
  3807. protocol: 'tests',
  3808. fn: function (){
  3809. var self=this;
  3810. return smalltalk.withContext(function($ctx1) {
  3811. var $2,$1;
  3812. $2=self._collection();
  3813. $ctx1.sendIdx["collection"]=1;
  3814. $1=_st($2)._second();
  3815. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3816. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3817. args: [],
  3818. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3819. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3820. referencedClasses: []
  3821. }),
  3822. globals.SequenceableCollectionTest);
  3823. smalltalk.addMethod(
  3824. smalltalk.method({
  3825. selector: "testThird",
  3826. protocol: 'tests',
  3827. fn: function (){
  3828. var self=this;
  3829. return smalltalk.withContext(function($ctx1) {
  3830. var $2,$1;
  3831. $2=self._collection();
  3832. $ctx1.sendIdx["collection"]=1;
  3833. $1=_st($2)._third();
  3834. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3835. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3836. args: [],
  3837. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3838. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3839. referencedClasses: []
  3840. }),
  3841. globals.SequenceableCollectionTest);
  3842. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3843. smalltalk.addMethod(
  3844. smalltalk.method({
  3845. selector: "collection",
  3846. protocol: 'fixture',
  3847. fn: function (){
  3848. var self=this;
  3849. var $1;
  3850. $1=[(1), (2), (3), (-4)];
  3851. return $1;
  3852. },
  3853. args: [],
  3854. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3855. messageSends: [],
  3856. referencedClasses: []
  3857. }),
  3858. globals.ArrayTest);
  3859. smalltalk.addMethod(
  3860. smalltalk.method({
  3861. selector: "collectionFirst",
  3862. protocol: 'fixture',
  3863. fn: function (){
  3864. var self=this;
  3865. return (1);
  3866. },
  3867. args: [],
  3868. source: "collectionFirst\x0a\x09^ 1",
  3869. messageSends: [],
  3870. referencedClasses: []
  3871. }),
  3872. globals.ArrayTest);
  3873. smalltalk.addMethod(
  3874. smalltalk.method({
  3875. selector: "collectionFirstTwo",
  3876. protocol: 'fixture',
  3877. fn: function (){
  3878. var self=this;
  3879. var $1;
  3880. $1=[(1), (2)];
  3881. return $1;
  3882. },
  3883. args: [],
  3884. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3885. messageSends: [],
  3886. referencedClasses: []
  3887. }),
  3888. globals.ArrayTest);
  3889. smalltalk.addMethod(
  3890. smalltalk.method({
  3891. selector: "collectionLast",
  3892. protocol: 'fixture',
  3893. fn: function (){
  3894. var self=this;
  3895. return (-4);
  3896. },
  3897. args: [],
  3898. source: "collectionLast\x0a\x09^ -4",
  3899. messageSends: [],
  3900. referencedClasses: []
  3901. }),
  3902. globals.ArrayTest);
  3903. smalltalk.addMethod(
  3904. smalltalk.method({
  3905. selector: "collectionLastTwo",
  3906. protocol: 'fixture',
  3907. fn: function (){
  3908. var self=this;
  3909. var $1;
  3910. $1=[(3), (-4)];
  3911. return $1;
  3912. },
  3913. args: [],
  3914. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3915. messageSends: [],
  3916. referencedClasses: []
  3917. }),
  3918. globals.ArrayTest);
  3919. smalltalk.addMethod(
  3920. smalltalk.method({
  3921. selector: "collectionOfPrintStrings",
  3922. protocol: 'fixture',
  3923. fn: function (){
  3924. var self=this;
  3925. var $1;
  3926. $1=["1", "2", "3", "-4"];
  3927. return $1;
  3928. },
  3929. args: [],
  3930. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3931. messageSends: [],
  3932. referencedClasses: []
  3933. }),
  3934. globals.ArrayTest);
  3935. smalltalk.addMethod(
  3936. smalltalk.method({
  3937. selector: "collectionSize",
  3938. protocol: 'fixture',
  3939. fn: function (){
  3940. var self=this;
  3941. return (4);
  3942. },
  3943. args: [],
  3944. source: "collectionSize\x0a\x09^ 4",
  3945. messageSends: [],
  3946. referencedClasses: []
  3947. }),
  3948. globals.ArrayTest);
  3949. smalltalk.addMethod(
  3950. smalltalk.method({
  3951. selector: "collectionWithDuplicates",
  3952. protocol: 'fixture',
  3953. fn: function (){
  3954. var self=this;
  3955. var $1;
  3956. $1=["a", "b", "c", (1), (2), (1), "a"];
  3957. return $1;
  3958. },
  3959. args: [],
  3960. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3961. messageSends: [],
  3962. referencedClasses: []
  3963. }),
  3964. globals.ArrayTest);
  3965. smalltalk.addMethod(
  3966. smalltalk.method({
  3967. selector: "collectionWithNewValue",
  3968. protocol: 'fixture',
  3969. fn: function (){
  3970. var self=this;
  3971. var $1;
  3972. $1=[(1), (2), (3), (-4), "N"];
  3973. return $1;
  3974. },
  3975. args: [],
  3976. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3977. messageSends: [],
  3978. referencedClasses: []
  3979. }),
  3980. globals.ArrayTest);
  3981. smalltalk.addMethod(
  3982. smalltalk.method({
  3983. selector: "sampleNewIndex",
  3984. protocol: 'fixture',
  3985. fn: function (){
  3986. var self=this;
  3987. return (5);
  3988. },
  3989. args: [],
  3990. source: "sampleNewIndex\x0a\x09^ 5",
  3991. messageSends: [],
  3992. referencedClasses: []
  3993. }),
  3994. globals.ArrayTest);
  3995. smalltalk.addMethod(
  3996. smalltalk.method({
  3997. selector: "samplesDo:",
  3998. protocol: 'fixture',
  3999. fn: function (aBlock){
  4000. var self=this;
  4001. return smalltalk.withContext(function($ctx1) {
  4002. globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4003. _st(aBlock)._value_value_((3),(3));
  4004. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4005. args: ["aBlock"],
  4006. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4007. messageSends: ["samplesDo:", "value:value:"],
  4008. referencedClasses: []
  4009. }),
  4010. globals.ArrayTest);
  4011. smalltalk.addMethod(
  4012. smalltalk.method({
  4013. selector: "testAdd",
  4014. protocol: 'tests',
  4015. fn: function (){
  4016. var self=this;
  4017. var array;
  4018. return smalltalk.withContext(function($ctx1) {
  4019. array=self._collection();
  4020. _st(array)._add_((6));
  4021. self._assert_equals_(_st(array)._last(),(6));
  4022. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4023. args: [],
  4024. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4025. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4026. referencedClasses: []
  4027. }),
  4028. globals.ArrayTest);
  4029. smalltalk.addMethod(
  4030. smalltalk.method({
  4031. selector: "testAddFirst",
  4032. protocol: 'tests',
  4033. fn: function (){
  4034. var self=this;
  4035. return smalltalk.withContext(function($ctx1) {
  4036. var $1,$2;
  4037. $1=self._collection();
  4038. _st($1)._addFirst_((0));
  4039. $2=_st($1)._yourself();
  4040. self._assert_equals_(_st($2)._first(),(0));
  4041. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4042. args: [],
  4043. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4044. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4045. referencedClasses: []
  4046. }),
  4047. globals.ArrayTest);
  4048. smalltalk.addMethod(
  4049. smalltalk.method({
  4050. selector: "testPrintString",
  4051. protocol: 'tests',
  4052. fn: function (){
  4053. var self=this;
  4054. var array;
  4055. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4056. return smalltalk.withContext(function($ctx1) {
  4057. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4058. array=_st($Array())._new();
  4059. $1=_st(array)._printString();
  4060. $ctx1.sendIdx["printString"]=1;
  4061. self._assert_equals_($1,"an Array ()");
  4062. $ctx1.sendIdx["assert:equals:"]=1;
  4063. $2=array;
  4064. _st($2)._add_((1));
  4065. $ctx1.sendIdx["add:"]=1;
  4066. $3=_st($2)._add_((3));
  4067. $ctx1.sendIdx["add:"]=2;
  4068. $4=_st(array)._printString();
  4069. $ctx1.sendIdx["printString"]=2;
  4070. self._assert_equals_($4,"an Array (1 3)");
  4071. $ctx1.sendIdx["assert:equals:"]=2;
  4072. _st(array)._add_("foo");
  4073. $5=_st(array)._printString();
  4074. $ctx1.sendIdx["printString"]=3;
  4075. self._assert_equals_($5,"an Array (1 3 'foo')");
  4076. $ctx1.sendIdx["assert:equals:"]=3;
  4077. $6=array;
  4078. _st($6)._remove_((1));
  4079. $ctx1.sendIdx["remove:"]=1;
  4080. $7=_st($6)._remove_((3));
  4081. $8=_st(array)._printString();
  4082. $ctx1.sendIdx["printString"]=4;
  4083. self._assert_equals_($8,"an Array ('foo')");
  4084. $ctx1.sendIdx["assert:equals:"]=4;
  4085. _st(array)._addLast_((3));
  4086. $ctx1.sendIdx["addLast:"]=1;
  4087. $9=_st(array)._printString();
  4088. $ctx1.sendIdx["printString"]=5;
  4089. self._assert_equals_($9,"an Array ('foo' 3)");
  4090. $ctx1.sendIdx["assert:equals:"]=5;
  4091. _st(array)._addLast_((3));
  4092. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4093. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4094. args: [],
  4095. 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)'.",
  4096. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4097. referencedClasses: ["Array"]
  4098. }),
  4099. globals.ArrayTest);
  4100. smalltalk.addMethod(
  4101. smalltalk.method({
  4102. selector: "testRemove",
  4103. protocol: 'tests',
  4104. fn: function (){
  4105. var self=this;
  4106. var array;
  4107. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4108. return smalltalk.withContext(function($ctx1) {
  4109. array=[(1), (2), (3), (4), (5)];
  4110. _st(array)._remove_((3));
  4111. $ctx1.sendIdx["remove:"]=1;
  4112. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4113. self._should_raise_((function(){
  4114. return smalltalk.withContext(function($ctx2) {
  4115. return _st(array)._remove_((3));
  4116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4117. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4118. args: [],
  4119. 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",
  4120. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4121. referencedClasses: ["Error"]
  4122. }),
  4123. globals.ArrayTest);
  4124. smalltalk.addMethod(
  4125. smalltalk.method({
  4126. selector: "testRemoveFromTo",
  4127. protocol: 'tests',
  4128. fn: function (){
  4129. var self=this;
  4130. return smalltalk.withContext(function($ctx1) {
  4131. var $1,$2;
  4132. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4133. $ctx1.sendIdx["removeFrom:to:"]=1;
  4134. self._assert_equals_($1,[(4)]);
  4135. $ctx1.sendIdx["assert:equals:"]=1;
  4136. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4137. $ctx1.sendIdx["removeFrom:to:"]=2;
  4138. self._assert_equals_($2,[(1), (4)]);
  4139. $ctx1.sendIdx["assert:equals:"]=2;
  4140. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4141. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4142. args: [],
  4143. 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)",
  4144. messageSends: ["assert:equals:", "removeFrom:to:"],
  4145. referencedClasses: []
  4146. }),
  4147. globals.ArrayTest);
  4148. smalltalk.addMethod(
  4149. smalltalk.method({
  4150. selector: "testRemoveIndex",
  4151. protocol: 'tests',
  4152. fn: function (){
  4153. var self=this;
  4154. return smalltalk.withContext(function($ctx1) {
  4155. var $1,$2;
  4156. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4157. $ctx1.sendIdx["removeIndex:"]=1;
  4158. self._assert_equals_($1,[(1), (3), (4)]);
  4159. $ctx1.sendIdx["assert:equals:"]=1;
  4160. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4161. $ctx1.sendIdx["removeIndex:"]=2;
  4162. self._assert_equals_($2,[(2), (3), (4)]);
  4163. $ctx1.sendIdx["assert:equals:"]=2;
  4164. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4165. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4166. args: [],
  4167. 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: #()",
  4168. messageSends: ["assert:equals:", "removeIndex:"],
  4169. referencedClasses: []
  4170. }),
  4171. globals.ArrayTest);
  4172. smalltalk.addMethod(
  4173. smalltalk.method({
  4174. selector: "testRemoveLast",
  4175. protocol: 'tests',
  4176. fn: function (){
  4177. var self=this;
  4178. var array;
  4179. return smalltalk.withContext(function($ctx1) {
  4180. array=[(1), (2)];
  4181. _st(array)._removeLast();
  4182. self._assert_equals_(_st(array)._last(),(1));
  4183. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4184. args: [],
  4185. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4186. messageSends: ["removeLast", "assert:equals:", "last"],
  4187. referencedClasses: []
  4188. }),
  4189. globals.ArrayTest);
  4190. smalltalk.addMethod(
  4191. smalltalk.method({
  4192. selector: "testReversed",
  4193. protocol: 'tests',
  4194. fn: function (){
  4195. var self=this;
  4196. var array;
  4197. return smalltalk.withContext(function($ctx1) {
  4198. array=[(5), (4), (3), (2), (1)];
  4199. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4200. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4201. args: [],
  4202. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4203. messageSends: ["assert:equals:", "reversed"],
  4204. referencedClasses: []
  4205. }),
  4206. globals.ArrayTest);
  4207. smalltalk.addMethod(
  4208. smalltalk.method({
  4209. selector: "testSort",
  4210. protocol: 'tests',
  4211. fn: function (){
  4212. var self=this;
  4213. var array;
  4214. return smalltalk.withContext(function($ctx1) {
  4215. array=[(10), (1), (5)];
  4216. _st(array)._sort();
  4217. self._assert_equals_(array,[(1), (5), (10)]);
  4218. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4219. args: [],
  4220. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4221. messageSends: ["sort", "assert:equals:"],
  4222. referencedClasses: []
  4223. }),
  4224. globals.ArrayTest);
  4225. smalltalk.addMethod(
  4226. smalltalk.method({
  4227. selector: "collectionClass",
  4228. protocol: 'fixture',
  4229. fn: function (){
  4230. var self=this;
  4231. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4232. return $Array();
  4233. },
  4234. args: [],
  4235. source: "collectionClass\x0a\x09^ Array",
  4236. messageSends: [],
  4237. referencedClasses: ["Array"]
  4238. }),
  4239. globals.ArrayTest.klass);
  4240. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4241. smalltalk.addMethod(
  4242. smalltalk.method({
  4243. selector: "collection",
  4244. protocol: 'fixture',
  4245. fn: function (){
  4246. var self=this;
  4247. return "helLo";
  4248. },
  4249. args: [],
  4250. source: "collection\x0a\x09^ 'helLo'",
  4251. messageSends: [],
  4252. referencedClasses: []
  4253. }),
  4254. globals.StringTest);
  4255. smalltalk.addMethod(
  4256. smalltalk.method({
  4257. selector: "collectionFirst",
  4258. protocol: 'fixture',
  4259. fn: function (){
  4260. var self=this;
  4261. return "h";
  4262. },
  4263. args: [],
  4264. source: "collectionFirst\x0a\x09^ 'h'",
  4265. messageSends: [],
  4266. referencedClasses: []
  4267. }),
  4268. globals.StringTest);
  4269. smalltalk.addMethod(
  4270. smalltalk.method({
  4271. selector: "collectionFirstTwo",
  4272. protocol: 'fixture',
  4273. fn: function (){
  4274. var self=this;
  4275. return "he";
  4276. },
  4277. args: [],
  4278. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4279. messageSends: [],
  4280. referencedClasses: []
  4281. }),
  4282. globals.StringTest);
  4283. smalltalk.addMethod(
  4284. smalltalk.method({
  4285. selector: "collectionLast",
  4286. protocol: 'fixture',
  4287. fn: function (){
  4288. var self=this;
  4289. return "o";
  4290. },
  4291. args: [],
  4292. source: "collectionLast\x0a\x09^ 'o'",
  4293. messageSends: [],
  4294. referencedClasses: []
  4295. }),
  4296. globals.StringTest);
  4297. smalltalk.addMethod(
  4298. smalltalk.method({
  4299. selector: "collectionLastTwo",
  4300. protocol: 'fixture',
  4301. fn: function (){
  4302. var self=this;
  4303. return "Lo";
  4304. },
  4305. args: [],
  4306. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4307. messageSends: [],
  4308. referencedClasses: []
  4309. }),
  4310. globals.StringTest);
  4311. smalltalk.addMethod(
  4312. smalltalk.method({
  4313. selector: "collectionOfPrintStrings",
  4314. protocol: 'fixture',
  4315. fn: function (){
  4316. var self=this;
  4317. return "'h''e''l''L''o'";
  4318. },
  4319. args: [],
  4320. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4321. messageSends: [],
  4322. referencedClasses: []
  4323. }),
  4324. globals.StringTest);
  4325. smalltalk.addMethod(
  4326. smalltalk.method({
  4327. selector: "collectionSize",
  4328. protocol: 'fixture',
  4329. fn: function (){
  4330. var self=this;
  4331. return (5);
  4332. },
  4333. args: [],
  4334. source: "collectionSize\x0a\x09^ 5",
  4335. messageSends: [],
  4336. referencedClasses: []
  4337. }),
  4338. globals.StringTest);
  4339. smalltalk.addMethod(
  4340. smalltalk.method({
  4341. selector: "collectionWithDuplicates",
  4342. protocol: 'fixture',
  4343. fn: function (){
  4344. var self=this;
  4345. return "abbaerte";
  4346. },
  4347. args: [],
  4348. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4349. messageSends: [],
  4350. referencedClasses: []
  4351. }),
  4352. globals.StringTest);
  4353. smalltalk.addMethod(
  4354. smalltalk.method({
  4355. selector: "collectionWithNewValue",
  4356. protocol: 'fixture',
  4357. fn: function (){
  4358. var self=this;
  4359. return "helLoN";
  4360. },
  4361. args: [],
  4362. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4363. messageSends: [],
  4364. referencedClasses: []
  4365. }),
  4366. globals.StringTest);
  4367. smalltalk.addMethod(
  4368. smalltalk.method({
  4369. selector: "sampleNewValueAsCollection",
  4370. protocol: 'fixture',
  4371. fn: function (){
  4372. var self=this;
  4373. return "N";
  4374. },
  4375. args: [],
  4376. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4377. messageSends: [],
  4378. referencedClasses: []
  4379. }),
  4380. globals.StringTest);
  4381. smalltalk.addMethod(
  4382. smalltalk.method({
  4383. selector: "samplesDo:",
  4384. protocol: 'fixture',
  4385. fn: function (aBlock){
  4386. var self=this;
  4387. return smalltalk.withContext(function($ctx1) {
  4388. globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4389. _st(aBlock)._value_value_((3),"l");
  4390. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4391. args: ["aBlock"],
  4392. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4393. messageSends: ["samplesDo:", "value:value:"],
  4394. referencedClasses: []
  4395. }),
  4396. globals.StringTest);
  4397. smalltalk.addMethod(
  4398. smalltalk.method({
  4399. selector: "testAddAll",
  4400. protocol: 'tests',
  4401. fn: function (){
  4402. var self=this;
  4403. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4404. return smalltalk.withContext(function($ctx1) {
  4405. var $1;
  4406. self._should_raise_((function(){
  4407. return smalltalk.withContext(function($ctx2) {
  4408. $1=self._collection();
  4409. $ctx2.sendIdx["collection"]=1;
  4410. return _st($1)._addAll_(self._collection());
  4411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4412. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4413. args: [],
  4414. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4415. messageSends: ["should:raise:", "addAll:", "collection"],
  4416. referencedClasses: ["Error"]
  4417. }),
  4418. globals.StringTest);
  4419. smalltalk.addMethod(
  4420. smalltalk.method({
  4421. selector: "testAddRemove",
  4422. protocol: 'tests',
  4423. fn: function (){
  4424. var self=this;
  4425. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4426. return smalltalk.withContext(function($ctx1) {
  4427. self._should_raise_((function(){
  4428. return smalltalk.withContext(function($ctx2) {
  4429. return "hello"._add_("a");
  4430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4431. $ctx1.sendIdx["should:raise:"]=1;
  4432. self._should_raise_((function(){
  4433. return smalltalk.withContext(function($ctx2) {
  4434. return "hello"._remove_("h");
  4435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4436. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4437. args: [],
  4438. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4439. messageSends: ["should:raise:", "add:", "remove:"],
  4440. referencedClasses: ["Error"]
  4441. }),
  4442. globals.StringTest);
  4443. smalltalk.addMethod(
  4444. smalltalk.method({
  4445. selector: "testAsArray",
  4446. protocol: 'tests',
  4447. fn: function (){
  4448. var self=this;
  4449. return smalltalk.withContext(function($ctx1) {
  4450. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4451. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4452. args: [],
  4453. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4454. messageSends: ["assert:equals:", "asArray"],
  4455. referencedClasses: []
  4456. }),
  4457. globals.StringTest);
  4458. smalltalk.addMethod(
  4459. smalltalk.method({
  4460. selector: "testAsLowerCase",
  4461. protocol: 'tests',
  4462. fn: function (){
  4463. var self=this;
  4464. return smalltalk.withContext(function($ctx1) {
  4465. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4466. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4467. args: [],
  4468. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4469. messageSends: ["assert:equals:", "asLowercase"],
  4470. referencedClasses: []
  4471. }),
  4472. globals.StringTest);
  4473. smalltalk.addMethod(
  4474. smalltalk.method({
  4475. selector: "testAsNumber",
  4476. protocol: 'tests',
  4477. fn: function (){
  4478. var self=this;
  4479. return smalltalk.withContext(function($ctx1) {
  4480. var $1,$2;
  4481. $1="3"._asNumber();
  4482. $ctx1.sendIdx["asNumber"]=1;
  4483. self._assert_equals_($1,(3));
  4484. $ctx1.sendIdx["assert:equals:"]=1;
  4485. $2="-3"._asNumber();
  4486. $ctx1.sendIdx["asNumber"]=2;
  4487. self._assert_equals_($2,(-3));
  4488. $ctx1.sendIdx["assert:equals:"]=2;
  4489. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4490. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4491. args: [],
  4492. 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.",
  4493. messageSends: ["assert:equals:", "asNumber"],
  4494. referencedClasses: []
  4495. }),
  4496. globals.StringTest);
  4497. smalltalk.addMethod(
  4498. smalltalk.method({
  4499. selector: "testAsUpperCase",
  4500. protocol: 'tests',
  4501. fn: function (){
  4502. var self=this;
  4503. return smalltalk.withContext(function($ctx1) {
  4504. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4505. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4506. args: [],
  4507. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4508. messageSends: ["assert:equals:", "asUppercase"],
  4509. referencedClasses: []
  4510. }),
  4511. globals.StringTest);
  4512. smalltalk.addMethod(
  4513. smalltalk.method({
  4514. selector: "testAsciiValue",
  4515. protocol: 'tests',
  4516. fn: function (){
  4517. var self=this;
  4518. var characterA,characterU;
  4519. return smalltalk.withContext(function($ctx1) {
  4520. var $1;
  4521. characterA="A";
  4522. characterU="U";
  4523. $1=_st(characterA)._asciiValue();
  4524. $ctx1.sendIdx["asciiValue"]=1;
  4525. self._assert_equals_($1,(65));
  4526. $ctx1.sendIdx["assert:equals:"]=1;
  4527. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4528. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4529. args: [],
  4530. 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",
  4531. messageSends: ["assert:equals:", "asciiValue"],
  4532. referencedClasses: []
  4533. }),
  4534. globals.StringTest);
  4535. smalltalk.addMethod(
  4536. smalltalk.method({
  4537. selector: "testAtIfAbsentPut",
  4538. protocol: 'tests',
  4539. fn: function (){
  4540. var self=this;
  4541. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4542. return smalltalk.withContext(function($ctx1) {
  4543. self._should_raise_((function(){
  4544. return smalltalk.withContext(function($ctx2) {
  4545. return "hello"._at_ifAbsentPut_((6),(function(){
  4546. return "a";
  4547. }));
  4548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4549. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4550. args: [],
  4551. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4552. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4553. referencedClasses: ["Error"]
  4554. }),
  4555. globals.StringTest);
  4556. smalltalk.addMethod(
  4557. smalltalk.method({
  4558. selector: "testAtPut",
  4559. protocol: 'tests',
  4560. fn: function (){
  4561. var self=this;
  4562. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4563. return smalltalk.withContext(function($ctx1) {
  4564. self._should_raise_((function(){
  4565. return smalltalk.withContext(function($ctx2) {
  4566. return "hello"._at_put_((1),"a");
  4567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4568. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4569. args: [],
  4570. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4571. messageSends: ["should:raise:", "at:put:"],
  4572. referencedClasses: ["Error"]
  4573. }),
  4574. globals.StringTest);
  4575. smalltalk.addMethod(
  4576. smalltalk.method({
  4577. selector: "testCapitalized",
  4578. protocol: 'tests',
  4579. fn: function (){
  4580. var self=this;
  4581. return smalltalk.withContext(function($ctx1) {
  4582. var $1,$2,$3;
  4583. $1="test"._capitalized();
  4584. $ctx1.sendIdx["capitalized"]=1;
  4585. self._assert_equals_($1,"Test");
  4586. $ctx1.sendIdx["assert:equals:"]=1;
  4587. $2="Test"._capitalized();
  4588. $ctx1.sendIdx["capitalized"]=2;
  4589. self._assert_equals_($2,"Test");
  4590. $ctx1.sendIdx["assert:equals:"]=2;
  4591. self._assert_equals_(""._capitalized(),"");
  4592. $ctx1.sendIdx["assert:equals:"]=3;
  4593. $3="Test"._isCapitalized();
  4594. $ctx1.sendIdx["isCapitalized"]=1;
  4595. self._assert_equals_($3,true);
  4596. $ctx1.sendIdx["assert:equals:"]=4;
  4597. self._assert_equals_("test"._isCapitalized(),false);
  4598. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4599. args: [],
  4600. 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.",
  4601. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4602. referencedClasses: []
  4603. }),
  4604. globals.StringTest);
  4605. smalltalk.addMethod(
  4606. smalltalk.method({
  4607. selector: "testCharCodeAt",
  4608. protocol: 'tests',
  4609. fn: function (){
  4610. var self=this;
  4611. return smalltalk.withContext(function($ctx1) {
  4612. var $1,$2,$3,$4,$5;
  4613. $1="jackie"._charCodeAt_((1));
  4614. $ctx1.sendIdx["charCodeAt:"]=1;
  4615. self._assert_equals_($1,(106));
  4616. $ctx1.sendIdx["assert:equals:"]=1;
  4617. $2="jackie"._charCodeAt_((2));
  4618. $ctx1.sendIdx["charCodeAt:"]=2;
  4619. self._assert_equals_($2,(97));
  4620. $ctx1.sendIdx["assert:equals:"]=2;
  4621. $3="jackie"._charCodeAt_((3));
  4622. $ctx1.sendIdx["charCodeAt:"]=3;
  4623. self._assert_equals_($3,(99));
  4624. $ctx1.sendIdx["assert:equals:"]=3;
  4625. $4="jackie"._charCodeAt_((4));
  4626. $ctx1.sendIdx["charCodeAt:"]=4;
  4627. self._assert_equals_($4,(107));
  4628. $ctx1.sendIdx["assert:equals:"]=4;
  4629. $5="jackie"._charCodeAt_((5));
  4630. $ctx1.sendIdx["charCodeAt:"]=5;
  4631. self._assert_equals_($5,(105));
  4632. $ctx1.sendIdx["assert:equals:"]=5;
  4633. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4634. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4635. args: [],
  4636. 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",
  4637. messageSends: ["assert:equals:", "charCodeAt:"],
  4638. referencedClasses: []
  4639. }),
  4640. globals.StringTest);
  4641. smalltalk.addMethod(
  4642. smalltalk.method({
  4643. selector: "testCopyFromTo",
  4644. protocol: 'tests',
  4645. fn: function (){
  4646. var self=this;
  4647. return smalltalk.withContext(function($ctx1) {
  4648. var $1;
  4649. $1="jackie"._copyFrom_to_((1),(3));
  4650. $ctx1.sendIdx["copyFrom:to:"]=1;
  4651. self._assert_equals_($1,"jac");
  4652. $ctx1.sendIdx["assert:equals:"]=1;
  4653. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4654. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4655. args: [],
  4656. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4657. messageSends: ["assert:equals:", "copyFrom:to:"],
  4658. referencedClasses: []
  4659. }),
  4660. globals.StringTest);
  4661. smalltalk.addMethod(
  4662. smalltalk.method({
  4663. selector: "testCopyWithoutAll",
  4664. protocol: 'tests',
  4665. fn: function (){
  4666. var self=this;
  4667. return smalltalk.withContext(function($ctx1) {
  4668. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4669. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4670. args: [],
  4671. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4672. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4673. referencedClasses: []
  4674. }),
  4675. globals.StringTest);
  4676. smalltalk.addMethod(
  4677. smalltalk.method({
  4678. selector: "testEquality",
  4679. protocol: 'tests',
  4680. fn: function (){
  4681. var self=this;
  4682. return smalltalk.withContext(function($ctx1) {
  4683. var $1,$2,$3;
  4684. self._assert_equals_("hello","hello");
  4685. $ctx1.sendIdx["assert:equals:"]=1;
  4686. $1="hello".__eq("world");
  4687. $ctx1.sendIdx["="]=1;
  4688. self._deny_($1);
  4689. $ctx1.sendIdx["deny:"]=1;
  4690. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4691. })));
  4692. $ctx1.sendIdx["="]=2;
  4693. self._deny_($2);
  4694. $ctx1.sendIdx["deny:"]=2;
  4695. $3="hello"._yourself();
  4696. $ctx1.sendIdx["yourself"]=1;
  4697. self._assert_equals_("hello",$3);
  4698. $ctx1.sendIdx["assert:equals:"]=2;
  4699. self._assert_equals_("hello"._yourself(),"hello");
  4700. self._deny_("".__eq((0)));
  4701. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4702. args: [],
  4703. 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",
  4704. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4705. referencedClasses: []
  4706. }),
  4707. globals.StringTest);
  4708. smalltalk.addMethod(
  4709. smalltalk.method({
  4710. selector: "testIdentity",
  4711. protocol: 'tests',
  4712. fn: function (){
  4713. var self=this;
  4714. return smalltalk.withContext(function($ctx1) {
  4715. var $1,$2,$4,$3,$5;
  4716. $1="hello".__eq_eq("hello");
  4717. $ctx1.sendIdx["=="]=1;
  4718. self._assert_($1);
  4719. $ctx1.sendIdx["assert:"]=1;
  4720. $2="hello".__eq_eq("world");
  4721. $ctx1.sendIdx["=="]=2;
  4722. self._deny_($2);
  4723. $ctx1.sendIdx["deny:"]=1;
  4724. $4="hello"._yourself();
  4725. $ctx1.sendIdx["yourself"]=1;
  4726. $3="hello".__eq_eq($4);
  4727. $ctx1.sendIdx["=="]=3;
  4728. self._assert_($3);
  4729. $ctx1.sendIdx["assert:"]=2;
  4730. $5=_st("hello"._yourself()).__eq_eq("hello");
  4731. $ctx1.sendIdx["=="]=4;
  4732. self._assert_($5);
  4733. self._deny_("".__eq_eq((0)));
  4734. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4735. args: [],
  4736. 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",
  4737. messageSends: ["assert:", "==", "deny:", "yourself"],
  4738. referencedClasses: []
  4739. }),
  4740. globals.StringTest);
  4741. smalltalk.addMethod(
  4742. smalltalk.method({
  4743. selector: "testIdentityHash",
  4744. protocol: 'tests',
  4745. fn: function (){
  4746. var self=this;
  4747. return smalltalk.withContext(function($ctx1) {
  4748. var $1,$2,$4,$3;
  4749. $1="foo"._identityHash();
  4750. $ctx1.sendIdx["identityHash"]=1;
  4751. $2="foo"._identityHash();
  4752. $ctx1.sendIdx["identityHash"]=2;
  4753. self._assert_equals_($1,$2);
  4754. $4="foo"._identityHash();
  4755. $ctx1.sendIdx["identityHash"]=3;
  4756. $3=_st($4).__eq("bar"._identityHash());
  4757. self._deny_($3);
  4758. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4759. args: [],
  4760. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4761. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4762. referencedClasses: []
  4763. }),
  4764. globals.StringTest);
  4765. smalltalk.addMethod(
  4766. smalltalk.method({
  4767. selector: "testIncludesSubString",
  4768. protocol: 'tests',
  4769. fn: function (){
  4770. var self=this;
  4771. return smalltalk.withContext(function($ctx1) {
  4772. var $1;
  4773. $1="amber"._includesSubString_("ber");
  4774. $ctx1.sendIdx["includesSubString:"]=1;
  4775. self._assert_($1);
  4776. self._deny_("amber"._includesSubString_("zork"));
  4777. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4778. args: [],
  4779. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4780. messageSends: ["assert:", "includesSubString:", "deny:"],
  4781. referencedClasses: []
  4782. }),
  4783. globals.StringTest);
  4784. smalltalk.addMethod(
  4785. smalltalk.method({
  4786. selector: "testIndexOfStartingAtWithNull",
  4787. protocol: 'tests',
  4788. fn: function (){
  4789. var self=this;
  4790. return self},
  4791. args: [],
  4792. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4793. messageSends: [],
  4794. referencedClasses: []
  4795. }),
  4796. globals.StringTest);
  4797. smalltalk.addMethod(
  4798. smalltalk.method({
  4799. selector: "testIndexOfWithNull",
  4800. protocol: 'tests',
  4801. fn: function (){
  4802. var self=this;
  4803. return self},
  4804. args: [],
  4805. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4806. messageSends: [],
  4807. referencedClasses: []
  4808. }),
  4809. globals.StringTest);
  4810. smalltalk.addMethod(
  4811. smalltalk.method({
  4812. selector: "testIsVowel",
  4813. protocol: 'tests',
  4814. fn: function (){
  4815. var self=this;
  4816. var vowel,consonant;
  4817. return smalltalk.withContext(function($ctx1) {
  4818. var $1;
  4819. vowel="u";
  4820. consonant="z";
  4821. $1=_st(vowel)._isVowel();
  4822. $ctx1.sendIdx["isVowel"]=1;
  4823. self._assert_equals_($1,true);
  4824. $ctx1.sendIdx["assert:equals:"]=1;
  4825. self._assert_equals_(_st(consonant)._isVowel(),false);
  4826. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4827. args: [],
  4828. 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",
  4829. messageSends: ["assert:equals:", "isVowel"],
  4830. referencedClasses: []
  4831. }),
  4832. globals.StringTest);
  4833. smalltalk.addMethod(
  4834. smalltalk.method({
  4835. selector: "testJoin",
  4836. protocol: 'tests',
  4837. fn: function (){
  4838. var self=this;
  4839. return smalltalk.withContext(function($ctx1) {
  4840. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4841. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4842. args: [],
  4843. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4844. messageSends: ["assert:equals:", "join:"],
  4845. referencedClasses: []
  4846. }),
  4847. globals.StringTest);
  4848. smalltalk.addMethod(
  4849. smalltalk.method({
  4850. selector: "testRemoveAll",
  4851. protocol: 'tests',
  4852. fn: function (){
  4853. var self=this;
  4854. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4855. return smalltalk.withContext(function($ctx1) {
  4856. self._should_raise_((function(){
  4857. return smalltalk.withContext(function($ctx2) {
  4858. return _st(self._collection())._removeAll();
  4859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4860. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4861. args: [],
  4862. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4863. messageSends: ["should:raise:", "removeAll", "collection"],
  4864. referencedClasses: ["Error"]
  4865. }),
  4866. globals.StringTest);
  4867. smalltalk.addMethod(
  4868. smalltalk.method({
  4869. selector: "testReversed",
  4870. protocol: 'tests',
  4871. fn: function (){
  4872. var self=this;
  4873. return smalltalk.withContext(function($ctx1) {
  4874. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4875. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4876. args: [],
  4877. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4878. messageSends: ["assert:equals:", "reversed"],
  4879. referencedClasses: []
  4880. }),
  4881. globals.StringTest);
  4882. smalltalk.addMethod(
  4883. smalltalk.method({
  4884. selector: "testStreamContents",
  4885. protocol: 'tests',
  4886. fn: function (){
  4887. var self=this;
  4888. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4889. return smalltalk.withContext(function($ctx1) {
  4890. var $1;
  4891. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4892. return smalltalk.withContext(function($ctx2) {
  4893. _st(aStream)._nextPutAll_("hello");
  4894. $ctx2.sendIdx["nextPutAll:"]=1;
  4895. _st(aStream)._space();
  4896. $1=_st(aStream)._nextPutAll_("world");
  4897. return $1;
  4898. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4899. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  4900. args: [],
  4901. 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'",
  4902. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4903. referencedClasses: ["String"]
  4904. }),
  4905. globals.StringTest);
  4906. smalltalk.addMethod(
  4907. smalltalk.method({
  4908. selector: "testSubStrings",
  4909. protocol: 'tests',
  4910. fn: function (){
  4911. var self=this;
  4912. return smalltalk.withContext(function($ctx1) {
  4913. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4914. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  4915. args: [],
  4916. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4917. messageSends: ["assert:equals:", "subStrings:"],
  4918. referencedClasses: []
  4919. }),
  4920. globals.StringTest);
  4921. smalltalk.addMethod(
  4922. smalltalk.method({
  4923. selector: "testTrim",
  4924. protocol: 'tests',
  4925. fn: function (){
  4926. var self=this;
  4927. return smalltalk.withContext(function($ctx1) {
  4928. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4929. $ctx1.sendIdx["assert:equals:"]=1;
  4930. self._assert_equals_("jackie "._trimRight(),"jackie");
  4931. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  4932. args: [],
  4933. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4934. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4935. referencedClasses: []
  4936. }),
  4937. globals.StringTest);
  4938. smalltalk.addMethod(
  4939. smalltalk.method({
  4940. selector: "collectionClass",
  4941. protocol: 'fixture',
  4942. fn: function (){
  4943. var self=this;
  4944. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4945. return $String();
  4946. },
  4947. args: [],
  4948. source: "collectionClass\x0a\x09^ String",
  4949. messageSends: [],
  4950. referencedClasses: ["String"]
  4951. }),
  4952. globals.StringTest.klass);
  4953. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  4954. smalltalk.addMethod(
  4955. smalltalk.method({
  4956. selector: "collection",
  4957. protocol: 'fixture',
  4958. fn: function (){
  4959. var self=this;
  4960. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  4961. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  4962. return smalltalk.withContext(function($ctx1) {
  4963. var $2,$3,$1;
  4964. $2=_st($Set())._new();
  4965. _st($2)._add_($Smalltalk());
  4966. $ctx1.sendIdx["add:"]=1;
  4967. _st($2)._add_(nil);
  4968. $ctx1.sendIdx["add:"]=2;
  4969. _st($2)._add_((3).__at((3)));
  4970. $ctx1.sendIdx["add:"]=3;
  4971. _st($2)._add_(false);
  4972. $3=_st($2)._yourself();
  4973. $1=$3;
  4974. return $1;
  4975. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  4976. args: [],
  4977. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  4978. messageSends: ["add:", "new", "@", "yourself"],
  4979. referencedClasses: ["Set", "Smalltalk"]
  4980. }),
  4981. globals.SetTest);
  4982. smalltalk.addMethod(
  4983. smalltalk.method({
  4984. selector: "collectionOfPrintStrings",
  4985. protocol: 'fixture',
  4986. fn: function (){
  4987. var self=this;
  4988. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  4989. return smalltalk.withContext(function($ctx1) {
  4990. var $2,$3,$1;
  4991. $2=_st($Set())._new();
  4992. _st($2)._add_("a SmalltalkImage");
  4993. $ctx1.sendIdx["add:"]=1;
  4994. _st($2)._add_("nil");
  4995. $ctx1.sendIdx["add:"]=2;
  4996. _st($2)._add_("3@3");
  4997. $ctx1.sendIdx["add:"]=3;
  4998. _st($2)._add_("false");
  4999. $3=_st($2)._yourself();
  5000. $1=$3;
  5001. return $1;
  5002. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5003. args: [],
  5004. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5005. messageSends: ["add:", "new", "yourself"],
  5006. referencedClasses: ["Set"]
  5007. }),
  5008. globals.SetTest);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "collectionSize",
  5012. protocol: 'fixture',
  5013. fn: function (){
  5014. var self=this;
  5015. return (4);
  5016. },
  5017. args: [],
  5018. source: "collectionSize\x0a\x09^ 4",
  5019. messageSends: [],
  5020. referencedClasses: []
  5021. }),
  5022. globals.SetTest);
  5023. smalltalk.addMethod(
  5024. smalltalk.method({
  5025. selector: "collectionWithDuplicates",
  5026. protocol: 'fixture',
  5027. fn: function (){
  5028. var self=this;
  5029. return smalltalk.withContext(function($ctx1) {
  5030. var $2,$3,$1;
  5031. $2=self._collection();
  5032. _st($2)._add_((0));
  5033. $3=_st($2)._yourself();
  5034. $1=$3;
  5035. return $1;
  5036. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5037. args: [],
  5038. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5039. messageSends: ["add:", "collection", "yourself"],
  5040. referencedClasses: []
  5041. }),
  5042. globals.SetTest);
  5043. smalltalk.addMethod(
  5044. smalltalk.method({
  5045. selector: "collectionWithNewValue",
  5046. protocol: 'fixture',
  5047. fn: function (){
  5048. var self=this;
  5049. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5050. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5051. return smalltalk.withContext(function($ctx1) {
  5052. var $2,$3,$1;
  5053. $2=_st($Set())._new();
  5054. _st($2)._add_($Smalltalk());
  5055. $ctx1.sendIdx["add:"]=1;
  5056. _st($2)._add_(nil);
  5057. $ctx1.sendIdx["add:"]=2;
  5058. _st($2)._add_((3).__at((3)));
  5059. $ctx1.sendIdx["add:"]=3;
  5060. _st($2)._add_("N");
  5061. $ctx1.sendIdx["add:"]=4;
  5062. _st($2)._add_(false);
  5063. $3=_st($2)._yourself();
  5064. $1=$3;
  5065. return $1;
  5066. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5067. args: [],
  5068. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5069. messageSends: ["add:", "new", "@", "yourself"],
  5070. referencedClasses: ["Set", "Smalltalk"]
  5071. }),
  5072. globals.SetTest);
  5073. smalltalk.addMethod(
  5074. smalltalk.method({
  5075. selector: "testAddAll",
  5076. protocol: 'tests',
  5077. fn: function (){
  5078. var self=this;
  5079. return smalltalk.withContext(function($ctx1) {
  5080. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5081. globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5082. $2=self._collection();
  5083. $ctx1.sendIdx["collection"]=1;
  5084. $3=$2;
  5085. $4=self._collection();
  5086. $ctx1.sendIdx["collection"]=2;
  5087. _st($3)._addAll_($4);
  5088. $ctx1.sendIdx["addAll:"]=1;
  5089. $5=_st($2)._yourself();
  5090. $ctx1.sendIdx["yourself"]=1;
  5091. $1=$5;
  5092. $6=self._collection();
  5093. $ctx1.sendIdx["collection"]=3;
  5094. self._assert_equals_($1,$6);
  5095. $ctx1.sendIdx["assert:equals:"]=1;
  5096. $8=self._collection();
  5097. $ctx1.sendIdx["collection"]=4;
  5098. $9=$8;
  5099. $10=self._collectionWithNewValue();
  5100. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5101. _st($9)._addAll_($10);
  5102. $ctx1.sendIdx["addAll:"]=2;
  5103. $11=_st($8)._yourself();
  5104. $ctx1.sendIdx["yourself"]=2;
  5105. $7=$11;
  5106. $12=self._collectionWithNewValue();
  5107. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5108. self._assert_equals_($7,$12);
  5109. $ctx1.sendIdx["assert:equals:"]=2;
  5110. $14=self._collectionWithNewValue();
  5111. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5112. _st($14)._addAll_(self._collection());
  5113. $15=_st($14)._yourself();
  5114. $13=$15;
  5115. self._assert_equals_($13,self._collectionWithNewValue());
  5116. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5117. args: [],
  5118. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  5119. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5120. referencedClasses: []
  5121. }),
  5122. globals.SetTest);
  5123. smalltalk.addMethod(
  5124. smalltalk.method({
  5125. selector: "testAddRemove",
  5126. protocol: 'tests',
  5127. fn: function (){
  5128. var self=this;
  5129. var set;
  5130. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5131. return smalltalk.withContext(function($ctx1) {
  5132. var $1,$2;
  5133. set=_st($Set())._new();
  5134. self._assert_(_st(set)._isEmpty());
  5135. $ctx1.sendIdx["assert:"]=1;
  5136. _st(set)._add_((3));
  5137. $ctx1.sendIdx["add:"]=1;
  5138. $1=_st(set)._includes_((3));
  5139. $ctx1.sendIdx["includes:"]=1;
  5140. self._assert_($1);
  5141. $ctx1.sendIdx["assert:"]=2;
  5142. _st(set)._add_((5));
  5143. $2=_st(set)._includes_((5));
  5144. $ctx1.sendIdx["includes:"]=2;
  5145. self._assert_($2);
  5146. _st(set)._remove_((3));
  5147. self._deny_(_st(set)._includes_((3)));
  5148. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5149. args: [],
  5150. 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)",
  5151. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5152. referencedClasses: ["Set"]
  5153. }),
  5154. globals.SetTest);
  5155. smalltalk.addMethod(
  5156. smalltalk.method({
  5157. selector: "testAt",
  5158. protocol: 'tests',
  5159. fn: function (){
  5160. var self=this;
  5161. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5162. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5163. return smalltalk.withContext(function($ctx1) {
  5164. self._should_raise_((function(){
  5165. return smalltalk.withContext(function($ctx2) {
  5166. return _st(_st($Set())._new())._at_put_((1),(2));
  5167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5168. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5169. args: [],
  5170. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5171. messageSends: ["should:raise:", "at:put:", "new"],
  5172. referencedClasses: ["Set", "Error"]
  5173. }),
  5174. globals.SetTest);
  5175. smalltalk.addMethod(
  5176. smalltalk.method({
  5177. selector: "testCollect",
  5178. protocol: 'tests',
  5179. fn: function (){
  5180. var self=this;
  5181. return smalltalk.withContext(function($ctx1) {
  5182. var $2,$1;
  5183. globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5184. $2=[(5), (6), (8)]._asSet();
  5185. $ctx1.sendIdx["asSet"]=1;
  5186. $1=_st($2)._collect_((function(x){
  5187. return smalltalk.withContext(function($ctx2) {
  5188. return _st(x).__backslash_backslash((3));
  5189. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5190. self._assert_equals_($1,[(0), (2)]._asSet());
  5191. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5192. args: [],
  5193. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5194. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5195. referencedClasses: []
  5196. }),
  5197. globals.SetTest);
  5198. smalltalk.addMethod(
  5199. smalltalk.method({
  5200. selector: "testComma",
  5201. protocol: 'tests',
  5202. fn: function (){
  5203. var self=this;
  5204. return smalltalk.withContext(function($ctx1) {
  5205. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5206. globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5207. $2=self._collection();
  5208. $ctx1.sendIdx["collection"]=1;
  5209. $3=self._collection();
  5210. $ctx1.sendIdx["collection"]=2;
  5211. $1=_st($2).__comma($3);
  5212. $ctx1.sendIdx[","]=1;
  5213. $4=self._collection();
  5214. $ctx1.sendIdx["collection"]=3;
  5215. self._assert_equals_($1,$4);
  5216. $ctx1.sendIdx["assert:equals:"]=1;
  5217. $6=self._collection();
  5218. $ctx1.sendIdx["collection"]=4;
  5219. $7=self._collectionWithNewValue();
  5220. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5221. $5=_st($6).__comma($7);
  5222. $ctx1.sendIdx[","]=2;
  5223. $8=self._collectionWithNewValue();
  5224. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5225. self._assert_equals_($5,$8);
  5226. $ctx1.sendIdx["assert:equals:"]=2;
  5227. $10=self._collectionWithNewValue();
  5228. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5229. $9=_st($10).__comma(self._collection());
  5230. self._assert_equals_($9,self._collectionWithNewValue());
  5231. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5232. args: [],
  5233. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  5234. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5235. referencedClasses: []
  5236. }),
  5237. globals.SetTest);
  5238. smalltalk.addMethod(
  5239. smalltalk.method({
  5240. selector: "testComparing",
  5241. protocol: 'tests',
  5242. fn: function (){
  5243. var self=this;
  5244. return smalltalk.withContext(function($ctx1) {
  5245. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5246. $1=[(0), (2)]._asSet();
  5247. $ctx1.sendIdx["asSet"]=1;
  5248. $2=[(0), (2)]._asSet();
  5249. $ctx1.sendIdx["asSet"]=2;
  5250. self._assert_equals_($1,$2);
  5251. $ctx1.sendIdx["assert:equals:"]=1;
  5252. $3=[(2), (0)]._asSet();
  5253. $ctx1.sendIdx["asSet"]=3;
  5254. $4=[(0), (2)]._asSet();
  5255. $ctx1.sendIdx["asSet"]=4;
  5256. self._assert_equals_($3,$4);
  5257. $6=[(0), (2), (3)]._asSet();
  5258. $ctx1.sendIdx["asSet"]=5;
  5259. $7=[(0), (2)]._asSet();
  5260. $ctx1.sendIdx["asSet"]=6;
  5261. $5=_st($6).__eq($7);
  5262. $ctx1.sendIdx["="]=1;
  5263. self._deny_($5);
  5264. $ctx1.sendIdx["deny:"]=1;
  5265. $9=[(1), (2)]._asSet();
  5266. $ctx1.sendIdx["asSet"]=7;
  5267. $8=_st($9).__eq([(0), (2)]._asSet());
  5268. self._deny_($8);
  5269. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5270. args: [],
  5271. 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",
  5272. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5273. referencedClasses: []
  5274. }),
  5275. globals.SetTest);
  5276. smalltalk.addMethod(
  5277. smalltalk.method({
  5278. selector: "testPrintString",
  5279. protocol: 'tests',
  5280. fn: function (){
  5281. var self=this;
  5282. var set;
  5283. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5284. return smalltalk.withContext(function($ctx1) {
  5285. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5286. set=_st($Set())._new();
  5287. $1=_st(set)._printString();
  5288. $ctx1.sendIdx["printString"]=1;
  5289. self._assert_equals_($1,"a Set ()");
  5290. $ctx1.sendIdx["assert:equals:"]=1;
  5291. $2=set;
  5292. _st($2)._add_((1));
  5293. $ctx1.sendIdx["add:"]=1;
  5294. $3=_st($2)._add_((3));
  5295. $ctx1.sendIdx["add:"]=2;
  5296. $4=_st(set)._printString();
  5297. $ctx1.sendIdx["printString"]=2;
  5298. self._assert_equals_($4,"a Set (1 3)");
  5299. $ctx1.sendIdx["assert:equals:"]=2;
  5300. _st(set)._add_("foo");
  5301. $ctx1.sendIdx["add:"]=3;
  5302. $5=_st(set)._printString();
  5303. $ctx1.sendIdx["printString"]=3;
  5304. self._assert_equals_($5,"a Set (1 3 'foo')");
  5305. $ctx1.sendIdx["assert:equals:"]=3;
  5306. $6=set;
  5307. _st($6)._remove_((1));
  5308. $ctx1.sendIdx["remove:"]=1;
  5309. $7=_st($6)._remove_((3));
  5310. $8=_st(set)._printString();
  5311. $ctx1.sendIdx["printString"]=4;
  5312. self._assert_equals_($8,"a Set ('foo')");
  5313. $ctx1.sendIdx["assert:equals:"]=4;
  5314. _st(set)._add_((3));
  5315. $ctx1.sendIdx["add:"]=4;
  5316. $9=_st(set)._printString();
  5317. $ctx1.sendIdx["printString"]=5;
  5318. self._assert_equals_($9,"a Set (3 'foo')");
  5319. $ctx1.sendIdx["assert:equals:"]=5;
  5320. _st(set)._add_((3));
  5321. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5322. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5323. args: [],
  5324. 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 (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5325. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5326. referencedClasses: ["Set"]
  5327. }),
  5328. globals.SetTest);
  5329. smalltalk.addMethod(
  5330. smalltalk.method({
  5331. selector: "testUnboxedObjects",
  5332. protocol: 'tests',
  5333. fn: function (){
  5334. var self=this;
  5335. return smalltalk.withContext(function($ctx1) {
  5336. var $4,$3,$2,$1;
  5337. $4="foo"._yourself();
  5338. $ctx1.sendIdx["yourself"]=1;
  5339. $3=[$4,"foo"._yourself()];
  5340. $2=_st($3)._asSet();
  5341. $1=_st($2)._asArray();
  5342. self._assert_equals_($1,["foo"]);
  5343. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5344. args: [],
  5345. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5346. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5347. referencedClasses: []
  5348. }),
  5349. globals.SetTest);
  5350. smalltalk.addMethod(
  5351. smalltalk.method({
  5352. selector: "testUnicity",
  5353. protocol: 'tests',
  5354. fn: function (){
  5355. var self=this;
  5356. var set;
  5357. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5358. return smalltalk.withContext(function($ctx1) {
  5359. var $1;
  5360. set=_st($Set())._new();
  5361. _st(set)._add_((21));
  5362. $ctx1.sendIdx["add:"]=1;
  5363. _st(set)._add_("hello");
  5364. $ctx1.sendIdx["add:"]=2;
  5365. _st(set)._add_((21));
  5366. $ctx1.sendIdx["add:"]=3;
  5367. $1=_st(set)._size();
  5368. $ctx1.sendIdx["size"]=1;
  5369. self._assert_equals_($1,(2));
  5370. $ctx1.sendIdx["assert:equals:"]=1;
  5371. _st(set)._add_("hello");
  5372. self._assert_equals_(_st(set)._size(),(2));
  5373. $ctx1.sendIdx["assert:equals:"]=2;
  5374. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5375. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5376. args: [],
  5377. 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')",
  5378. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5379. referencedClasses: ["Set"]
  5380. }),
  5381. globals.SetTest);
  5382. smalltalk.addMethod(
  5383. smalltalk.method({
  5384. selector: "collectionClass",
  5385. protocol: 'fixture',
  5386. fn: function (){
  5387. var self=this;
  5388. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5389. return $Set();
  5390. },
  5391. args: [],
  5392. source: "collectionClass\x0a\x09^ Set",
  5393. messageSends: [],
  5394. referencedClasses: ["Set"]
  5395. }),
  5396. globals.SetTest.klass);
  5397. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5398. smalltalk.addMethod(
  5399. smalltalk.method({
  5400. selector: "testShow",
  5401. protocol: 'tests',
  5402. fn: function (){
  5403. var self=this;
  5404. var originalTranscript;
  5405. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5406. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5407. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5408. return smalltalk.withContext(function($ctx1) {
  5409. originalTranscript=_st($Transcript())._current();
  5410. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5411. $ctx1.sendIdx["register:"]=1;
  5412. self._shouldnt_raise_((function(){
  5413. return smalltalk.withContext(function($ctx2) {
  5414. return _st($Transcript())._show_("Hello console!");
  5415. $ctx2.sendIdx["show:"]=1;
  5416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5417. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5418. self._shouldnt_raise_((function(){
  5419. return smalltalk.withContext(function($ctx2) {
  5420. return _st($Transcript())._show_(console);
  5421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5422. _st($Transcript())._register_(originalTranscript);
  5423. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5424. args: [],
  5425. 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.",
  5426. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5427. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5428. }),
  5429. globals.ConsoleTranscriptTest);
  5430. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5431. smalltalk.addMethod(
  5432. smalltalk.method({
  5433. selector: "jsObject",
  5434. protocol: 'accessing',
  5435. fn: function (){
  5436. var self=this;
  5437. return smalltalk.withContext(function($ctx1) {
  5438. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5439. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5440. args: [],
  5441. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5442. messageSends: [],
  5443. referencedClasses: []
  5444. }),
  5445. globals.JSObjectProxyTest);
  5446. smalltalk.addMethod(
  5447. smalltalk.method({
  5448. selector: "testAtIfAbsent",
  5449. protocol: 'tests',
  5450. fn: function (){
  5451. var self=this;
  5452. var testObject;
  5453. return smalltalk.withContext(function($ctx1) {
  5454. var $1,$2,$3;
  5455. testObject=self._jsObject();
  5456. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5457. return "Property does not exist";
  5458. }));
  5459. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5460. self._assert_equals_($1,"Property does not exist");
  5461. $ctx1.sendIdx["assert:equals:"]=1;
  5462. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5463. return "Property does not exist";
  5464. }));
  5465. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5466. self._assert_equals_($2,nil);
  5467. $ctx1.sendIdx["assert:equals:"]=2;
  5468. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5469. return "Property does not exist";
  5470. }));
  5471. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5472. self._assert_equals_($3,(1));
  5473. $ctx1.sendIdx["assert:equals:"]=3;
  5474. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5475. return "Property does not exist";
  5476. })),nil);
  5477. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5478. args: [],
  5479. 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.",
  5480. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5481. referencedClasses: []
  5482. }),
  5483. globals.JSObjectProxyTest);
  5484. smalltalk.addMethod(
  5485. smalltalk.method({
  5486. selector: "testAtIfPresent",
  5487. protocol: 'tests',
  5488. fn: function (){
  5489. var self=this;
  5490. var testObject;
  5491. return smalltalk.withContext(function($ctx1) {
  5492. var $2,$1,$4,$3,$6,$5;
  5493. testObject=self._jsObject();
  5494. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5495. return smalltalk.withContext(function($ctx2) {
  5496. $2=_st(x)._asString();
  5497. $ctx2.sendIdx["asString"]=1;
  5498. return "hello ".__comma($2);
  5499. $ctx2.sendIdx[","]=1;
  5500. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5501. $ctx1.sendIdx["at:ifPresent:"]=1;
  5502. self._assert_equals_($1,nil);
  5503. $ctx1.sendIdx["assert:equals:"]=1;
  5504. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5505. return smalltalk.withContext(function($ctx2) {
  5506. $4=_st(x)._asString();
  5507. $ctx2.sendIdx["asString"]=2;
  5508. return "hello ".__comma($4);
  5509. $ctx2.sendIdx[","]=2;
  5510. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5511. $ctx1.sendIdx["at:ifPresent:"]=2;
  5512. self._assert_equals_($3,"hello nil");
  5513. $ctx1.sendIdx["assert:equals:"]=2;
  5514. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5515. return smalltalk.withContext(function($ctx2) {
  5516. $6=_st(x)._asString();
  5517. $ctx2.sendIdx["asString"]=3;
  5518. return "hello ".__comma($6);
  5519. $ctx2.sendIdx[","]=3;
  5520. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5521. $ctx1.sendIdx["at:ifPresent:"]=3;
  5522. self._assert_equals_($5,"hello 1");
  5523. $ctx1.sendIdx["assert:equals:"]=3;
  5524. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5525. return smalltalk.withContext(function($ctx2) {
  5526. return "hello ".__comma(_st(x)._asString());
  5527. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5528. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5529. args: [],
  5530. 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'.",
  5531. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5532. referencedClasses: []
  5533. }),
  5534. globals.JSObjectProxyTest);
  5535. smalltalk.addMethod(
  5536. smalltalk.method({
  5537. selector: "testAtIfPresentIfAbsent",
  5538. protocol: 'tests',
  5539. fn: function (){
  5540. var self=this;
  5541. var testObject;
  5542. return smalltalk.withContext(function($ctx1) {
  5543. var $2,$1,$4,$3,$6,$5;
  5544. testObject=self._jsObject();
  5545. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5546. return smalltalk.withContext(function($ctx2) {
  5547. $2=_st(x)._asString();
  5548. $ctx2.sendIdx["asString"]=1;
  5549. return "hello ".__comma($2);
  5550. $ctx2.sendIdx[","]=1;
  5551. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5552. return "not present";
  5553. }));
  5554. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5555. self._assert_equals_($1,"not present");
  5556. $ctx1.sendIdx["assert:equals:"]=1;
  5557. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5558. return smalltalk.withContext(function($ctx2) {
  5559. $4=_st(x)._asString();
  5560. $ctx2.sendIdx["asString"]=2;
  5561. return "hello ".__comma($4);
  5562. $ctx2.sendIdx[","]=2;
  5563. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5564. return "not present";
  5565. }));
  5566. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5567. self._assert_equals_($3,"hello nil");
  5568. $ctx1.sendIdx["assert:equals:"]=2;
  5569. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5570. return smalltalk.withContext(function($ctx2) {
  5571. $6=_st(x)._asString();
  5572. $ctx2.sendIdx["asString"]=3;
  5573. return "hello ".__comma($6);
  5574. $ctx2.sendIdx[","]=3;
  5575. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5576. return "not present";
  5577. }));
  5578. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5579. self._assert_equals_($5,"hello 1");
  5580. $ctx1.sendIdx["assert:equals:"]=3;
  5581. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5582. return smalltalk.withContext(function($ctx2) {
  5583. return "hello ".__comma(_st(x)._asString());
  5584. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5585. return "not present";
  5586. })),"hello nil");
  5587. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5588. args: [],
  5589. 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'.",
  5590. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5591. referencedClasses: []
  5592. }),
  5593. globals.JSObjectProxyTest);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "testAtPut",
  5597. protocol: 'tests',
  5598. fn: function (){
  5599. var self=this;
  5600. var testObject;
  5601. return smalltalk.withContext(function($ctx1) {
  5602. var $2,$1;
  5603. testObject=self._jsObject();
  5604. $2=_st(testObject)._at_("abc");
  5605. $ctx1.sendIdx["at:"]=1;
  5606. $1=_st($2).__tild_eq("xyz");
  5607. self._assert_($1);
  5608. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5609. $ctx1.sendIdx["assert:equals:"]=1;
  5610. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5611. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5612. args: [],
  5613. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  5614. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5615. referencedClasses: []
  5616. }),
  5617. globals.JSObjectProxyTest);
  5618. smalltalk.addMethod(
  5619. smalltalk.method({
  5620. selector: "testComparison",
  5621. protocol: 'tests',
  5622. fn: function (){
  5623. var self=this;
  5624. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5625. return smalltalk.withContext(function($ctx1) {
  5626. var $1,$2;
  5627. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5628. $1=_st(console).__eq(console);
  5629. $ctx1.sendIdx["="]=1;
  5630. self._assert_($1);
  5631. $2=_st(console).__eq(_st($Object())._new());
  5632. $ctx1.sendIdx["="]=2;
  5633. self._deny_($2);
  5634. $ctx1.sendIdx["deny:"]=1;
  5635. self._deny_(_st(console).__eq(self._jsObject()));
  5636. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5637. args: [],
  5638. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5639. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5640. referencedClasses: ["Object"]
  5641. }),
  5642. globals.JSObjectProxyTest);
  5643. smalltalk.addMethod(
  5644. smalltalk.method({
  5645. selector: "testDNU",
  5646. protocol: 'tests',
  5647. fn: function (){
  5648. var self=this;
  5649. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5650. return smalltalk.withContext(function($ctx1) {
  5651. self._should_raise_((function(){
  5652. return smalltalk.withContext(function($ctx2) {
  5653. return _st(self._jsObject())._foo();
  5654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5655. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5656. args: [],
  5657. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5658. messageSends: ["should:raise:", "foo", "jsObject"],
  5659. referencedClasses: ["MessageNotUnderstood"]
  5660. }),
  5661. globals.JSObjectProxyTest);
  5662. smalltalk.addMethod(
  5663. smalltalk.method({
  5664. selector: "testMessageSend",
  5665. protocol: 'tests',
  5666. fn: function (){
  5667. var self=this;
  5668. return smalltalk.withContext(function($ctx1) {
  5669. var $2,$1,$4,$3;
  5670. $2=self._jsObject();
  5671. $ctx1.sendIdx["jsObject"]=1;
  5672. $1=_st($2)._a();
  5673. self._assert_equals_($1,(1));
  5674. $ctx1.sendIdx["assert:equals:"]=1;
  5675. $4=self._jsObject();
  5676. $ctx1.sendIdx["jsObject"]=2;
  5677. $3=_st($4)._b();
  5678. self._assert_equals_($3,(2));
  5679. $ctx1.sendIdx["assert:equals:"]=2;
  5680. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5681. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5682. args: [],
  5683. 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",
  5684. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5685. referencedClasses: []
  5686. }),
  5687. globals.JSObjectProxyTest);
  5688. smalltalk.addMethod(
  5689. smalltalk.method({
  5690. selector: "testMethodWithArguments",
  5691. protocol: 'tests',
  5692. fn: function (){
  5693. var self=this;
  5694. return smalltalk.withContext(function($ctx1) {
  5695. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5696. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5697. args: [],
  5698. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5699. messageSends: ["assert:equals:", "c:", "jsObject"],
  5700. referencedClasses: []
  5701. }),
  5702. globals.JSObjectProxyTest);
  5703. smalltalk.addMethod(
  5704. smalltalk.method({
  5705. selector: "testPrinting",
  5706. protocol: 'tests',
  5707. fn: function (){
  5708. var self=this;
  5709. return smalltalk.withContext(function($ctx1) {
  5710. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5711. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5712. args: [],
  5713. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5714. messageSends: ["assert:equals:", "printString", "jsObject"],
  5715. referencedClasses: []
  5716. }),
  5717. globals.JSObjectProxyTest);
  5718. smalltalk.addMethod(
  5719. smalltalk.method({
  5720. selector: "testPropertyThatReturnsEmptyString",
  5721. protocol: 'tests',
  5722. fn: function (){
  5723. var self=this;
  5724. var object;
  5725. return smalltalk.withContext(function($ctx1) {
  5726. var $1;
  5727. object=self._jsObject();
  5728. $1=_st(object)._d();
  5729. $ctx1.sendIdx["d"]=1;
  5730. self._assert_equals_($1,"");
  5731. $ctx1.sendIdx["assert:equals:"]=1;
  5732. _st(object)._d_("hello");
  5733. self._assert_equals_(_st(object)._d(),"hello");
  5734. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5735. args: [],
  5736. 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'",
  5737. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5738. referencedClasses: []
  5739. }),
  5740. globals.JSObjectProxyTest);
  5741. smalltalk.addMethod(
  5742. smalltalk.method({
  5743. selector: "testPropertyThatReturnsUndefined",
  5744. protocol: 'tests',
  5745. fn: function (){
  5746. var self=this;
  5747. var object;
  5748. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5749. return smalltalk.withContext(function($ctx1) {
  5750. object=self._jsObject();
  5751. self._shouldnt_raise_((function(){
  5752. return smalltalk.withContext(function($ctx2) {
  5753. return _st(object)._e();
  5754. $ctx2.sendIdx["e"]=1;
  5755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5756. self._assert_(_st(_st(object)._e())._isNil());
  5757. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5758. args: [],
  5759. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5760. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5761. referencedClasses: ["MessageNotUnderstood"]
  5762. }),
  5763. globals.JSObjectProxyTest);
  5764. smalltalk.addMethod(
  5765. smalltalk.method({
  5766. selector: "testValue",
  5767. protocol: 'tests',
  5768. fn: function (){
  5769. var self=this;
  5770. var testObject;
  5771. return smalltalk.withContext(function($ctx1) {
  5772. testObject=self._jsObject();
  5773. _st(testObject)._at_put_("value","aValue");
  5774. self._assert_equals_(_st(testObject)._value(),"aValue");
  5775. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5776. args: [],
  5777. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5778. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5779. referencedClasses: []
  5780. }),
  5781. globals.JSObjectProxyTest);
  5782. smalltalk.addMethod(
  5783. smalltalk.method({
  5784. selector: "testYourself",
  5785. protocol: 'tests',
  5786. fn: function (){
  5787. var self=this;
  5788. var object;
  5789. return smalltalk.withContext(function($ctx1) {
  5790. var $1,$2;
  5791. $1=self._jsObject();
  5792. _st($1)._d_("test");
  5793. $2=_st($1)._yourself();
  5794. object=$2;
  5795. self._assert_equals_(_st(object)._d(),"test");
  5796. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5797. args: [],
  5798. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5799. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5800. referencedClasses: []
  5801. }),
  5802. globals.JSObjectProxyTest);
  5803. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5804. smalltalk.addMethod(
  5805. smalltalk.method({
  5806. selector: "testCatchingException",
  5807. protocol: 'tests',
  5808. fn: function (){
  5809. var self=this;
  5810. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5811. return smalltalk.withContext(function($ctx1) {
  5812. _st((function(){
  5813. return smalltalk.withContext(function($ctx2) {
  5814. return self._throwException();
  5815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5816. return smalltalk.withContext(function($ctx2) {
  5817. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5818. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5819. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5820. args: [],
  5821. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5822. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5823. referencedClasses: ["Error"]
  5824. }),
  5825. globals.JavaScriptExceptionTest);
  5826. smalltalk.addMethod(
  5827. smalltalk.method({
  5828. selector: "testRaisingException",
  5829. protocol: 'tests',
  5830. fn: function (){
  5831. var self=this;
  5832. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5833. return smalltalk.withContext(function($ctx1) {
  5834. self._should_raise_((function(){
  5835. return smalltalk.withContext(function($ctx2) {
  5836. return self._throwException();
  5837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5838. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5839. args: [],
  5840. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5841. messageSends: ["should:raise:", "throwException"],
  5842. referencedClasses: ["JavaScriptException"]
  5843. }),
  5844. globals.JavaScriptExceptionTest);
  5845. smalltalk.addMethod(
  5846. smalltalk.method({
  5847. selector: "throwException",
  5848. protocol: 'helpers',
  5849. fn: function (){
  5850. var self=this;
  5851. return smalltalk.withContext(function($ctx1) {
  5852. throw 'test';
  5853. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  5854. args: [],
  5855. source: "throwException\x0a\x09<throw 'test'>",
  5856. messageSends: [],
  5857. referencedClasses: []
  5858. }),
  5859. globals.JavaScriptExceptionTest);
  5860. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5861. smalltalk.addMethod(
  5862. smalltalk.method({
  5863. selector: "testValue",
  5864. protocol: 'tests',
  5865. fn: function (){
  5866. var self=this;
  5867. var messageSend;
  5868. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5869. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5870. return smalltalk.withContext(function($ctx1) {
  5871. var $1,$2;
  5872. $1=_st($MessageSend())._new();
  5873. $ctx1.sendIdx["new"]=1;
  5874. _st($1)._receiver_(_st($Object())._new());
  5875. _st($1)._selector_("asString");
  5876. $2=_st($1)._yourself();
  5877. messageSend=$2;
  5878. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5879. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  5880. args: [],
  5881. 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'",
  5882. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5883. referencedClasses: ["MessageSend", "Object"]
  5884. }),
  5885. globals.MessageSendTest);
  5886. smalltalk.addMethod(
  5887. smalltalk.method({
  5888. selector: "testValueWithArguments",
  5889. protocol: 'tests',
  5890. fn: function (){
  5891. var self=this;
  5892. var messageSend;
  5893. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5894. return smalltalk.withContext(function($ctx1) {
  5895. var $1,$2;
  5896. $1=_st($MessageSend())._new();
  5897. _st($1)._receiver_((2));
  5898. _st($1)._selector_("+");
  5899. $2=_st($1)._yourself();
  5900. messageSend=$2;
  5901. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5902. $ctx1.sendIdx["assert:equals:"]=1;
  5903. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5904. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  5905. args: [],
  5906. 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",
  5907. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5908. referencedClasses: ["MessageSend"]
  5909. }),
  5910. globals.MessageSendTest);
  5911. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5912. smalltalk.addMethod(
  5913. smalltalk.method({
  5914. selector: "codeGeneratorClass",
  5915. protocol: 'accessing',
  5916. fn: function (){
  5917. var self=this;
  5918. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5919. return $CodeGenerator();
  5920. },
  5921. args: [],
  5922. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5923. messageSends: [],
  5924. referencedClasses: ["CodeGenerator"]
  5925. }),
  5926. globals.MethodInheritanceTest);
  5927. smalltalk.addMethod(
  5928. smalltalk.method({
  5929. selector: "compiler",
  5930. protocol: 'factory',
  5931. fn: function (){
  5932. var self=this;
  5933. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5934. return smalltalk.withContext(function($ctx1) {
  5935. var $2,$3,$1;
  5936. $2=_st($Compiler())._new();
  5937. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5938. $3=_st($2)._yourself();
  5939. $1=$3;
  5940. return $1;
  5941. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  5942. args: [],
  5943. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5944. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5945. referencedClasses: ["Compiler"]
  5946. }),
  5947. globals.MethodInheritanceTest);
  5948. smalltalk.addMethod(
  5949. smalltalk.method({
  5950. selector: "deinstallBottom",
  5951. protocol: 'testing',
  5952. fn: function (){
  5953. var self=this;
  5954. return smalltalk.withContext(function($ctx1) {
  5955. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5956. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  5957. args: [],
  5958. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5959. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5960. referencedClasses: []
  5961. }),
  5962. globals.MethodInheritanceTest);
  5963. smalltalk.addMethod(
  5964. smalltalk.method({
  5965. selector: "deinstallMiddle",
  5966. protocol: 'testing',
  5967. fn: function (){
  5968. var self=this;
  5969. return smalltalk.withContext(function($ctx1) {
  5970. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5971. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  5972. args: [],
  5973. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5974. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5975. referencedClasses: []
  5976. }),
  5977. globals.MethodInheritanceTest);
  5978. smalltalk.addMethod(
  5979. smalltalk.method({
  5980. selector: "deinstallTop",
  5981. protocol: 'testing',
  5982. fn: function (){
  5983. var self=this;
  5984. return smalltalk.withContext(function($ctx1) {
  5985. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5986. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  5987. args: [],
  5988. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5989. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5990. referencedClasses: []
  5991. }),
  5992. globals.MethodInheritanceTest);
  5993. smalltalk.addMethod(
  5994. smalltalk.method({
  5995. selector: "installBottom:",
  5996. protocol: 'testing',
  5997. fn: function (aString){
  5998. var self=this;
  5999. return smalltalk.withContext(function($ctx1) {
  6000. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6001. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6002. args: ["aString"],
  6003. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6004. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6005. referencedClasses: []
  6006. }),
  6007. globals.MethodInheritanceTest);
  6008. smalltalk.addMethod(
  6009. smalltalk.method({
  6010. selector: "installMiddle:",
  6011. protocol: 'testing',
  6012. fn: function (aString){
  6013. var self=this;
  6014. return smalltalk.withContext(function($ctx1) {
  6015. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6016. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6017. args: ["aString"],
  6018. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6019. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6020. referencedClasses: []
  6021. }),
  6022. globals.MethodInheritanceTest);
  6023. smalltalk.addMethod(
  6024. smalltalk.method({
  6025. selector: "installTop:",
  6026. protocol: 'testing',
  6027. fn: function (aString){
  6028. var self=this;
  6029. return smalltalk.withContext(function($ctx1) {
  6030. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6031. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6032. args: ["aString"],
  6033. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6034. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6035. referencedClasses: []
  6036. }),
  6037. globals.MethodInheritanceTest);
  6038. smalltalk.addMethod(
  6039. smalltalk.method({
  6040. selector: "setUp",
  6041. protocol: 'initialization',
  6042. fn: function (){
  6043. var self=this;
  6044. return smalltalk.withContext(function($ctx1) {
  6045. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6046. $ctx1.sendIdx["new"]=1;
  6047. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6048. $ctx1.sendIdx["new"]=2;
  6049. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6050. self["@method"]=nil;
  6051. self["@performBlock"]=(function(){
  6052. return smalltalk.withContext(function($ctx2) {
  6053. return self._error_("performBlock not initialized");
  6054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6055. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6056. args: [],
  6057. 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' ]",
  6058. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6059. referencedClasses: []
  6060. }),
  6061. globals.MethodInheritanceTest);
  6062. smalltalk.addMethod(
  6063. smalltalk.method({
  6064. selector: "shouldMNU",
  6065. protocol: 'testing',
  6066. fn: function (){
  6067. var self=this;
  6068. return smalltalk.withContext(function($ctx1) {
  6069. self._shouldMNUTop();
  6070. self._shouldMNUMiddle();
  6071. self._shouldMNUBottom();
  6072. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6073. args: [],
  6074. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6075. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6076. referencedClasses: []
  6077. }),
  6078. globals.MethodInheritanceTest);
  6079. smalltalk.addMethod(
  6080. smalltalk.method({
  6081. selector: "shouldMNUBottom",
  6082. protocol: 'testing',
  6083. fn: function (){
  6084. var self=this;
  6085. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6086. return smalltalk.withContext(function($ctx1) {
  6087. self._should_raise_((function(){
  6088. return smalltalk.withContext(function($ctx2) {
  6089. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6091. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6092. args: [],
  6093. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6094. messageSends: ["should:raise:", "value:"],
  6095. referencedClasses: ["MessageNotUnderstood"]
  6096. }),
  6097. globals.MethodInheritanceTest);
  6098. smalltalk.addMethod(
  6099. smalltalk.method({
  6100. selector: "shouldMNUMiddle",
  6101. protocol: 'testing',
  6102. fn: function (){
  6103. var self=this;
  6104. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6105. return smalltalk.withContext(function($ctx1) {
  6106. self._should_raise_((function(){
  6107. return smalltalk.withContext(function($ctx2) {
  6108. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6110. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6111. args: [],
  6112. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6113. messageSends: ["should:raise:", "value:"],
  6114. referencedClasses: ["MessageNotUnderstood"]
  6115. }),
  6116. globals.MethodInheritanceTest);
  6117. smalltalk.addMethod(
  6118. smalltalk.method({
  6119. selector: "shouldMNUTop",
  6120. protocol: 'testing',
  6121. fn: function (){
  6122. var self=this;
  6123. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6124. return smalltalk.withContext(function($ctx1) {
  6125. self._should_raise_((function(){
  6126. return smalltalk.withContext(function($ctx2) {
  6127. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6129. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6130. args: [],
  6131. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6132. messageSends: ["should:raise:", "value:"],
  6133. referencedClasses: ["MessageNotUnderstood"]
  6134. }),
  6135. globals.MethodInheritanceTest);
  6136. smalltalk.addMethod(
  6137. smalltalk.method({
  6138. selector: "shouldReturn:",
  6139. protocol: 'testing',
  6140. fn: function (anObject){
  6141. var self=this;
  6142. var result;
  6143. return smalltalk.withContext(function($ctx1) {
  6144. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6145. $ctx1.sendIdx["value:"]=1;
  6146. self._assert_equals_(["top",anObject],["top",result]);
  6147. $ctx1.sendIdx["assert:equals:"]=1;
  6148. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6149. $ctx1.sendIdx["value:"]=2;
  6150. self._assert_equals_(["middle",anObject],["middle",result]);
  6151. $ctx1.sendIdx["assert:equals:"]=2;
  6152. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6153. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6154. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6155. args: ["anObject"],
  6156. 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 }",
  6157. messageSends: ["value:", "assert:equals:"],
  6158. referencedClasses: []
  6159. }),
  6160. globals.MethodInheritanceTest);
  6161. smalltalk.addMethod(
  6162. smalltalk.method({
  6163. selector: "shouldReturn:and:and:",
  6164. protocol: 'testing',
  6165. fn: function (anObject,anObject2,anObject3){
  6166. var self=this;
  6167. var result;
  6168. return smalltalk.withContext(function($ctx1) {
  6169. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6170. $ctx1.sendIdx["value:"]=1;
  6171. self._assert_equals_(["top",anObject],["top",result]);
  6172. $ctx1.sendIdx["assert:equals:"]=1;
  6173. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6174. $ctx1.sendIdx["value:"]=2;
  6175. self._assert_equals_(["middle",anObject2],["middle",result]);
  6176. $ctx1.sendIdx["assert:equals:"]=2;
  6177. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6178. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6179. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6180. args: ["anObject", "anObject2", "anObject3"],
  6181. 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 }",
  6182. messageSends: ["value:", "assert:equals:"],
  6183. referencedClasses: []
  6184. }),
  6185. globals.MethodInheritanceTest);
  6186. smalltalk.addMethod(
  6187. smalltalk.method({
  6188. selector: "targetClassBottom",
  6189. protocol: 'accessing',
  6190. fn: function (){
  6191. var self=this;
  6192. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6193. return $JavaScriptException();
  6194. },
  6195. args: [],
  6196. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6197. messageSends: [],
  6198. referencedClasses: ["JavaScriptException"]
  6199. }),
  6200. globals.MethodInheritanceTest);
  6201. smalltalk.addMethod(
  6202. smalltalk.method({
  6203. selector: "targetClassMiddle",
  6204. protocol: 'accessing',
  6205. fn: function (){
  6206. var self=this;
  6207. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6208. return $Error();
  6209. },
  6210. args: [],
  6211. source: "targetClassMiddle\x0a\x09^ Error",
  6212. messageSends: [],
  6213. referencedClasses: ["Error"]
  6214. }),
  6215. globals.MethodInheritanceTest);
  6216. smalltalk.addMethod(
  6217. smalltalk.method({
  6218. selector: "targetClassTop",
  6219. protocol: 'accessing',
  6220. fn: function (){
  6221. var self=this;
  6222. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6223. return $Object();
  6224. },
  6225. args: [],
  6226. source: "targetClassTop\x0a\x09^ Object",
  6227. messageSends: [],
  6228. referencedClasses: ["Object"]
  6229. }),
  6230. globals.MethodInheritanceTest);
  6231. smalltalk.addMethod(
  6232. smalltalk.method({
  6233. selector: "tearDown",
  6234. protocol: 'initialization',
  6235. fn: function (){
  6236. var self=this;
  6237. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6238. return smalltalk.withContext(function($ctx1) {
  6239. _st((function(){
  6240. return smalltalk.withContext(function($ctx2) {
  6241. return self._deinstallTop();
  6242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6243. }));
  6244. $ctx1.sendIdx["on:do:"]=1;
  6245. _st((function(){
  6246. return smalltalk.withContext(function($ctx2) {
  6247. return self._deinstallMiddle();
  6248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6249. }));
  6250. $ctx1.sendIdx["on:do:"]=2;
  6251. _st((function(){
  6252. return smalltalk.withContext(function($ctx2) {
  6253. return self._deinstallBottom();
  6254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6255. }));
  6256. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6257. args: [],
  6258. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6259. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6260. referencedClasses: ["Error"]
  6261. }),
  6262. globals.MethodInheritanceTest);
  6263. smalltalk.addMethod(
  6264. smalltalk.method({
  6265. selector: "testMNU11",
  6266. protocol: 'tests',
  6267. fn: function (){
  6268. var self=this;
  6269. return smalltalk.withContext(function($ctx1) {
  6270. self["@performBlock"]=(function(x){
  6271. return smalltalk.withContext(function($ctx2) {
  6272. return _st(x)._foo();
  6273. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6274. self._shouldMNU();
  6275. $ctx1.sendIdx["shouldMNU"]=1;
  6276. self._installTop_("foo ^ false");
  6277. $ctx1.sendIdx["installTop:"]=1;
  6278. self._installTop_("foo ^ true");
  6279. self._deinstallTop();
  6280. self._shouldMNU();
  6281. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6282. args: [],
  6283. 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",
  6284. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6285. referencedClasses: []
  6286. }),
  6287. globals.MethodInheritanceTest);
  6288. smalltalk.addMethod(
  6289. smalltalk.method({
  6290. selector: "testMNU22",
  6291. protocol: 'tests',
  6292. fn: function (){
  6293. var self=this;
  6294. return smalltalk.withContext(function($ctx1) {
  6295. self["@performBlock"]=(function(x){
  6296. return smalltalk.withContext(function($ctx2) {
  6297. return _st(x)._foo();
  6298. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6299. self._shouldMNU();
  6300. $ctx1.sendIdx["shouldMNU"]=1;
  6301. self._installMiddle_("foo ^ false");
  6302. $ctx1.sendIdx["installMiddle:"]=1;
  6303. self._installMiddle_("foo ^ true");
  6304. self._deinstallMiddle();
  6305. self._shouldMNU();
  6306. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6307. args: [],
  6308. 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",
  6309. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6310. referencedClasses: []
  6311. }),
  6312. globals.MethodInheritanceTest);
  6313. smalltalk.addMethod(
  6314. smalltalk.method({
  6315. selector: "testReturns1",
  6316. protocol: 'tests',
  6317. fn: function (){
  6318. var self=this;
  6319. return smalltalk.withContext(function($ctx1) {
  6320. self["@performBlock"]=(function(x){
  6321. return smalltalk.withContext(function($ctx2) {
  6322. return _st(x)._foo();
  6323. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6324. self._installTop_("foo ^ false");
  6325. $ctx1.sendIdx["installTop:"]=1;
  6326. self._shouldReturn_(false);
  6327. $ctx1.sendIdx["shouldReturn:"]=1;
  6328. self._installTop_("foo ^ true");
  6329. self._shouldReturn_(true);
  6330. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6331. args: [],
  6332. 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",
  6333. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6334. referencedClasses: []
  6335. }),
  6336. globals.MethodInheritanceTest);
  6337. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6338. smalltalk.addMethod(
  6339. smalltalk.method({
  6340. selector: "testAbs",
  6341. protocol: 'tests',
  6342. fn: function (){
  6343. var self=this;
  6344. return smalltalk.withContext(function($ctx1) {
  6345. var $1;
  6346. $1=(4)._abs();
  6347. $ctx1.sendIdx["abs"]=1;
  6348. self._assert_equals_($1,(4));
  6349. $ctx1.sendIdx["assert:equals:"]=1;
  6350. self._assert_equals_((-4)._abs(),(4));
  6351. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6352. args: [],
  6353. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6354. messageSends: ["assert:equals:", "abs"],
  6355. referencedClasses: []
  6356. }),
  6357. globals.NumberTest);
  6358. smalltalk.addMethod(
  6359. smalltalk.method({
  6360. selector: "testArithmetic",
  6361. protocol: 'tests',
  6362. fn: function (){
  6363. var self=this;
  6364. return smalltalk.withContext(function($ctx1) {
  6365. var $1,$2,$3,$5,$4;
  6366. $1=(1.5).__plus((1));
  6367. $ctx1.sendIdx["+"]=1;
  6368. self._assert_equals_($1,(2.5));
  6369. $ctx1.sendIdx["assert:equals:"]=1;
  6370. $2=(2).__minus((1));
  6371. $ctx1.sendIdx["-"]=1;
  6372. self._assert_equals_($2,(1));
  6373. $ctx1.sendIdx["assert:equals:"]=2;
  6374. self._assert_equals_((-2).__minus((1)),(-3));
  6375. $ctx1.sendIdx["assert:equals:"]=3;
  6376. self._assert_equals_((12).__slash((2)),(6));
  6377. $ctx1.sendIdx["assert:equals:"]=4;
  6378. $3=(3).__star((4));
  6379. $ctx1.sendIdx["*"]=1;
  6380. self._assert_equals_($3,(12));
  6381. $ctx1.sendIdx["assert:equals:"]=5;
  6382. self._assert_equals_((7).__slash_slash((2)),(3));
  6383. $ctx1.sendIdx["assert:equals:"]=6;
  6384. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6385. $ctx1.sendIdx["assert:equals:"]=7;
  6386. $5=(1).__plus((2));
  6387. $ctx1.sendIdx["+"]=2;
  6388. $4=_st($5).__star((3));
  6389. $ctx1.sendIdx["*"]=2;
  6390. self._assert_equals_($4,(9));
  6391. $ctx1.sendIdx["assert:equals:"]=8;
  6392. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6393. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6394. args: [],
  6395. 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",
  6396. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6397. referencedClasses: []
  6398. }),
  6399. globals.NumberTest);
  6400. smalltalk.addMethod(
  6401. smalltalk.method({
  6402. selector: "testAsNumber",
  6403. protocol: 'tests',
  6404. fn: function (){
  6405. var self=this;
  6406. return smalltalk.withContext(function($ctx1) {
  6407. self._assert_equals_((3)._asNumber(),(3));
  6408. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6409. args: [],
  6410. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6411. messageSends: ["assert:equals:", "asNumber"],
  6412. referencedClasses: []
  6413. }),
  6414. globals.NumberTest);
  6415. smalltalk.addMethod(
  6416. smalltalk.method({
  6417. selector: "testCeiling",
  6418. protocol: 'tests',
  6419. fn: function (){
  6420. var self=this;
  6421. return smalltalk.withContext(function($ctx1) {
  6422. var $1,$2;
  6423. $1=(1.2)._ceiling();
  6424. $ctx1.sendIdx["ceiling"]=1;
  6425. self._assert_equals_($1,(2));
  6426. $ctx1.sendIdx["assert:equals:"]=1;
  6427. $2=(-1.2)._ceiling();
  6428. $ctx1.sendIdx["ceiling"]=2;
  6429. self._assert_equals_($2,(-1));
  6430. $ctx1.sendIdx["assert:equals:"]=2;
  6431. self._assert_equals_((1)._ceiling(),(1));
  6432. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6433. args: [],
  6434. 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.",
  6435. messageSends: ["assert:equals:", "ceiling"],
  6436. referencedClasses: []
  6437. }),
  6438. globals.NumberTest);
  6439. smalltalk.addMethod(
  6440. smalltalk.method({
  6441. selector: "testComparison",
  6442. protocol: 'tests',
  6443. fn: function (){
  6444. var self=this;
  6445. return smalltalk.withContext(function($ctx1) {
  6446. var $1,$2,$3,$4;
  6447. $1=(3).__gt((2));
  6448. $ctx1.sendIdx[">"]=1;
  6449. self._assert_($1);
  6450. $ctx1.sendIdx["assert:"]=1;
  6451. $2=(2).__lt((3));
  6452. $ctx1.sendIdx["<"]=1;
  6453. self._assert_($2);
  6454. $ctx1.sendIdx["assert:"]=2;
  6455. self._deny_((3).__lt((2)));
  6456. $ctx1.sendIdx["deny:"]=1;
  6457. self._deny_((2).__gt((3)));
  6458. $3=(3).__gt_eq((3));
  6459. $ctx1.sendIdx[">="]=1;
  6460. self._assert_($3);
  6461. $ctx1.sendIdx["assert:"]=3;
  6462. self._assert_((3.1).__gt_eq((3)));
  6463. $ctx1.sendIdx["assert:"]=4;
  6464. $4=(3).__lt_eq((3));
  6465. $ctx1.sendIdx["<="]=1;
  6466. self._assert_($4);
  6467. $ctx1.sendIdx["assert:"]=5;
  6468. self._assert_((3).__lt_eq((3.1)));
  6469. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6470. args: [],
  6471. 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",
  6472. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6473. referencedClasses: []
  6474. }),
  6475. globals.NumberTest);
  6476. smalltalk.addMethod(
  6477. smalltalk.method({
  6478. selector: "testCopying",
  6479. protocol: 'tests',
  6480. fn: function (){
  6481. var self=this;
  6482. return smalltalk.withContext(function($ctx1) {
  6483. var $1;
  6484. $1=_st((1)._copy()).__eq_eq((1));
  6485. $ctx1.sendIdx["=="]=1;
  6486. self._assert_($1);
  6487. $ctx1.sendIdx["assert:"]=1;
  6488. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6489. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6490. args: [],
  6491. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6492. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6493. referencedClasses: []
  6494. }),
  6495. globals.NumberTest);
  6496. smalltalk.addMethod(
  6497. smalltalk.method({
  6498. selector: "testEquality",
  6499. protocol: 'tests',
  6500. fn: function (){
  6501. var self=this;
  6502. return smalltalk.withContext(function($ctx1) {
  6503. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6504. $1=(1).__eq((1));
  6505. $ctx1.sendIdx["="]=1;
  6506. self._assert_($1);
  6507. $ctx1.sendIdx["assert:"]=1;
  6508. $2=(0).__eq((0));
  6509. $ctx1.sendIdx["="]=2;
  6510. self._assert_($2);
  6511. $ctx1.sendIdx["assert:"]=2;
  6512. $3=(1).__eq((0));
  6513. $ctx1.sendIdx["="]=3;
  6514. self._deny_($3);
  6515. $ctx1.sendIdx["deny:"]=1;
  6516. $5=(1)._yourself();
  6517. $ctx1.sendIdx["yourself"]=1;
  6518. $4=_st($5).__eq((1));
  6519. $ctx1.sendIdx["="]=4;
  6520. self._assert_($4);
  6521. $ctx1.sendIdx["assert:"]=3;
  6522. $7=(1)._yourself();
  6523. $ctx1.sendIdx["yourself"]=2;
  6524. $6=(1).__eq($7);
  6525. $ctx1.sendIdx["="]=5;
  6526. self._assert_($6);
  6527. $ctx1.sendIdx["assert:"]=4;
  6528. $9=(1)._yourself();
  6529. $ctx1.sendIdx["yourself"]=3;
  6530. $8=_st($9).__eq((1)._yourself());
  6531. $ctx1.sendIdx["="]=6;
  6532. self._assert_($8);
  6533. $10=(0).__eq(false);
  6534. $ctx1.sendIdx["="]=7;
  6535. self._deny_($10);
  6536. $ctx1.sendIdx["deny:"]=2;
  6537. $11=false.__eq((0));
  6538. $ctx1.sendIdx["="]=8;
  6539. self._deny_($11);
  6540. $ctx1.sendIdx["deny:"]=3;
  6541. $12="".__eq((0));
  6542. $ctx1.sendIdx["="]=9;
  6543. self._deny_($12);
  6544. $ctx1.sendIdx["deny:"]=4;
  6545. self._deny_((0).__eq(""));
  6546. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6547. args: [],
  6548. 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 = ''",
  6549. messageSends: ["assert:", "=", "deny:", "yourself"],
  6550. referencedClasses: []
  6551. }),
  6552. globals.NumberTest);
  6553. smalltalk.addMethod(
  6554. smalltalk.method({
  6555. selector: "testFloor",
  6556. protocol: 'tests',
  6557. fn: function (){
  6558. var self=this;
  6559. return smalltalk.withContext(function($ctx1) {
  6560. var $1,$2;
  6561. $1=(1.2)._floor();
  6562. $ctx1.sendIdx["floor"]=1;
  6563. self._assert_equals_($1,(1));
  6564. $ctx1.sendIdx["assert:equals:"]=1;
  6565. $2=(-1.2)._floor();
  6566. $ctx1.sendIdx["floor"]=2;
  6567. self._assert_equals_($2,(-2));
  6568. $ctx1.sendIdx["assert:equals:"]=2;
  6569. self._assert_equals_((1)._floor(),(1));
  6570. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6571. args: [],
  6572. 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.",
  6573. messageSends: ["assert:equals:", "floor"],
  6574. referencedClasses: []
  6575. }),
  6576. globals.NumberTest);
  6577. smalltalk.addMethod(
  6578. smalltalk.method({
  6579. selector: "testHexNumbers",
  6580. protocol: 'tests',
  6581. fn: function (){
  6582. var self=this;
  6583. return smalltalk.withContext(function($ctx1) {
  6584. var $1,$2,$3,$4,$5;
  6585. self._assert_equals_((9),(9));
  6586. $ctx1.sendIdx["assert:equals:"]=1;
  6587. $1=(10)._truncated();
  6588. $ctx1.sendIdx["truncated"]=1;
  6589. self._assert_equals_($1,(10));
  6590. $ctx1.sendIdx["assert:equals:"]=2;
  6591. $2=(11)._truncated();
  6592. $ctx1.sendIdx["truncated"]=2;
  6593. self._assert_equals_($2,(11));
  6594. $ctx1.sendIdx["assert:equals:"]=3;
  6595. $3=(12)._truncated();
  6596. $ctx1.sendIdx["truncated"]=3;
  6597. self._assert_equals_($3,(12));
  6598. $ctx1.sendIdx["assert:equals:"]=4;
  6599. $4=(13)._truncated();
  6600. $ctx1.sendIdx["truncated"]=4;
  6601. self._assert_equals_($4,(13));
  6602. $ctx1.sendIdx["assert:equals:"]=5;
  6603. $5=(14)._truncated();
  6604. $ctx1.sendIdx["truncated"]=5;
  6605. self._assert_equals_($5,(14));
  6606. $ctx1.sendIdx["assert:equals:"]=6;
  6607. self._assert_equals_((15)._truncated(),(15));
  6608. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6609. args: [],
  6610. 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",
  6611. messageSends: ["assert:equals:", "truncated"],
  6612. referencedClasses: []
  6613. }),
  6614. globals.NumberTest);
  6615. smalltalk.addMethod(
  6616. smalltalk.method({
  6617. selector: "testIdentity",
  6618. protocol: 'tests',
  6619. fn: function (){
  6620. var self=this;
  6621. return smalltalk.withContext(function($ctx1) {
  6622. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6623. $1=(1).__eq_eq((1));
  6624. $ctx1.sendIdx["=="]=1;
  6625. self._assert_($1);
  6626. $ctx1.sendIdx["assert:"]=1;
  6627. $2=(0).__eq_eq((0));
  6628. $ctx1.sendIdx["=="]=2;
  6629. self._assert_($2);
  6630. $ctx1.sendIdx["assert:"]=2;
  6631. $3=(1).__eq_eq((0));
  6632. $ctx1.sendIdx["=="]=3;
  6633. self._deny_($3);
  6634. $ctx1.sendIdx["deny:"]=1;
  6635. $5=(1)._yourself();
  6636. $ctx1.sendIdx["yourself"]=1;
  6637. $4=_st($5).__eq_eq((1));
  6638. $ctx1.sendIdx["=="]=4;
  6639. self._assert_($4);
  6640. $ctx1.sendIdx["assert:"]=3;
  6641. $7=(1)._yourself();
  6642. $ctx1.sendIdx["yourself"]=2;
  6643. $6=(1).__eq_eq($7);
  6644. $ctx1.sendIdx["=="]=5;
  6645. self._assert_($6);
  6646. $ctx1.sendIdx["assert:"]=4;
  6647. $9=(1)._yourself();
  6648. $ctx1.sendIdx["yourself"]=3;
  6649. $8=_st($9).__eq_eq((1)._yourself());
  6650. $ctx1.sendIdx["=="]=6;
  6651. self._assert_($8);
  6652. self._deny_((1).__eq_eq((2)));
  6653. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6654. args: [],
  6655. 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",
  6656. messageSends: ["assert:", "==", "deny:", "yourself"],
  6657. referencedClasses: []
  6658. }),
  6659. globals.NumberTest);
  6660. smalltalk.addMethod(
  6661. smalltalk.method({
  6662. selector: "testInvalidHexNumbers",
  6663. protocol: 'tests',
  6664. fn: function (){
  6665. var self=this;
  6666. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6667. return smalltalk.withContext(function($ctx1) {
  6668. self._should_raise_((function(){
  6669. return smalltalk.withContext(function($ctx2) {
  6670. return (16)._rG();
  6671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6672. $ctx1.sendIdx["should:raise:"]=1;
  6673. self._should_raise_((function(){
  6674. return smalltalk.withContext(function($ctx2) {
  6675. return (16)._rg();
  6676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6677. $ctx1.sendIdx["should:raise:"]=2;
  6678. self._should_raise_((function(){
  6679. return smalltalk.withContext(function($ctx2) {
  6680. return (16)._rH();
  6681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6682. $ctx1.sendIdx["should:raise:"]=3;
  6683. self._should_raise_((function(){
  6684. return smalltalk.withContext(function($ctx2) {
  6685. return (16)._rh();
  6686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6687. $ctx1.sendIdx["should:raise:"]=4;
  6688. self._should_raise_((function(){
  6689. return smalltalk.withContext(function($ctx2) {
  6690. return (16)._rI();
  6691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6692. $ctx1.sendIdx["should:raise:"]=5;
  6693. self._should_raise_((function(){
  6694. return smalltalk.withContext(function($ctx2) {
  6695. return (16)._ri();
  6696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6697. $ctx1.sendIdx["should:raise:"]=6;
  6698. self._should_raise_((function(){
  6699. return smalltalk.withContext(function($ctx2) {
  6700. return (16)._rJ();
  6701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6702. $ctx1.sendIdx["should:raise:"]=7;
  6703. self._should_raise_((function(){
  6704. return smalltalk.withContext(function($ctx2) {
  6705. return (16)._rj();
  6706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6707. $ctx1.sendIdx["should:raise:"]=8;
  6708. self._should_raise_((function(){
  6709. return smalltalk.withContext(function($ctx2) {
  6710. return (16)._rK();
  6711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6712. $ctx1.sendIdx["should:raise:"]=9;
  6713. self._should_raise_((function(){
  6714. return smalltalk.withContext(function($ctx2) {
  6715. return (16)._rk();
  6716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6717. $ctx1.sendIdx["should:raise:"]=10;
  6718. self._should_raise_((function(){
  6719. return smalltalk.withContext(function($ctx2) {
  6720. return (16)._rL();
  6721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6722. $ctx1.sendIdx["should:raise:"]=11;
  6723. self._should_raise_((function(){
  6724. return smalltalk.withContext(function($ctx2) {
  6725. return (16)._rl();
  6726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6727. $ctx1.sendIdx["should:raise:"]=12;
  6728. self._should_raise_((function(){
  6729. return smalltalk.withContext(function($ctx2) {
  6730. return (16)._rM();
  6731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6732. $ctx1.sendIdx["should:raise:"]=13;
  6733. self._should_raise_((function(){
  6734. return smalltalk.withContext(function($ctx2) {
  6735. return (16)._rm();
  6736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6737. $ctx1.sendIdx["should:raise:"]=14;
  6738. self._should_raise_((function(){
  6739. return smalltalk.withContext(function($ctx2) {
  6740. return (16)._rN();
  6741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6742. $ctx1.sendIdx["should:raise:"]=15;
  6743. self._should_raise_((function(){
  6744. return smalltalk.withContext(function($ctx2) {
  6745. return (16)._rn();
  6746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6747. $ctx1.sendIdx["should:raise:"]=16;
  6748. self._should_raise_((function(){
  6749. return smalltalk.withContext(function($ctx2) {
  6750. return (16)._rO();
  6751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6752. $ctx1.sendIdx["should:raise:"]=17;
  6753. self._should_raise_((function(){
  6754. return smalltalk.withContext(function($ctx2) {
  6755. return (16)._ro();
  6756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6757. $ctx1.sendIdx["should:raise:"]=18;
  6758. self._should_raise_((function(){
  6759. return smalltalk.withContext(function($ctx2) {
  6760. return (16)._rP();
  6761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6762. $ctx1.sendIdx["should:raise:"]=19;
  6763. self._should_raise_((function(){
  6764. return smalltalk.withContext(function($ctx2) {
  6765. return (16)._rp();
  6766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6767. $ctx1.sendIdx["should:raise:"]=20;
  6768. self._should_raise_((function(){
  6769. return smalltalk.withContext(function($ctx2) {
  6770. return (16)._rQ();
  6771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6772. $ctx1.sendIdx["should:raise:"]=21;
  6773. self._should_raise_((function(){
  6774. return smalltalk.withContext(function($ctx2) {
  6775. return (16)._rq();
  6776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6777. $ctx1.sendIdx["should:raise:"]=22;
  6778. self._should_raise_((function(){
  6779. return smalltalk.withContext(function($ctx2) {
  6780. return (16)._rR();
  6781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6782. $ctx1.sendIdx["should:raise:"]=23;
  6783. self._should_raise_((function(){
  6784. return smalltalk.withContext(function($ctx2) {
  6785. return (16)._rr();
  6786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6787. $ctx1.sendIdx["should:raise:"]=24;
  6788. self._should_raise_((function(){
  6789. return smalltalk.withContext(function($ctx2) {
  6790. return (16)._rS();
  6791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6792. $ctx1.sendIdx["should:raise:"]=25;
  6793. self._should_raise_((function(){
  6794. return smalltalk.withContext(function($ctx2) {
  6795. return (16)._rs();
  6796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6797. $ctx1.sendIdx["should:raise:"]=26;
  6798. self._should_raise_((function(){
  6799. return smalltalk.withContext(function($ctx2) {
  6800. return (16)._rT();
  6801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6802. $ctx1.sendIdx["should:raise:"]=27;
  6803. self._should_raise_((function(){
  6804. return smalltalk.withContext(function($ctx2) {
  6805. return (16)._rt();
  6806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6807. $ctx1.sendIdx["should:raise:"]=28;
  6808. self._should_raise_((function(){
  6809. return smalltalk.withContext(function($ctx2) {
  6810. return (16)._rU();
  6811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6812. $ctx1.sendIdx["should:raise:"]=29;
  6813. self._should_raise_((function(){
  6814. return smalltalk.withContext(function($ctx2) {
  6815. return (16)._ru();
  6816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6817. $ctx1.sendIdx["should:raise:"]=30;
  6818. self._should_raise_((function(){
  6819. return smalltalk.withContext(function($ctx2) {
  6820. return (16)._rV();
  6821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6822. $ctx1.sendIdx["should:raise:"]=31;
  6823. self._should_raise_((function(){
  6824. return smalltalk.withContext(function($ctx2) {
  6825. return (16)._rv();
  6826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6827. $ctx1.sendIdx["should:raise:"]=32;
  6828. self._should_raise_((function(){
  6829. return smalltalk.withContext(function($ctx2) {
  6830. return (16)._rW();
  6831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6832. $ctx1.sendIdx["should:raise:"]=33;
  6833. self._should_raise_((function(){
  6834. return smalltalk.withContext(function($ctx2) {
  6835. return (16)._rw();
  6836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6837. $ctx1.sendIdx["should:raise:"]=34;
  6838. self._should_raise_((function(){
  6839. return smalltalk.withContext(function($ctx2) {
  6840. return (16)._rX();
  6841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6842. $ctx1.sendIdx["should:raise:"]=35;
  6843. self._should_raise_((function(){
  6844. return smalltalk.withContext(function($ctx2) {
  6845. return (16)._rx();
  6846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6847. $ctx1.sendIdx["should:raise:"]=36;
  6848. self._should_raise_((function(){
  6849. return smalltalk.withContext(function($ctx2) {
  6850. return (16)._rY();
  6851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6852. $ctx1.sendIdx["should:raise:"]=37;
  6853. self._should_raise_((function(){
  6854. return smalltalk.withContext(function($ctx2) {
  6855. return (16)._ry();
  6856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6857. $ctx1.sendIdx["should:raise:"]=38;
  6858. self._should_raise_((function(){
  6859. return smalltalk.withContext(function($ctx2) {
  6860. return (16)._rZ();
  6861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6862. $ctx1.sendIdx["should:raise:"]=39;
  6863. self._should_raise_((function(){
  6864. return smalltalk.withContext(function($ctx2) {
  6865. return (16)._rz();
  6866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6867. $ctx1.sendIdx["should:raise:"]=40;
  6868. self._should_raise_((function(){
  6869. return smalltalk.withContext(function($ctx2) {
  6870. return (11259375)._Z();
  6871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6872. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6873. args: [],
  6874. 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.",
  6875. 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"],
  6876. referencedClasses: ["MessageNotUnderstood"]
  6877. }),
  6878. globals.NumberTest);
  6879. smalltalk.addMethod(
  6880. smalltalk.method({
  6881. selector: "testLog",
  6882. protocol: 'tests',
  6883. fn: function (){
  6884. var self=this;
  6885. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  6886. return smalltalk.withContext(function($ctx1) {
  6887. self._assert_equals_((10000)._log(),(4));
  6888. $ctx1.sendIdx["assert:equals:"]=1;
  6889. self._assert_equals_((512)._log_((2)),(9));
  6890. $ctx1.sendIdx["assert:equals:"]=2;
  6891. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6892. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  6893. args: [],
  6894. 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.",
  6895. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6896. referencedClasses: ["Number"]
  6897. }),
  6898. globals.NumberTest);
  6899. smalltalk.addMethod(
  6900. smalltalk.method({
  6901. selector: "testMinMax",
  6902. protocol: 'tests',
  6903. fn: function (){
  6904. var self=this;
  6905. return smalltalk.withContext(function($ctx1) {
  6906. self._assert_equals_((2)._max_((5)),(5));
  6907. $ctx1.sendIdx["assert:equals:"]=1;
  6908. self._assert_equals_((2)._min_((5)),(2));
  6909. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  6910. args: [],
  6911. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6912. messageSends: ["assert:equals:", "max:", "min:"],
  6913. referencedClasses: []
  6914. }),
  6915. globals.NumberTest);
  6916. smalltalk.addMethod(
  6917. smalltalk.method({
  6918. selector: "testNegated",
  6919. protocol: 'tests',
  6920. fn: function (){
  6921. var self=this;
  6922. return smalltalk.withContext(function($ctx1) {
  6923. var $1;
  6924. $1=(3)._negated();
  6925. $ctx1.sendIdx["negated"]=1;
  6926. self._assert_equals_($1,(-3));
  6927. $ctx1.sendIdx["assert:equals:"]=1;
  6928. self._assert_equals_((-3)._negated(),(3));
  6929. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  6930. args: [],
  6931. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6932. messageSends: ["assert:equals:", "negated"],
  6933. referencedClasses: []
  6934. }),
  6935. globals.NumberTest);
  6936. smalltalk.addMethod(
  6937. smalltalk.method({
  6938. selector: "testPrintShowingDecimalPlaces",
  6939. protocol: 'tests',
  6940. fn: function (){
  6941. var self=this;
  6942. return smalltalk.withContext(function($ctx1) {
  6943. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6944. $1=(23)._printShowingDecimalPlaces_((2));
  6945. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6946. self._assert_equals_($1,"23.00");
  6947. $ctx1.sendIdx["assert:equals:"]=1;
  6948. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6949. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6950. self._assert_equals_($2,"23.57");
  6951. $ctx1.sendIdx["assert:equals:"]=2;
  6952. $4=(234.567)._negated();
  6953. $ctx1.sendIdx["negated"]=1;
  6954. $3=_st($4)._printShowingDecimalPlaces_((5));
  6955. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6956. self._assert_equals_($3,"-234.56700");
  6957. $ctx1.sendIdx["assert:equals:"]=3;
  6958. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6959. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6960. self._assert_equals_($5,"23");
  6961. $ctx1.sendIdx["assert:equals:"]=4;
  6962. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6963. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6964. self._assert_equals_($6,"24");
  6965. $ctx1.sendIdx["assert:equals:"]=5;
  6966. $8=(23.4567)._negated();
  6967. $ctx1.sendIdx["negated"]=2;
  6968. $7=_st($8)._printShowingDecimalPlaces_((0));
  6969. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6970. self._assert_equals_($7,"-23");
  6971. $ctx1.sendIdx["assert:equals:"]=6;
  6972. $10=(23.5567)._negated();
  6973. $ctx1.sendIdx["negated"]=3;
  6974. $9=_st($10)._printShowingDecimalPlaces_((0));
  6975. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6976. self._assert_equals_($9,"-24");
  6977. $ctx1.sendIdx["assert:equals:"]=7;
  6978. $11=(100000000)._printShowingDecimalPlaces_((1));
  6979. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6980. self._assert_equals_($11,"100000000.0");
  6981. $ctx1.sendIdx["assert:equals:"]=8;
  6982. $12=(0.98)._printShowingDecimalPlaces_((5));
  6983. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6984. self._assert_equals_($12,"0.98000");
  6985. $ctx1.sendIdx["assert:equals:"]=9;
  6986. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6987. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6988. self._assert_equals_($13,"-0.98");
  6989. $ctx1.sendIdx["assert:equals:"]=10;
  6990. $14=(2.567)._printShowingDecimalPlaces_((2));
  6991. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6992. self._assert_equals_($14,"2.57");
  6993. $ctx1.sendIdx["assert:equals:"]=11;
  6994. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6995. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6996. self._assert_equals_($15,"-2.57");
  6997. $ctx1.sendIdx["assert:equals:"]=12;
  6998. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6999. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7000. args: [],
  7001. 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'.",
  7002. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7003. referencedClasses: []
  7004. }),
  7005. globals.NumberTest);
  7006. smalltalk.addMethod(
  7007. smalltalk.method({
  7008. selector: "testRaisedTo",
  7009. protocol: 'tests',
  7010. fn: function (){
  7011. var self=this;
  7012. return smalltalk.withContext(function($ctx1) {
  7013. var $1,$2,$3;
  7014. $1=(2)._raisedTo_((4));
  7015. $ctx1.sendIdx["raisedTo:"]=1;
  7016. self._assert_equals_($1,(16));
  7017. $ctx1.sendIdx["assert:equals:"]=1;
  7018. $2=(2)._raisedTo_((0));
  7019. $ctx1.sendIdx["raisedTo:"]=2;
  7020. self._assert_equals_($2,(1));
  7021. $ctx1.sendIdx["assert:equals:"]=2;
  7022. $3=(2)._raisedTo_((-3));
  7023. $ctx1.sendIdx["raisedTo:"]=3;
  7024. self._assert_equals_($3,(0.125));
  7025. $ctx1.sendIdx["assert:equals:"]=3;
  7026. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7027. $ctx1.sendIdx["assert:equals:"]=4;
  7028. self._assert_equals_((2).__star_star((4)),(16));
  7029. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7030. args: [],
  7031. 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.",
  7032. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7033. referencedClasses: []
  7034. }),
  7035. globals.NumberTest);
  7036. smalltalk.addMethod(
  7037. smalltalk.method({
  7038. selector: "testRounded",
  7039. protocol: 'tests',
  7040. fn: function (){
  7041. var self=this;
  7042. return smalltalk.withContext(function($ctx1) {
  7043. var $1,$2;
  7044. $1=(3)._rounded();
  7045. $ctx1.sendIdx["rounded"]=1;
  7046. self._assert_equals_($1,(3));
  7047. $ctx1.sendIdx["assert:equals:"]=1;
  7048. $2=(3.212)._rounded();
  7049. $ctx1.sendIdx["rounded"]=2;
  7050. self._assert_equals_($2,(3));
  7051. $ctx1.sendIdx["assert:equals:"]=2;
  7052. self._assert_equals_((3.51)._rounded(),(4));
  7053. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7054. args: [],
  7055. 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",
  7056. messageSends: ["assert:equals:", "rounded"],
  7057. referencedClasses: []
  7058. }),
  7059. globals.NumberTest);
  7060. smalltalk.addMethod(
  7061. smalltalk.method({
  7062. selector: "testSign",
  7063. protocol: 'tests',
  7064. fn: function (){
  7065. var self=this;
  7066. return smalltalk.withContext(function($ctx1) {
  7067. var $1,$2;
  7068. $1=(5)._sign();
  7069. $ctx1.sendIdx["sign"]=1;
  7070. self._assert_equals_($1,(1));
  7071. $ctx1.sendIdx["assert:equals:"]=1;
  7072. $2=(0)._sign();
  7073. $ctx1.sendIdx["sign"]=2;
  7074. self._assert_equals_($2,(0));
  7075. $ctx1.sendIdx["assert:equals:"]=2;
  7076. self._assert_equals_((-1.4)._sign(),(-1));
  7077. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7078. args: [],
  7079. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7080. messageSends: ["assert:equals:", "sign"],
  7081. referencedClasses: []
  7082. }),
  7083. globals.NumberTest);
  7084. smalltalk.addMethod(
  7085. smalltalk.method({
  7086. selector: "testSqrt",
  7087. protocol: 'tests',
  7088. fn: function (){
  7089. var self=this;
  7090. return smalltalk.withContext(function($ctx1) {
  7091. var $1;
  7092. $1=(4)._sqrt();
  7093. $ctx1.sendIdx["sqrt"]=1;
  7094. self._assert_equals_($1,(2));
  7095. $ctx1.sendIdx["assert:equals:"]=1;
  7096. self._assert_equals_((16)._sqrt(),(4));
  7097. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7098. args: [],
  7099. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7100. messageSends: ["assert:equals:", "sqrt"],
  7101. referencedClasses: []
  7102. }),
  7103. globals.NumberTest);
  7104. smalltalk.addMethod(
  7105. smalltalk.method({
  7106. selector: "testSquared",
  7107. protocol: 'tests',
  7108. fn: function (){
  7109. var self=this;
  7110. return smalltalk.withContext(function($ctx1) {
  7111. self._assert_equals_((4)._squared(),(16));
  7112. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7113. args: [],
  7114. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7115. messageSends: ["assert:equals:", "squared"],
  7116. referencedClasses: []
  7117. }),
  7118. globals.NumberTest);
  7119. smalltalk.addMethod(
  7120. smalltalk.method({
  7121. selector: "testTimesRepeat",
  7122. protocol: 'tests',
  7123. fn: function (){
  7124. var self=this;
  7125. var i;
  7126. return smalltalk.withContext(function($ctx1) {
  7127. i=(0);
  7128. (0)._timesRepeat_((function(){
  7129. return smalltalk.withContext(function($ctx2) {
  7130. i=_st(i).__plus((1));
  7131. $ctx2.sendIdx["+"]=1;
  7132. return i;
  7133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7134. $ctx1.sendIdx["timesRepeat:"]=1;
  7135. self._assert_equals_(i,(0));
  7136. $ctx1.sendIdx["assert:equals:"]=1;
  7137. (5)._timesRepeat_((function(){
  7138. return smalltalk.withContext(function($ctx2) {
  7139. i=_st(i).__plus((1));
  7140. return i;
  7141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7142. self._assert_equals_(i,(5));
  7143. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7144. args: [],
  7145. 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",
  7146. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7147. referencedClasses: []
  7148. }),
  7149. globals.NumberTest);
  7150. smalltalk.addMethod(
  7151. smalltalk.method({
  7152. selector: "testTo",
  7153. protocol: 'tests',
  7154. fn: function (){
  7155. var self=this;
  7156. return smalltalk.withContext(function($ctx1) {
  7157. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7158. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7159. args: [],
  7160. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7161. messageSends: ["assert:equals:", "to:"],
  7162. referencedClasses: []
  7163. }),
  7164. globals.NumberTest);
  7165. smalltalk.addMethod(
  7166. smalltalk.method({
  7167. selector: "testToBy",
  7168. protocol: 'tests',
  7169. fn: function (){
  7170. var self=this;
  7171. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7172. return smalltalk.withContext(function($ctx1) {
  7173. var $1;
  7174. $1=(0)._to_by_((6),(2));
  7175. $ctx1.sendIdx["to:by:"]=1;
  7176. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7177. self._should_raise_((function(){
  7178. return smalltalk.withContext(function($ctx2) {
  7179. return (1)._to_by_((4),(0));
  7180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7181. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7182. args: [],
  7183. 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",
  7184. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7185. referencedClasses: ["Error"]
  7186. }),
  7187. globals.NumberTest);
  7188. smalltalk.addMethod(
  7189. smalltalk.method({
  7190. selector: "testTrigonometry",
  7191. protocol: 'tests',
  7192. fn: function (){
  7193. var self=this;
  7194. return smalltalk.withContext(function($ctx1) {
  7195. self._assert_equals_((0)._cos(),(1));
  7196. $ctx1.sendIdx["assert:equals:"]=1;
  7197. self._assert_equals_((0)._sin(),(0));
  7198. $ctx1.sendIdx["assert:equals:"]=2;
  7199. self._assert_equals_((0)._tan(),(0));
  7200. $ctx1.sendIdx["assert:equals:"]=3;
  7201. self._assert_equals_((1)._arcCos(),(0));
  7202. $ctx1.sendIdx["assert:equals:"]=4;
  7203. self._assert_equals_((0)._arcSin(),(0));
  7204. $ctx1.sendIdx["assert:equals:"]=5;
  7205. self._assert_equals_((0)._arcTan(),(0));
  7206. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7207. args: [],
  7208. 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.",
  7209. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7210. referencedClasses: []
  7211. }),
  7212. globals.NumberTest);
  7213. smalltalk.addMethod(
  7214. smalltalk.method({
  7215. selector: "testTruncated",
  7216. protocol: 'tests',
  7217. fn: function (){
  7218. var self=this;
  7219. return smalltalk.withContext(function($ctx1) {
  7220. var $1,$2;
  7221. $1=(3)._truncated();
  7222. $ctx1.sendIdx["truncated"]=1;
  7223. self._assert_equals_($1,(3));
  7224. $ctx1.sendIdx["assert:equals:"]=1;
  7225. $2=(3.212)._truncated();
  7226. $ctx1.sendIdx["truncated"]=2;
  7227. self._assert_equals_($2,(3));
  7228. $ctx1.sendIdx["assert:equals:"]=2;
  7229. self._assert_equals_((3.51)._truncated(),(3));
  7230. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7231. args: [],
  7232. 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",
  7233. messageSends: ["assert:equals:", "truncated"],
  7234. referencedClasses: []
  7235. }),
  7236. globals.NumberTest);
  7237. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7238. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7239. smalltalk.addMethod(
  7240. smalltalk.method({
  7241. selector: "foo",
  7242. protocol: 'not yet classified',
  7243. fn: function (){
  7244. var self=this;
  7245. var $1;
  7246. $1=self["@foo"];
  7247. return $1;
  7248. },
  7249. args: [],
  7250. source: "foo\x0a\x09^ foo",
  7251. messageSends: [],
  7252. referencedClasses: []
  7253. }),
  7254. globals.ObjectMock);
  7255. smalltalk.addMethod(
  7256. smalltalk.method({
  7257. selector: "foo:",
  7258. protocol: 'not yet classified',
  7259. fn: function (anObject){
  7260. var self=this;
  7261. self["@foo"]=anObject;
  7262. return self},
  7263. args: ["anObject"],
  7264. source: "foo: anObject\x0a\x09foo := anObject",
  7265. messageSends: [],
  7266. referencedClasses: []
  7267. }),
  7268. globals.ObjectMock);
  7269. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7270. smalltalk.addMethod(
  7271. smalltalk.method({
  7272. selector: "notDefined",
  7273. protocol: 'tests',
  7274. fn: function (){
  7275. var self=this;
  7276. return smalltalk.withContext(function($ctx1) {
  7277. return void 0;;
  7278. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7279. args: [],
  7280. source: "notDefined\x0a\x09<return void 0;>",
  7281. messageSends: [],
  7282. referencedClasses: []
  7283. }),
  7284. globals.ObjectTest);
  7285. smalltalk.addMethod(
  7286. smalltalk.method({
  7287. selector: "testBasicAccess",
  7288. protocol: 'tests',
  7289. fn: function (){
  7290. var self=this;
  7291. var o;
  7292. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7293. return smalltalk.withContext(function($ctx1) {
  7294. var $1;
  7295. o=_st($Object())._new();
  7296. _st(o)._basicAt_put_("a",(1));
  7297. $1=_st(o)._basicAt_("a");
  7298. $ctx1.sendIdx["basicAt:"]=1;
  7299. self._assert_equals_($1,(1));
  7300. $ctx1.sendIdx["assert:equals:"]=1;
  7301. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7302. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7303. args: [],
  7304. 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",
  7305. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7306. referencedClasses: ["Object"]
  7307. }),
  7308. globals.ObjectTest);
  7309. smalltalk.addMethod(
  7310. smalltalk.method({
  7311. selector: "testBasicPerform",
  7312. protocol: 'tests',
  7313. fn: function (){
  7314. var self=this;
  7315. var o;
  7316. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7317. return smalltalk.withContext(function($ctx1) {
  7318. o=_st($Object())._new();
  7319. _st(o)._basicAt_put_("func",(function(){
  7320. return "hello";
  7321. }));
  7322. $ctx1.sendIdx["basicAt:put:"]=1;
  7323. _st(o)._basicAt_put_("func2",(function(a){
  7324. return smalltalk.withContext(function($ctx2) {
  7325. return _st(a).__plus((1));
  7326. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7327. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7328. $ctx1.sendIdx["assert:equals:"]=1;
  7329. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7330. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7331. args: [],
  7332. 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",
  7333. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7334. referencedClasses: ["Object"]
  7335. }),
  7336. globals.ObjectTest);
  7337. smalltalk.addMethod(
  7338. smalltalk.method({
  7339. selector: "testDNU",
  7340. protocol: 'tests',
  7341. fn: function (){
  7342. var self=this;
  7343. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7344. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7345. return smalltalk.withContext(function($ctx1) {
  7346. self._should_raise_((function(){
  7347. return smalltalk.withContext(function($ctx2) {
  7348. return _st(_st($Object())._new())._foo();
  7349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7350. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7351. args: [],
  7352. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7353. messageSends: ["should:raise:", "foo", "new"],
  7354. referencedClasses: ["Object", "MessageNotUnderstood"]
  7355. }),
  7356. globals.ObjectTest);
  7357. smalltalk.addMethod(
  7358. smalltalk.method({
  7359. selector: "testEquality",
  7360. protocol: 'tests',
  7361. fn: function (){
  7362. var self=this;
  7363. var o;
  7364. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7365. return smalltalk.withContext(function($ctx1) {
  7366. var $1,$2,$4,$3;
  7367. o=_st($Object())._new();
  7368. $ctx1.sendIdx["new"]=1;
  7369. $1=_st(o).__eq(_st($Object())._new());
  7370. $ctx1.sendIdx["="]=1;
  7371. self._deny_($1);
  7372. $2=_st(o).__eq(o);
  7373. $ctx1.sendIdx["="]=2;
  7374. self._assert_($2);
  7375. $ctx1.sendIdx["assert:"]=1;
  7376. $4=_st(o)._yourself();
  7377. $ctx1.sendIdx["yourself"]=1;
  7378. $3=_st($4).__eq(o);
  7379. $ctx1.sendIdx["="]=3;
  7380. self._assert_($3);
  7381. $ctx1.sendIdx["assert:"]=2;
  7382. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7383. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7384. args: [],
  7385. 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)",
  7386. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7387. referencedClasses: ["Object"]
  7388. }),
  7389. globals.ObjectTest);
  7390. smalltalk.addMethod(
  7391. smalltalk.method({
  7392. selector: "testHalt",
  7393. protocol: 'tests',
  7394. fn: function (){
  7395. var self=this;
  7396. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7397. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7398. return smalltalk.withContext(function($ctx1) {
  7399. self._should_raise_((function(){
  7400. return smalltalk.withContext(function($ctx2) {
  7401. return _st(_st($Object())._new())._halt();
  7402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7403. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7404. args: [],
  7405. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7406. messageSends: ["should:raise:", "halt", "new"],
  7407. referencedClasses: ["Object", "Error"]
  7408. }),
  7409. globals.ObjectTest);
  7410. smalltalk.addMethod(
  7411. smalltalk.method({
  7412. selector: "testIdentity",
  7413. protocol: 'tests',
  7414. fn: function (){
  7415. var self=this;
  7416. var o;
  7417. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7418. return smalltalk.withContext(function($ctx1) {
  7419. var $1,$2,$4,$3;
  7420. o=_st($Object())._new();
  7421. $ctx1.sendIdx["new"]=1;
  7422. $1=_st(o).__eq_eq(_st($Object())._new());
  7423. $ctx1.sendIdx["=="]=1;
  7424. self._deny_($1);
  7425. $2=_st(o).__eq_eq(o);
  7426. $ctx1.sendIdx["=="]=2;
  7427. self._assert_($2);
  7428. $ctx1.sendIdx["assert:"]=1;
  7429. $4=_st(o)._yourself();
  7430. $ctx1.sendIdx["yourself"]=1;
  7431. $3=_st($4).__eq_eq(o);
  7432. $ctx1.sendIdx["=="]=3;
  7433. self._assert_($3);
  7434. $ctx1.sendIdx["assert:"]=2;
  7435. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7436. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7437. args: [],
  7438. 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",
  7439. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7440. referencedClasses: ["Object"]
  7441. }),
  7442. globals.ObjectTest);
  7443. smalltalk.addMethod(
  7444. smalltalk.method({
  7445. selector: "testIfNil",
  7446. protocol: 'tests',
  7447. fn: function (){
  7448. var self=this;
  7449. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7450. return smalltalk.withContext(function($ctx1) {
  7451. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7452. $2=_st($Object())._new();
  7453. $ctx1.sendIdx["new"]=1;
  7454. $1=_st($2)._isNil();
  7455. self._deny_($1);
  7456. $ctx1.sendIdx["deny:"]=1;
  7457. $5=_st($Object())._new();
  7458. $ctx1.sendIdx["new"]=2;
  7459. if(($receiver = $5) == nil || $receiver == null){
  7460. $4=true;
  7461. } else {
  7462. $4=$5;
  7463. };
  7464. $3=_st($4).__eq(true);
  7465. self._deny_($3);
  7466. $7=_st($Object())._new();
  7467. $ctx1.sendIdx["new"]=3;
  7468. if(($receiver = $7) == nil || $receiver == null){
  7469. $6=$7;
  7470. } else {
  7471. $6=true;
  7472. };
  7473. self._assert_equals_($6,true);
  7474. $ctx1.sendIdx["assert:equals:"]=1;
  7475. $9=_st($Object())._new();
  7476. $ctx1.sendIdx["new"]=4;
  7477. if(($receiver = $9) == nil || $receiver == null){
  7478. $8=false;
  7479. } else {
  7480. $8=true;
  7481. };
  7482. self._assert_equals_($8,true);
  7483. $ctx1.sendIdx["assert:equals:"]=2;
  7484. $11=_st($Object())._new();
  7485. if(($receiver = $11) == nil || $receiver == null){
  7486. $10=false;
  7487. } else {
  7488. $10=true;
  7489. };
  7490. self._assert_equals_($10,true);
  7491. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7492. args: [],
  7493. 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",
  7494. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7495. referencedClasses: ["Object"]
  7496. }),
  7497. globals.ObjectTest);
  7498. smalltalk.addMethod(
  7499. smalltalk.method({
  7500. selector: "testInstVars",
  7501. protocol: 'tests',
  7502. fn: function (){
  7503. var self=this;
  7504. var o;
  7505. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7506. return smalltalk.withContext(function($ctx1) {
  7507. var $1,$2;
  7508. o=_st($ObjectMock())._new();
  7509. $1=_st(o)._instVarAt_("foo");
  7510. $ctx1.sendIdx["instVarAt:"]=1;
  7511. self._assert_equals_($1,nil);
  7512. $ctx1.sendIdx["assert:equals:"]=1;
  7513. _st(o)._instVarAt_put_("foo",(1));
  7514. $2=_st(o)._instVarAt_("foo");
  7515. $ctx1.sendIdx["instVarAt:"]=2;
  7516. self._assert_equals_($2,(1));
  7517. $ctx1.sendIdx["assert:equals:"]=2;
  7518. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7519. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7520. args: [],
  7521. 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",
  7522. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7523. referencedClasses: ["ObjectMock"]
  7524. }),
  7525. globals.ObjectTest);
  7526. smalltalk.addMethod(
  7527. smalltalk.method({
  7528. selector: "testNilUndefined",
  7529. protocol: 'tests',
  7530. fn: function (){
  7531. var self=this;
  7532. return smalltalk.withContext(function($ctx1) {
  7533. self._assert_equals_(self._notDefined(),nil);
  7534. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7535. args: [],
  7536. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7537. messageSends: ["assert:equals:", "notDefined"],
  7538. referencedClasses: []
  7539. }),
  7540. globals.ObjectTest);
  7541. smalltalk.addMethod(
  7542. smalltalk.method({
  7543. selector: "testYourself",
  7544. protocol: 'tests',
  7545. fn: function (){
  7546. var self=this;
  7547. var o;
  7548. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7549. return smalltalk.withContext(function($ctx1) {
  7550. o=_st($ObjectMock())._new();
  7551. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7552. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7553. args: [],
  7554. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7555. messageSends: ["new", "assert:", "==", "yourself"],
  7556. referencedClasses: ["ObjectMock"]
  7557. }),
  7558. globals.ObjectTest);
  7559. smalltalk.addMethod(
  7560. smalltalk.method({
  7561. selector: "testidentityHash",
  7562. protocol: 'tests',
  7563. fn: function (){
  7564. var self=this;
  7565. var o1,o2;
  7566. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7567. return smalltalk.withContext(function($ctx1) {
  7568. var $2,$3,$1,$5,$4;
  7569. o1=_st($Object())._new();
  7570. $ctx1.sendIdx["new"]=1;
  7571. o2=_st($Object())._new();
  7572. $2=_st(o1)._identityHash();
  7573. $ctx1.sendIdx["identityHash"]=1;
  7574. $3=_st(o1)._identityHash();
  7575. $ctx1.sendIdx["identityHash"]=2;
  7576. $1=_st($2).__eq_eq($3);
  7577. $ctx1.sendIdx["=="]=1;
  7578. self._assert_($1);
  7579. $5=_st(o1)._identityHash();
  7580. $ctx1.sendIdx["identityHash"]=3;
  7581. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7582. self._deny_($4);
  7583. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7584. args: [],
  7585. 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",
  7586. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7587. referencedClasses: ["Object"]
  7588. }),
  7589. globals.ObjectTest);
  7590. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7591. smalltalk.addMethod(
  7592. smalltalk.method({
  7593. selector: "testAccessing",
  7594. protocol: 'tests',
  7595. fn: function (){
  7596. var self=this;
  7597. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7598. return smalltalk.withContext(function($ctx1) {
  7599. var $2,$1,$3,$6,$5,$4;
  7600. $2=_st($Point())._x_y_((3),(4));
  7601. $ctx1.sendIdx["x:y:"]=1;
  7602. $1=_st($2)._x();
  7603. $ctx1.sendIdx["x"]=1;
  7604. self._assert_equals_($1,(3));
  7605. $ctx1.sendIdx["assert:equals:"]=1;
  7606. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7607. $ctx1.sendIdx["y"]=1;
  7608. self._assert_equals_($3,(4));
  7609. $ctx1.sendIdx["assert:equals:"]=2;
  7610. $6=_st($Point())._new();
  7611. $ctx1.sendIdx["new"]=1;
  7612. $5=_st($6)._x_((3));
  7613. $4=_st($5)._x();
  7614. self._assert_equals_($4,(3));
  7615. $ctx1.sendIdx["assert:equals:"]=3;
  7616. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7617. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7618. args: [],
  7619. 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",
  7620. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7621. referencedClasses: ["Point"]
  7622. }),
  7623. globals.PointTest);
  7624. smalltalk.addMethod(
  7625. smalltalk.method({
  7626. selector: "testArithmetic",
  7627. protocol: 'tests',
  7628. fn: function (){
  7629. var self=this;
  7630. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7631. return smalltalk.withContext(function($ctx1) {
  7632. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7633. $2=(3).__at((4));
  7634. $ctx1.sendIdx["@"]=1;
  7635. $3=(3).__at((4));
  7636. $ctx1.sendIdx["@"]=2;
  7637. $1=_st($2).__star($3);
  7638. $4=_st($Point())._x_y_((9),(16));
  7639. $ctx1.sendIdx["x:y:"]=1;
  7640. self._assert_equals_($1,$4);
  7641. $ctx1.sendIdx["assert:equals:"]=1;
  7642. $6=(3).__at((4));
  7643. $ctx1.sendIdx["@"]=3;
  7644. $7=(3).__at((4));
  7645. $ctx1.sendIdx["@"]=4;
  7646. $5=_st($6).__plus($7);
  7647. $8=_st($Point())._x_y_((6),(8));
  7648. $ctx1.sendIdx["x:y:"]=2;
  7649. self._assert_equals_($5,$8);
  7650. $ctx1.sendIdx["assert:equals:"]=2;
  7651. $10=(3).__at((4));
  7652. $ctx1.sendIdx["@"]=5;
  7653. $11=(3).__at((4));
  7654. $ctx1.sendIdx["@"]=6;
  7655. $9=_st($10).__minus($11);
  7656. $12=_st($Point())._x_y_((0),(0));
  7657. $ctx1.sendIdx["x:y:"]=3;
  7658. self._assert_equals_($9,$12);
  7659. $ctx1.sendIdx["assert:equals:"]=3;
  7660. $14=(6).__at((8));
  7661. $ctx1.sendIdx["@"]=7;
  7662. $13=_st($14).__slash((3).__at((4)));
  7663. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7664. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7665. args: [],
  7666. 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)",
  7667. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7668. referencedClasses: ["Point"]
  7669. }),
  7670. globals.PointTest);
  7671. smalltalk.addMethod(
  7672. smalltalk.method({
  7673. selector: "testAt",
  7674. protocol: 'tests',
  7675. fn: function (){
  7676. var self=this;
  7677. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7678. return smalltalk.withContext(function($ctx1) {
  7679. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7680. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7681. args: [],
  7682. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7683. messageSends: ["assert:equals:", "@", "x:y:"],
  7684. referencedClasses: ["Point"]
  7685. }),
  7686. globals.PointTest);
  7687. smalltalk.addMethod(
  7688. smalltalk.method({
  7689. selector: "testEgality",
  7690. protocol: 'tests',
  7691. fn: function (){
  7692. var self=this;
  7693. return smalltalk.withContext(function($ctx1) {
  7694. var $2,$3,$1,$5,$4;
  7695. $2=(3).__at((4));
  7696. $ctx1.sendIdx["@"]=1;
  7697. $3=(3).__at((4));
  7698. $ctx1.sendIdx["@"]=2;
  7699. $1=_st($2).__eq($3);
  7700. $ctx1.sendIdx["="]=1;
  7701. self._assert_($1);
  7702. $5=(3).__at((5));
  7703. $ctx1.sendIdx["@"]=3;
  7704. $4=_st($5).__eq((3).__at((6)));
  7705. self._deny_($4);
  7706. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7707. args: [],
  7708. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7709. messageSends: ["assert:", "=", "@", "deny:"],
  7710. referencedClasses: []
  7711. }),
  7712. globals.PointTest);
  7713. smalltalk.addMethod(
  7714. smalltalk.method({
  7715. selector: "testNew",
  7716. protocol: 'tests',
  7717. fn: function (){
  7718. var self=this;
  7719. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7720. return smalltalk.withContext(function($ctx1) {
  7721. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7722. $3=_st($Point())._new();
  7723. $ctx1.sendIdx["new"]=1;
  7724. $2=_st($3)._x_((3));
  7725. $ctx1.sendIdx["x:"]=1;
  7726. $1=_st($2)._y();
  7727. $ctx1.sendIdx["y"]=1;
  7728. self._assert_equals_($1,nil);
  7729. $ctx1.sendIdx["assert:equals:"]=1;
  7730. $7=_st($Point())._new();
  7731. $ctx1.sendIdx["new"]=2;
  7732. $6=_st($7)._x_((3));
  7733. $5=_st($6)._x();
  7734. $ctx1.sendIdx["x"]=1;
  7735. $4=_st($5).__eq((0));
  7736. $ctx1.sendIdx["="]=1;
  7737. self._deny_($4);
  7738. $ctx1.sendIdx["deny:"]=1;
  7739. $10=_st($Point())._new();
  7740. $ctx1.sendIdx["new"]=3;
  7741. $9=_st($10)._y_((4));
  7742. $ctx1.sendIdx["y:"]=1;
  7743. $8=_st($9)._x();
  7744. self._assert_equals_($8,nil);
  7745. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7746. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7747. args: [],
  7748. 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",
  7749. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7750. referencedClasses: ["Point"]
  7751. }),
  7752. globals.PointTest);
  7753. smalltalk.addMethod(
  7754. smalltalk.method({
  7755. selector: "testTranslateBy",
  7756. protocol: 'tests',
  7757. fn: function (){
  7758. var self=this;
  7759. return smalltalk.withContext(function($ctx1) {
  7760. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7761. $2=(3).__at((3));
  7762. $ctx1.sendIdx["@"]=1;
  7763. $3=(0).__at((1));
  7764. $ctx1.sendIdx["@"]=2;
  7765. $1=_st($2)._translateBy_($3);
  7766. $ctx1.sendIdx["translateBy:"]=1;
  7767. $4=(3).__at((4));
  7768. $ctx1.sendIdx["@"]=3;
  7769. self._assert_equals_($1,$4);
  7770. $ctx1.sendIdx["assert:equals:"]=1;
  7771. $6=(3).__at((3));
  7772. $ctx1.sendIdx["@"]=4;
  7773. $8=(1)._negated();
  7774. $ctx1.sendIdx["negated"]=1;
  7775. $7=(0).__at($8);
  7776. $ctx1.sendIdx["@"]=5;
  7777. $5=_st($6)._translateBy_($7);
  7778. $ctx1.sendIdx["translateBy:"]=2;
  7779. $9=(3).__at((2));
  7780. $ctx1.sendIdx["@"]=6;
  7781. self._assert_equals_($5,$9);
  7782. $ctx1.sendIdx["assert:equals:"]=2;
  7783. $11=(3).__at((3));
  7784. $ctx1.sendIdx["@"]=7;
  7785. $12=(2).__at((3));
  7786. $ctx1.sendIdx["@"]=8;
  7787. $10=_st($11)._translateBy_($12);
  7788. $ctx1.sendIdx["translateBy:"]=3;
  7789. $13=(5).__at((6));
  7790. $ctx1.sendIdx["@"]=9;
  7791. self._assert_equals_($10,$13);
  7792. $ctx1.sendIdx["assert:equals:"]=3;
  7793. $15=(3).__at((3));
  7794. $ctx1.sendIdx["@"]=10;
  7795. $16=_st((3)._negated()).__at((0));
  7796. $ctx1.sendIdx["@"]=11;
  7797. $14=_st($15)._translateBy_($16);
  7798. self._assert_equals_($14,(0).__at((3)));
  7799. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7800. args: [],
  7801. 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.",
  7802. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7803. referencedClasses: []
  7804. }),
  7805. globals.PointTest);
  7806. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7807. smalltalk.addMethod(
  7808. smalltalk.method({
  7809. selector: "testNextIfAbsent",
  7810. protocol: 'tests',
  7811. fn: function (){
  7812. var self=this;
  7813. var queue;
  7814. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7815. return smalltalk.withContext(function($ctx1) {
  7816. var $2,$1;
  7817. queue=_st($Queue())._new();
  7818. _st(queue)._nextPut_("index1");
  7819. $2=_st(queue)._nextIfAbsent_("empty");
  7820. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7821. $1=_st($2).__eq("index1");
  7822. $ctx1.sendIdx["="]=1;
  7823. self._assert_($1);
  7824. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7825. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7826. args: [],
  7827. 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'",
  7828. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7829. referencedClasses: ["Queue"]
  7830. }),
  7831. globals.QueueTest);
  7832. smalltalk.addMethod(
  7833. smalltalk.method({
  7834. selector: "testQueueNext",
  7835. protocol: 'tests',
  7836. fn: function (){
  7837. var self=this;
  7838. var queue;
  7839. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7840. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7841. return smalltalk.withContext(function($ctx1) {
  7842. var $1,$2,$4,$3,$6,$5;
  7843. queue=_st($Queue())._new();
  7844. $1=queue;
  7845. _st($1)._nextPut_("index1");
  7846. $ctx1.sendIdx["nextPut:"]=1;
  7847. $2=_st($1)._nextPut_("index2");
  7848. $4=_st(queue)._next();
  7849. $ctx1.sendIdx["next"]=1;
  7850. $3=_st($4).__eq("index1");
  7851. $ctx1.sendIdx["="]=1;
  7852. self._assert_($3);
  7853. $6=_st(queue)._next();
  7854. $ctx1.sendIdx["next"]=2;
  7855. $5=_st($6).__eq("index");
  7856. self._deny_($5);
  7857. self._should_raise_((function(){
  7858. return smalltalk.withContext(function($ctx2) {
  7859. return _st(queue)._next();
  7860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7861. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  7862. args: [],
  7863. 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",
  7864. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7865. referencedClasses: ["Queue", "Error"]
  7866. }),
  7867. globals.QueueTest);
  7868. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  7869. smalltalk.addMethod(
  7870. smalltalk.method({
  7871. selector: "testAtRandomNumber",
  7872. protocol: 'tests',
  7873. fn: function (){
  7874. var self=this;
  7875. var val;
  7876. return smalltalk.withContext(function($ctx1) {
  7877. (100)._timesRepeat_((function(){
  7878. return smalltalk.withContext(function($ctx2) {
  7879. val=(10)._atRandom();
  7880. val;
  7881. self._assert_(_st(val).__gt((0)));
  7882. $ctx2.sendIdx["assert:"]=1;
  7883. return self._assert_(_st(val).__lt((11)));
  7884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7885. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  7886. args: [],
  7887. 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]",
  7888. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7889. referencedClasses: []
  7890. }),
  7891. globals.RandomTest);
  7892. smalltalk.addMethod(
  7893. smalltalk.method({
  7894. selector: "testAtRandomSequenceableCollection",
  7895. protocol: 'tests',
  7896. fn: function (){
  7897. var self=this;
  7898. var val;
  7899. return smalltalk.withContext(function($ctx1) {
  7900. var $3,$4,$2,$1;
  7901. (100)._timesRepeat_((function(){
  7902. return smalltalk.withContext(function($ctx2) {
  7903. val="abc"._atRandom();
  7904. val;
  7905. $3=_st(val).__eq("a");
  7906. $ctx2.sendIdx["="]=1;
  7907. $4=_st(val).__eq("b");
  7908. $ctx2.sendIdx["="]=2;
  7909. $2=_st($3).__or($4);
  7910. $1=_st($2).__or(_st(val).__eq("c"));
  7911. $ctx2.sendIdx["|"]=1;
  7912. return self._assert_($1);
  7913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7914. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  7915. args: [],
  7916. 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].",
  7917. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7918. referencedClasses: []
  7919. }),
  7920. globals.RandomTest);
  7921. smalltalk.addMethod(
  7922. smalltalk.method({
  7923. selector: "textNext",
  7924. protocol: 'tests',
  7925. fn: function (){
  7926. var self=this;
  7927. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  7928. return smalltalk.withContext(function($ctx1) {
  7929. var $1;
  7930. (10000)._timesRepeat_((function(){
  7931. var current,next;
  7932. return smalltalk.withContext(function($ctx2) {
  7933. next=_st(_st($Random())._new())._next();
  7934. next;
  7935. self._assert_(_st(next).__gt_eq((0)));
  7936. $ctx2.sendIdx["assert:"]=1;
  7937. self._assert_(_st(next).__lt((1)));
  7938. $1=_st(current).__eq(next);
  7939. $ctx2.sendIdx["="]=1;
  7940. self._deny_($1);
  7941. return _st(next).__eq(current);
  7942. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7943. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  7944. args: [],
  7945. 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 ]",
  7946. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7947. referencedClasses: ["Random"]
  7948. }),
  7949. globals.RandomTest);
  7950. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  7951. smalltalk.addMethod(
  7952. smalltalk.method({
  7953. selector: "collectionClass",
  7954. protocol: 'accessing',
  7955. fn: function (){
  7956. var self=this;
  7957. return smalltalk.withContext(function($ctx1) {
  7958. var $1;
  7959. $1=_st(self._class())._collectionClass();
  7960. return $1;
  7961. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  7962. args: [],
  7963. source: "collectionClass\x0a\x09^ self class collectionClass",
  7964. messageSends: ["collectionClass", "class"],
  7965. referencedClasses: []
  7966. }),
  7967. globals.StreamTest);
  7968. smalltalk.addMethod(
  7969. smalltalk.method({
  7970. selector: "newCollection",
  7971. protocol: 'accessing',
  7972. fn: function (){
  7973. var self=this;
  7974. return smalltalk.withContext(function($ctx1) {
  7975. var $1;
  7976. $1=_st(self._collectionClass())._new();
  7977. return $1;
  7978. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  7979. args: [],
  7980. source: "newCollection\x0a\x09^ self collectionClass new",
  7981. messageSends: ["new", "collectionClass"],
  7982. referencedClasses: []
  7983. }),
  7984. globals.StreamTest);
  7985. smalltalk.addMethod(
  7986. smalltalk.method({
  7987. selector: "newStream",
  7988. protocol: 'accessing',
  7989. fn: function (){
  7990. var self=this;
  7991. return smalltalk.withContext(function($ctx1) {
  7992. var $1;
  7993. $1=_st(_st(self._collectionClass())._new())._stream();
  7994. return $1;
  7995. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  7996. args: [],
  7997. source: "newStream\x0a\x09^ self collectionClass new stream",
  7998. messageSends: ["stream", "new", "collectionClass"],
  7999. referencedClasses: []
  8000. }),
  8001. globals.StreamTest);
  8002. smalltalk.addMethod(
  8003. smalltalk.method({
  8004. selector: "testAtStartAtEnd",
  8005. protocol: 'tests',
  8006. fn: function (){
  8007. var self=this;
  8008. var stream;
  8009. return smalltalk.withContext(function($ctx1) {
  8010. var $1,$2,$3,$4;
  8011. stream=self._newStream();
  8012. $1=_st(stream)._atStart();
  8013. $ctx1.sendIdx["atStart"]=1;
  8014. self._assert_($1);
  8015. $ctx1.sendIdx["assert:"]=1;
  8016. $2=_st(stream)._atEnd();
  8017. $ctx1.sendIdx["atEnd"]=1;
  8018. self._assert_($2);
  8019. $ctx1.sendIdx["assert:"]=2;
  8020. _st(stream)._nextPutAll_(self._newCollection());
  8021. $3=_st(stream)._atEnd();
  8022. $ctx1.sendIdx["atEnd"]=2;
  8023. self._assert_($3);
  8024. $4=_st(stream)._atStart();
  8025. $ctx1.sendIdx["atStart"]=2;
  8026. self._deny_($4);
  8027. $ctx1.sendIdx["deny:"]=1;
  8028. _st(stream)._position_((1));
  8029. self._deny_(_st(stream)._atEnd());
  8030. $ctx1.sendIdx["deny:"]=2;
  8031. self._deny_(_st(stream)._atStart());
  8032. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8033. args: [],
  8034. 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",
  8035. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8036. referencedClasses: []
  8037. }),
  8038. globals.StreamTest);
  8039. smalltalk.addMethod(
  8040. smalltalk.method({
  8041. selector: "testContents",
  8042. protocol: 'tests',
  8043. fn: function (){
  8044. var self=this;
  8045. var stream;
  8046. return smalltalk.withContext(function($ctx1) {
  8047. var $1,$2;
  8048. stream=self._newStream();
  8049. $1=stream;
  8050. $2=self._newCollection();
  8051. $ctx1.sendIdx["newCollection"]=1;
  8052. _st($1)._nextPutAll_($2);
  8053. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8054. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8055. args: [],
  8056. 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",
  8057. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8058. referencedClasses: []
  8059. }),
  8060. globals.StreamTest);
  8061. smalltalk.addMethod(
  8062. smalltalk.method({
  8063. selector: "testIsEmpty",
  8064. protocol: 'tests',
  8065. fn: function (){
  8066. var self=this;
  8067. var stream;
  8068. return smalltalk.withContext(function($ctx1) {
  8069. var $1;
  8070. stream=self._newStream();
  8071. $1=_st(stream)._isEmpty();
  8072. $ctx1.sendIdx["isEmpty"]=1;
  8073. self._assert_($1);
  8074. _st(stream)._nextPutAll_(self._newCollection());
  8075. self._deny_(_st(stream)._isEmpty());
  8076. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8077. args: [],
  8078. 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",
  8079. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8080. referencedClasses: []
  8081. }),
  8082. globals.StreamTest);
  8083. smalltalk.addMethod(
  8084. smalltalk.method({
  8085. selector: "testPosition",
  8086. protocol: 'tests',
  8087. fn: function (){
  8088. var self=this;
  8089. var collection,stream;
  8090. return smalltalk.withContext(function($ctx1) {
  8091. var $1,$2,$3;
  8092. collection=self._newCollection();
  8093. stream=self._newStream();
  8094. _st(stream)._nextPutAll_(collection);
  8095. $1=_st(stream)._position();
  8096. $ctx1.sendIdx["position"]=1;
  8097. self._assert_equals_($1,_st(collection)._size());
  8098. $ctx1.sendIdx["assert:equals:"]=1;
  8099. _st(stream)._position_((0));
  8100. $2=_st(stream)._position();
  8101. $ctx1.sendIdx["position"]=2;
  8102. self._assert_equals_($2,(0));
  8103. $ctx1.sendIdx["assert:equals:"]=2;
  8104. _st(stream)._next();
  8105. $ctx1.sendIdx["next"]=1;
  8106. $3=_st(stream)._position();
  8107. $ctx1.sendIdx["position"]=3;
  8108. self._assert_equals_($3,(1));
  8109. $ctx1.sendIdx["assert:equals:"]=3;
  8110. _st(stream)._next();
  8111. self._assert_equals_(_st(stream)._position(),(2));
  8112. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8113. args: [],
  8114. 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",
  8115. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8116. referencedClasses: []
  8117. }),
  8118. globals.StreamTest);
  8119. smalltalk.addMethod(
  8120. smalltalk.method({
  8121. selector: "testReading",
  8122. protocol: 'tests',
  8123. fn: function (){
  8124. var self=this;
  8125. var stream,collection;
  8126. return smalltalk.withContext(function($ctx1) {
  8127. var $1,$2,$3;
  8128. collection=self._newCollection();
  8129. stream=self._newStream();
  8130. $1=stream;
  8131. _st($1)._nextPutAll_(collection);
  8132. $2=_st($1)._position_((0));
  8133. _st(collection)._do_((function(each){
  8134. return smalltalk.withContext(function($ctx2) {
  8135. $3=_st(stream)._next();
  8136. $ctx2.sendIdx["next"]=1;
  8137. return self._assert_equals_($3,each);
  8138. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8139. self._assert_(_st(_st(stream)._next())._isNil());
  8140. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8141. args: [],
  8142. 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",
  8143. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8144. referencedClasses: []
  8145. }),
  8146. globals.StreamTest);
  8147. smalltalk.addMethod(
  8148. smalltalk.method({
  8149. selector: "testStreamContents",
  8150. protocol: 'tests',
  8151. fn: function (){
  8152. var self=this;
  8153. return self},
  8154. args: [],
  8155. source: "testStreamContents",
  8156. messageSends: [],
  8157. referencedClasses: []
  8158. }),
  8159. globals.StreamTest);
  8160. smalltalk.addMethod(
  8161. smalltalk.method({
  8162. selector: "testWrite",
  8163. protocol: 'tests',
  8164. fn: function (){
  8165. var self=this;
  8166. var stream,collection;
  8167. return smalltalk.withContext(function($ctx1) {
  8168. collection=self._newCollection();
  8169. stream=self._newStream();
  8170. _st(collection)._do_((function(each){
  8171. return smalltalk.withContext(function($ctx2) {
  8172. return _st(stream).__lt_lt(each);
  8173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8174. self._assert_equals_(_st(stream)._contents(),collection);
  8175. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8176. args: [],
  8177. 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",
  8178. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8179. referencedClasses: []
  8180. }),
  8181. globals.StreamTest);
  8182. smalltalk.addMethod(
  8183. smalltalk.method({
  8184. selector: "testWriting",
  8185. protocol: 'tests',
  8186. fn: function (){
  8187. var self=this;
  8188. var stream,collection;
  8189. return smalltalk.withContext(function($ctx1) {
  8190. var $1;
  8191. collection=self._newCollection();
  8192. stream=self._newStream();
  8193. $ctx1.sendIdx["newStream"]=1;
  8194. _st(collection)._do_((function(each){
  8195. return smalltalk.withContext(function($ctx2) {
  8196. return _st(stream)._nextPut_(each);
  8197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8198. $1=_st(stream)._contents();
  8199. $ctx1.sendIdx["contents"]=1;
  8200. self._assert_equals_($1,collection);
  8201. $ctx1.sendIdx["assert:equals:"]=1;
  8202. stream=self._newStream();
  8203. _st(stream)._nextPutAll_(collection);
  8204. self._assert_equals_(_st(stream)._contents(),collection);
  8205. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8206. args: [],
  8207. 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",
  8208. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8209. referencedClasses: []
  8210. }),
  8211. globals.StreamTest);
  8212. smalltalk.addMethod(
  8213. smalltalk.method({
  8214. selector: "collectionClass",
  8215. protocol: 'accessing',
  8216. fn: function (){
  8217. var self=this;
  8218. return nil;
  8219. },
  8220. args: [],
  8221. source: "collectionClass\x0a\x09^ nil",
  8222. messageSends: [],
  8223. referencedClasses: []
  8224. }),
  8225. globals.StreamTest.klass);
  8226. smalltalk.addMethod(
  8227. smalltalk.method({
  8228. selector: "isAbstract",
  8229. protocol: 'testing',
  8230. fn: function (){
  8231. var self=this;
  8232. return smalltalk.withContext(function($ctx1) {
  8233. var $1;
  8234. $1=_st(self._collectionClass())._isNil();
  8235. return $1;
  8236. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8237. args: [],
  8238. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8239. messageSends: ["isNil", "collectionClass"],
  8240. referencedClasses: []
  8241. }),
  8242. globals.StreamTest.klass);
  8243. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8244. smalltalk.addMethod(
  8245. smalltalk.method({
  8246. selector: "newCollection",
  8247. protocol: 'accessing',
  8248. fn: function (){
  8249. var self=this;
  8250. return smalltalk.withContext(function($ctx1) {
  8251. var $1;
  8252. $1=[true,(1),(3).__at((4)),"foo"];
  8253. return $1;
  8254. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8255. args: [],
  8256. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8257. messageSends: ["@"],
  8258. referencedClasses: []
  8259. }),
  8260. globals.ArrayStreamTest);
  8261. smalltalk.addMethod(
  8262. smalltalk.method({
  8263. selector: "collectionClass",
  8264. protocol: 'accessing',
  8265. fn: function (){
  8266. var self=this;
  8267. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8268. return $Array();
  8269. },
  8270. args: [],
  8271. source: "collectionClass\x0a\x09^ Array",
  8272. messageSends: [],
  8273. referencedClasses: ["Array"]
  8274. }),
  8275. globals.ArrayStreamTest.klass);
  8276. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8277. smalltalk.addMethod(
  8278. smalltalk.method({
  8279. selector: "newCollection",
  8280. protocol: 'accessing',
  8281. fn: function (){
  8282. var self=this;
  8283. return "hello world";
  8284. },
  8285. args: [],
  8286. source: "newCollection\x0a\x09^ 'hello world'",
  8287. messageSends: [],
  8288. referencedClasses: []
  8289. }),
  8290. globals.StringStreamTest);
  8291. smalltalk.addMethod(
  8292. smalltalk.method({
  8293. selector: "collectionClass",
  8294. protocol: 'accessing',
  8295. fn: function (){
  8296. var self=this;
  8297. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8298. return $String();
  8299. },
  8300. args: [],
  8301. source: "collectionClass\x0a\x09^ String",
  8302. messageSends: [],
  8303. referencedClasses: ["String"]
  8304. }),
  8305. globals.StringStreamTest.klass);
  8306. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8307. smalltalk.addMethod(
  8308. smalltalk.method({
  8309. selector: "testCopying",
  8310. protocol: 'tests',
  8311. fn: function (){
  8312. var self=this;
  8313. return smalltalk.withContext(function($ctx1) {
  8314. self._assert_equals_(nil._copy(),nil);
  8315. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8316. args: [],
  8317. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8318. messageSends: ["assert:equals:", "copy"],
  8319. referencedClasses: []
  8320. }),
  8321. globals.UndefinedTest);
  8322. smalltalk.addMethod(
  8323. smalltalk.method({
  8324. selector: "testDeepCopy",
  8325. protocol: 'tests',
  8326. fn: function (){
  8327. var self=this;
  8328. return smalltalk.withContext(function($ctx1) {
  8329. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8330. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8331. args: [],
  8332. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8333. messageSends: ["assert:", "=", "deepCopy"],
  8334. referencedClasses: []
  8335. }),
  8336. globals.UndefinedTest);
  8337. smalltalk.addMethod(
  8338. smalltalk.method({
  8339. selector: "testIfNil",
  8340. protocol: 'tests',
  8341. fn: function (){
  8342. var self=this;
  8343. return smalltalk.withContext(function($ctx1) {
  8344. var $1,$3,$2,$4,$6,$5;
  8345. if(($receiver = nil) == nil || $receiver == null){
  8346. $1=true;
  8347. } else {
  8348. $1=nil;
  8349. };
  8350. self._assert_equals_($1,true);
  8351. $ctx1.sendIdx["assert:equals:"]=1;
  8352. if(($receiver = nil) == nil || $receiver == null){
  8353. $3=nil;
  8354. } else {
  8355. $3=true;
  8356. };
  8357. $2=_st($3).__eq(true);
  8358. $ctx1.sendIdx["="]=1;
  8359. self._deny_($2);
  8360. $ctx1.sendIdx["deny:"]=1;
  8361. if(($receiver = nil) == nil || $receiver == null){
  8362. $4=true;
  8363. } else {
  8364. $4=false;
  8365. };
  8366. self._assert_equals_($4,true);
  8367. if(($receiver = nil) == nil || $receiver == null){
  8368. $6=false;
  8369. } else {
  8370. $6=true;
  8371. };
  8372. $5=_st($6).__eq(true);
  8373. self._deny_($5);
  8374. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8375. args: [],
  8376. 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",
  8377. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8378. referencedClasses: []
  8379. }),
  8380. globals.UndefinedTest);
  8381. smalltalk.addMethod(
  8382. smalltalk.method({
  8383. selector: "testIsNil",
  8384. protocol: 'tests',
  8385. fn: function (){
  8386. var self=this;
  8387. return smalltalk.withContext(function($ctx1) {
  8388. self._assert_(nil._isNil());
  8389. self._deny_(nil._notNil());
  8390. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8391. args: [],
  8392. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8393. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8394. referencedClasses: []
  8395. }),
  8396. globals.UndefinedTest);
  8397. });