2
0

Kernel-Tests.js 337 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$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},smalltalk.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. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.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 smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.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},smalltalk.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. smalltalk.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 smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.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},smalltalk.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. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.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 smalltalk.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",{},smalltalk.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. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.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",{},smalltalk.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. smalltalk.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",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.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 smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.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},smalltalk.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. smalltalk.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 smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. 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",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. 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",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. 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.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. 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",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. 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",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. 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)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. 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",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. 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'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. 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'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. 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;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. 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))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. 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 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st($Smalltalk())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. 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",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._globals();
  1060. $ctx1.sendIdx["globals"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._globals();
  1065. $ctx1.sendIdx["globals"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1095. _st($Smalltalk())._removeClass_($ObjectMock2());
  1096. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1097. args: [],
  1098. 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",
  1099. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1100. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1101. }),
  1102. smalltalk.ClassBuilderTest);
  1103. smalltalk.addMethod(
  1104. smalltalk.method({
  1105. selector: "testClassMigrationWithClassInstanceVariables",
  1106. protocol: 'tests',
  1107. fn: function (){
  1108. var self=this;
  1109. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1110. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1111. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1112. return smalltalk.withContext(function($ctx1) {
  1113. var $1;
  1114. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1115. $1=_st($ObjectMock2())._class();
  1116. $ctx1.sendIdx["class"]=1;
  1117. _st($1)._instanceVariableNames_("foo bar");
  1118. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1119. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1120. _st($Smalltalk())._removeClass_($ObjectMock2());
  1121. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1122. args: [],
  1123. 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",
  1124. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1125. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1126. }),
  1127. smalltalk.ClassBuilderTest);
  1128. smalltalk.addMethod(
  1129. smalltalk.method({
  1130. selector: "testClassMigrationWithSubclasses",
  1131. protocol: 'tests',
  1132. fn: function (){
  1133. var self=this;
  1134. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1135. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1136. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1137. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1138. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1139. return smalltalk.withContext(function($ctx1) {
  1140. var $2,$1,$4,$3;
  1141. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1142. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1143. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1144. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1145. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1146. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1147. $2=_st($ObjectMock())._subclasses();
  1148. $ctx1.sendIdx["subclasses"]=1;
  1149. $1=_st($2)._includes_($ObjectMock2());
  1150. $ctx1.sendIdx["includes:"]=1;
  1151. self._assert_($1);
  1152. $ctx1.sendIdx["assert:"]=1;
  1153. $4=_st($ObjectMock2())._subclasses();
  1154. $ctx1.sendIdx["subclasses"]=2;
  1155. $3=_st($4)._includes_($ObjectMock3());
  1156. $ctx1.sendIdx["includes:"]=2;
  1157. self._assert_($3);
  1158. $ctx1.sendIdx["assert:"]=2;
  1159. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1160. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1161. return smalltalk.withContext(function($ctx2) {
  1162. return _st($Smalltalk())._removeClass_(each);
  1163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1165. args: [],
  1166. 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 ]",
  1167. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1168. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1169. }),
  1170. smalltalk.ClassBuilderTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "testInstanceVariableNames",
  1174. protocol: 'tests',
  1175. fn: function (){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1179. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1180. args: [],
  1181. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1182. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1183. referencedClasses: []
  1184. }),
  1185. smalltalk.ClassBuilderTest);
  1186. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1187. smalltalk.addMethod(
  1188. smalltalk.method({
  1189. selector: "assertSameContents:as:",
  1190. protocol: 'convenience',
  1191. fn: function (aCollection,anotherCollection){
  1192. var self=this;
  1193. return smalltalk.withContext(function($ctx1) {
  1194. var $2,$1,$4,$3;
  1195. $2=_st(aCollection)._size();
  1196. $ctx1.sendIdx["size"]=1;
  1197. $1=_st($2).__eq(_st(anotherCollection)._size());
  1198. $ctx1.sendIdx["="]=1;
  1199. self._assert_($1);
  1200. $ctx1.sendIdx["assert:"]=1;
  1201. _st(aCollection)._do_((function(each){
  1202. return smalltalk.withContext(function($ctx2) {
  1203. $4=_st(aCollection)._occurrencesOf_(each);
  1204. $ctx2.sendIdx["occurrencesOf:"]=1;
  1205. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1206. return self._assert_($3);
  1207. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1208. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1209. args: ["aCollection", "anotherCollection"],
  1210. 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)) ]",
  1211. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1212. referencedClasses: []
  1213. }),
  1214. smalltalk.CollectionTest);
  1215. smalltalk.addMethod(
  1216. smalltalk.method({
  1217. selector: "collection",
  1218. protocol: 'fixture',
  1219. fn: function (){
  1220. var self=this;
  1221. return smalltalk.withContext(function($ctx1) {
  1222. self._subclassResponsibility();
  1223. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1224. args: [],
  1225. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1226. messageSends: ["subclassResponsibility"],
  1227. referencedClasses: []
  1228. }),
  1229. smalltalk.CollectionTest);
  1230. smalltalk.addMethod(
  1231. smalltalk.method({
  1232. selector: "collectionClass",
  1233. protocol: 'fixture',
  1234. fn: function (){
  1235. var self=this;
  1236. return smalltalk.withContext(function($ctx1) {
  1237. var $1;
  1238. $1=_st(self._class())._collectionClass();
  1239. return $1;
  1240. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1241. args: [],
  1242. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1243. messageSends: ["collectionClass", "class"],
  1244. referencedClasses: []
  1245. }),
  1246. smalltalk.CollectionTest);
  1247. smalltalk.addMethod(
  1248. smalltalk.method({
  1249. selector: "collectionOfPrintStrings",
  1250. protocol: 'fixture',
  1251. fn: function (){
  1252. var self=this;
  1253. return smalltalk.withContext(function($ctx1) {
  1254. self._subclassResponsibility();
  1255. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1256. args: [],
  1257. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1258. messageSends: ["subclassResponsibility"],
  1259. referencedClasses: []
  1260. }),
  1261. smalltalk.CollectionTest);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "collectionSize",
  1265. protocol: 'fixture',
  1266. fn: function (){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) {
  1269. self._subclassResponsibility();
  1270. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1271. args: [],
  1272. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1273. messageSends: ["subclassResponsibility"],
  1274. referencedClasses: []
  1275. }),
  1276. smalltalk.CollectionTest);
  1277. smalltalk.addMethod(
  1278. smalltalk.method({
  1279. selector: "collectionWithDuplicates",
  1280. protocol: 'fixture',
  1281. fn: function (){
  1282. var self=this;
  1283. return smalltalk.withContext(function($ctx1) {
  1284. self._subclassResponsibility();
  1285. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1286. args: [],
  1287. 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",
  1288. messageSends: ["subclassResponsibility"],
  1289. referencedClasses: []
  1290. }),
  1291. smalltalk.CollectionTest);
  1292. smalltalk.addMethod(
  1293. smalltalk.method({
  1294. selector: "collectionWithNewValue",
  1295. protocol: 'fixture',
  1296. fn: function (){
  1297. var self=this;
  1298. return smalltalk.withContext(function($ctx1) {
  1299. self._subclassResponsibility();
  1300. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1301. args: [],
  1302. 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",
  1303. messageSends: ["subclassResponsibility"],
  1304. referencedClasses: []
  1305. }),
  1306. smalltalk.CollectionTest);
  1307. smalltalk.addMethod(
  1308. smalltalk.method({
  1309. selector: "isCollectionReadOnly",
  1310. protocol: 'testing',
  1311. fn: function (){
  1312. var self=this;
  1313. return smalltalk.withContext(function($ctx1) {
  1314. return false;
  1315. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1316. args: [],
  1317. source: "isCollectionReadOnly\x0a\x09^ false",
  1318. messageSends: [],
  1319. referencedClasses: []
  1320. }),
  1321. smalltalk.CollectionTest);
  1322. smalltalk.addMethod(
  1323. smalltalk.method({
  1324. selector: "sampleNewValue",
  1325. protocol: 'fixture',
  1326. fn: function (){
  1327. var self=this;
  1328. return smalltalk.withContext(function($ctx1) {
  1329. return "N";
  1330. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1331. args: [],
  1332. 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'",
  1333. messageSends: [],
  1334. referencedClasses: []
  1335. }),
  1336. smalltalk.CollectionTest);
  1337. smalltalk.addMethod(
  1338. smalltalk.method({
  1339. selector: "sampleNewValueAsCollection",
  1340. protocol: 'fixture',
  1341. fn: function (){
  1342. var self=this;
  1343. return smalltalk.withContext(function($ctx1) {
  1344. var $1;
  1345. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1346. return $1;
  1347. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1348. args: [],
  1349. 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",
  1350. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1351. referencedClasses: []
  1352. }),
  1353. smalltalk.CollectionTest);
  1354. smalltalk.addMethod(
  1355. smalltalk.method({
  1356. selector: "testAddAll",
  1357. protocol: 'tests',
  1358. fn: function (){
  1359. var self=this;
  1360. return smalltalk.withContext(function($ctx1) {
  1361. 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;
  1362. $2=self._collection();
  1363. $ctx1.sendIdx["collection"]=1;
  1364. $3=$2;
  1365. $5=self._collectionClass();
  1366. $ctx1.sendIdx["collectionClass"]=1;
  1367. $4=_st($5)._new();
  1368. $ctx1.sendIdx["new"]=1;
  1369. _st($3)._addAll_($4);
  1370. $ctx1.sendIdx["addAll:"]=1;
  1371. $6=_st($2)._yourself();
  1372. $ctx1.sendIdx["yourself"]=1;
  1373. $1=$6;
  1374. $7=self._collection();
  1375. $ctx1.sendIdx["collection"]=2;
  1376. self._assert_equals_($1,$7);
  1377. $ctx1.sendIdx["assert:equals:"]=1;
  1378. $10=self._collectionClass();
  1379. $ctx1.sendIdx["collectionClass"]=2;
  1380. $9=_st($10)._new();
  1381. $ctx1.sendIdx["new"]=2;
  1382. $11=$9;
  1383. $12=self._collection();
  1384. $ctx1.sendIdx["collection"]=3;
  1385. _st($11)._addAll_($12);
  1386. $ctx1.sendIdx["addAll:"]=2;
  1387. $13=_st($9)._yourself();
  1388. $ctx1.sendIdx["yourself"]=2;
  1389. $8=$13;
  1390. $14=self._collection();
  1391. $ctx1.sendIdx["collection"]=4;
  1392. self._assert_equals_($8,$14);
  1393. $ctx1.sendIdx["assert:equals:"]=2;
  1394. $17=self._collectionClass();
  1395. $ctx1.sendIdx["collectionClass"]=3;
  1396. $16=_st($17)._new();
  1397. $ctx1.sendIdx["new"]=3;
  1398. $18=$16;
  1399. $20=self._collectionClass();
  1400. $ctx1.sendIdx["collectionClass"]=4;
  1401. $19=_st($20)._new();
  1402. $ctx1.sendIdx["new"]=4;
  1403. _st($18)._addAll_($19);
  1404. $ctx1.sendIdx["addAll:"]=3;
  1405. $21=_st($16)._yourself();
  1406. $ctx1.sendIdx["yourself"]=3;
  1407. $15=$21;
  1408. self._assert_equals_($15,_st(self._collectionClass())._new());
  1409. $ctx1.sendIdx["assert:equals:"]=3;
  1410. $23=self._collection();
  1411. $ctx1.sendIdx["collection"]=5;
  1412. $24=$23;
  1413. $25=self._sampleNewValueAsCollection();
  1414. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1415. _st($24)._addAll_($25);
  1416. $ctx1.sendIdx["addAll:"]=4;
  1417. $26=_st($23)._yourself();
  1418. $ctx1.sendIdx["yourself"]=4;
  1419. $22=$26;
  1420. $27=self._collectionWithNewValue();
  1421. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1422. self._assert_equals_($22,$27);
  1423. $28=self._sampleNewValueAsCollection();
  1424. _st($28)._addAll_(self._collection());
  1425. $29=_st($28)._yourself();
  1426. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1427. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1428. args: [],
  1429. 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",
  1430. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1431. referencedClasses: []
  1432. }),
  1433. smalltalk.CollectionTest);
  1434. smalltalk.addMethod(
  1435. smalltalk.method({
  1436. selector: "testAllSatisfy",
  1437. protocol: 'tests',
  1438. fn: function (){
  1439. var self=this;
  1440. var collection,anyOne;
  1441. return smalltalk.withContext(function($ctx1) {
  1442. var $1;
  1443. collection=self._collection();
  1444. anyOne=_st(collection)._anyOne();
  1445. $1=_st(collection)._allSatisfy_((function(each){
  1446. return smalltalk.withContext(function($ctx2) {
  1447. return _st(collection)._includes_(each);
  1448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1449. $ctx1.sendIdx["allSatisfy:"]=1;
  1450. self._assert_($1);
  1451. self._deny_(_st(collection)._allSatisfy_((function(each){
  1452. return smalltalk.withContext(function($ctx2) {
  1453. return _st(each).__tild_eq(anyOne);
  1454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1455. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1456. args: [],
  1457. 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 ])",
  1458. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1459. referencedClasses: []
  1460. }),
  1461. smalltalk.CollectionTest);
  1462. smalltalk.addMethod(
  1463. smalltalk.method({
  1464. selector: "testAnyOne",
  1465. protocol: 'tests',
  1466. fn: function (){
  1467. var self=this;
  1468. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1469. return smalltalk.withContext(function($ctx1) {
  1470. var $2,$1;
  1471. self._should_raise_((function(){
  1472. return smalltalk.withContext(function($ctx2) {
  1473. return _st(_st(self._collectionClass())._new())._anyOne();
  1474. $ctx2.sendIdx["anyOne"]=1;
  1475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1476. $2=self._collection();
  1477. $ctx1.sendIdx["collection"]=1;
  1478. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1479. self._assert_($1);
  1480. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1481. args: [],
  1482. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1483. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1484. referencedClasses: ["Error"]
  1485. }),
  1486. smalltalk.CollectionTest);
  1487. smalltalk.addMethod(
  1488. smalltalk.method({
  1489. selector: "testAnySatisfy",
  1490. protocol: 'tests',
  1491. fn: function (){
  1492. var self=this;
  1493. var anyOne;
  1494. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1495. return smalltalk.withContext(function($ctx1) {
  1496. var $1,$3,$2;
  1497. $1=self._collection();
  1498. $ctx1.sendIdx["collection"]=1;
  1499. anyOne=_st($1)._anyOne();
  1500. $3=self._collection();
  1501. $ctx1.sendIdx["collection"]=2;
  1502. $2=_st($3)._anySatisfy_((function(each){
  1503. return smalltalk.withContext(function($ctx2) {
  1504. return _st(each).__eq(anyOne);
  1505. $ctx2.sendIdx["="]=1;
  1506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1507. $ctx1.sendIdx["anySatisfy:"]=1;
  1508. self._assert_($2);
  1509. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1510. return smalltalk.withContext(function($ctx2) {
  1511. return _st(each).__eq(_st($Object())._new());
  1512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1513. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1514. args: [],
  1515. 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 ])",
  1516. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1517. referencedClasses: ["Object"]
  1518. }),
  1519. smalltalk.CollectionTest);
  1520. smalltalk.addMethod(
  1521. smalltalk.method({
  1522. selector: "testAsArray",
  1523. protocol: 'tests',
  1524. fn: function (){
  1525. var self=this;
  1526. return smalltalk.withContext(function($ctx1) {
  1527. var $1;
  1528. $1=self._collection();
  1529. $ctx1.sendIdx["collection"]=1;
  1530. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1531. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1532. args: [],
  1533. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1534. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1535. referencedClasses: []
  1536. }),
  1537. smalltalk.CollectionTest);
  1538. smalltalk.addMethod(
  1539. smalltalk.method({
  1540. selector: "testAsOrderedCollection",
  1541. protocol: 'tests',
  1542. fn: function (){
  1543. var self=this;
  1544. return smalltalk.withContext(function($ctx1) {
  1545. var $1;
  1546. $1=self._collection();
  1547. $ctx1.sendIdx["collection"]=1;
  1548. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1549. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1550. args: [],
  1551. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1552. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1553. referencedClasses: []
  1554. }),
  1555. smalltalk.CollectionTest);
  1556. smalltalk.addMethod(
  1557. smalltalk.method({
  1558. selector: "testAsSet",
  1559. protocol: 'tests',
  1560. fn: function (){
  1561. var self=this;
  1562. var c,set;
  1563. return smalltalk.withContext(function($ctx1) {
  1564. c=self._collectionWithDuplicates();
  1565. set=_st(c)._asSet();
  1566. self._assert_equals_(_st(set)._size(),(5));
  1567. _st(c)._do_((function(each){
  1568. return smalltalk.withContext(function($ctx2) {
  1569. return self._assert_(_st(set)._includes_(each));
  1570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1572. args: [],
  1573. 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) ]",
  1574. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1575. referencedClasses: []
  1576. }),
  1577. smalltalk.CollectionTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testCollect",
  1581. protocol: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1586. $2=self._collection();
  1587. $ctx1.sendIdx["collection"]=1;
  1588. $1=_st($2)._collect_((function(each){
  1589. return smalltalk.withContext(function($ctx2) {
  1590. return each;
  1591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1592. $ctx1.sendIdx["collect:"]=1;
  1593. $3=self._collection();
  1594. $ctx1.sendIdx["collection"]=2;
  1595. self._assert_equals_($1,$3);
  1596. $ctx1.sendIdx["assert:equals:"]=1;
  1597. $5=self._collectionWithNewValue();
  1598. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1599. $4=_st($5)._collect_((function(each){
  1600. return smalltalk.withContext(function($ctx2) {
  1601. return each;
  1602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1603. $ctx1.sendIdx["collect:"]=2;
  1604. self._assert_equals_($4,self._collectionWithNewValue());
  1605. $ctx1.sendIdx["assert:equals:"]=2;
  1606. $8=self._collectionClass();
  1607. $ctx1.sendIdx["collectionClass"]=1;
  1608. $7=_st($8)._new();
  1609. $ctx1.sendIdx["new"]=1;
  1610. $6=_st($7)._collect_((function(each){
  1611. return smalltalk.withContext(function($ctx2) {
  1612. return _st(each)._printString();
  1613. $ctx2.sendIdx["printString"]=1;
  1614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1615. $ctx1.sendIdx["collect:"]=3;
  1616. self._assert_equals_($6,_st(self._collectionClass())._new());
  1617. $ctx1.sendIdx["assert:equals:"]=3;
  1618. $11=self._collection();
  1619. $ctx1.sendIdx["collection"]=3;
  1620. $10=_st($11)._collect_((function(){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return self._sampleNewValue();
  1623. $ctx2.sendIdx["sampleNewValue"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1625. $ctx1.sendIdx["collect:"]=4;
  1626. $9=_st($10)._detect_((function(){
  1627. return smalltalk.withContext(function($ctx2) {
  1628. return true;
  1629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1630. self._assert_equals_($9,self._sampleNewValue());
  1631. $ctx1.sendIdx["assert:equals:"]=4;
  1632. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1633. return smalltalk.withContext(function($ctx2) {
  1634. return _st(each)._printString();
  1635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1636. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1637. args: [],
  1638. 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",
  1639. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1640. referencedClasses: []
  1641. }),
  1642. smalltalk.CollectionTest);
  1643. smalltalk.addMethod(
  1644. smalltalk.method({
  1645. selector: "testComma",
  1646. protocol: 'tests',
  1647. fn: function (){
  1648. var self=this;
  1649. return smalltalk.withContext(function($ctx1) {
  1650. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1651. $2=self._collection();
  1652. $ctx1.sendIdx["collection"]=1;
  1653. $4=self._collectionClass();
  1654. $ctx1.sendIdx["collectionClass"]=1;
  1655. $3=_st($4)._new();
  1656. $ctx1.sendIdx["new"]=1;
  1657. $1=_st($2).__comma($3);
  1658. $ctx1.sendIdx[","]=1;
  1659. $5=self._collection();
  1660. $ctx1.sendIdx["collection"]=2;
  1661. self._assert_equals_($1,$5);
  1662. $ctx1.sendIdx["assert:equals:"]=1;
  1663. $8=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=2;
  1665. $7=_st($8)._new();
  1666. $ctx1.sendIdx["new"]=2;
  1667. $9=self._collection();
  1668. $ctx1.sendIdx["collection"]=3;
  1669. $6=_st($7).__comma($9);
  1670. $ctx1.sendIdx[","]=2;
  1671. $10=self._collection();
  1672. $ctx1.sendIdx["collection"]=4;
  1673. self._assert_equals_($6,$10);
  1674. $ctx1.sendIdx["assert:equals:"]=2;
  1675. $13=self._collectionClass();
  1676. $ctx1.sendIdx["collectionClass"]=3;
  1677. $12=_st($13)._new();
  1678. $ctx1.sendIdx["new"]=3;
  1679. $15=self._collectionClass();
  1680. $ctx1.sendIdx["collectionClass"]=4;
  1681. $14=_st($15)._new();
  1682. $ctx1.sendIdx["new"]=4;
  1683. $11=_st($12).__comma($14);
  1684. $ctx1.sendIdx[","]=3;
  1685. self._assert_equals_($11,_st(self._collectionClass())._new());
  1686. $ctx1.sendIdx["assert:equals:"]=3;
  1687. $17=self._collection();
  1688. $ctx1.sendIdx["collection"]=5;
  1689. $18=self._sampleNewValueAsCollection();
  1690. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1691. $16=_st($17).__comma($18);
  1692. $ctx1.sendIdx[","]=4;
  1693. $19=self._collectionWithNewValue();
  1694. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1695. self._assert_equals_($16,$19);
  1696. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1697. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1698. args: [],
  1699. 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",
  1700. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1701. referencedClasses: []
  1702. }),
  1703. smalltalk.CollectionTest);
  1704. smalltalk.addMethod(
  1705. smalltalk.method({
  1706. selector: "testDetect",
  1707. protocol: 'tests',
  1708. fn: function (){
  1709. var self=this;
  1710. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1711. return smalltalk.withContext(function($ctx1) {
  1712. var $1,$2,$3,$4,$6,$5,$7;
  1713. self._shouldnt_raise_((function(){
  1714. return smalltalk.withContext(function($ctx2) {
  1715. $1=self._collection();
  1716. $ctx2.sendIdx["collection"]=1;
  1717. return _st($1)._detect_((function(){
  1718. return smalltalk.withContext(function($ctx3) {
  1719. return true;
  1720. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1721. $ctx2.sendIdx["detect:"]=1;
  1722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1723. self._should_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $2=self._collection();
  1726. $ctx2.sendIdx["collection"]=2;
  1727. return _st($2)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return false;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1731. $ctx2.sendIdx["detect:"]=2;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1733. $ctx1.sendIdx["should:raise:"]=1;
  1734. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1735. return smalltalk.withContext(function($ctx2) {
  1736. return true;
  1737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1738. $ctx1.sendIdx["detect:"]=3;
  1739. $4=self._sampleNewValue();
  1740. $ctx1.sendIdx["sampleNewValue"]=1;
  1741. self._assert_equals_($3,$4);
  1742. $ctx1.sendIdx["assert:equals:"]=1;
  1743. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1744. return smalltalk.withContext(function($ctx2) {
  1745. $6=self._sampleNewValue();
  1746. $ctx2.sendIdx["sampleNewValue"]=2;
  1747. return _st(each).__eq($6);
  1748. $ctx2.sendIdx["="]=1;
  1749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1750. $ctx1.sendIdx["detect:"]=4;
  1751. $7=self._sampleNewValue();
  1752. $ctx1.sendIdx["sampleNewValue"]=3;
  1753. self._assert_equals_($5,$7);
  1754. self._should_raise_((function(){
  1755. return smalltalk.withContext(function($ctx2) {
  1756. return _st(self._collection())._detect_((function(each){
  1757. return smalltalk.withContext(function($ctx3) {
  1758. return _st(each).__eq(self._sampleNewValue());
  1759. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1761. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1762. args: [],
  1763. 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",
  1764. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1765. referencedClasses: ["Error"]
  1766. }),
  1767. smalltalk.CollectionTest);
  1768. smalltalk.addMethod(
  1769. smalltalk.method({
  1770. selector: "testDetectIfNone",
  1771. protocol: 'tests',
  1772. fn: function (){
  1773. var self=this;
  1774. var sentinel;
  1775. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1776. return smalltalk.withContext(function($ctx1) {
  1777. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1778. sentinel=_st($Object())._new();
  1779. $3=self._collection();
  1780. $ctx1.sendIdx["collection"]=1;
  1781. $2=_st($3)._detect_ifNone_((function(){
  1782. return smalltalk.withContext(function($ctx2) {
  1783. return true;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1785. return smalltalk.withContext(function($ctx2) {
  1786. return sentinel;
  1787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1788. $ctx1.sendIdx["detect:ifNone:"]=1;
  1789. $1=_st($2).__tild_eq(sentinel);
  1790. self._assert_($1);
  1791. $5=self._collection();
  1792. $ctx1.sendIdx["collection"]=2;
  1793. $4=_st($5)._detect_ifNone_((function(){
  1794. return smalltalk.withContext(function($ctx2) {
  1795. return false;
  1796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1797. return smalltalk.withContext(function($ctx2) {
  1798. return sentinel;
  1799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1800. $ctx1.sendIdx["detect:ifNone:"]=2;
  1801. self._assert_equals_($4,sentinel);
  1802. $ctx1.sendIdx["assert:equals:"]=1;
  1803. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return true;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=3;
  1811. $7=self._sampleNewValue();
  1812. $ctx1.sendIdx["sampleNewValue"]=1;
  1813. self._assert_equals_($6,$7);
  1814. $ctx1.sendIdx["assert:equals:"]=2;
  1815. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1816. return smalltalk.withContext(function($ctx2) {
  1817. $9=self._sampleNewValue();
  1818. $ctx2.sendIdx["sampleNewValue"]=2;
  1819. return _st(each).__eq($9);
  1820. $ctx2.sendIdx["="]=1;
  1821. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1822. return smalltalk.withContext(function($ctx2) {
  1823. return sentinel;
  1824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1825. $ctx1.sendIdx["detect:ifNone:"]=4;
  1826. $10=self._sampleNewValue();
  1827. $ctx1.sendIdx["sampleNewValue"]=3;
  1828. self._assert_equals_($8,$10);
  1829. $ctx1.sendIdx["assert:equals:"]=3;
  1830. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1831. return smalltalk.withContext(function($ctx2) {
  1832. return _st(each).__eq(self._sampleNewValue());
  1833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1834. return smalltalk.withContext(function($ctx2) {
  1835. return sentinel;
  1836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1837. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1838. args: [],
  1839. 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",
  1840. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1841. referencedClasses: ["Object"]
  1842. }),
  1843. smalltalk.CollectionTest);
  1844. smalltalk.addMethod(
  1845. smalltalk.method({
  1846. selector: "testDo",
  1847. protocol: 'tests',
  1848. fn: function (){
  1849. var self=this;
  1850. var newCollection;
  1851. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $1,$2;
  1854. newCollection=_st($OrderedCollection())._new();
  1855. $ctx1.sendIdx["new"]=1;
  1856. $1=self._collection();
  1857. $ctx1.sendIdx["collection"]=1;
  1858. _st($1)._do_((function(each){
  1859. return smalltalk.withContext(function($ctx2) {
  1860. return _st(newCollection)._add_(each);
  1861. $ctx2.sendIdx["add:"]=1;
  1862. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1863. $ctx1.sendIdx["do:"]=1;
  1864. self._assertSameContents_as_(self._collection(),newCollection);
  1865. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1866. newCollection=_st($OrderedCollection())._new();
  1867. $2=self._collectionWithDuplicates();
  1868. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1869. _st($2)._do_((function(each){
  1870. return smalltalk.withContext(function($ctx2) {
  1871. return _st(newCollection)._add_(each);
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1873. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1874. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1875. args: [],
  1876. 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",
  1877. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1878. referencedClasses: ["OrderedCollection"]
  1879. }),
  1880. smalltalk.CollectionTest);
  1881. smalltalk.addMethod(
  1882. smalltalk.method({
  1883. selector: "testIfEmptyFamily",
  1884. protocol: 'tests',
  1885. fn: function (){
  1886. var self=this;
  1887. return smalltalk.withContext(function($ctx1) {
  1888. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1889. $3=self._collectionClass();
  1890. $ctx1.sendIdx["collectionClass"]=1;
  1891. $2=_st($3)._new();
  1892. $ctx1.sendIdx["new"]=1;
  1893. $1=_st($2)._ifEmpty_((function(){
  1894. return smalltalk.withContext(function($ctx2) {
  1895. return (42);
  1896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1897. $ctx1.sendIdx["ifEmpty:"]=1;
  1898. self._assert_equals_($1,(42));
  1899. $ctx1.sendIdx["assert:equals:"]=1;
  1900. $5=self._collection();
  1901. $ctx1.sendIdx["collection"]=1;
  1902. $4=_st($5)._ifEmpty_((function(){
  1903. return smalltalk.withContext(function($ctx2) {
  1904. return (42);
  1905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1906. $6=self._collection();
  1907. $ctx1.sendIdx["collection"]=2;
  1908. self._assert_equals_($4,$6);
  1909. $ctx1.sendIdx["assert:equals:"]=2;
  1910. $9=self._collectionClass();
  1911. $ctx1.sendIdx["collectionClass"]=2;
  1912. $8=_st($9)._new();
  1913. $ctx1.sendIdx["new"]=2;
  1914. $7=_st($8)._ifNotEmpty_((function(){
  1915. return smalltalk.withContext(function($ctx2) {
  1916. return (42);
  1917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1918. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1919. $11=self._collectionClass();
  1920. $ctx1.sendIdx["collectionClass"]=3;
  1921. $10=_st($11)._new();
  1922. $ctx1.sendIdx["new"]=3;
  1923. self._assert_equals_($7,$10);
  1924. $ctx1.sendIdx["assert:equals:"]=3;
  1925. $13=self._collection();
  1926. $ctx1.sendIdx["collection"]=3;
  1927. $12=_st($13)._ifNotEmpty_((function(){
  1928. return smalltalk.withContext(function($ctx2) {
  1929. return (42);
  1930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1931. self._assert_equals_($12,(42));
  1932. $ctx1.sendIdx["assert:equals:"]=4;
  1933. $16=self._collectionClass();
  1934. $ctx1.sendIdx["collectionClass"]=4;
  1935. $15=_st($16)._new();
  1936. $ctx1.sendIdx["new"]=4;
  1937. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1941. return smalltalk.withContext(function($ctx2) {
  1942. return (999);
  1943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1944. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1945. self._assert_equals_($14,(42));
  1946. $ctx1.sendIdx["assert:equals:"]=5;
  1947. $18=self._collection();
  1948. $ctx1.sendIdx["collection"]=4;
  1949. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1950. return smalltalk.withContext(function($ctx2) {
  1951. return (42);
  1952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1953. return smalltalk.withContext(function($ctx2) {
  1954. return (999);
  1955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1956. self._assert_equals_($17,(999));
  1957. $ctx1.sendIdx["assert:equals:"]=6;
  1958. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1959. return smalltalk.withContext(function($ctx2) {
  1960. return (42);
  1961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1962. return smalltalk.withContext(function($ctx2) {
  1963. return (999);
  1964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1965. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1966. self._assert_equals_($19,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=7;
  1968. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1975. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1976. args: [],
  1977. 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",
  1978. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1979. referencedClasses: []
  1980. }),
  1981. smalltalk.CollectionTest);
  1982. smalltalk.addMethod(
  1983. smalltalk.method({
  1984. selector: "testIsEmpty",
  1985. protocol: 'tests',
  1986. fn: function (){
  1987. var self=this;
  1988. return smalltalk.withContext(function($ctx1) {
  1989. var $1;
  1990. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1991. $ctx1.sendIdx["isEmpty"]=1;
  1992. self._assert_($1);
  1993. self._deny_(_st(self._collection())._isEmpty());
  1994. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1995. args: [],
  1996. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1997. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1998. referencedClasses: []
  1999. }),
  2000. smalltalk.CollectionTest);
  2001. smalltalk.addMethod(
  2002. smalltalk.method({
  2003. selector: "testNoneSatisfy",
  2004. protocol: 'tests',
  2005. fn: function (){
  2006. var self=this;
  2007. var anyOne;
  2008. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2009. return smalltalk.withContext(function($ctx1) {
  2010. var $1,$3,$2;
  2011. $1=self._collection();
  2012. $ctx1.sendIdx["collection"]=1;
  2013. anyOne=_st($1)._anyOne();
  2014. $3=self._collection();
  2015. $ctx1.sendIdx["collection"]=2;
  2016. $2=_st($3)._noneSatisfy_((function(each){
  2017. return smalltalk.withContext(function($ctx2) {
  2018. return _st(each).__eq(anyOne);
  2019. $ctx2.sendIdx["="]=1;
  2020. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2021. $ctx1.sendIdx["noneSatisfy:"]=1;
  2022. self._deny_($2);
  2023. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2024. return smalltalk.withContext(function($ctx2) {
  2025. return _st(each).__eq(_st($Object())._new());
  2026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2027. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2028. args: [],
  2029. 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 ])",
  2030. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2031. referencedClasses: ["Object"]
  2032. }),
  2033. smalltalk.CollectionTest);
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "testRemoveAll",
  2037. protocol: 'tests',
  2038. fn: function (){
  2039. var self=this;
  2040. return smalltalk.withContext(function($ctx1) {
  2041. var $1,$2;
  2042. $1=self._collection();
  2043. _st($1)._removeAll();
  2044. $2=_st($1)._yourself();
  2045. self._assert_equals_($2,_st(self._collectionClass())._new());
  2046. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2047. args: [],
  2048. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2049. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2050. referencedClasses: []
  2051. }),
  2052. smalltalk.CollectionTest);
  2053. smalltalk.addMethod(
  2054. smalltalk.method({
  2055. selector: "testSelect",
  2056. protocol: 'tests',
  2057. fn: function (){
  2058. var self=this;
  2059. return smalltalk.withContext(function($ctx1) {
  2060. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2061. $2=self._collection();
  2062. $ctx1.sendIdx["collection"]=1;
  2063. $1=_st($2)._select_((function(){
  2064. return smalltalk.withContext(function($ctx2) {
  2065. return false;
  2066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2067. $ctx1.sendIdx["select:"]=1;
  2068. $4=self._collectionClass();
  2069. $ctx1.sendIdx["collectionClass"]=1;
  2070. $3=_st($4)._new();
  2071. $ctx1.sendIdx["new"]=1;
  2072. self._assert_equals_($1,$3);
  2073. $ctx1.sendIdx["assert:equals:"]=1;
  2074. $6=self._collection();
  2075. $ctx1.sendIdx["collection"]=2;
  2076. $5=_st($6)._select_((function(){
  2077. return smalltalk.withContext(function($ctx2) {
  2078. return true;
  2079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2080. $ctx1.sendIdx["select:"]=2;
  2081. $7=self._collection();
  2082. $ctx1.sendIdx["collection"]=3;
  2083. self._assert_equals_($5,$7);
  2084. $ctx1.sendIdx["assert:equals:"]=2;
  2085. $9=self._collectionWithNewValue();
  2086. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2087. $8=_st($9)._select_((function(each){
  2088. return smalltalk.withContext(function($ctx2) {
  2089. $10=self._sampleNewValue();
  2090. $ctx2.sendIdx["sampleNewValue"]=1;
  2091. return _st(each).__eq($10);
  2092. $ctx2.sendIdx["="]=1;
  2093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2094. $ctx1.sendIdx["select:"]=3;
  2095. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2096. $ctx1.sendIdx["assert:equals:"]=3;
  2097. $12=self._collectionWithNewValue();
  2098. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2099. $11=_st($12)._select_((function(each){
  2100. return smalltalk.withContext(function($ctx2) {
  2101. $13=self._sampleNewValue();
  2102. $ctx2.sendIdx["sampleNewValue"]=2;
  2103. return _st(each).__tild_eq($13);
  2104. $ctx2.sendIdx["~="]=1;
  2105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2106. $ctx1.sendIdx["select:"]=4;
  2107. $14=self._collection();
  2108. $ctx1.sendIdx["collection"]=4;
  2109. self._assert_equals_($11,$14);
  2110. $ctx1.sendIdx["assert:equals:"]=4;
  2111. $16=self._collection();
  2112. $ctx1.sendIdx["collection"]=5;
  2113. $15=_st($16)._select_((function(each){
  2114. return smalltalk.withContext(function($ctx2) {
  2115. $17=self._sampleNewValue();
  2116. $ctx2.sendIdx["sampleNewValue"]=3;
  2117. return _st(each).__eq($17);
  2118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2119. $ctx1.sendIdx["select:"]=5;
  2120. self._assert_equals_($15,_st(self._collectionClass())._new());
  2121. $ctx1.sendIdx["assert:equals:"]=5;
  2122. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2123. return smalltalk.withContext(function($ctx2) {
  2124. return _st(each).__tild_eq(self._sampleNewValue());
  2125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2126. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2127. args: [],
  2128. 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",
  2129. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2130. referencedClasses: []
  2131. }),
  2132. smalltalk.CollectionTest);
  2133. smalltalk.addMethod(
  2134. smalltalk.method({
  2135. selector: "testSize",
  2136. protocol: 'tests',
  2137. fn: function (){
  2138. var self=this;
  2139. return smalltalk.withContext(function($ctx1) {
  2140. var $1,$2;
  2141. $1=_st(_st(self._collectionClass())._new())._size();
  2142. $ctx1.sendIdx["size"]=1;
  2143. self._assert_equals_($1,(0));
  2144. $ctx1.sendIdx["assert:equals:"]=1;
  2145. $2=_st(self._sampleNewValueAsCollection())._size();
  2146. $ctx1.sendIdx["size"]=2;
  2147. self._assert_equals_($2,(1));
  2148. $ctx1.sendIdx["assert:equals:"]=2;
  2149. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2150. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2151. args: [],
  2152. 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",
  2153. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2154. referencedClasses: []
  2155. }),
  2156. smalltalk.CollectionTest);
  2157. smalltalk.addMethod(
  2158. smalltalk.method({
  2159. selector: "collectionClass",
  2160. protocol: 'fixture',
  2161. fn: function (){
  2162. var self=this;
  2163. return smalltalk.withContext(function($ctx1) {
  2164. return nil;
  2165. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2166. args: [],
  2167. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2168. messageSends: [],
  2169. referencedClasses: []
  2170. }),
  2171. smalltalk.CollectionTest.klass);
  2172. smalltalk.addMethod(
  2173. smalltalk.method({
  2174. selector: "isAbstract",
  2175. protocol: 'testing',
  2176. fn: function (){
  2177. var self=this;
  2178. return smalltalk.withContext(function($ctx1) {
  2179. var $1;
  2180. $1=_st(self._collectionClass())._isNil();
  2181. return $1;
  2182. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2183. args: [],
  2184. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2185. messageSends: ["isNil", "collectionClass"],
  2186. referencedClasses: []
  2187. }),
  2188. smalltalk.CollectionTest.klass);
  2189. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2190. smalltalk.addMethod(
  2191. smalltalk.method({
  2192. selector: "collectionWithNewValue",
  2193. protocol: 'fixture',
  2194. fn: function (){
  2195. var self=this;
  2196. return smalltalk.withContext(function($ctx1) {
  2197. self._subclassResponsibility();
  2198. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2199. args: [],
  2200. 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",
  2201. messageSends: ["subclassResponsibility"],
  2202. referencedClasses: []
  2203. }),
  2204. smalltalk.IndexableCollectionTest);
  2205. smalltalk.addMethod(
  2206. smalltalk.method({
  2207. selector: "sampleNewIndex",
  2208. protocol: 'fixture',
  2209. fn: function (){
  2210. var self=this;
  2211. return smalltalk.withContext(function($ctx1) {
  2212. self._subclassResponsibility();
  2213. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2214. args: [],
  2215. 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",
  2216. messageSends: ["subclassResponsibility"],
  2217. referencedClasses: []
  2218. }),
  2219. smalltalk.IndexableCollectionTest);
  2220. smalltalk.addMethod(
  2221. smalltalk.method({
  2222. selector: "sampleNonIndexesDo:",
  2223. protocol: 'fixture',
  2224. fn: function (aBlock){
  2225. var self=this;
  2226. return smalltalk.withContext(function($ctx1) {
  2227. self._subclassResponsibility();
  2228. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2229. args: ["aBlock"],
  2230. 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",
  2231. messageSends: ["subclassResponsibility"],
  2232. referencedClasses: []
  2233. }),
  2234. smalltalk.IndexableCollectionTest);
  2235. smalltalk.addMethod(
  2236. smalltalk.method({
  2237. selector: "samplesDo:",
  2238. protocol: 'fixture',
  2239. fn: function (aBlock){
  2240. var self=this;
  2241. return smalltalk.withContext(function($ctx1) {
  2242. self._subclassResponsibility();
  2243. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2244. args: ["aBlock"],
  2245. 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",
  2246. messageSends: ["subclassResponsibility"],
  2247. referencedClasses: []
  2248. }),
  2249. smalltalk.IndexableCollectionTest);
  2250. smalltalk.addMethod(
  2251. smalltalk.method({
  2252. selector: "testAt",
  2253. protocol: 'tests',
  2254. fn: function (){
  2255. var self=this;
  2256. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2257. return smalltalk.withContext(function($ctx1) {
  2258. var $1;
  2259. self._nonIndexesDo_((function(each){
  2260. return smalltalk.withContext(function($ctx2) {
  2261. return self._should_raise_((function(){
  2262. return smalltalk.withContext(function($ctx3) {
  2263. $1=self._collection();
  2264. $ctx3.sendIdx["collection"]=1;
  2265. return _st($1)._at_(each);
  2266. $ctx3.sendIdx["at:"]=1;
  2267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2269. self._samplesDo_((function(index,value){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2272. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2273. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2274. args: [],
  2275. 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 ]",
  2276. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2277. referencedClasses: ["Error"]
  2278. }),
  2279. smalltalk.IndexableCollectionTest);
  2280. smalltalk.addMethod(
  2281. smalltalk.method({
  2282. selector: "testAtIfAbsent",
  2283. protocol: 'tests',
  2284. fn: function (){
  2285. var self=this;
  2286. return smalltalk.withContext(function($ctx1) {
  2287. var $2,$1,$3;
  2288. self._nonIndexesDo_((function(each){
  2289. return smalltalk.withContext(function($ctx2) {
  2290. $2=self._collection();
  2291. $ctx2.sendIdx["collection"]=1;
  2292. $1=_st($2)._at_ifAbsent_(each,(function(){
  2293. return smalltalk.withContext(function($ctx3) {
  2294. return self._sampleNewValue();
  2295. $ctx3.sendIdx["sampleNewValue"]=1;
  2296. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2297. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2298. $3=self._sampleNewValue();
  2299. $ctx2.sendIdx["sampleNewValue"]=2;
  2300. return self._assert_equals_($1,$3);
  2301. $ctx2.sendIdx["assert:equals:"]=1;
  2302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2303. self._samplesDo_((function(index,value){
  2304. return smalltalk.withContext(function($ctx2) {
  2305. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2306. return smalltalk.withContext(function($ctx3) {
  2307. return self._sampleNewValue();
  2308. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2309. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2310. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2311. args: [],
  2312. 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 ].",
  2313. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2314. referencedClasses: []
  2315. }),
  2316. smalltalk.IndexableCollectionTest);
  2317. smalltalk.addMethod(
  2318. smalltalk.method({
  2319. selector: "testAtIfAbsentPut",
  2320. protocol: 'tests',
  2321. fn: function (){
  2322. var self=this;
  2323. var newCollection;
  2324. return smalltalk.withContext(function($ctx1) {
  2325. var $1;
  2326. newCollection=self._collection();
  2327. $ctx1.sendIdx["collection"]=1;
  2328. self._samplesDo_((function(index,value){
  2329. return smalltalk.withContext(function($ctx2) {
  2330. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2331. return smalltalk.withContext(function($ctx3) {
  2332. return self._sampleNewValue();
  2333. $ctx3.sendIdx["sampleNewValue"]=1;
  2334. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2335. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2336. return self._assert_equals_($1,value);
  2337. $ctx2.sendIdx["assert:equals:"]=1;
  2338. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2339. self._assert_equals_(newCollection,self._collection());
  2340. $ctx1.sendIdx["assert:equals:"]=2;
  2341. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. return self._sampleNewValue();
  2344. $ctx2.sendIdx["sampleNewValue"]=2;
  2345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2346. $ctx1.sendIdx["assert:equals:"]=3;
  2347. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2348. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2349. args: [],
  2350. 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",
  2351. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2352. referencedClasses: []
  2353. }),
  2354. smalltalk.IndexableCollectionTest);
  2355. smalltalk.addMethod(
  2356. smalltalk.method({
  2357. selector: "testAtIfPresent",
  2358. protocol: 'tests',
  2359. fn: function (){
  2360. var self=this;
  2361. var visited,sentinel;
  2362. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2363. return smalltalk.withContext(function($ctx1) {
  2364. var $2,$1,$4,$3;
  2365. sentinel=_st($Object())._new();
  2366. self._nonIndexesDo_((function(each){
  2367. return smalltalk.withContext(function($ctx2) {
  2368. visited=nil;
  2369. visited;
  2370. $2=self._collection();
  2371. $ctx2.sendIdx["collection"]=1;
  2372. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2373. return smalltalk.withContext(function($ctx3) {
  2374. visited=value1;
  2375. visited;
  2376. return sentinel;
  2377. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2378. $ctx2.sendIdx["at:ifPresent:"]=1;
  2379. self._assert_equals_($1,nil);
  2380. $ctx2.sendIdx["assert:equals:"]=1;
  2381. return self._assert_(_st(visited)._isNil());
  2382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2383. self._samplesDo_((function(index,value){
  2384. return smalltalk.withContext(function($ctx2) {
  2385. visited=nil;
  2386. visited;
  2387. $4=self._collection();
  2388. $ctx2.sendIdx["collection"]=2;
  2389. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2390. return smalltalk.withContext(function($ctx3) {
  2391. visited=value2;
  2392. visited;
  2393. return sentinel;
  2394. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2395. self._assert_equals_($3,sentinel);
  2396. $ctx2.sendIdx["assert:equals:"]=2;
  2397. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2398. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2399. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2400. args: [],
  2401. 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) ]",
  2402. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2403. referencedClasses: ["Object"]
  2404. }),
  2405. smalltalk.IndexableCollectionTest);
  2406. smalltalk.addMethod(
  2407. smalltalk.method({
  2408. selector: "testAtIfPresentIfAbsent",
  2409. protocol: 'tests',
  2410. fn: function (){
  2411. var self=this;
  2412. var visited,sentinel;
  2413. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2414. return smalltalk.withContext(function($ctx1) {
  2415. var $2,$1,$3,$5,$4;
  2416. sentinel=_st($Object())._new();
  2417. self._nonIndexesDo_((function(each){
  2418. return smalltalk.withContext(function($ctx2) {
  2419. visited=nil;
  2420. visited;
  2421. $2=self._collection();
  2422. $ctx2.sendIdx["collection"]=1;
  2423. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2424. return smalltalk.withContext(function($ctx3) {
  2425. visited=value1;
  2426. visited;
  2427. return sentinel;
  2428. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2429. return smalltalk.withContext(function($ctx3) {
  2430. return self._sampleNewValue();
  2431. $ctx3.sendIdx["sampleNewValue"]=1;
  2432. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2433. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2434. $3=self._sampleNewValue();
  2435. $ctx2.sendIdx["sampleNewValue"]=2;
  2436. self._assert_equals_($1,$3);
  2437. $ctx2.sendIdx["assert:equals:"]=1;
  2438. return self._assert_(_st(visited)._isNil());
  2439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2440. self._samplesDo_((function(index,value){
  2441. return smalltalk.withContext(function($ctx2) {
  2442. visited=nil;
  2443. visited;
  2444. $5=self._collection();
  2445. $ctx2.sendIdx["collection"]=2;
  2446. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2447. return smalltalk.withContext(function($ctx3) {
  2448. visited=value2;
  2449. visited;
  2450. return sentinel;
  2451. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2452. return smalltalk.withContext(function($ctx3) {
  2453. return self._sampleNewValue();
  2454. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2455. self._assert_equals_($4,sentinel);
  2456. $ctx2.sendIdx["assert:equals:"]=2;
  2457. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2458. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2459. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2460. args: [],
  2461. 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) ]",
  2462. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2463. referencedClasses: ["Object"]
  2464. }),
  2465. smalltalk.IndexableCollectionTest);
  2466. smalltalk.addMethod(
  2467. smalltalk.method({
  2468. selector: "testAtPut",
  2469. protocol: 'tests',
  2470. fn: function (){
  2471. var self=this;
  2472. var newCollection;
  2473. return smalltalk.withContext(function($ctx1) {
  2474. newCollection=self._collection();
  2475. $ctx1.sendIdx["collection"]=1;
  2476. self._samplesDo_((function(index,value){
  2477. return smalltalk.withContext(function($ctx2) {
  2478. return _st(newCollection)._at_put_(index,value);
  2479. $ctx2.sendIdx["at:put:"]=1;
  2480. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2481. self._assert_equals_(newCollection,self._collection());
  2482. $ctx1.sendIdx["assert:equals:"]=1;
  2483. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2484. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2485. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2486. args: [],
  2487. 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",
  2488. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2489. referencedClasses: []
  2490. }),
  2491. smalltalk.IndexableCollectionTest);
  2492. smalltalk.addMethod(
  2493. smalltalk.method({
  2494. selector: "testEquality",
  2495. protocol: 'tests',
  2496. fn: function (){
  2497. var self=this;
  2498. return smalltalk.withContext(function($ctx1) {
  2499. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2500. $2=self._collectionClass();
  2501. $ctx1.sendIdx["collectionClass"]=1;
  2502. $1=_st($2)._new();
  2503. $ctx1.sendIdx["new"]=1;
  2504. $4=self._collectionClass();
  2505. $ctx1.sendIdx["collectionClass"]=2;
  2506. $3=_st($4)._new();
  2507. $ctx1.sendIdx["new"]=2;
  2508. self._assert_equals_($1,$3);
  2509. $ctx1.sendIdx["assert:equals:"]=1;
  2510. $5=self._collection();
  2511. $ctx1.sendIdx["collection"]=1;
  2512. $6=self._collection();
  2513. $ctx1.sendIdx["collection"]=2;
  2514. self._assert_equals_($5,$6);
  2515. $ctx1.sendIdx["assert:equals:"]=2;
  2516. $7=self._collectionWithNewValue();
  2517. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2518. self._assert_equals_($7,self._collectionWithNewValue());
  2519. $10=self._collectionClass();
  2520. $ctx1.sendIdx["collectionClass"]=3;
  2521. $9=_st($10)._new();
  2522. $ctx1.sendIdx["new"]=3;
  2523. $11=self._collection();
  2524. $ctx1.sendIdx["collection"]=3;
  2525. $8=_st($9).__eq($11);
  2526. $ctx1.sendIdx["="]=1;
  2527. self._deny_($8);
  2528. $ctx1.sendIdx["deny:"]=1;
  2529. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2530. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.IndexableCollectionTest)})},
  2531. args: [],
  2532. 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",
  2533. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2534. referencedClasses: []
  2535. }),
  2536. smalltalk.IndexableCollectionTest);
  2537. smalltalk.addMethod(
  2538. smalltalk.method({
  2539. selector: "testIndexOf",
  2540. protocol: 'tests',
  2541. fn: function (){
  2542. var self=this;
  2543. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2544. return smalltalk.withContext(function($ctx1) {
  2545. var $1;
  2546. self._should_raise_((function(){
  2547. return smalltalk.withContext(function($ctx2) {
  2548. $1=self._collection();
  2549. $ctx2.sendIdx["collection"]=1;
  2550. return _st($1)._indexOf_(self._sampleNewValue());
  2551. $ctx2.sendIdx["indexOf:"]=1;
  2552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2553. self._samplesDo_((function(index,value){
  2554. return smalltalk.withContext(function($ctx2) {
  2555. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2556. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2557. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2558. args: [],
  2559. 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 ]",
  2560. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2561. referencedClasses: ["Error"]
  2562. }),
  2563. smalltalk.IndexableCollectionTest);
  2564. smalltalk.addMethod(
  2565. smalltalk.method({
  2566. selector: "testIndexOfWithNull",
  2567. protocol: 'tests',
  2568. fn: function (){
  2569. var self=this;
  2570. var jsNull;
  2571. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2572. return smalltalk.withContext(function($ctx1) {
  2573. var $1,$2;
  2574. jsNull=_st($JSON())._parse_("null");
  2575. self._samplesDo_((function(index,value){
  2576. return smalltalk.withContext(function($ctx2) {
  2577. $1=self._collection();
  2578. _st($1)._at_put_(index,jsNull);
  2579. $2=_st($1)._indexOf_(jsNull);
  2580. return self._assert_equals_($2,index);
  2581. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2582. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},smalltalk.IndexableCollectionTest)})},
  2583. args: [],
  2584. 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 ]",
  2585. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2586. referencedClasses: ["JSON"]
  2587. }),
  2588. smalltalk.IndexableCollectionTest);
  2589. smalltalk.addMethod(
  2590. smalltalk.method({
  2591. selector: "testWithIndexDo",
  2592. protocol: 'tests',
  2593. fn: function (){
  2594. var self=this;
  2595. var collection;
  2596. return smalltalk.withContext(function($ctx1) {
  2597. collection=self._collection();
  2598. $ctx1.sendIdx["collection"]=1;
  2599. _st(self._collection())._withIndexDo_((function(each,index){
  2600. return smalltalk.withContext(function($ctx2) {
  2601. return self._assert_equals_(_st(collection)._at_(index),each);
  2602. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2603. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2604. args: [],
  2605. 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 ]",
  2606. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2607. referencedClasses: []
  2608. }),
  2609. smalltalk.IndexableCollectionTest);
  2610. smalltalk.addClass('AssociativeCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2611. smalltalk.addMethod(
  2612. smalltalk.method({
  2613. selector: "collectionKeys",
  2614. protocol: 'fixture',
  2615. fn: function (){
  2616. var self=this;
  2617. return smalltalk.withContext(function($ctx1) {
  2618. self._subclassResponsibility();
  2619. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.AssociativeCollectionTest)})},
  2620. args: [],
  2621. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2622. messageSends: ["subclassResponsibility"],
  2623. referencedClasses: []
  2624. }),
  2625. smalltalk.AssociativeCollectionTest);
  2626. smalltalk.addMethod(
  2627. smalltalk.method({
  2628. selector: "collectionValues",
  2629. protocol: 'fixture',
  2630. fn: function (){
  2631. var self=this;
  2632. return smalltalk.withContext(function($ctx1) {
  2633. self._subclassResponsibility();
  2634. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.AssociativeCollectionTest)})},
  2635. args: [],
  2636. source: "collectionValues\x0a\x09self subclassResponsibility",
  2637. messageSends: ["subclassResponsibility"],
  2638. referencedClasses: []
  2639. }),
  2640. smalltalk.AssociativeCollectionTest);
  2641. smalltalk.addMethod(
  2642. smalltalk.method({
  2643. selector: "nonIndexesDo:",
  2644. protocol: 'fixture',
  2645. fn: function (aBlock){
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) {
  2648. _st(aBlock)._value_((5));
  2649. $ctx1.sendIdx["value:"]=1;
  2650. _st(aBlock)._value_("z");
  2651. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2652. args: ["aBlock"],
  2653. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2654. messageSends: ["value:"],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.AssociativeCollectionTest);
  2658. smalltalk.addMethod(
  2659. smalltalk.method({
  2660. selector: "sampleNewIndex",
  2661. protocol: 'fixture',
  2662. fn: function (){
  2663. var self=this;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. return "new";
  2666. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.AssociativeCollectionTest)})},
  2667. args: [],
  2668. source: "sampleNewIndex\x0a\x09^ 'new'",
  2669. messageSends: [],
  2670. referencedClasses: []
  2671. }),
  2672. smalltalk.AssociativeCollectionTest);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "samplesDo:",
  2676. protocol: 'fixture',
  2677. fn: function (aBlock){
  2678. var self=this;
  2679. return smalltalk.withContext(function($ctx1) {
  2680. _st(aBlock)._value_value_("a",(2));
  2681. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2682. args: ["aBlock"],
  2683. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2684. messageSends: ["value:value:"],
  2685. referencedClasses: []
  2686. }),
  2687. smalltalk.AssociativeCollectionTest);
  2688. smalltalk.addMethod(
  2689. smalltalk.method({
  2690. selector: "testAddAll",
  2691. protocol: 'tests',
  2692. fn: function (){
  2693. var self=this;
  2694. return smalltalk.withContext(function($ctx1) {
  2695. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2696. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2697. $2=self._collection();
  2698. $ctx1.sendIdx["collection"]=1;
  2699. $3=$2;
  2700. $4=self._collection();
  2701. $ctx1.sendIdx["collection"]=2;
  2702. _st($3)._addAll_($4);
  2703. $ctx1.sendIdx["addAll:"]=1;
  2704. $5=_st($2)._yourself();
  2705. $ctx1.sendIdx["yourself"]=1;
  2706. $1=$5;
  2707. $6=self._collection();
  2708. $ctx1.sendIdx["collection"]=3;
  2709. self._assert_equals_($1,$6);
  2710. $ctx1.sendIdx["assert:equals:"]=1;
  2711. $8=self._collection();
  2712. $ctx1.sendIdx["collection"]=4;
  2713. $9=$8;
  2714. $10=self._collectionWithNewValue();
  2715. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2716. _st($9)._addAll_($10);
  2717. $ctx1.sendIdx["addAll:"]=2;
  2718. $11=_st($8)._yourself();
  2719. $ctx1.sendIdx["yourself"]=2;
  2720. $7=$11;
  2721. $12=self._collectionWithNewValue();
  2722. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2723. self._assert_equals_($7,$12);
  2724. $ctx1.sendIdx["assert:equals:"]=2;
  2725. $14=self._collectionWithNewValue();
  2726. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2727. _st($14)._addAll_(self._collection());
  2728. $15=_st($14)._yourself();
  2729. $13=$15;
  2730. self._assert_equals_($13,self._collectionWithNewValue());
  2731. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.AssociativeCollectionTest)})},
  2732. args: [],
  2733. 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",
  2734. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2735. referencedClasses: []
  2736. }),
  2737. smalltalk.AssociativeCollectionTest);
  2738. smalltalk.addMethod(
  2739. smalltalk.method({
  2740. selector: "testAsDictionary",
  2741. protocol: 'tests',
  2742. fn: function (){
  2743. var self=this;
  2744. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2745. return smalltalk.withContext(function($ctx1) {
  2746. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2747. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.AssociativeCollectionTest)})},
  2748. args: [],
  2749. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2750. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2751. referencedClasses: ["Dictionary"]
  2752. }),
  2753. smalltalk.AssociativeCollectionTest);
  2754. smalltalk.addMethod(
  2755. smalltalk.method({
  2756. selector: "testAsHashedCollection",
  2757. protocol: 'tests',
  2758. fn: function (){
  2759. var self=this;
  2760. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2761. return smalltalk.withContext(function($ctx1) {
  2762. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2763. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.AssociativeCollectionTest)})},
  2764. args: [],
  2765. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2766. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2767. referencedClasses: ["HashedCollection"]
  2768. }),
  2769. smalltalk.AssociativeCollectionTest);
  2770. smalltalk.addMethod(
  2771. smalltalk.method({
  2772. selector: "testComma",
  2773. protocol: 'tests',
  2774. fn: function (){
  2775. var self=this;
  2776. return smalltalk.withContext(function($ctx1) {
  2777. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2778. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2779. $2=self._collection();
  2780. $ctx1.sendIdx["collection"]=1;
  2781. $3=self._collection();
  2782. $ctx1.sendIdx["collection"]=2;
  2783. $1=_st($2).__comma($3);
  2784. $ctx1.sendIdx[","]=1;
  2785. $4=self._collection();
  2786. $ctx1.sendIdx["collection"]=3;
  2787. self._assert_equals_($1,$4);
  2788. $ctx1.sendIdx["assert:equals:"]=1;
  2789. $6=self._collection();
  2790. $ctx1.sendIdx["collection"]=4;
  2791. $7=self._collectionWithNewValue();
  2792. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2793. $5=_st($6).__comma($7);
  2794. $ctx1.sendIdx[","]=2;
  2795. $8=self._collectionWithNewValue();
  2796. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2797. self._assert_equals_($5,$8);
  2798. $ctx1.sendIdx["assert:equals:"]=2;
  2799. $10=self._collectionWithNewValue();
  2800. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2801. $9=_st($10).__comma(self._collection());
  2802. self._assert_equals_($9,self._collectionWithNewValue());
  2803. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.AssociativeCollectionTest)})},
  2804. args: [],
  2805. 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",
  2806. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2807. referencedClasses: []
  2808. }),
  2809. smalltalk.AssociativeCollectionTest);
  2810. smalltalk.addMethod(
  2811. smalltalk.method({
  2812. selector: "testFrom",
  2813. protocol: 'tests',
  2814. fn: function (){
  2815. var self=this;
  2816. var associations;
  2817. return smalltalk.withContext(function($ctx1) {
  2818. var $1,$2,$3,$5,$4;
  2819. $1="a".__minus_gt((1));
  2820. $ctx1.sendIdx["->"]=1;
  2821. $2="b".__minus_gt((2));
  2822. $ctx1.sendIdx["->"]=2;
  2823. associations=[$1,$2];
  2824. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2825. $5="a".__minus_gt((1));
  2826. $ctx1.sendIdx["->"]=3;
  2827. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2828. self._assertSameContents_as_($3,$4);
  2829. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.AssociativeCollectionTest)})},
  2830. args: [],
  2831. 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 }.",
  2832. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2833. referencedClasses: []
  2834. }),
  2835. smalltalk.AssociativeCollectionTest);
  2836. smalltalk.addMethod(
  2837. smalltalk.method({
  2838. selector: "testKeys",
  2839. protocol: 'tests',
  2840. fn: function (){
  2841. var self=this;
  2842. return smalltalk.withContext(function($ctx1) {
  2843. var $2,$1,$3,$4;
  2844. $2=_st(_st(self._collectionClass())._new())._keys();
  2845. $ctx1.sendIdx["keys"]=1;
  2846. $1=_st($2)._isEmpty();
  2847. self._assert_($1);
  2848. $3=_st(self._collection())._keys();
  2849. $ctx1.sendIdx["keys"]=2;
  2850. $4=self._collectionKeys();
  2851. $ctx1.sendIdx["collectionKeys"]=1;
  2852. self._assertSameContents_as_($3,$4);
  2853. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2854. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2855. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},smalltalk.AssociativeCollectionTest)})},
  2856. args: [],
  2857. 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 }",
  2858. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2859. referencedClasses: []
  2860. }),
  2861. smalltalk.AssociativeCollectionTest);
  2862. smalltalk.addMethod(
  2863. smalltalk.method({
  2864. selector: "testNewFromPairs",
  2865. protocol: 'tests',
  2866. fn: function (){
  2867. var self=this;
  2868. var flattenedAssociations;
  2869. return smalltalk.withContext(function($ctx1) {
  2870. var $1,$3,$2;
  2871. flattenedAssociations=["a",(1),"b",(2)];
  2872. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2873. $3="a".__minus_gt((1));
  2874. $ctx1.sendIdx["->"]=1;
  2875. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2876. self._assertSameContents_as_($1,$2);
  2877. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.AssociativeCollectionTest)})},
  2878. args: [],
  2879. 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 }.",
  2880. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2881. referencedClasses: []
  2882. }),
  2883. smalltalk.AssociativeCollectionTest);
  2884. smalltalk.addMethod(
  2885. smalltalk.method({
  2886. selector: "testPrintString",
  2887. protocol: 'tests',
  2888. fn: function (){
  2889. var self=this;
  2890. return smalltalk.withContext(function($ctx1) {
  2891. var $3,$2,$4,$1,$5;
  2892. $3=self._collectionClass();
  2893. $ctx1.sendIdx["collectionClass"]=1;
  2894. $2=_st($3)._new();
  2895. _st($2)._at_put_("firstname","James");
  2896. $ctx1.sendIdx["at:put:"]=1;
  2897. _st($2)._at_put_("lastname","Bond");
  2898. $4=_st($2)._printString();
  2899. $1=$4;
  2900. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2901. $ctx1.sendIdx[","]=1;
  2902. self._assert_equals_($1,$5);
  2903. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.AssociativeCollectionTest)})},
  2904. args: [],
  2905. 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'')'",
  2906. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2907. referencedClasses: []
  2908. }),
  2909. smalltalk.AssociativeCollectionTest);
  2910. smalltalk.addMethod(
  2911. smalltalk.method({
  2912. selector: "testRemoveKey",
  2913. protocol: 'tests',
  2914. fn: function (){
  2915. var self=this;
  2916. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2917. return smalltalk.withContext(function($ctx1) {
  2918. var $1,$2,$3,$5,$6,$4,$7,$8;
  2919. self._nonIndexesDo_((function(each){
  2920. var collection;
  2921. return smalltalk.withContext(function($ctx2) {
  2922. collection=self._collection();
  2923. $ctx2.sendIdx["collection"]=1;
  2924. collection;
  2925. self._should_raise_((function(){
  2926. return smalltalk.withContext(function($ctx3) {
  2927. return _st(collection)._removeKey_(each);
  2928. $ctx3.sendIdx["removeKey:"]=1;
  2929. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2930. $1=collection;
  2931. $2=self._collection();
  2932. $ctx2.sendIdx["collection"]=2;
  2933. return self._assert_equals_($1,$2);
  2934. $ctx2.sendIdx["assert:equals:"]=1;
  2935. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2936. self._samplesDo_((function(index,value){
  2937. var collection;
  2938. return smalltalk.withContext(function($ctx2) {
  2939. collection=self._collection();
  2940. $ctx2.sendIdx["collection"]=3;
  2941. collection;
  2942. $3=_st(collection)._removeKey_(index);
  2943. $ctx2.sendIdx["removeKey:"]=2;
  2944. self._assert_equals_($3,value);
  2945. $ctx2.sendIdx["assert:equals:"]=2;
  2946. $5=collection;
  2947. $6=self._collection();
  2948. $ctx2.sendIdx["collection"]=4;
  2949. $4=_st($5).__eq($6);
  2950. return self._deny_($4);
  2951. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2952. $7=self._collectionWithNewValue();
  2953. _st($7)._removeKey_(self._sampleNewIndex());
  2954. $8=_st($7)._yourself();
  2955. self._assert_equals_($8,self._collection());
  2956. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},smalltalk.AssociativeCollectionTest)})},
  2957. args: [],
  2958. 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",
  2959. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2960. referencedClasses: ["Error"]
  2961. }),
  2962. smalltalk.AssociativeCollectionTest);
  2963. smalltalk.addMethod(
  2964. smalltalk.method({
  2965. selector: "testRemoveKeyIfAbsent",
  2966. protocol: 'tests',
  2967. fn: function (){
  2968. var self=this;
  2969. return smalltalk.withContext(function($ctx1) {
  2970. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2971. self._nonIndexesDo_((function(each){
  2972. var collection;
  2973. return smalltalk.withContext(function($ctx2) {
  2974. collection=self._collection();
  2975. $ctx2.sendIdx["collection"]=1;
  2976. collection;
  2977. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2978. return smalltalk.withContext(function($ctx3) {
  2979. return self._sampleNewValue();
  2980. $ctx3.sendIdx["sampleNewValue"]=1;
  2981. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2982. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2983. $2=self._sampleNewValue();
  2984. $ctx2.sendIdx["sampleNewValue"]=2;
  2985. self._assert_equals_($1,$2);
  2986. $ctx2.sendIdx["assert:equals:"]=1;
  2987. $3=collection;
  2988. $4=self._collection();
  2989. $ctx2.sendIdx["collection"]=2;
  2990. return self._assert_equals_($3,$4);
  2991. $ctx2.sendIdx["assert:equals:"]=2;
  2992. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2993. self._samplesDo_((function(index,value){
  2994. var collection;
  2995. return smalltalk.withContext(function($ctx2) {
  2996. collection=self._collection();
  2997. $ctx2.sendIdx["collection"]=3;
  2998. collection;
  2999. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3000. return smalltalk.withContext(function($ctx3) {
  3001. return self._sampleNewValue();
  3002. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3003. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3004. self._assert_equals_($5,value);
  3005. $ctx2.sendIdx["assert:equals:"]=3;
  3006. $7=collection;
  3007. $8=self._collection();
  3008. $ctx2.sendIdx["collection"]=4;
  3009. $6=_st($7).__eq($8);
  3010. return self._deny_($6);
  3011. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3012. $9=self._collectionWithNewValue();
  3013. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3014. return smalltalk.withContext(function($ctx2) {
  3015. return self._assert_(false);
  3016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3017. $10=_st($9)._yourself();
  3018. self._assert_equals_($10,self._collection());
  3019. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},smalltalk.AssociativeCollectionTest)})},
  3020. args: [],
  3021. 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",
  3022. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3023. referencedClasses: []
  3024. }),
  3025. smalltalk.AssociativeCollectionTest);
  3026. smalltalk.addMethod(
  3027. smalltalk.method({
  3028. selector: "testValues",
  3029. protocol: 'tests',
  3030. fn: function (){
  3031. var self=this;
  3032. return smalltalk.withContext(function($ctx1) {
  3033. var $2,$1,$3,$4;
  3034. $2=_st(_st(self._collectionClass())._new())._values();
  3035. $ctx1.sendIdx["values"]=1;
  3036. $1=_st($2)._isEmpty();
  3037. self._assert_($1);
  3038. $3=_st(self._collection())._values();
  3039. $ctx1.sendIdx["values"]=2;
  3040. $4=self._collectionValues();
  3041. $ctx1.sendIdx["collectionValues"]=1;
  3042. self._assertSameContents_as_($3,$4);
  3043. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3044. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3045. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},smalltalk.AssociativeCollectionTest)})},
  3046. args: [],
  3047. 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 }",
  3048. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3049. referencedClasses: []
  3050. }),
  3051. smalltalk.AssociativeCollectionTest);
  3052. smalltalk.addClass('DictionaryTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3053. smalltalk.addMethod(
  3054. smalltalk.method({
  3055. selector: "collection",
  3056. protocol: 'fixture',
  3057. fn: function (){
  3058. var self=this;
  3059. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3060. return smalltalk.withContext(function($ctx1) {
  3061. var $2,$3,$1;
  3062. $2=_st($Dictionary())._new();
  3063. _st($2)._at_put_((1),(1));
  3064. $ctx1.sendIdx["at:put:"]=1;
  3065. _st($2)._at_put_("a",(2));
  3066. $ctx1.sendIdx["at:put:"]=2;
  3067. _st($2)._at_put_(true,(3));
  3068. $ctx1.sendIdx["at:put:"]=3;
  3069. _st($2)._at_put_((1).__at((3)),(-4));
  3070. $3=_st($2)._yourself();
  3071. $1=$3;
  3072. return $1;
  3073. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  3074. args: [],
  3075. 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",
  3076. messageSends: ["at:put:", "new", "@", "yourself"],
  3077. referencedClasses: ["Dictionary"]
  3078. }),
  3079. smalltalk.DictionaryTest);
  3080. smalltalk.addMethod(
  3081. smalltalk.method({
  3082. selector: "collectionKeys",
  3083. protocol: 'fixture',
  3084. fn: function (){
  3085. var self=this;
  3086. return smalltalk.withContext(function($ctx1) {
  3087. var $1;
  3088. $1=[(1),"a",true,(1).__at((3))];
  3089. return $1;
  3090. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.DictionaryTest)})},
  3091. args: [],
  3092. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3093. messageSends: ["@"],
  3094. referencedClasses: []
  3095. }),
  3096. smalltalk.DictionaryTest);
  3097. smalltalk.addMethod(
  3098. smalltalk.method({
  3099. selector: "collectionOfPrintStrings",
  3100. protocol: 'fixture',
  3101. fn: function (){
  3102. var self=this;
  3103. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3104. return smalltalk.withContext(function($ctx1) {
  3105. var $2,$3,$1;
  3106. $2=_st($Dictionary())._new();
  3107. _st($2)._at_put_((1),"1");
  3108. $ctx1.sendIdx["at:put:"]=1;
  3109. _st($2)._at_put_("a","2");
  3110. $ctx1.sendIdx["at:put:"]=2;
  3111. _st($2)._at_put_(true,"3");
  3112. $ctx1.sendIdx["at:put:"]=3;
  3113. _st($2)._at_put_((1).__at((3)),"-4");
  3114. $3=_st($2)._yourself();
  3115. $1=$3;
  3116. return $1;
  3117. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  3118. args: [],
  3119. 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",
  3120. messageSends: ["at:put:", "new", "@", "yourself"],
  3121. referencedClasses: ["Dictionary"]
  3122. }),
  3123. smalltalk.DictionaryTest);
  3124. smalltalk.addMethod(
  3125. smalltalk.method({
  3126. selector: "collectionSize",
  3127. protocol: 'fixture',
  3128. fn: function (){
  3129. var self=this;
  3130. return smalltalk.withContext(function($ctx1) {
  3131. return (4);
  3132. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  3133. args: [],
  3134. source: "collectionSize\x0a\x09^ 4",
  3135. messageSends: [],
  3136. referencedClasses: []
  3137. }),
  3138. smalltalk.DictionaryTest);
  3139. smalltalk.addMethod(
  3140. smalltalk.method({
  3141. selector: "collectionValues",
  3142. protocol: 'fixture',
  3143. fn: function (){
  3144. var self=this;
  3145. return smalltalk.withContext(function($ctx1) {
  3146. var $1;
  3147. $1=[(1),(2),(3),(-4)];
  3148. return $1;
  3149. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.DictionaryTest)})},
  3150. args: [],
  3151. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3152. messageSends: [],
  3153. referencedClasses: []
  3154. }),
  3155. smalltalk.DictionaryTest);
  3156. smalltalk.addMethod(
  3157. smalltalk.method({
  3158. selector: "collectionWithDuplicates",
  3159. protocol: 'fixture',
  3160. fn: function (){
  3161. var self=this;
  3162. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3163. return smalltalk.withContext(function($ctx1) {
  3164. var $2,$3,$1;
  3165. $2=_st($Dictionary())._new();
  3166. _st($2)._at_put_((1),(1));
  3167. $ctx1.sendIdx["at:put:"]=1;
  3168. _st($2)._at_put_("a",(2));
  3169. $ctx1.sendIdx["at:put:"]=2;
  3170. _st($2)._at_put_(true,(3));
  3171. $ctx1.sendIdx["at:put:"]=3;
  3172. _st($2)._at_put_((4),(-4));
  3173. $ctx1.sendIdx["at:put:"]=4;
  3174. _st($2)._at_put_("b",(1));
  3175. $ctx1.sendIdx["at:put:"]=5;
  3176. _st($2)._at_put_((3),(3));
  3177. $ctx1.sendIdx["at:put:"]=6;
  3178. _st($2)._at_put_(false,(12));
  3179. $3=_st($2)._yourself();
  3180. $1=$3;
  3181. return $1;
  3182. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  3183. args: [],
  3184. 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",
  3185. messageSends: ["at:put:", "new", "yourself"],
  3186. referencedClasses: ["Dictionary"]
  3187. }),
  3188. smalltalk.DictionaryTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "collectionWithNewValue",
  3192. protocol: 'fixture',
  3193. fn: function (){
  3194. var self=this;
  3195. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3196. return smalltalk.withContext(function($ctx1) {
  3197. var $2,$3,$1;
  3198. $2=_st($Dictionary())._new();
  3199. _st($2)._at_put_((1),(1));
  3200. $ctx1.sendIdx["at:put:"]=1;
  3201. _st($2)._at_put_("a",(2));
  3202. $ctx1.sendIdx["at:put:"]=2;
  3203. _st($2)._at_put_(true,(3));
  3204. $ctx1.sendIdx["at:put:"]=3;
  3205. _st($2)._at_put_((1).__at((3)),(-4));
  3206. $ctx1.sendIdx["at:put:"]=4;
  3207. _st($2)._at_put_("new","N");
  3208. $3=_st($2)._yourself();
  3209. $1=$3;
  3210. return $1;
  3211. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  3212. args: [],
  3213. 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",
  3214. messageSends: ["at:put:", "new", "@", "yourself"],
  3215. referencedClasses: ["Dictionary"]
  3216. }),
  3217. smalltalk.DictionaryTest);
  3218. smalltalk.addMethod(
  3219. smalltalk.method({
  3220. selector: "sampleNewValueAsCollection",
  3221. protocol: 'fixture',
  3222. fn: function (){
  3223. var self=this;
  3224. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3225. return smalltalk.withContext(function($ctx1) {
  3226. var $2,$3,$1;
  3227. $2=_st($Dictionary())._new();
  3228. _st($2)._at_put_("new","N");
  3229. $3=_st($2)._yourself();
  3230. $1=$3;
  3231. return $1;
  3232. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3233. args: [],
  3234. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3235. messageSends: ["at:put:", "new", "yourself"],
  3236. referencedClasses: ["Dictionary"]
  3237. }),
  3238. smalltalk.DictionaryTest);
  3239. smalltalk.addMethod(
  3240. smalltalk.method({
  3241. selector: "samplesDo:",
  3242. protocol: 'fixture',
  3243. fn: function (aBlock){
  3244. var self=this;
  3245. return smalltalk.withContext(function($ctx1) {
  3246. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3247. _st(aBlock)._value_value_(true,(3));
  3248. $ctx1.sendIdx["value:value:"]=1;
  3249. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3250. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3251. args: ["aBlock"],
  3252. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3253. messageSends: ["samplesDo:", "value:value:", "@"],
  3254. referencedClasses: []
  3255. }),
  3256. smalltalk.DictionaryTest);
  3257. smalltalk.addMethod(
  3258. smalltalk.method({
  3259. selector: "testAccessing",
  3260. protocol: 'tests',
  3261. fn: function (){
  3262. var self=this;
  3263. var d;
  3264. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3265. return smalltalk.withContext(function($ctx1) {
  3266. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3267. d=_st($Dictionary())._new();
  3268. _st(d)._at_put_("hello","world");
  3269. $ctx1.sendIdx["at:put:"]=1;
  3270. $1=_st(d)._at_("hello");
  3271. $ctx1.sendIdx["at:"]=1;
  3272. self._assert_equals_($1,"world");
  3273. $ctx1.sendIdx["assert:equals:"]=1;
  3274. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3275. return smalltalk.withContext(function($ctx2) {
  3276. return nil;
  3277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3278. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3279. self._assert_equals_($2,"world");
  3280. $ctx1.sendIdx["assert:equals:"]=2;
  3281. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3282. return smalltalk.withContext(function($ctx2) {
  3283. return nil;
  3284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3285. $ctx1.sendIdx["deny:"]=1;
  3286. $3=_st(d)._includesKey_("hello");
  3287. $ctx1.sendIdx["includesKey:"]=1;
  3288. self._assert_($3);
  3289. $ctx1.sendIdx["assert:"]=1;
  3290. $4=_st(d)._includesKey_("foo");
  3291. $ctx1.sendIdx["includesKey:"]=2;
  3292. self._deny_($4);
  3293. $ctx1.sendIdx["deny:"]=2;
  3294. _st(d)._at_put_((1),(2));
  3295. $ctx1.sendIdx["at:put:"]=2;
  3296. $5=_st(d)._at_((1));
  3297. $ctx1.sendIdx["at:"]=2;
  3298. self._assert_equals_($5,(2));
  3299. $ctx1.sendIdx["assert:equals:"]=3;
  3300. $6=d;
  3301. $7=(1).__at((3));
  3302. $ctx1.sendIdx["@"]=1;
  3303. _st($6)._at_put_($7,(3));
  3304. $9=d;
  3305. $10=(1).__at((3));
  3306. $ctx1.sendIdx["@"]=2;
  3307. $8=_st($9)._at_($10);
  3308. self._assert_equals_($8,(3));
  3309. $12=d;
  3310. $13=(1).__at((3));
  3311. $ctx1.sendIdx["@"]=3;
  3312. $11=_st($12)._includesKey_($13);
  3313. $ctx1.sendIdx["includesKey:"]=3;
  3314. self._assert_($11);
  3315. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3316. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3317. args: [],
  3318. 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)",
  3319. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3320. referencedClasses: ["Dictionary"]
  3321. }),
  3322. smalltalk.DictionaryTest);
  3323. smalltalk.addMethod(
  3324. smalltalk.method({
  3325. selector: "testDynamicDictionaries",
  3326. protocol: 'tests',
  3327. fn: function (){
  3328. var self=this;
  3329. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3330. return smalltalk.withContext(function($ctx1) {
  3331. var $3,$2,$1;
  3332. $3="hello".__minus_gt((1));
  3333. $ctx1.sendIdx["->"]=1;
  3334. $2=smalltalk.HashedCollection._from_([$3]);
  3335. $1=_st($2)._asDictionary();
  3336. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3337. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3338. args: [],
  3339. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3340. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3341. referencedClasses: ["Dictionary"]
  3342. }),
  3343. smalltalk.DictionaryTest);
  3344. smalltalk.addMethod(
  3345. smalltalk.method({
  3346. selector: "collectionClass",
  3347. protocol: 'fixture',
  3348. fn: function (){
  3349. var self=this;
  3350. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3351. return smalltalk.withContext(function($ctx1) {
  3352. return $Dictionary();
  3353. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3354. args: [],
  3355. source: "collectionClass\x0a\x09^ Dictionary",
  3356. messageSends: [],
  3357. referencedClasses: ["Dictionary"]
  3358. }),
  3359. smalltalk.DictionaryTest.klass);
  3360. smalltalk.addClass('HashedCollectionTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3361. smalltalk.addMethod(
  3362. smalltalk.method({
  3363. selector: "collection",
  3364. protocol: 'fixture',
  3365. fn: function (){
  3366. var self=this;
  3367. return smalltalk.withContext(function($ctx1) {
  3368. var $2,$3,$4,$1;
  3369. $2="b".__minus_gt((1));
  3370. $ctx1.sendIdx["->"]=1;
  3371. $3="a".__minus_gt((2));
  3372. $ctx1.sendIdx["->"]=2;
  3373. $4="c".__minus_gt((3));
  3374. $ctx1.sendIdx["->"]=3;
  3375. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3376. return $1;
  3377. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  3378. args: [],
  3379. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3380. messageSends: ["->"],
  3381. referencedClasses: []
  3382. }),
  3383. smalltalk.HashedCollectionTest);
  3384. smalltalk.addMethod(
  3385. smalltalk.method({
  3386. selector: "collectionKeys",
  3387. protocol: 'fixture',
  3388. fn: function (){
  3389. var self=this;
  3390. return smalltalk.withContext(function($ctx1) {
  3391. var $1;
  3392. $1=["b","a","c","d"];
  3393. return $1;
  3394. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.HashedCollectionTest)})},
  3395. args: [],
  3396. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3397. messageSends: [],
  3398. referencedClasses: []
  3399. }),
  3400. smalltalk.HashedCollectionTest);
  3401. smalltalk.addMethod(
  3402. smalltalk.method({
  3403. selector: "collectionOfPrintStrings",
  3404. protocol: 'fixture',
  3405. fn: function (){
  3406. var self=this;
  3407. return smalltalk.withContext(function($ctx1) {
  3408. var $2,$3,$4,$1;
  3409. $2="b".__minus_gt("1");
  3410. $ctx1.sendIdx["->"]=1;
  3411. $3="a".__minus_gt("2");
  3412. $ctx1.sendIdx["->"]=2;
  3413. $4="c".__minus_gt("3");
  3414. $ctx1.sendIdx["->"]=3;
  3415. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3416. return $1;
  3417. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  3418. args: [],
  3419. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3420. messageSends: ["->"],
  3421. referencedClasses: []
  3422. }),
  3423. smalltalk.HashedCollectionTest);
  3424. smalltalk.addMethod(
  3425. smalltalk.method({
  3426. selector: "collectionSize",
  3427. protocol: 'fixture',
  3428. fn: function (){
  3429. var self=this;
  3430. return smalltalk.withContext(function($ctx1) {
  3431. return (4);
  3432. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  3433. args: [],
  3434. source: "collectionSize\x0a\x09^ 4",
  3435. messageSends: [],
  3436. referencedClasses: []
  3437. }),
  3438. smalltalk.HashedCollectionTest);
  3439. smalltalk.addMethod(
  3440. smalltalk.method({
  3441. selector: "collectionValues",
  3442. protocol: 'fixture',
  3443. fn: function (){
  3444. var self=this;
  3445. return smalltalk.withContext(function($ctx1) {
  3446. var $1;
  3447. $1=[(1),(2),(3),(-4)];
  3448. return $1;
  3449. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.HashedCollectionTest)})},
  3450. args: [],
  3451. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3452. messageSends: [],
  3453. referencedClasses: []
  3454. }),
  3455. smalltalk.HashedCollectionTest);
  3456. smalltalk.addMethod(
  3457. smalltalk.method({
  3458. selector: "collectionWithDuplicates",
  3459. protocol: 'fixture',
  3460. fn: function (){
  3461. var self=this;
  3462. return smalltalk.withContext(function($ctx1) {
  3463. var $2,$3,$4,$5,$6,$7,$1;
  3464. $2="b".__minus_gt((1));
  3465. $ctx1.sendIdx["->"]=1;
  3466. $3="a".__minus_gt((2));
  3467. $ctx1.sendIdx["->"]=2;
  3468. $4="c".__minus_gt((3));
  3469. $ctx1.sendIdx["->"]=3;
  3470. $5="d".__minus_gt((-4));
  3471. $ctx1.sendIdx["->"]=4;
  3472. $6="e".__minus_gt((1));
  3473. $ctx1.sendIdx["->"]=5;
  3474. $7="f".__minus_gt((2));
  3475. $ctx1.sendIdx["->"]=6;
  3476. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3477. return $1;
  3478. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  3479. args: [],
  3480. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3481. messageSends: ["->"],
  3482. referencedClasses: []
  3483. }),
  3484. smalltalk.HashedCollectionTest);
  3485. smalltalk.addMethod(
  3486. smalltalk.method({
  3487. selector: "collectionWithNewValue",
  3488. protocol: 'fixture',
  3489. fn: function (){
  3490. var self=this;
  3491. return smalltalk.withContext(function($ctx1) {
  3492. var $2,$3,$4,$5,$1;
  3493. $2="b".__minus_gt((1));
  3494. $ctx1.sendIdx["->"]=1;
  3495. $3="a".__minus_gt((2));
  3496. $ctx1.sendIdx["->"]=2;
  3497. $4="c".__minus_gt((3));
  3498. $ctx1.sendIdx["->"]=3;
  3499. $5="d".__minus_gt((-4));
  3500. $ctx1.sendIdx["->"]=4;
  3501. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3502. return $1;
  3503. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  3504. args: [],
  3505. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3506. messageSends: ["->"],
  3507. referencedClasses: []
  3508. }),
  3509. smalltalk.HashedCollectionTest);
  3510. smalltalk.addMethod(
  3511. smalltalk.method({
  3512. selector: "sampleNewValueAsCollection",
  3513. protocol: 'fixture',
  3514. fn: function (){
  3515. var self=this;
  3516. return smalltalk.withContext(function($ctx1) {
  3517. var $1;
  3518. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  3519. return $1;
  3520. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  3521. args: [],
  3522. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3523. messageSends: ["->"],
  3524. referencedClasses: []
  3525. }),
  3526. smalltalk.HashedCollectionTest);
  3527. smalltalk.addMethod(
  3528. smalltalk.method({
  3529. selector: "testDynamicDictionaries",
  3530. protocol: 'tests',
  3531. fn: function (){
  3532. var self=this;
  3533. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3534. return smalltalk.withContext(function($ctx1) {
  3535. var $3,$2,$1;
  3536. $3="hello".__minus_gt((1));
  3537. $ctx1.sendIdx["->"]=1;
  3538. $2=smalltalk.HashedCollection._from_([$3]);
  3539. $1=_st($2)._asHashedCollection();
  3540. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3541. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.HashedCollectionTest)})},
  3542. args: [],
  3543. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3544. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3545. referencedClasses: ["HashedCollection"]
  3546. }),
  3547. smalltalk.HashedCollectionTest);
  3548. smalltalk.addMethod(
  3549. smalltalk.method({
  3550. selector: "collectionClass",
  3551. protocol: 'fixture',
  3552. fn: function (){
  3553. var self=this;
  3554. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3555. return smalltalk.withContext(function($ctx1) {
  3556. return $HashedCollection();
  3557. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  3558. args: [],
  3559. source: "collectionClass\x0a\x09^ HashedCollection",
  3560. messageSends: [],
  3561. referencedClasses: ["HashedCollection"]
  3562. }),
  3563. smalltalk.HashedCollectionTest.klass);
  3564. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3565. smalltalk.addMethod(
  3566. smalltalk.method({
  3567. selector: "collectionFirst",
  3568. protocol: 'fixture',
  3569. fn: function (){
  3570. var self=this;
  3571. return smalltalk.withContext(function($ctx1) {
  3572. self._subclassResponsibility();
  3573. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3574. args: [],
  3575. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3576. messageSends: ["subclassResponsibility"],
  3577. referencedClasses: []
  3578. }),
  3579. smalltalk.SequenceableCollectionTest);
  3580. smalltalk.addMethod(
  3581. smalltalk.method({
  3582. selector: "collectionFirstTwo",
  3583. protocol: 'fixture',
  3584. fn: function (){
  3585. var self=this;
  3586. return smalltalk.withContext(function($ctx1) {
  3587. self._subclassResponsibility();
  3588. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3589. args: [],
  3590. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3591. messageSends: ["subclassResponsibility"],
  3592. referencedClasses: []
  3593. }),
  3594. smalltalk.SequenceableCollectionTest);
  3595. smalltalk.addMethod(
  3596. smalltalk.method({
  3597. selector: "collectionLast",
  3598. protocol: 'fixture',
  3599. fn: function (){
  3600. var self=this;
  3601. return smalltalk.withContext(function($ctx1) {
  3602. self._subclassResponsibility();
  3603. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3604. args: [],
  3605. source: "collectionLast\x0a\x09self subclassResponsibility",
  3606. messageSends: ["subclassResponsibility"],
  3607. referencedClasses: []
  3608. }),
  3609. smalltalk.SequenceableCollectionTest);
  3610. smalltalk.addMethod(
  3611. smalltalk.method({
  3612. selector: "collectionLastTwo",
  3613. protocol: 'fixture',
  3614. fn: function (){
  3615. var self=this;
  3616. return smalltalk.withContext(function($ctx1) {
  3617. self._subclassResponsibility();
  3618. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3619. args: [],
  3620. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3621. messageSends: ["subclassResponsibility"],
  3622. referencedClasses: []
  3623. }),
  3624. smalltalk.SequenceableCollectionTest);
  3625. smalltalk.addMethod(
  3626. smalltalk.method({
  3627. selector: "nonIndexesDo:",
  3628. protocol: 'fixture',
  3629. fn: function (aBlock){
  3630. var self=this;
  3631. return smalltalk.withContext(function($ctx1) {
  3632. _st(aBlock)._value_((0));
  3633. $ctx1.sendIdx["value:"]=1;
  3634. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3635. $ctx1.sendIdx["value:"]=2;
  3636. _st(aBlock)._value_("z");
  3637. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3638. args: ["aBlock"],
  3639. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3640. messageSends: ["value:", "+", "collectionSize"],
  3641. referencedClasses: []
  3642. }),
  3643. smalltalk.SequenceableCollectionTest);
  3644. smalltalk.addMethod(
  3645. smalltalk.method({
  3646. selector: "samplesDo:",
  3647. protocol: 'fixture',
  3648. fn: function (aBlock){
  3649. var self=this;
  3650. return smalltalk.withContext(function($ctx1) {
  3651. _st(aBlock)._value_value_((1),self._collectionFirst());
  3652. $ctx1.sendIdx["value:value:"]=1;
  3653. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3654. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3655. args: ["aBlock"],
  3656. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3657. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3658. referencedClasses: []
  3659. }),
  3660. smalltalk.SequenceableCollectionTest);
  3661. smalltalk.addMethod(
  3662. smalltalk.method({
  3663. selector: "testBeginsWith",
  3664. protocol: 'tests',
  3665. fn: function (){
  3666. var self=this;
  3667. return smalltalk.withContext(function($ctx1) {
  3668. var $2,$1,$4,$5,$3,$7,$6;
  3669. $2=self._collection();
  3670. $ctx1.sendIdx["collection"]=1;
  3671. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3672. $ctx1.sendIdx["beginsWith:"]=1;
  3673. self._assert_($1);
  3674. $ctx1.sendIdx["assert:"]=1;
  3675. $4=self._collection();
  3676. $ctx1.sendIdx["collection"]=2;
  3677. $5=self._collection();
  3678. $ctx1.sendIdx["collection"]=3;
  3679. $3=_st($4)._beginsWith_($5);
  3680. $ctx1.sendIdx["beginsWith:"]=2;
  3681. self._assert_($3);
  3682. $ctx1.sendIdx["assert:"]=2;
  3683. $7=self._collection();
  3684. $ctx1.sendIdx["collection"]=4;
  3685. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3686. $ctx1.sendIdx["beginsWith:"]=3;
  3687. self._assert_($6);
  3688. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3689. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3690. args: [],
  3691. 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)",
  3692. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3693. referencedClasses: []
  3694. }),
  3695. smalltalk.SequenceableCollectionTest);
  3696. smalltalk.addMethod(
  3697. smalltalk.method({
  3698. selector: "testEndsWith",
  3699. protocol: 'tests',
  3700. fn: function (){
  3701. var self=this;
  3702. return smalltalk.withContext(function($ctx1) {
  3703. var $2,$1,$4,$5,$3,$7,$6;
  3704. $2=self._collection();
  3705. $ctx1.sendIdx["collection"]=1;
  3706. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3707. $ctx1.sendIdx["endsWith:"]=1;
  3708. self._assert_($1);
  3709. $ctx1.sendIdx["assert:"]=1;
  3710. $4=self._collection();
  3711. $ctx1.sendIdx["collection"]=2;
  3712. $5=self._collection();
  3713. $ctx1.sendIdx["collection"]=3;
  3714. $3=_st($4)._endsWith_($5);
  3715. $ctx1.sendIdx["endsWith:"]=2;
  3716. self._assert_($3);
  3717. $ctx1.sendIdx["assert:"]=2;
  3718. $7=self._collection();
  3719. $ctx1.sendIdx["collection"]=4;
  3720. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3721. $ctx1.sendIdx["endsWith:"]=3;
  3722. self._assert_($6);
  3723. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3724. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3725. args: [],
  3726. 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)",
  3727. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3728. referencedClasses: []
  3729. }),
  3730. smalltalk.SequenceableCollectionTest);
  3731. smalltalk.addMethod(
  3732. smalltalk.method({
  3733. selector: "testFirst",
  3734. protocol: 'tests',
  3735. fn: function (){
  3736. var self=this;
  3737. return smalltalk.withContext(function($ctx1) {
  3738. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3739. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3740. args: [],
  3741. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3742. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3743. referencedClasses: []
  3744. }),
  3745. smalltalk.SequenceableCollectionTest);
  3746. smalltalk.addMethod(
  3747. smalltalk.method({
  3748. selector: "testFirstN",
  3749. protocol: 'tests',
  3750. fn: function (){
  3751. var self=this;
  3752. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3753. return smalltalk.withContext(function($ctx1) {
  3754. var $2,$1,$4,$3,$6,$5,$7;
  3755. $2=self._collection();
  3756. $ctx1.sendIdx["collection"]=1;
  3757. $1=_st($2)._first_((2));
  3758. $ctx1.sendIdx["first:"]=1;
  3759. self._assert_equals_($1,self._collectionFirstTwo());
  3760. $ctx1.sendIdx["assert:equals:"]=1;
  3761. $4=self._collection();
  3762. $ctx1.sendIdx["collection"]=2;
  3763. $3=_st($4)._first_((0));
  3764. $ctx1.sendIdx["first:"]=2;
  3765. self._assert_equals_($3,_st(self._collectionClass())._new());
  3766. $ctx1.sendIdx["assert:equals:"]=2;
  3767. $6=self._collection();
  3768. $ctx1.sendIdx["collection"]=3;
  3769. $5=_st($6)._first_(self._collectionSize());
  3770. $ctx1.sendIdx["first:"]=3;
  3771. $7=self._collection();
  3772. $ctx1.sendIdx["collection"]=4;
  3773. self._assert_equals_($5,$7);
  3774. self._should_raise_((function(){
  3775. return smalltalk.withContext(function($ctx2) {
  3776. return _st(self._collection())._first_((33));
  3777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3778. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3779. args: [],
  3780. 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",
  3781. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3782. referencedClasses: ["Error"]
  3783. }),
  3784. smalltalk.SequenceableCollectionTest);
  3785. smalltalk.addMethod(
  3786. smalltalk.method({
  3787. selector: "testFourth",
  3788. protocol: 'tests',
  3789. fn: function (){
  3790. var self=this;
  3791. return smalltalk.withContext(function($ctx1) {
  3792. var $2,$1;
  3793. $2=self._collection();
  3794. $ctx1.sendIdx["collection"]=1;
  3795. $1=_st($2)._fourth();
  3796. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3797. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3798. args: [],
  3799. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3800. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3801. referencedClasses: []
  3802. }),
  3803. smalltalk.SequenceableCollectionTest);
  3804. smalltalk.addMethod(
  3805. smalltalk.method({
  3806. selector: "testIndexOfStartingAt",
  3807. protocol: 'tests',
  3808. fn: function (){
  3809. var self=this;
  3810. var jsNull;
  3811. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3812. return smalltalk.withContext(function($ctx1) {
  3813. var $2,$1,$4,$3;
  3814. jsNull=_st($JSON())._parse_("null");
  3815. self._samplesDo_((function(index,value){
  3816. return smalltalk.withContext(function($ctx2) {
  3817. $2=self._collection();
  3818. $ctx2.sendIdx["collection"]=1;
  3819. $1=_st($2)._indexOf_startingAt_(value,(1));
  3820. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3821. self._assert_equals_($1,index);
  3822. $ctx2.sendIdx["assert:equals:"]=1;
  3823. $4=self._collection();
  3824. $ctx2.sendIdx["collection"]=2;
  3825. $3=_st($4)._indexOf_startingAt_(value,index);
  3826. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3827. self._assert_equals_($3,index);
  3828. $ctx2.sendIdx["assert:equals:"]=2;
  3829. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3830. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3831. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3832. args: [],
  3833. 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 ]",
  3834. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3835. referencedClasses: ["JSON"]
  3836. }),
  3837. smalltalk.SequenceableCollectionTest);
  3838. smalltalk.addMethod(
  3839. smalltalk.method({
  3840. selector: "testIndexOfStartingAtWithNull",
  3841. protocol: 'tests',
  3842. fn: function (){
  3843. var self=this;
  3844. var jsNull;
  3845. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3846. return smalltalk.withContext(function($ctx1) {
  3847. var $1,$2;
  3848. jsNull=_st($JSON())._parse_("null");
  3849. self._samplesDo_((function(index,value){
  3850. var collection;
  3851. return smalltalk.withContext(function($ctx2) {
  3852. collection=self._collection();
  3853. collection;
  3854. _st(collection)._at_put_(index,jsNull);
  3855. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3856. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3857. self._assert_equals_($1,index);
  3858. $ctx2.sendIdx["assert:equals:"]=1;
  3859. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3860. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3861. self._assert_equals_($2,index);
  3862. $ctx2.sendIdx["assert:equals:"]=2;
  3863. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3864. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3865. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3866. args: [],
  3867. 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 ]",
  3868. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3869. referencedClasses: ["JSON"]
  3870. }),
  3871. smalltalk.SequenceableCollectionTest);
  3872. smalltalk.addMethod(
  3873. smalltalk.method({
  3874. selector: "testLast",
  3875. protocol: 'tests',
  3876. fn: function (){
  3877. var self=this;
  3878. return smalltalk.withContext(function($ctx1) {
  3879. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3880. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3881. args: [],
  3882. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3883. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3884. referencedClasses: []
  3885. }),
  3886. smalltalk.SequenceableCollectionTest);
  3887. smalltalk.addMethod(
  3888. smalltalk.method({
  3889. selector: "testLastN",
  3890. protocol: 'tests',
  3891. fn: function (){
  3892. var self=this;
  3893. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3894. return smalltalk.withContext(function($ctx1) {
  3895. var $2,$1,$4,$3,$6,$5,$7;
  3896. $2=self._collection();
  3897. $ctx1.sendIdx["collection"]=1;
  3898. $1=_st($2)._last_((2));
  3899. $ctx1.sendIdx["last:"]=1;
  3900. self._assert_equals_($1,self._collectionLastTwo());
  3901. $ctx1.sendIdx["assert:equals:"]=1;
  3902. $4=self._collection();
  3903. $ctx1.sendIdx["collection"]=2;
  3904. $3=_st($4)._last_((0));
  3905. $ctx1.sendIdx["last:"]=2;
  3906. self._assert_equals_($3,_st(self._collectionClass())._new());
  3907. $ctx1.sendIdx["assert:equals:"]=2;
  3908. $6=self._collection();
  3909. $ctx1.sendIdx["collection"]=3;
  3910. $5=_st($6)._last_(self._collectionSize());
  3911. $ctx1.sendIdx["last:"]=3;
  3912. $7=self._collection();
  3913. $ctx1.sendIdx["collection"]=4;
  3914. self._assert_equals_($5,$7);
  3915. self._should_raise_((function(){
  3916. return smalltalk.withContext(function($ctx2) {
  3917. return _st(self._collection())._last_((33));
  3918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3919. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3920. args: [],
  3921. 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",
  3922. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3923. referencedClasses: ["Error"]
  3924. }),
  3925. smalltalk.SequenceableCollectionTest);
  3926. smalltalk.addMethod(
  3927. smalltalk.method({
  3928. selector: "testSecond",
  3929. protocol: 'tests',
  3930. fn: function (){
  3931. var self=this;
  3932. return smalltalk.withContext(function($ctx1) {
  3933. var $2,$1;
  3934. $2=self._collection();
  3935. $ctx1.sendIdx["collection"]=1;
  3936. $1=_st($2)._second();
  3937. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3938. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3939. args: [],
  3940. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3941. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3942. referencedClasses: []
  3943. }),
  3944. smalltalk.SequenceableCollectionTest);
  3945. smalltalk.addMethod(
  3946. smalltalk.method({
  3947. selector: "testThird",
  3948. protocol: 'tests',
  3949. fn: function (){
  3950. var self=this;
  3951. return smalltalk.withContext(function($ctx1) {
  3952. var $2,$1;
  3953. $2=self._collection();
  3954. $ctx1.sendIdx["collection"]=1;
  3955. $1=_st($2)._third();
  3956. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3957. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3958. args: [],
  3959. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3960. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3961. referencedClasses: []
  3962. }),
  3963. smalltalk.SequenceableCollectionTest);
  3964. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3965. smalltalk.addMethod(
  3966. smalltalk.method({
  3967. selector: "collection",
  3968. protocol: 'fixture',
  3969. fn: function (){
  3970. var self=this;
  3971. return smalltalk.withContext(function($ctx1) {
  3972. var $1;
  3973. $1=[(1), (2), (3), (-4)];
  3974. return $1;
  3975. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3976. args: [],
  3977. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3978. messageSends: [],
  3979. referencedClasses: []
  3980. }),
  3981. smalltalk.ArrayTest);
  3982. smalltalk.addMethod(
  3983. smalltalk.method({
  3984. selector: "collectionFirst",
  3985. protocol: 'fixture',
  3986. fn: function (){
  3987. var self=this;
  3988. return smalltalk.withContext(function($ctx1) {
  3989. return (1);
  3990. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3991. args: [],
  3992. source: "collectionFirst\x0a\x09^ 1",
  3993. messageSends: [],
  3994. referencedClasses: []
  3995. }),
  3996. smalltalk.ArrayTest);
  3997. smalltalk.addMethod(
  3998. smalltalk.method({
  3999. selector: "collectionFirstTwo",
  4000. protocol: 'fixture',
  4001. fn: function (){
  4002. var self=this;
  4003. return smalltalk.withContext(function($ctx1) {
  4004. var $1;
  4005. $1=[(1), (2)];
  4006. return $1;
  4007. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  4008. args: [],
  4009. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. smalltalk.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "collectionLast",
  4017. protocol: 'fixture',
  4018. fn: function (){
  4019. var self=this;
  4020. return smalltalk.withContext(function($ctx1) {
  4021. return (-4);
  4022. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  4023. args: [],
  4024. source: "collectionLast\x0a\x09^ -4",
  4025. messageSends: [],
  4026. referencedClasses: []
  4027. }),
  4028. smalltalk.ArrayTest);
  4029. smalltalk.addMethod(
  4030. smalltalk.method({
  4031. selector: "collectionLastTwo",
  4032. protocol: 'fixture',
  4033. fn: function (){
  4034. var self=this;
  4035. return smalltalk.withContext(function($ctx1) {
  4036. var $1;
  4037. $1=[(3), (-4)];
  4038. return $1;
  4039. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  4040. args: [],
  4041. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4042. messageSends: [],
  4043. referencedClasses: []
  4044. }),
  4045. smalltalk.ArrayTest);
  4046. smalltalk.addMethod(
  4047. smalltalk.method({
  4048. selector: "collectionOfPrintStrings",
  4049. protocol: 'fixture',
  4050. fn: function (){
  4051. var self=this;
  4052. return smalltalk.withContext(function($ctx1) {
  4053. var $1;
  4054. $1=["1", "2", "3", "-4"];
  4055. return $1;
  4056. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  4057. args: [],
  4058. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4059. messageSends: [],
  4060. referencedClasses: []
  4061. }),
  4062. smalltalk.ArrayTest);
  4063. smalltalk.addMethod(
  4064. smalltalk.method({
  4065. selector: "collectionSize",
  4066. protocol: 'fixture',
  4067. fn: function (){
  4068. var self=this;
  4069. return smalltalk.withContext(function($ctx1) {
  4070. return (4);
  4071. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  4072. args: [],
  4073. source: "collectionSize\x0a\x09^ 4",
  4074. messageSends: [],
  4075. referencedClasses: []
  4076. }),
  4077. smalltalk.ArrayTest);
  4078. smalltalk.addMethod(
  4079. smalltalk.method({
  4080. selector: "collectionWithDuplicates",
  4081. protocol: 'fixture',
  4082. fn: function (){
  4083. var self=this;
  4084. return smalltalk.withContext(function($ctx1) {
  4085. var $1;
  4086. $1=["a", "b", "c", (1), (2), (1), "a"];
  4087. return $1;
  4088. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  4089. args: [],
  4090. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4091. messageSends: [],
  4092. referencedClasses: []
  4093. }),
  4094. smalltalk.ArrayTest);
  4095. smalltalk.addMethod(
  4096. smalltalk.method({
  4097. selector: "collectionWithNewValue",
  4098. protocol: 'fixture',
  4099. fn: function (){
  4100. var self=this;
  4101. return smalltalk.withContext(function($ctx1) {
  4102. var $1;
  4103. $1=[(1), (2), (3), (-4), "N"];
  4104. return $1;
  4105. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  4106. args: [],
  4107. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4108. messageSends: [],
  4109. referencedClasses: []
  4110. }),
  4111. smalltalk.ArrayTest);
  4112. smalltalk.addMethod(
  4113. smalltalk.method({
  4114. selector: "sampleNewIndex",
  4115. protocol: 'fixture',
  4116. fn: function (){
  4117. var self=this;
  4118. return smalltalk.withContext(function($ctx1) {
  4119. return (5);
  4120. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  4121. args: [],
  4122. source: "sampleNewIndex\x0a\x09^ 5",
  4123. messageSends: [],
  4124. referencedClasses: []
  4125. }),
  4126. smalltalk.ArrayTest);
  4127. smalltalk.addMethod(
  4128. smalltalk.method({
  4129. selector: "samplesDo:",
  4130. protocol: 'fixture',
  4131. fn: function (aBlock){
  4132. var self=this;
  4133. return smalltalk.withContext(function($ctx1) {
  4134. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4135. _st(aBlock)._value_value_((3),(3));
  4136. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  4137. args: ["aBlock"],
  4138. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4139. messageSends: ["samplesDo:", "value:value:"],
  4140. referencedClasses: []
  4141. }),
  4142. smalltalk.ArrayTest);
  4143. smalltalk.addMethod(
  4144. smalltalk.method({
  4145. selector: "testAdd",
  4146. protocol: 'tests',
  4147. fn: function (){
  4148. var self=this;
  4149. var array;
  4150. return smalltalk.withContext(function($ctx1) {
  4151. array=self._collection();
  4152. _st(array)._add_((6));
  4153. self._assert_equals_(_st(array)._last(),(6));
  4154. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  4155. args: [],
  4156. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4157. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4158. referencedClasses: []
  4159. }),
  4160. smalltalk.ArrayTest);
  4161. smalltalk.addMethod(
  4162. smalltalk.method({
  4163. selector: "testAddFirst",
  4164. protocol: 'tests',
  4165. fn: function (){
  4166. var self=this;
  4167. return smalltalk.withContext(function($ctx1) {
  4168. var $1,$2;
  4169. $1=self._collection();
  4170. _st($1)._addFirst_((0));
  4171. $2=_st($1)._yourself();
  4172. self._assert_equals_(_st($2)._first(),(0));
  4173. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  4174. args: [],
  4175. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4176. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4177. referencedClasses: []
  4178. }),
  4179. smalltalk.ArrayTest);
  4180. smalltalk.addMethod(
  4181. smalltalk.method({
  4182. selector: "testPrintString",
  4183. protocol: 'tests',
  4184. fn: function (){
  4185. var self=this;
  4186. var array;
  4187. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4188. return smalltalk.withContext(function($ctx1) {
  4189. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4190. array=_st($Array())._new();
  4191. $1=_st(array)._printString();
  4192. $ctx1.sendIdx["printString"]=1;
  4193. self._assert_equals_($1,"an Array ()");
  4194. $ctx1.sendIdx["assert:equals:"]=1;
  4195. $2=array;
  4196. _st($2)._add_((1));
  4197. $ctx1.sendIdx["add:"]=1;
  4198. $3=_st($2)._add_((3));
  4199. $ctx1.sendIdx["add:"]=2;
  4200. $4=_st(array)._printString();
  4201. $ctx1.sendIdx["printString"]=2;
  4202. self._assert_equals_($4,"an Array (1 3)");
  4203. $ctx1.sendIdx["assert:equals:"]=2;
  4204. _st(array)._add_("foo");
  4205. $5=_st(array)._printString();
  4206. $ctx1.sendIdx["printString"]=3;
  4207. self._assert_equals_($5,"an Array (1 3 'foo')");
  4208. $ctx1.sendIdx["assert:equals:"]=3;
  4209. $6=array;
  4210. _st($6)._remove_((1));
  4211. $ctx1.sendIdx["remove:"]=1;
  4212. $7=_st($6)._remove_((3));
  4213. $8=_st(array)._printString();
  4214. $ctx1.sendIdx["printString"]=4;
  4215. self._assert_equals_($8,"an Array ('foo')");
  4216. $ctx1.sendIdx["assert:equals:"]=4;
  4217. _st(array)._addLast_((3));
  4218. $ctx1.sendIdx["addLast:"]=1;
  4219. $9=_st(array)._printString();
  4220. $ctx1.sendIdx["printString"]=5;
  4221. self._assert_equals_($9,"an Array ('foo' 3)");
  4222. $ctx1.sendIdx["assert:equals:"]=5;
  4223. _st(array)._addLast_((3));
  4224. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4225. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4226. args: [],
  4227. 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)'.",
  4228. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4229. referencedClasses: ["Array"]
  4230. }),
  4231. smalltalk.ArrayTest);
  4232. smalltalk.addMethod(
  4233. smalltalk.method({
  4234. selector: "testRemove",
  4235. protocol: 'tests',
  4236. fn: function (){
  4237. var self=this;
  4238. var array;
  4239. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4240. return smalltalk.withContext(function($ctx1) {
  4241. array=[(1), (2), (3), (4), (5)];
  4242. _st(array)._remove_((3));
  4243. $ctx1.sendIdx["remove:"]=1;
  4244. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4245. self._should_raise_((function(){
  4246. return smalltalk.withContext(function($ctx2) {
  4247. return _st(array)._remove_((3));
  4248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4249. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4250. args: [],
  4251. 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",
  4252. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4253. referencedClasses: ["Error"]
  4254. }),
  4255. smalltalk.ArrayTest);
  4256. smalltalk.addMethod(
  4257. smalltalk.method({
  4258. selector: "testRemoveFromTo",
  4259. protocol: 'tests',
  4260. fn: function (){
  4261. var self=this;
  4262. return smalltalk.withContext(function($ctx1) {
  4263. var $1,$2;
  4264. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4265. $ctx1.sendIdx["removeFrom:to:"]=1;
  4266. self._assert_equals_($1,[(4)]);
  4267. $ctx1.sendIdx["assert:equals:"]=1;
  4268. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4269. $ctx1.sendIdx["removeFrom:to:"]=2;
  4270. self._assert_equals_($2,[(1), (4)]);
  4271. $ctx1.sendIdx["assert:equals:"]=2;
  4272. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4273. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4274. args: [],
  4275. 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)",
  4276. messageSends: ["assert:equals:", "removeFrom:to:"],
  4277. referencedClasses: []
  4278. }),
  4279. smalltalk.ArrayTest);
  4280. smalltalk.addMethod(
  4281. smalltalk.method({
  4282. selector: "testRemoveIndex",
  4283. protocol: 'tests',
  4284. fn: function (){
  4285. var self=this;
  4286. return smalltalk.withContext(function($ctx1) {
  4287. var $1,$2;
  4288. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4289. $ctx1.sendIdx["removeIndex:"]=1;
  4290. self._assert_equals_($1,[(1), (3), (4)]);
  4291. $ctx1.sendIdx["assert:equals:"]=1;
  4292. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4293. $ctx1.sendIdx["removeIndex:"]=2;
  4294. self._assert_equals_($2,[(2), (3), (4)]);
  4295. $ctx1.sendIdx["assert:equals:"]=2;
  4296. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4297. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4298. args: [],
  4299. 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: #()",
  4300. messageSends: ["assert:equals:", "removeIndex:"],
  4301. referencedClasses: []
  4302. }),
  4303. smalltalk.ArrayTest);
  4304. smalltalk.addMethod(
  4305. smalltalk.method({
  4306. selector: "testRemoveLast",
  4307. protocol: 'tests',
  4308. fn: function (){
  4309. var self=this;
  4310. var array;
  4311. return smalltalk.withContext(function($ctx1) {
  4312. array=[(1), (2)];
  4313. _st(array)._removeLast();
  4314. self._assert_equals_(_st(array)._last(),(1));
  4315. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4316. args: [],
  4317. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4318. messageSends: ["removeLast", "assert:equals:", "last"],
  4319. referencedClasses: []
  4320. }),
  4321. smalltalk.ArrayTest);
  4322. smalltalk.addMethod(
  4323. smalltalk.method({
  4324. selector: "testReversed",
  4325. protocol: 'tests',
  4326. fn: function (){
  4327. var self=this;
  4328. var array;
  4329. return smalltalk.withContext(function($ctx1) {
  4330. array=[(5), (4), (3), (2), (1)];
  4331. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4332. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4333. args: [],
  4334. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4335. messageSends: ["assert:equals:", "reversed"],
  4336. referencedClasses: []
  4337. }),
  4338. smalltalk.ArrayTest);
  4339. smalltalk.addMethod(
  4340. smalltalk.method({
  4341. selector: "testSort",
  4342. protocol: 'tests',
  4343. fn: function (){
  4344. var self=this;
  4345. var array;
  4346. return smalltalk.withContext(function($ctx1) {
  4347. array=[(3), (1), (4), (5), (2)];
  4348. _st(array)._sort();
  4349. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4350. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4351. args: [],
  4352. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4353. messageSends: ["sort", "assert:equals:"],
  4354. referencedClasses: []
  4355. }),
  4356. smalltalk.ArrayTest);
  4357. smalltalk.addMethod(
  4358. smalltalk.method({
  4359. selector: "collectionClass",
  4360. protocol: 'fixture',
  4361. fn: function (){
  4362. var self=this;
  4363. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4364. return smalltalk.withContext(function($ctx1) {
  4365. return $Array();
  4366. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4367. args: [],
  4368. source: "collectionClass\x0a\x09^ Array",
  4369. messageSends: [],
  4370. referencedClasses: ["Array"]
  4371. }),
  4372. smalltalk.ArrayTest.klass);
  4373. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4374. smalltalk.addMethod(
  4375. smalltalk.method({
  4376. selector: "collection",
  4377. protocol: 'fixture',
  4378. fn: function (){
  4379. var self=this;
  4380. return smalltalk.withContext(function($ctx1) {
  4381. return "helLo";
  4382. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4383. args: [],
  4384. source: "collection\x0a\x09^ 'helLo'",
  4385. messageSends: [],
  4386. referencedClasses: []
  4387. }),
  4388. smalltalk.StringTest);
  4389. smalltalk.addMethod(
  4390. smalltalk.method({
  4391. selector: "collectionFirst",
  4392. protocol: 'fixture',
  4393. fn: function (){
  4394. var self=this;
  4395. return smalltalk.withContext(function($ctx1) {
  4396. return "h";
  4397. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4398. args: [],
  4399. source: "collectionFirst\x0a\x09^ 'h'",
  4400. messageSends: [],
  4401. referencedClasses: []
  4402. }),
  4403. smalltalk.StringTest);
  4404. smalltalk.addMethod(
  4405. smalltalk.method({
  4406. selector: "collectionFirstTwo",
  4407. protocol: 'fixture',
  4408. fn: function (){
  4409. var self=this;
  4410. return smalltalk.withContext(function($ctx1) {
  4411. return "he";
  4412. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4413. args: [],
  4414. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4415. messageSends: [],
  4416. referencedClasses: []
  4417. }),
  4418. smalltalk.StringTest);
  4419. smalltalk.addMethod(
  4420. smalltalk.method({
  4421. selector: "collectionLast",
  4422. protocol: 'fixture',
  4423. fn: function (){
  4424. var self=this;
  4425. return smalltalk.withContext(function($ctx1) {
  4426. return "o";
  4427. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4428. args: [],
  4429. source: "collectionLast\x0a\x09^ 'o'",
  4430. messageSends: [],
  4431. referencedClasses: []
  4432. }),
  4433. smalltalk.StringTest);
  4434. smalltalk.addMethod(
  4435. smalltalk.method({
  4436. selector: "collectionLastTwo",
  4437. protocol: 'fixture',
  4438. fn: function (){
  4439. var self=this;
  4440. return smalltalk.withContext(function($ctx1) {
  4441. return "Lo";
  4442. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4443. args: [],
  4444. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4445. messageSends: [],
  4446. referencedClasses: []
  4447. }),
  4448. smalltalk.StringTest);
  4449. smalltalk.addMethod(
  4450. smalltalk.method({
  4451. selector: "collectionOfPrintStrings",
  4452. protocol: 'fixture',
  4453. fn: function (){
  4454. var self=this;
  4455. return smalltalk.withContext(function($ctx1) {
  4456. return "'h''e''l''L''o'";
  4457. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4458. args: [],
  4459. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4460. messageSends: [],
  4461. referencedClasses: []
  4462. }),
  4463. smalltalk.StringTest);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "collectionSize",
  4467. protocol: 'fixture',
  4468. fn: function (){
  4469. var self=this;
  4470. return smalltalk.withContext(function($ctx1) {
  4471. return (5);
  4472. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4473. args: [],
  4474. source: "collectionSize\x0a\x09^ 5",
  4475. messageSends: [],
  4476. referencedClasses: []
  4477. }),
  4478. smalltalk.StringTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "collectionWithDuplicates",
  4482. protocol: 'fixture',
  4483. fn: function (){
  4484. var self=this;
  4485. return smalltalk.withContext(function($ctx1) {
  4486. return "abbaerte";
  4487. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4488. args: [],
  4489. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4490. messageSends: [],
  4491. referencedClasses: []
  4492. }),
  4493. smalltalk.StringTest);
  4494. smalltalk.addMethod(
  4495. smalltalk.method({
  4496. selector: "collectionWithNewValue",
  4497. protocol: 'fixture',
  4498. fn: function (){
  4499. var self=this;
  4500. return smalltalk.withContext(function($ctx1) {
  4501. return "helLoN";
  4502. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4503. args: [],
  4504. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4505. messageSends: [],
  4506. referencedClasses: []
  4507. }),
  4508. smalltalk.StringTest);
  4509. smalltalk.addMethod(
  4510. smalltalk.method({
  4511. selector: "sampleNewValueAsCollection",
  4512. protocol: 'fixture',
  4513. fn: function (){
  4514. var self=this;
  4515. return smalltalk.withContext(function($ctx1) {
  4516. return "N";
  4517. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4518. args: [],
  4519. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4520. messageSends: [],
  4521. referencedClasses: []
  4522. }),
  4523. smalltalk.StringTest);
  4524. smalltalk.addMethod(
  4525. smalltalk.method({
  4526. selector: "samplesDo:",
  4527. protocol: 'fixture',
  4528. fn: function (aBlock){
  4529. var self=this;
  4530. return smalltalk.withContext(function($ctx1) {
  4531. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4532. _st(aBlock)._value_value_((3),"l");
  4533. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4534. args: ["aBlock"],
  4535. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4536. messageSends: ["samplesDo:", "value:value:"],
  4537. referencedClasses: []
  4538. }),
  4539. smalltalk.StringTest);
  4540. smalltalk.addMethod(
  4541. smalltalk.method({
  4542. selector: "testAddAll",
  4543. protocol: 'tests',
  4544. fn: function (){
  4545. var self=this;
  4546. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4547. return smalltalk.withContext(function($ctx1) {
  4548. var $1;
  4549. self._should_raise_((function(){
  4550. return smalltalk.withContext(function($ctx2) {
  4551. $1=self._collection();
  4552. $ctx2.sendIdx["collection"]=1;
  4553. return _st($1)._addAll_(self._collection());
  4554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4555. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4556. args: [],
  4557. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4558. messageSends: ["should:raise:", "addAll:", "collection"],
  4559. referencedClasses: ["Error"]
  4560. }),
  4561. smalltalk.StringTest);
  4562. smalltalk.addMethod(
  4563. smalltalk.method({
  4564. selector: "testAddRemove",
  4565. protocol: 'tests',
  4566. fn: function (){
  4567. var self=this;
  4568. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4569. return smalltalk.withContext(function($ctx1) {
  4570. self._should_raise_((function(){
  4571. return smalltalk.withContext(function($ctx2) {
  4572. return "hello"._add_("a");
  4573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4574. $ctx1.sendIdx["should:raise:"]=1;
  4575. self._should_raise_((function(){
  4576. return smalltalk.withContext(function($ctx2) {
  4577. return "hello"._remove_("h");
  4578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4579. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4580. args: [],
  4581. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4582. messageSends: ["should:raise:", "add:", "remove:"],
  4583. referencedClasses: ["Error"]
  4584. }),
  4585. smalltalk.StringTest);
  4586. smalltalk.addMethod(
  4587. smalltalk.method({
  4588. selector: "testAsArray",
  4589. protocol: 'tests',
  4590. fn: function (){
  4591. var self=this;
  4592. return smalltalk.withContext(function($ctx1) {
  4593. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4594. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4595. args: [],
  4596. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4597. messageSends: ["assert:equals:", "asArray"],
  4598. referencedClasses: []
  4599. }),
  4600. smalltalk.StringTest);
  4601. smalltalk.addMethod(
  4602. smalltalk.method({
  4603. selector: "testAsLowerCase",
  4604. protocol: 'tests',
  4605. fn: function (){
  4606. var self=this;
  4607. return smalltalk.withContext(function($ctx1) {
  4608. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4609. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4610. args: [],
  4611. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4612. messageSends: ["assert:equals:", "asLowercase"],
  4613. referencedClasses: []
  4614. }),
  4615. smalltalk.StringTest);
  4616. smalltalk.addMethod(
  4617. smalltalk.method({
  4618. selector: "testAsNumber",
  4619. protocol: 'tests',
  4620. fn: function (){
  4621. var self=this;
  4622. return smalltalk.withContext(function($ctx1) {
  4623. var $1,$2;
  4624. $1="3"._asNumber();
  4625. $ctx1.sendIdx["asNumber"]=1;
  4626. self._assert_equals_($1,(3));
  4627. $ctx1.sendIdx["assert:equals:"]=1;
  4628. $2="-3"._asNumber();
  4629. $ctx1.sendIdx["asNumber"]=2;
  4630. self._assert_equals_($2,(-3));
  4631. $ctx1.sendIdx["assert:equals:"]=2;
  4632. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4633. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4634. args: [],
  4635. 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.",
  4636. messageSends: ["assert:equals:", "asNumber"],
  4637. referencedClasses: []
  4638. }),
  4639. smalltalk.StringTest);
  4640. smalltalk.addMethod(
  4641. smalltalk.method({
  4642. selector: "testAsUpperCase",
  4643. protocol: 'tests',
  4644. fn: function (){
  4645. var self=this;
  4646. return smalltalk.withContext(function($ctx1) {
  4647. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4648. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4649. args: [],
  4650. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4651. messageSends: ["assert:equals:", "asUppercase"],
  4652. referencedClasses: []
  4653. }),
  4654. smalltalk.StringTest);
  4655. smalltalk.addMethod(
  4656. smalltalk.method({
  4657. selector: "testAsciiValue",
  4658. protocol: 'tests',
  4659. fn: function (){
  4660. var self=this;
  4661. var characterA,characterU;
  4662. return smalltalk.withContext(function($ctx1) {
  4663. var $1;
  4664. characterA="A";
  4665. characterU="U";
  4666. $1=_st(characterA)._asciiValue();
  4667. $ctx1.sendIdx["asciiValue"]=1;
  4668. self._assert_equals_($1,(65));
  4669. $ctx1.sendIdx["assert:equals:"]=1;
  4670. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4671. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4672. args: [],
  4673. 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",
  4674. messageSends: ["assert:equals:", "asciiValue"],
  4675. referencedClasses: []
  4676. }),
  4677. smalltalk.StringTest);
  4678. smalltalk.addMethod(
  4679. smalltalk.method({
  4680. selector: "testAtIfAbsentPut",
  4681. protocol: 'tests',
  4682. fn: function (){
  4683. var self=this;
  4684. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4685. return smalltalk.withContext(function($ctx1) {
  4686. self._should_raise_((function(){
  4687. return smalltalk.withContext(function($ctx2) {
  4688. return "hello"._at_ifAbsentPut_((6),(function(){
  4689. return smalltalk.withContext(function($ctx3) {
  4690. return "a";
  4691. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4693. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
  4694. args: [],
  4695. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4696. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4697. referencedClasses: ["Error"]
  4698. }),
  4699. smalltalk.StringTest);
  4700. smalltalk.addMethod(
  4701. smalltalk.method({
  4702. selector: "testAtPut",
  4703. protocol: 'tests',
  4704. fn: function (){
  4705. var self=this;
  4706. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4707. return smalltalk.withContext(function($ctx1) {
  4708. self._should_raise_((function(){
  4709. return smalltalk.withContext(function($ctx2) {
  4710. return "hello"._at_put_((1),"a");
  4711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4712. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4713. args: [],
  4714. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4715. messageSends: ["should:raise:", "at:put:"],
  4716. referencedClasses: ["Error"]
  4717. }),
  4718. smalltalk.StringTest);
  4719. smalltalk.addMethod(
  4720. smalltalk.method({
  4721. selector: "testCapitalized",
  4722. protocol: 'tests',
  4723. fn: function (){
  4724. var self=this;
  4725. return smalltalk.withContext(function($ctx1) {
  4726. var $1,$2,$3;
  4727. $1="test"._capitalized();
  4728. $ctx1.sendIdx["capitalized"]=1;
  4729. self._assert_equals_($1,"Test");
  4730. $ctx1.sendIdx["assert:equals:"]=1;
  4731. $2="Test"._capitalized();
  4732. $ctx1.sendIdx["capitalized"]=2;
  4733. self._assert_equals_($2,"Test");
  4734. $ctx1.sendIdx["assert:equals:"]=2;
  4735. self._assert_equals_(""._capitalized(),"");
  4736. $ctx1.sendIdx["assert:equals:"]=3;
  4737. $3="Test"._isCapitalized();
  4738. $ctx1.sendIdx["isCapitalized"]=1;
  4739. self._assert_equals_($3,true);
  4740. $ctx1.sendIdx["assert:equals:"]=4;
  4741. self._assert_equals_("test"._isCapitalized(),false);
  4742. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4743. args: [],
  4744. 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.",
  4745. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4746. referencedClasses: []
  4747. }),
  4748. smalltalk.StringTest);
  4749. smalltalk.addMethod(
  4750. smalltalk.method({
  4751. selector: "testCharCodeAt",
  4752. protocol: 'tests',
  4753. fn: function (){
  4754. var self=this;
  4755. return smalltalk.withContext(function($ctx1) {
  4756. var $1,$2,$3,$4,$5;
  4757. $1="jackie"._charCodeAt_((1));
  4758. $ctx1.sendIdx["charCodeAt:"]=1;
  4759. self._assert_equals_($1,(106));
  4760. $ctx1.sendIdx["assert:equals:"]=1;
  4761. $2="jackie"._charCodeAt_((2));
  4762. $ctx1.sendIdx["charCodeAt:"]=2;
  4763. self._assert_equals_($2,(97));
  4764. $ctx1.sendIdx["assert:equals:"]=2;
  4765. $3="jackie"._charCodeAt_((3));
  4766. $ctx1.sendIdx["charCodeAt:"]=3;
  4767. self._assert_equals_($3,(99));
  4768. $ctx1.sendIdx["assert:equals:"]=3;
  4769. $4="jackie"._charCodeAt_((4));
  4770. $ctx1.sendIdx["charCodeAt:"]=4;
  4771. self._assert_equals_($4,(107));
  4772. $ctx1.sendIdx["assert:equals:"]=4;
  4773. $5="jackie"._charCodeAt_((5));
  4774. $ctx1.sendIdx["charCodeAt:"]=5;
  4775. self._assert_equals_($5,(105));
  4776. $ctx1.sendIdx["assert:equals:"]=5;
  4777. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4778. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4779. args: [],
  4780. 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",
  4781. messageSends: ["assert:equals:", "charCodeAt:"],
  4782. referencedClasses: []
  4783. }),
  4784. smalltalk.StringTest);
  4785. smalltalk.addMethod(
  4786. smalltalk.method({
  4787. selector: "testCopyFromTo",
  4788. protocol: 'tests',
  4789. fn: function (){
  4790. var self=this;
  4791. return smalltalk.withContext(function($ctx1) {
  4792. var $1;
  4793. $1="jackie"._copyFrom_to_((1),(3));
  4794. $ctx1.sendIdx["copyFrom:to:"]=1;
  4795. self._assert_equals_($1,"jac");
  4796. $ctx1.sendIdx["assert:equals:"]=1;
  4797. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4798. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4799. args: [],
  4800. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4801. messageSends: ["assert:equals:", "copyFrom:to:"],
  4802. referencedClasses: []
  4803. }),
  4804. smalltalk.StringTest);
  4805. smalltalk.addMethod(
  4806. smalltalk.method({
  4807. selector: "testCopyWithoutAll",
  4808. protocol: 'tests',
  4809. fn: function (){
  4810. var self=this;
  4811. return smalltalk.withContext(function($ctx1) {
  4812. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4813. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4814. args: [],
  4815. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4816. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4817. referencedClasses: []
  4818. }),
  4819. smalltalk.StringTest);
  4820. smalltalk.addMethod(
  4821. smalltalk.method({
  4822. selector: "testEquality",
  4823. protocol: 'tests',
  4824. fn: function (){
  4825. var self=this;
  4826. return smalltalk.withContext(function($ctx1) {
  4827. var $1,$2,$3;
  4828. self._assert_equals_("hello","hello");
  4829. $ctx1.sendIdx["assert:equals:"]=1;
  4830. $1="hello".__eq("world");
  4831. $ctx1.sendIdx["="]=1;
  4832. self._deny_($1);
  4833. $ctx1.sendIdx["deny:"]=1;
  4834. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4835. return smalltalk.withContext(function($ctx2) {
  4836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4837. $ctx1.sendIdx["="]=2;
  4838. self._deny_($2);
  4839. $ctx1.sendIdx["deny:"]=2;
  4840. $3="hello"._yourself();
  4841. $ctx1.sendIdx["yourself"]=1;
  4842. self._assert_equals_("hello",$3);
  4843. $ctx1.sendIdx["assert:equals:"]=2;
  4844. self._assert_equals_("hello"._yourself(),"hello");
  4845. self._deny_("".__eq((0)));
  4846. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4847. args: [],
  4848. 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",
  4849. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4850. referencedClasses: []
  4851. }),
  4852. smalltalk.StringTest);
  4853. smalltalk.addMethod(
  4854. smalltalk.method({
  4855. selector: "testIdentity",
  4856. protocol: 'tests',
  4857. fn: function (){
  4858. var self=this;
  4859. return smalltalk.withContext(function($ctx1) {
  4860. var $1,$2,$4,$3,$5;
  4861. $1="hello".__eq_eq("hello");
  4862. $ctx1.sendIdx["=="]=1;
  4863. self._assert_($1);
  4864. $ctx1.sendIdx["assert:"]=1;
  4865. $2="hello".__eq_eq("world");
  4866. $ctx1.sendIdx["=="]=2;
  4867. self._deny_($2);
  4868. $ctx1.sendIdx["deny:"]=1;
  4869. $4="hello"._yourself();
  4870. $ctx1.sendIdx["yourself"]=1;
  4871. $3="hello".__eq_eq($4);
  4872. $ctx1.sendIdx["=="]=3;
  4873. self._assert_($3);
  4874. $ctx1.sendIdx["assert:"]=2;
  4875. $5=_st("hello"._yourself()).__eq_eq("hello");
  4876. $ctx1.sendIdx["=="]=4;
  4877. self._assert_($5);
  4878. self._deny_("".__eq_eq((0)));
  4879. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4880. args: [],
  4881. 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",
  4882. messageSends: ["assert:", "==", "deny:", "yourself"],
  4883. referencedClasses: []
  4884. }),
  4885. smalltalk.StringTest);
  4886. smalltalk.addMethod(
  4887. smalltalk.method({
  4888. selector: "testIdentityHash",
  4889. protocol: 'tests',
  4890. fn: function (){
  4891. var self=this;
  4892. return smalltalk.withContext(function($ctx1) {
  4893. var $1,$2,$4,$3;
  4894. $1="foo"._identityHash();
  4895. $ctx1.sendIdx["identityHash"]=1;
  4896. $2="foo"._identityHash();
  4897. $ctx1.sendIdx["identityHash"]=2;
  4898. self._assert_equals_($1,$2);
  4899. $4="foo"._identityHash();
  4900. $ctx1.sendIdx["identityHash"]=3;
  4901. $3=_st($4).__eq("bar"._identityHash());
  4902. self._deny_($3);
  4903. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4904. args: [],
  4905. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4906. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4907. referencedClasses: []
  4908. }),
  4909. smalltalk.StringTest);
  4910. smalltalk.addMethod(
  4911. smalltalk.method({
  4912. selector: "testIncludesSubString",
  4913. protocol: 'tests',
  4914. fn: function (){
  4915. var self=this;
  4916. return smalltalk.withContext(function($ctx1) {
  4917. var $1;
  4918. $1="amber"._includesSubString_("ber");
  4919. $ctx1.sendIdx["includesSubString:"]=1;
  4920. self._assert_($1);
  4921. self._deny_("amber"._includesSubString_("zork"));
  4922. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4923. args: [],
  4924. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4925. messageSends: ["assert:", "includesSubString:", "deny:"],
  4926. referencedClasses: []
  4927. }),
  4928. smalltalk.StringTest);
  4929. smalltalk.addMethod(
  4930. smalltalk.method({
  4931. selector: "testIndexOfStartingAtWithNull",
  4932. protocol: 'tests',
  4933. fn: function (){
  4934. var self=this;
  4935. return smalltalk.withContext(function($ctx1) {
  4936. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{},smalltalk.StringTest)})},
  4937. args: [],
  4938. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4939. messageSends: [],
  4940. referencedClasses: []
  4941. }),
  4942. smalltalk.StringTest);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "testIndexOfWithNull",
  4946. protocol: 'tests',
  4947. fn: function (){
  4948. var self=this;
  4949. return smalltalk.withContext(function($ctx1) {
  4950. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{},smalltalk.StringTest)})},
  4951. args: [],
  4952. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4953. messageSends: [],
  4954. referencedClasses: []
  4955. }),
  4956. smalltalk.StringTest);
  4957. smalltalk.addMethod(
  4958. smalltalk.method({
  4959. selector: "testIsVowel",
  4960. protocol: 'tests',
  4961. fn: function (){
  4962. var self=this;
  4963. var vowel,consonant;
  4964. return smalltalk.withContext(function($ctx1) {
  4965. var $1;
  4966. vowel="u";
  4967. consonant="z";
  4968. $1=_st(vowel)._isVowel();
  4969. $ctx1.sendIdx["isVowel"]=1;
  4970. self._assert_equals_($1,true);
  4971. $ctx1.sendIdx["assert:equals:"]=1;
  4972. self._assert_equals_(_st(consonant)._isVowel(),false);
  4973. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4974. args: [],
  4975. 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",
  4976. messageSends: ["assert:equals:", "isVowel"],
  4977. referencedClasses: []
  4978. }),
  4979. smalltalk.StringTest);
  4980. smalltalk.addMethod(
  4981. smalltalk.method({
  4982. selector: "testJoin",
  4983. protocol: 'tests',
  4984. fn: function (){
  4985. var self=this;
  4986. return smalltalk.withContext(function($ctx1) {
  4987. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4988. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4989. args: [],
  4990. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4991. messageSends: ["assert:equals:", "join:"],
  4992. referencedClasses: []
  4993. }),
  4994. smalltalk.StringTest);
  4995. smalltalk.addMethod(
  4996. smalltalk.method({
  4997. selector: "testRemoveAll",
  4998. protocol: 'tests',
  4999. fn: function (){
  5000. var self=this;
  5001. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5002. return smalltalk.withContext(function($ctx1) {
  5003. self._should_raise_((function(){
  5004. return smalltalk.withContext(function($ctx2) {
  5005. return _st(self._collection())._removeAll();
  5006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5007. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  5008. args: [],
  5009. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  5010. messageSends: ["should:raise:", "removeAll", "collection"],
  5011. referencedClasses: ["Error"]
  5012. }),
  5013. smalltalk.StringTest);
  5014. smalltalk.addMethod(
  5015. smalltalk.method({
  5016. selector: "testReversed",
  5017. protocol: 'tests',
  5018. fn: function (){
  5019. var self=this;
  5020. return smalltalk.withContext(function($ctx1) {
  5021. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5022. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  5023. args: [],
  5024. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5025. messageSends: ["assert:equals:", "reversed"],
  5026. referencedClasses: []
  5027. }),
  5028. smalltalk.StringTest);
  5029. smalltalk.addMethod(
  5030. smalltalk.method({
  5031. selector: "testStreamContents",
  5032. protocol: 'tests',
  5033. fn: function (){
  5034. var self=this;
  5035. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5036. return smalltalk.withContext(function($ctx1) {
  5037. var $1;
  5038. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5039. return smalltalk.withContext(function($ctx2) {
  5040. _st(aStream)._nextPutAll_("hello");
  5041. $ctx2.sendIdx["nextPutAll:"]=1;
  5042. _st(aStream)._space();
  5043. $1=_st(aStream)._nextPutAll_("world");
  5044. return $1;
  5045. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5046. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  5047. args: [],
  5048. 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'",
  5049. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5050. referencedClasses: ["String"]
  5051. }),
  5052. smalltalk.StringTest);
  5053. smalltalk.addMethod(
  5054. smalltalk.method({
  5055. selector: "testSubStrings",
  5056. protocol: 'tests',
  5057. fn: function (){
  5058. var self=this;
  5059. return smalltalk.withContext(function($ctx1) {
  5060. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5061. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  5062. args: [],
  5063. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5064. messageSends: ["assert:equals:", "subStrings:"],
  5065. referencedClasses: []
  5066. }),
  5067. smalltalk.StringTest);
  5068. smalltalk.addMethod(
  5069. smalltalk.method({
  5070. selector: "testTrim",
  5071. protocol: 'tests',
  5072. fn: function (){
  5073. var self=this;
  5074. return smalltalk.withContext(function($ctx1) {
  5075. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5076. $ctx1.sendIdx["assert:equals:"]=1;
  5077. self._assert_equals_("jackie "._trimRight(),"jackie");
  5078. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  5079. args: [],
  5080. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5081. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5082. referencedClasses: []
  5083. }),
  5084. smalltalk.StringTest);
  5085. smalltalk.addMethod(
  5086. smalltalk.method({
  5087. selector: "collectionClass",
  5088. protocol: 'fixture',
  5089. fn: function (){
  5090. var self=this;
  5091. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5092. return smalltalk.withContext(function($ctx1) {
  5093. return $String();
  5094. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  5095. args: [],
  5096. source: "collectionClass\x0a\x09^ String",
  5097. messageSends: [],
  5098. referencedClasses: ["String"]
  5099. }),
  5100. smalltalk.StringTest.klass);
  5101. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  5102. smalltalk.addMethod(
  5103. smalltalk.method({
  5104. selector: "collection",
  5105. protocol: 'fixture',
  5106. fn: function (){
  5107. var self=this;
  5108. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5109. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5110. return smalltalk.withContext(function($ctx1) {
  5111. var $2,$3,$1;
  5112. $2=_st($Set())._new();
  5113. _st($2)._add_($Smalltalk());
  5114. $ctx1.sendIdx["add:"]=1;
  5115. _st($2)._add_(nil);
  5116. $ctx1.sendIdx["add:"]=2;
  5117. _st($2)._add_((3).__at((3)));
  5118. $ctx1.sendIdx["add:"]=3;
  5119. _st($2)._add_(false);
  5120. $3=_st($2)._yourself();
  5121. $1=$3;
  5122. return $1;
  5123. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  5124. args: [],
  5125. 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",
  5126. messageSends: ["add:", "new", "@", "yourself"],
  5127. referencedClasses: ["Set", "Smalltalk"]
  5128. }),
  5129. smalltalk.SetTest);
  5130. smalltalk.addMethod(
  5131. smalltalk.method({
  5132. selector: "collectionOfPrintStrings",
  5133. protocol: 'fixture',
  5134. fn: function (){
  5135. var self=this;
  5136. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5137. return smalltalk.withContext(function($ctx1) {
  5138. var $2,$3,$1;
  5139. $2=_st($Set())._new();
  5140. _st($2)._add_("a SmalltalkImage");
  5141. $ctx1.sendIdx["add:"]=1;
  5142. _st($2)._add_("nil");
  5143. $ctx1.sendIdx["add:"]=2;
  5144. _st($2)._add_("3@3");
  5145. $ctx1.sendIdx["add:"]=3;
  5146. _st($2)._add_("false");
  5147. $3=_st($2)._yourself();
  5148. $1=$3;
  5149. return $1;
  5150. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  5151. args: [],
  5152. 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",
  5153. messageSends: ["add:", "new", "yourself"],
  5154. referencedClasses: ["Set"]
  5155. }),
  5156. smalltalk.SetTest);
  5157. smalltalk.addMethod(
  5158. smalltalk.method({
  5159. selector: "collectionSize",
  5160. protocol: 'fixture',
  5161. fn: function (){
  5162. var self=this;
  5163. return smalltalk.withContext(function($ctx1) {
  5164. return (4);
  5165. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  5166. args: [],
  5167. source: "collectionSize\x0a\x09^ 4",
  5168. messageSends: [],
  5169. referencedClasses: []
  5170. }),
  5171. smalltalk.SetTest);
  5172. smalltalk.addMethod(
  5173. smalltalk.method({
  5174. selector: "collectionWithDuplicates",
  5175. protocol: 'fixture',
  5176. fn: function (){
  5177. var self=this;
  5178. return smalltalk.withContext(function($ctx1) {
  5179. var $2,$3,$1;
  5180. $2=self._collection();
  5181. _st($2)._add_((0));
  5182. $3=_st($2)._yourself();
  5183. $1=$3;
  5184. return $1;
  5185. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  5186. args: [],
  5187. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5188. messageSends: ["add:", "collection", "yourself"],
  5189. referencedClasses: []
  5190. }),
  5191. smalltalk.SetTest);
  5192. smalltalk.addMethod(
  5193. smalltalk.method({
  5194. selector: "collectionWithNewValue",
  5195. protocol: 'fixture',
  5196. fn: function (){
  5197. var self=this;
  5198. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5199. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5200. return smalltalk.withContext(function($ctx1) {
  5201. var $2,$3,$1;
  5202. $2=_st($Set())._new();
  5203. _st($2)._add_($Smalltalk());
  5204. $ctx1.sendIdx["add:"]=1;
  5205. _st($2)._add_(nil);
  5206. $ctx1.sendIdx["add:"]=2;
  5207. _st($2)._add_((3).__at((3)));
  5208. $ctx1.sendIdx["add:"]=3;
  5209. _st($2)._add_("N");
  5210. $ctx1.sendIdx["add:"]=4;
  5211. _st($2)._add_(false);
  5212. $3=_st($2)._yourself();
  5213. $1=$3;
  5214. return $1;
  5215. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  5216. args: [],
  5217. 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",
  5218. messageSends: ["add:", "new", "@", "yourself"],
  5219. referencedClasses: ["Set", "Smalltalk"]
  5220. }),
  5221. smalltalk.SetTest);
  5222. smalltalk.addMethod(
  5223. smalltalk.method({
  5224. selector: "testAddAll",
  5225. protocol: 'tests',
  5226. fn: function (){
  5227. var self=this;
  5228. return smalltalk.withContext(function($ctx1) {
  5229. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5230. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5231. $2=self._collection();
  5232. $ctx1.sendIdx["collection"]=1;
  5233. $3=$2;
  5234. $4=self._collection();
  5235. $ctx1.sendIdx["collection"]=2;
  5236. _st($3)._addAll_($4);
  5237. $ctx1.sendIdx["addAll:"]=1;
  5238. $5=_st($2)._yourself();
  5239. $ctx1.sendIdx["yourself"]=1;
  5240. $1=$5;
  5241. $6=self._collection();
  5242. $ctx1.sendIdx["collection"]=3;
  5243. self._assert_equals_($1,$6);
  5244. $ctx1.sendIdx["assert:equals:"]=1;
  5245. $8=self._collection();
  5246. $ctx1.sendIdx["collection"]=4;
  5247. $9=$8;
  5248. $10=self._collectionWithNewValue();
  5249. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5250. _st($9)._addAll_($10);
  5251. $ctx1.sendIdx["addAll:"]=2;
  5252. $11=_st($8)._yourself();
  5253. $ctx1.sendIdx["yourself"]=2;
  5254. $7=$11;
  5255. $12=self._collectionWithNewValue();
  5256. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5257. self._assert_equals_($7,$12);
  5258. $ctx1.sendIdx["assert:equals:"]=2;
  5259. $14=self._collectionWithNewValue();
  5260. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5261. _st($14)._addAll_(self._collection());
  5262. $15=_st($14)._yourself();
  5263. $13=$15;
  5264. self._assert_equals_($13,self._collectionWithNewValue());
  5265. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  5266. args: [],
  5267. 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",
  5268. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5269. referencedClasses: []
  5270. }),
  5271. smalltalk.SetTest);
  5272. smalltalk.addMethod(
  5273. smalltalk.method({
  5274. selector: "testAddRemove",
  5275. protocol: 'tests',
  5276. fn: function (){
  5277. var self=this;
  5278. var set;
  5279. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5280. return smalltalk.withContext(function($ctx1) {
  5281. var $1,$2;
  5282. set=_st($Set())._new();
  5283. self._assert_(_st(set)._isEmpty());
  5284. $ctx1.sendIdx["assert:"]=1;
  5285. _st(set)._add_((3));
  5286. $ctx1.sendIdx["add:"]=1;
  5287. $1=_st(set)._includes_((3));
  5288. $ctx1.sendIdx["includes:"]=1;
  5289. self._assert_($1);
  5290. $ctx1.sendIdx["assert:"]=2;
  5291. _st(set)._add_((5));
  5292. $2=_st(set)._includes_((5));
  5293. $ctx1.sendIdx["includes:"]=2;
  5294. self._assert_($2);
  5295. _st(set)._remove_((3));
  5296. self._deny_(_st(set)._includes_((3)));
  5297. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5298. args: [],
  5299. 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)",
  5300. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5301. referencedClasses: ["Set"]
  5302. }),
  5303. smalltalk.SetTest);
  5304. smalltalk.addMethod(
  5305. smalltalk.method({
  5306. selector: "testAt",
  5307. protocol: 'tests',
  5308. fn: function (){
  5309. var self=this;
  5310. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5311. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5312. return smalltalk.withContext(function($ctx1) {
  5313. self._should_raise_((function(){
  5314. return smalltalk.withContext(function($ctx2) {
  5315. return _st(_st($Set())._new())._at_put_((1),(2));
  5316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5317. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5318. args: [],
  5319. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5320. messageSends: ["should:raise:", "at:put:", "new"],
  5321. referencedClasses: ["Set", "Error"]
  5322. }),
  5323. smalltalk.SetTest);
  5324. smalltalk.addMethod(
  5325. smalltalk.method({
  5326. selector: "testCollect",
  5327. protocol: 'tests',
  5328. fn: function (){
  5329. var self=this;
  5330. return smalltalk.withContext(function($ctx1) {
  5331. var $2,$1;
  5332. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5333. $2=[(5), (6), (8)]._asSet();
  5334. $ctx1.sendIdx["asSet"]=1;
  5335. $1=_st($2)._collect_((function(x){
  5336. return smalltalk.withContext(function($ctx2) {
  5337. return _st(x).__backslash_backslash((3));
  5338. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5339. self._assert_equals_($1,[(0), (2)]._asSet());
  5340. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5341. args: [],
  5342. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5343. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5344. referencedClasses: []
  5345. }),
  5346. smalltalk.SetTest);
  5347. smalltalk.addMethod(
  5348. smalltalk.method({
  5349. selector: "testComma",
  5350. protocol: 'tests',
  5351. fn: function (){
  5352. var self=this;
  5353. return smalltalk.withContext(function($ctx1) {
  5354. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5355. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5356. $2=self._collection();
  5357. $ctx1.sendIdx["collection"]=1;
  5358. $3=self._collection();
  5359. $ctx1.sendIdx["collection"]=2;
  5360. $1=_st($2).__comma($3);
  5361. $ctx1.sendIdx[","]=1;
  5362. $4=self._collection();
  5363. $ctx1.sendIdx["collection"]=3;
  5364. self._assert_equals_($1,$4);
  5365. $ctx1.sendIdx["assert:equals:"]=1;
  5366. $6=self._collection();
  5367. $ctx1.sendIdx["collection"]=4;
  5368. $7=self._collectionWithNewValue();
  5369. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5370. $5=_st($6).__comma($7);
  5371. $ctx1.sendIdx[","]=2;
  5372. $8=self._collectionWithNewValue();
  5373. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5374. self._assert_equals_($5,$8);
  5375. $ctx1.sendIdx["assert:equals:"]=2;
  5376. $10=self._collectionWithNewValue();
  5377. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5378. $9=_st($10).__comma(self._collection());
  5379. self._assert_equals_($9,self._collectionWithNewValue());
  5380. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5381. args: [],
  5382. 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",
  5383. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5384. referencedClasses: []
  5385. }),
  5386. smalltalk.SetTest);
  5387. smalltalk.addMethod(
  5388. smalltalk.method({
  5389. selector: "testComparing",
  5390. protocol: 'tests',
  5391. fn: function (){
  5392. var self=this;
  5393. return smalltalk.withContext(function($ctx1) {
  5394. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5395. $1=[(0), (2)]._asSet();
  5396. $ctx1.sendIdx["asSet"]=1;
  5397. $2=[(0), (2)]._asSet();
  5398. $ctx1.sendIdx["asSet"]=2;
  5399. self._assert_equals_($1,$2);
  5400. $ctx1.sendIdx["assert:equals:"]=1;
  5401. $3=[(2), (0)]._asSet();
  5402. $ctx1.sendIdx["asSet"]=3;
  5403. $4=[(0), (2)]._asSet();
  5404. $ctx1.sendIdx["asSet"]=4;
  5405. self._assert_equals_($3,$4);
  5406. $6=[(0), (2), (3)]._asSet();
  5407. $ctx1.sendIdx["asSet"]=5;
  5408. $7=[(0), (2)]._asSet();
  5409. $ctx1.sendIdx["asSet"]=6;
  5410. $5=_st($6).__eq($7);
  5411. $ctx1.sendIdx["="]=1;
  5412. self._deny_($5);
  5413. $ctx1.sendIdx["deny:"]=1;
  5414. $9=[(1), (2)]._asSet();
  5415. $ctx1.sendIdx["asSet"]=7;
  5416. $8=_st($9).__eq([(0), (2)]._asSet());
  5417. self._deny_($8);
  5418. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5419. args: [],
  5420. 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",
  5421. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5422. referencedClasses: []
  5423. }),
  5424. smalltalk.SetTest);
  5425. smalltalk.addMethod(
  5426. smalltalk.method({
  5427. selector: "testPrintString",
  5428. protocol: 'tests',
  5429. fn: function (){
  5430. var self=this;
  5431. var set;
  5432. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5433. return smalltalk.withContext(function($ctx1) {
  5434. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5435. set=_st($Set())._new();
  5436. $1=_st(set)._printString();
  5437. $ctx1.sendIdx["printString"]=1;
  5438. self._assert_equals_($1,"a Set ()");
  5439. $ctx1.sendIdx["assert:equals:"]=1;
  5440. $2=set;
  5441. _st($2)._add_((1));
  5442. $ctx1.sendIdx["add:"]=1;
  5443. $3=_st($2)._add_((3));
  5444. $ctx1.sendIdx["add:"]=2;
  5445. $4=_st(set)._printString();
  5446. $ctx1.sendIdx["printString"]=2;
  5447. self._assert_equals_($4,"a Set (1 3)");
  5448. $ctx1.sendIdx["assert:equals:"]=2;
  5449. _st(set)._add_("foo");
  5450. $ctx1.sendIdx["add:"]=3;
  5451. $5=_st(set)._printString();
  5452. $ctx1.sendIdx["printString"]=3;
  5453. self._assert_equals_($5,"a Set (1 3 'foo')");
  5454. $ctx1.sendIdx["assert:equals:"]=3;
  5455. $6=set;
  5456. _st($6)._remove_((1));
  5457. $ctx1.sendIdx["remove:"]=1;
  5458. $7=_st($6)._remove_((3));
  5459. $8=_st(set)._printString();
  5460. $ctx1.sendIdx["printString"]=4;
  5461. self._assert_equals_($8,"a Set ('foo')");
  5462. $ctx1.sendIdx["assert:equals:"]=4;
  5463. _st(set)._add_((3));
  5464. $ctx1.sendIdx["add:"]=4;
  5465. $9=_st(set)._printString();
  5466. $ctx1.sendIdx["printString"]=5;
  5467. self._assert_equals_($9,"a Set (3 'foo')");
  5468. $ctx1.sendIdx["assert:equals:"]=5;
  5469. _st(set)._add_((3));
  5470. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5471. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5472. args: [],
  5473. 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'')'",
  5474. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5475. referencedClasses: ["Set"]
  5476. }),
  5477. smalltalk.SetTest);
  5478. smalltalk.addMethod(
  5479. smalltalk.method({
  5480. selector: "testUnboxedObjects",
  5481. protocol: 'tests',
  5482. fn: function (){
  5483. var self=this;
  5484. return smalltalk.withContext(function($ctx1) {
  5485. var $4,$3,$2,$1;
  5486. $4="foo"._yourself();
  5487. $ctx1.sendIdx["yourself"]=1;
  5488. $3=[$4,"foo"._yourself()];
  5489. $2=_st($3)._asSet();
  5490. $1=_st($2)._asArray();
  5491. self._assert_equals_($1,["foo"]);
  5492. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5493. args: [],
  5494. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5495. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5496. referencedClasses: []
  5497. }),
  5498. smalltalk.SetTest);
  5499. smalltalk.addMethod(
  5500. smalltalk.method({
  5501. selector: "testUnicity",
  5502. protocol: 'tests',
  5503. fn: function (){
  5504. var self=this;
  5505. var set;
  5506. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5507. return smalltalk.withContext(function($ctx1) {
  5508. var $1;
  5509. set=_st($Set())._new();
  5510. _st(set)._add_((21));
  5511. $ctx1.sendIdx["add:"]=1;
  5512. _st(set)._add_("hello");
  5513. $ctx1.sendIdx["add:"]=2;
  5514. _st(set)._add_((21));
  5515. $ctx1.sendIdx["add:"]=3;
  5516. $1=_st(set)._size();
  5517. $ctx1.sendIdx["size"]=1;
  5518. self._assert_equals_($1,(2));
  5519. $ctx1.sendIdx["assert:equals:"]=1;
  5520. _st(set)._add_("hello");
  5521. self._assert_equals_(_st(set)._size(),(2));
  5522. $ctx1.sendIdx["assert:equals:"]=2;
  5523. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5524. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5525. args: [],
  5526. 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')",
  5527. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5528. referencedClasses: ["Set"]
  5529. }),
  5530. smalltalk.SetTest);
  5531. smalltalk.addMethod(
  5532. smalltalk.method({
  5533. selector: "collectionClass",
  5534. protocol: 'fixture',
  5535. fn: function (){
  5536. var self=this;
  5537. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5538. return smalltalk.withContext(function($ctx1) {
  5539. return $Set();
  5540. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5541. args: [],
  5542. source: "collectionClass\x0a\x09^ Set",
  5543. messageSends: [],
  5544. referencedClasses: ["Set"]
  5545. }),
  5546. smalltalk.SetTest.klass);
  5547. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5548. smalltalk.addMethod(
  5549. smalltalk.method({
  5550. selector: "testShow",
  5551. protocol: 'tests',
  5552. fn: function (){
  5553. var self=this;
  5554. var originalTranscript;
  5555. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5556. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5557. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5558. return smalltalk.withContext(function($ctx1) {
  5559. originalTranscript=_st($Transcript())._current();
  5560. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5561. $ctx1.sendIdx["register:"]=1;
  5562. self._shouldnt_raise_((function(){
  5563. return smalltalk.withContext(function($ctx2) {
  5564. return _st($Transcript())._show_("Hello console!");
  5565. $ctx2.sendIdx["show:"]=1;
  5566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5567. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5568. self._shouldnt_raise_((function(){
  5569. return smalltalk.withContext(function($ctx2) {
  5570. return _st($Transcript())._show_(console);
  5571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5572. _st($Transcript())._register_(originalTranscript);
  5573. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5574. args: [],
  5575. 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.",
  5576. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5577. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5578. }),
  5579. smalltalk.ConsoleTranscriptTest);
  5580. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5581. smalltalk.addMethod(
  5582. smalltalk.method({
  5583. selector: "jsObject",
  5584. protocol: 'accessing',
  5585. fn: function (){
  5586. var self=this;
  5587. return smalltalk.withContext(function($ctx1) {
  5588. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5589. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5590. args: [],
  5591. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5592. messageSends: [],
  5593. referencedClasses: []
  5594. }),
  5595. smalltalk.JSObjectProxyTest);
  5596. smalltalk.addMethod(
  5597. smalltalk.method({
  5598. selector: "testAtIfAbsent",
  5599. protocol: 'tests',
  5600. fn: function (){
  5601. var self=this;
  5602. var testObject;
  5603. return smalltalk.withContext(function($ctx1) {
  5604. var $1,$2,$3;
  5605. testObject=self._jsObject();
  5606. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5607. return smalltalk.withContext(function($ctx2) {
  5608. return "Property does not exist";
  5609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5610. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5611. self._assert_equals_($1,"Property does not exist");
  5612. $ctx1.sendIdx["assert:equals:"]=1;
  5613. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5614. return smalltalk.withContext(function($ctx2) {
  5615. return "Property does not exist";
  5616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5617. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5618. self._assert_equals_($2,nil);
  5619. $ctx1.sendIdx["assert:equals:"]=2;
  5620. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5621. return smalltalk.withContext(function($ctx2) {
  5622. return "Property does not exist";
  5623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5624. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5625. self._assert_equals_($3,(1));
  5626. $ctx1.sendIdx["assert:equals:"]=3;
  5627. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5628. return smalltalk.withContext(function($ctx2) {
  5629. return "Property does not exist";
  5630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5631. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5632. args: [],
  5633. 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.",
  5634. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5635. referencedClasses: []
  5636. }),
  5637. smalltalk.JSObjectProxyTest);
  5638. smalltalk.addMethod(
  5639. smalltalk.method({
  5640. selector: "testAtIfPresent",
  5641. protocol: 'tests',
  5642. fn: function (){
  5643. var self=this;
  5644. var testObject;
  5645. return smalltalk.withContext(function($ctx1) {
  5646. var $2,$1,$4,$3,$6,$5;
  5647. testObject=self._jsObject();
  5648. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5649. return smalltalk.withContext(function($ctx2) {
  5650. $2=_st(x)._asString();
  5651. $ctx2.sendIdx["asString"]=1;
  5652. return "hello ".__comma($2);
  5653. $ctx2.sendIdx[","]=1;
  5654. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5655. $ctx1.sendIdx["at:ifPresent:"]=1;
  5656. self._assert_equals_($1,nil);
  5657. $ctx1.sendIdx["assert:equals:"]=1;
  5658. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5659. return smalltalk.withContext(function($ctx2) {
  5660. $4=_st(x)._asString();
  5661. $ctx2.sendIdx["asString"]=2;
  5662. return "hello ".__comma($4);
  5663. $ctx2.sendIdx[","]=2;
  5664. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5665. $ctx1.sendIdx["at:ifPresent:"]=2;
  5666. self._assert_equals_($3,"hello nil");
  5667. $ctx1.sendIdx["assert:equals:"]=2;
  5668. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5669. return smalltalk.withContext(function($ctx2) {
  5670. $6=_st(x)._asString();
  5671. $ctx2.sendIdx["asString"]=3;
  5672. return "hello ".__comma($6);
  5673. $ctx2.sendIdx[","]=3;
  5674. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5675. $ctx1.sendIdx["at:ifPresent:"]=3;
  5676. self._assert_equals_($5,"hello 1");
  5677. $ctx1.sendIdx["assert:equals:"]=3;
  5678. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5679. return smalltalk.withContext(function($ctx2) {
  5680. return "hello ".__comma(_st(x)._asString());
  5681. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5682. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5683. args: [],
  5684. 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'.",
  5685. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5686. referencedClasses: []
  5687. }),
  5688. smalltalk.JSObjectProxyTest);
  5689. smalltalk.addMethod(
  5690. smalltalk.method({
  5691. selector: "testAtIfPresentIfAbsent",
  5692. protocol: 'tests',
  5693. fn: function (){
  5694. var self=this;
  5695. var testObject;
  5696. return smalltalk.withContext(function($ctx1) {
  5697. var $2,$1,$4,$3,$6,$5;
  5698. testObject=self._jsObject();
  5699. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5700. return smalltalk.withContext(function($ctx2) {
  5701. $2=_st(x)._asString();
  5702. $ctx2.sendIdx["asString"]=1;
  5703. return "hello ".__comma($2);
  5704. $ctx2.sendIdx[","]=1;
  5705. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5706. return smalltalk.withContext(function($ctx2) {
  5707. return "not present";
  5708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5709. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5710. self._assert_equals_($1,"not present");
  5711. $ctx1.sendIdx["assert:equals:"]=1;
  5712. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5713. return smalltalk.withContext(function($ctx2) {
  5714. $4=_st(x)._asString();
  5715. $ctx2.sendIdx["asString"]=2;
  5716. return "hello ".__comma($4);
  5717. $ctx2.sendIdx[","]=2;
  5718. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5719. return smalltalk.withContext(function($ctx2) {
  5720. return "not present";
  5721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5722. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5723. self._assert_equals_($3,"hello nil");
  5724. $ctx1.sendIdx["assert:equals:"]=2;
  5725. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5726. return smalltalk.withContext(function($ctx2) {
  5727. $6=_st(x)._asString();
  5728. $ctx2.sendIdx["asString"]=3;
  5729. return "hello ".__comma($6);
  5730. $ctx2.sendIdx[","]=3;
  5731. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5732. return smalltalk.withContext(function($ctx2) {
  5733. return "not present";
  5734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5735. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5736. self._assert_equals_($5,"hello 1");
  5737. $ctx1.sendIdx["assert:equals:"]=3;
  5738. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5739. return smalltalk.withContext(function($ctx2) {
  5740. return "hello ".__comma(_st(x)._asString());
  5741. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5742. return smalltalk.withContext(function($ctx2) {
  5743. return "not present";
  5744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5745. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5746. args: [],
  5747. 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'.",
  5748. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5749. referencedClasses: []
  5750. }),
  5751. smalltalk.JSObjectProxyTest);
  5752. smalltalk.addMethod(
  5753. smalltalk.method({
  5754. selector: "testAtPut",
  5755. protocol: 'tests',
  5756. fn: function (){
  5757. var self=this;
  5758. var testObject;
  5759. return smalltalk.withContext(function($ctx1) {
  5760. var $2,$1;
  5761. testObject=self._jsObject();
  5762. $2=_st(testObject)._at_("abc");
  5763. $ctx1.sendIdx["at:"]=1;
  5764. $1=_st($2).__tild_eq("xyz");
  5765. self._assert_($1);
  5766. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5767. $ctx1.sendIdx["assert:equals:"]=1;
  5768. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5769. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5770. args: [],
  5771. 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'",
  5772. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5773. referencedClasses: []
  5774. }),
  5775. smalltalk.JSObjectProxyTest);
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "testDNU",
  5779. protocol: 'tests',
  5780. fn: function (){
  5781. var self=this;
  5782. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5783. return smalltalk.withContext(function($ctx1) {
  5784. self._should_raise_((function(){
  5785. return smalltalk.withContext(function($ctx2) {
  5786. return _st(self._jsObject())._foo();
  5787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5788. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5789. args: [],
  5790. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5791. messageSends: ["should:raise:", "foo", "jsObject"],
  5792. referencedClasses: ["MessageNotUnderstood"]
  5793. }),
  5794. smalltalk.JSObjectProxyTest);
  5795. smalltalk.addMethod(
  5796. smalltalk.method({
  5797. selector: "testMessageSend",
  5798. protocol: 'tests',
  5799. fn: function (){
  5800. var self=this;
  5801. return smalltalk.withContext(function($ctx1) {
  5802. var $2,$1,$4,$3;
  5803. $2=self._jsObject();
  5804. $ctx1.sendIdx["jsObject"]=1;
  5805. $1=_st($2)._a();
  5806. self._assert_equals_($1,(1));
  5807. $ctx1.sendIdx["assert:equals:"]=1;
  5808. $4=self._jsObject();
  5809. $ctx1.sendIdx["jsObject"]=2;
  5810. $3=_st($4)._b();
  5811. self._assert_equals_($3,(2));
  5812. $ctx1.sendIdx["assert:equals:"]=2;
  5813. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5814. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5815. args: [],
  5816. 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",
  5817. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5818. referencedClasses: []
  5819. }),
  5820. smalltalk.JSObjectProxyTest);
  5821. smalltalk.addMethod(
  5822. smalltalk.method({
  5823. selector: "testMethodWithArguments",
  5824. protocol: 'tests',
  5825. fn: function (){
  5826. var self=this;
  5827. return smalltalk.withContext(function($ctx1) {
  5828. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5829. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5830. args: [],
  5831. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5832. messageSends: ["assert:equals:", "c:", "jsObject"],
  5833. referencedClasses: []
  5834. }),
  5835. smalltalk.JSObjectProxyTest);
  5836. smalltalk.addMethod(
  5837. smalltalk.method({
  5838. selector: "testPrinting",
  5839. protocol: 'tests',
  5840. fn: function (){
  5841. var self=this;
  5842. return smalltalk.withContext(function($ctx1) {
  5843. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5844. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5845. args: [],
  5846. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5847. messageSends: ["assert:equals:", "printString", "jsObject"],
  5848. referencedClasses: []
  5849. }),
  5850. smalltalk.JSObjectProxyTest);
  5851. smalltalk.addMethod(
  5852. smalltalk.method({
  5853. selector: "testPropertyThatReturnsEmptyString",
  5854. protocol: 'tests',
  5855. fn: function (){
  5856. var self=this;
  5857. var object;
  5858. return smalltalk.withContext(function($ctx1) {
  5859. var $1;
  5860. object=self._jsObject();
  5861. $1=_st(object)._d();
  5862. $ctx1.sendIdx["d"]=1;
  5863. self._assert_equals_($1,"");
  5864. $ctx1.sendIdx["assert:equals:"]=1;
  5865. _st(object)._d_("hello");
  5866. self._assert_equals_(_st(object)._d(),"hello");
  5867. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5868. args: [],
  5869. 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'",
  5870. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5871. referencedClasses: []
  5872. }),
  5873. smalltalk.JSObjectProxyTest);
  5874. smalltalk.addMethod(
  5875. smalltalk.method({
  5876. selector: "testPropertyThatReturnsUndefined",
  5877. protocol: 'tests',
  5878. fn: function (){
  5879. var self=this;
  5880. var object;
  5881. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5882. return smalltalk.withContext(function($ctx1) {
  5883. object=self._jsObject();
  5884. self._shouldnt_raise_((function(){
  5885. return smalltalk.withContext(function($ctx2) {
  5886. return _st(object)._e();
  5887. $ctx2.sendIdx["e"]=1;
  5888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5889. self._assert_(_st(_st(object)._e())._isNil());
  5890. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5891. args: [],
  5892. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5893. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5894. referencedClasses: ["MessageNotUnderstood"]
  5895. }),
  5896. smalltalk.JSObjectProxyTest);
  5897. smalltalk.addMethod(
  5898. smalltalk.method({
  5899. selector: "testValue",
  5900. protocol: 'tests',
  5901. fn: function (){
  5902. var self=this;
  5903. var testObject;
  5904. return smalltalk.withContext(function($ctx1) {
  5905. testObject=self._jsObject();
  5906. _st(testObject)._at_put_("value","aValue");
  5907. self._assert_equals_(_st(testObject)._value(),"aValue");
  5908. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5909. args: [],
  5910. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5911. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5912. referencedClasses: []
  5913. }),
  5914. smalltalk.JSObjectProxyTest);
  5915. smalltalk.addMethod(
  5916. smalltalk.method({
  5917. selector: "testYourself",
  5918. protocol: 'tests',
  5919. fn: function (){
  5920. var self=this;
  5921. var object;
  5922. return smalltalk.withContext(function($ctx1) {
  5923. var $1,$2;
  5924. $1=self._jsObject();
  5925. _st($1)._d_("test");
  5926. $2=_st($1)._yourself();
  5927. object=$2;
  5928. self._assert_equals_(_st(object)._d(),"test");
  5929. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5930. args: [],
  5931. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5932. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5933. referencedClasses: []
  5934. }),
  5935. smalltalk.JSObjectProxyTest);
  5936. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5937. smalltalk.addMethod(
  5938. smalltalk.method({
  5939. selector: "testCatchingException",
  5940. protocol: 'tests',
  5941. fn: function (){
  5942. var self=this;
  5943. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5944. return smalltalk.withContext(function($ctx1) {
  5945. _st((function(){
  5946. return smalltalk.withContext(function($ctx2) {
  5947. return self._throwException();
  5948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5949. return smalltalk.withContext(function($ctx2) {
  5950. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5951. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5952. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5953. args: [],
  5954. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5955. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5956. referencedClasses: ["Error"]
  5957. }),
  5958. smalltalk.JavaScriptExceptionTest);
  5959. smalltalk.addMethod(
  5960. smalltalk.method({
  5961. selector: "testRaisingException",
  5962. protocol: 'tests',
  5963. fn: function (){
  5964. var self=this;
  5965. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5966. return smalltalk.withContext(function($ctx1) {
  5967. self._should_raise_((function(){
  5968. return smalltalk.withContext(function($ctx2) {
  5969. return self._throwException();
  5970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5971. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5972. args: [],
  5973. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5974. messageSends: ["should:raise:", "throwException"],
  5975. referencedClasses: ["JavaScriptException"]
  5976. }),
  5977. smalltalk.JavaScriptExceptionTest);
  5978. smalltalk.addMethod(
  5979. smalltalk.method({
  5980. selector: "throwException",
  5981. protocol: 'helpers',
  5982. fn: function (){
  5983. var self=this;
  5984. return smalltalk.withContext(function($ctx1) {
  5985. throw 'test';
  5986. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5987. args: [],
  5988. source: "throwException\x0a\x09<throw 'test'>",
  5989. messageSends: [],
  5990. referencedClasses: []
  5991. }),
  5992. smalltalk.JavaScriptExceptionTest);
  5993. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5994. smalltalk.addMethod(
  5995. smalltalk.method({
  5996. selector: "testValue",
  5997. protocol: 'tests',
  5998. fn: function (){
  5999. var self=this;
  6000. var messageSend;
  6001. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6002. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6003. return smalltalk.withContext(function($ctx1) {
  6004. var $1,$2;
  6005. $1=_st($MessageSend())._new();
  6006. $ctx1.sendIdx["new"]=1;
  6007. _st($1)._receiver_(_st($Object())._new());
  6008. _st($1)._selector_("asString");
  6009. $2=_st($1)._yourself();
  6010. messageSend=$2;
  6011. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6012. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6013. args: [],
  6014. 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'",
  6015. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6016. referencedClasses: ["MessageSend", "Object"]
  6017. }),
  6018. smalltalk.MessageSendTest);
  6019. smalltalk.addMethod(
  6020. smalltalk.method({
  6021. selector: "testValueWithArguments",
  6022. protocol: 'tests',
  6023. fn: function (){
  6024. var self=this;
  6025. var messageSend;
  6026. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6027. return smalltalk.withContext(function($ctx1) {
  6028. var $1,$2;
  6029. $1=_st($MessageSend())._new();
  6030. _st($1)._receiver_((2));
  6031. _st($1)._selector_("+");
  6032. $2=_st($1)._yourself();
  6033. messageSend=$2;
  6034. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6035. $ctx1.sendIdx["assert:equals:"]=1;
  6036. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6037. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6038. args: [],
  6039. 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",
  6040. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6041. referencedClasses: ["MessageSend"]
  6042. }),
  6043. smalltalk.MessageSendTest);
  6044. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6045. smalltalk.addMethod(
  6046. smalltalk.method({
  6047. selector: "codeGeneratorClass",
  6048. protocol: 'accessing',
  6049. fn: function (){
  6050. var self=this;
  6051. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6052. return smalltalk.withContext(function($ctx1) {
  6053. return $CodeGenerator();
  6054. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  6055. args: [],
  6056. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6057. messageSends: [],
  6058. referencedClasses: ["CodeGenerator"]
  6059. }),
  6060. smalltalk.MethodInheritanceTest);
  6061. smalltalk.addMethod(
  6062. smalltalk.method({
  6063. selector: "compiler",
  6064. protocol: 'factory',
  6065. fn: function (){
  6066. var self=this;
  6067. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6068. return smalltalk.withContext(function($ctx1) {
  6069. var $2,$3,$1;
  6070. $2=_st($Compiler())._new();
  6071. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6072. $3=_st($2)._yourself();
  6073. $1=$3;
  6074. return $1;
  6075. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  6076. args: [],
  6077. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6078. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6079. referencedClasses: ["Compiler"]
  6080. }),
  6081. smalltalk.MethodInheritanceTest);
  6082. smalltalk.addMethod(
  6083. smalltalk.method({
  6084. selector: "deinstallBottom",
  6085. protocol: 'testing',
  6086. fn: function (){
  6087. var self=this;
  6088. return smalltalk.withContext(function($ctx1) {
  6089. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6090. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  6091. args: [],
  6092. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6093. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6094. referencedClasses: []
  6095. }),
  6096. smalltalk.MethodInheritanceTest);
  6097. smalltalk.addMethod(
  6098. smalltalk.method({
  6099. selector: "deinstallMiddle",
  6100. protocol: 'testing',
  6101. fn: function (){
  6102. var self=this;
  6103. return smalltalk.withContext(function($ctx1) {
  6104. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6105. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  6106. args: [],
  6107. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6108. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6109. referencedClasses: []
  6110. }),
  6111. smalltalk.MethodInheritanceTest);
  6112. smalltalk.addMethod(
  6113. smalltalk.method({
  6114. selector: "deinstallTop",
  6115. protocol: 'testing',
  6116. fn: function (){
  6117. var self=this;
  6118. return smalltalk.withContext(function($ctx1) {
  6119. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6120. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  6121. args: [],
  6122. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6123. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6124. referencedClasses: []
  6125. }),
  6126. smalltalk.MethodInheritanceTest);
  6127. smalltalk.addMethod(
  6128. smalltalk.method({
  6129. selector: "installBottom:",
  6130. protocol: 'testing',
  6131. fn: function (aString){
  6132. var self=this;
  6133. return smalltalk.withContext(function($ctx1) {
  6134. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6135. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6136. args: ["aString"],
  6137. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6138. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6139. referencedClasses: []
  6140. }),
  6141. smalltalk.MethodInheritanceTest);
  6142. smalltalk.addMethod(
  6143. smalltalk.method({
  6144. selector: "installMiddle:",
  6145. protocol: 'testing',
  6146. fn: function (aString){
  6147. var self=this;
  6148. return smalltalk.withContext(function($ctx1) {
  6149. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6150. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6151. args: ["aString"],
  6152. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6153. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6154. referencedClasses: []
  6155. }),
  6156. smalltalk.MethodInheritanceTest);
  6157. smalltalk.addMethod(
  6158. smalltalk.method({
  6159. selector: "installTop:",
  6160. protocol: 'testing',
  6161. fn: function (aString){
  6162. var self=this;
  6163. return smalltalk.withContext(function($ctx1) {
  6164. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6165. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6166. args: ["aString"],
  6167. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6168. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6169. referencedClasses: []
  6170. }),
  6171. smalltalk.MethodInheritanceTest);
  6172. smalltalk.addMethod(
  6173. smalltalk.method({
  6174. selector: "setUp",
  6175. protocol: 'initialization',
  6176. fn: function (){
  6177. var self=this;
  6178. return smalltalk.withContext(function($ctx1) {
  6179. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6180. $ctx1.sendIdx["new"]=1;
  6181. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6182. $ctx1.sendIdx["new"]=2;
  6183. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6184. self["@method"]=nil;
  6185. self["@performBlock"]=(function(){
  6186. return smalltalk.withContext(function($ctx2) {
  6187. return self._error_("performBlock not initialized");
  6188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6189. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  6190. args: [],
  6191. 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' ]",
  6192. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6193. referencedClasses: []
  6194. }),
  6195. smalltalk.MethodInheritanceTest);
  6196. smalltalk.addMethod(
  6197. smalltalk.method({
  6198. selector: "shouldMNU",
  6199. protocol: 'testing',
  6200. fn: function (){
  6201. var self=this;
  6202. return smalltalk.withContext(function($ctx1) {
  6203. self._shouldMNUTop();
  6204. self._shouldMNUMiddle();
  6205. self._shouldMNUBottom();
  6206. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  6207. args: [],
  6208. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6209. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6210. referencedClasses: []
  6211. }),
  6212. smalltalk.MethodInheritanceTest);
  6213. smalltalk.addMethod(
  6214. smalltalk.method({
  6215. selector: "shouldMNUBottom",
  6216. protocol: 'testing',
  6217. fn: function (){
  6218. var self=this;
  6219. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6220. return smalltalk.withContext(function($ctx1) {
  6221. self._should_raise_((function(){
  6222. return smalltalk.withContext(function($ctx2) {
  6223. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6225. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  6226. args: [],
  6227. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6228. messageSends: ["should:raise:", "value:"],
  6229. referencedClasses: ["MessageNotUnderstood"]
  6230. }),
  6231. smalltalk.MethodInheritanceTest);
  6232. smalltalk.addMethod(
  6233. smalltalk.method({
  6234. selector: "shouldMNUMiddle",
  6235. protocol: 'testing',
  6236. fn: function (){
  6237. var self=this;
  6238. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6239. return smalltalk.withContext(function($ctx1) {
  6240. self._should_raise_((function(){
  6241. return smalltalk.withContext(function($ctx2) {
  6242. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6244. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  6245. args: [],
  6246. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6247. messageSends: ["should:raise:", "value:"],
  6248. referencedClasses: ["MessageNotUnderstood"]
  6249. }),
  6250. smalltalk.MethodInheritanceTest);
  6251. smalltalk.addMethod(
  6252. smalltalk.method({
  6253. selector: "shouldMNUTop",
  6254. protocol: 'testing',
  6255. fn: function (){
  6256. var self=this;
  6257. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6258. return smalltalk.withContext(function($ctx1) {
  6259. self._should_raise_((function(){
  6260. return smalltalk.withContext(function($ctx2) {
  6261. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6263. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  6264. args: [],
  6265. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6266. messageSends: ["should:raise:", "value:"],
  6267. referencedClasses: ["MessageNotUnderstood"]
  6268. }),
  6269. smalltalk.MethodInheritanceTest);
  6270. smalltalk.addMethod(
  6271. smalltalk.method({
  6272. selector: "shouldReturn:",
  6273. protocol: 'testing',
  6274. fn: function (anObject){
  6275. var self=this;
  6276. var result;
  6277. return smalltalk.withContext(function($ctx1) {
  6278. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6279. $ctx1.sendIdx["value:"]=1;
  6280. self._assert_equals_(["top",anObject],["top",result]);
  6281. $ctx1.sendIdx["assert:equals:"]=1;
  6282. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6283. $ctx1.sendIdx["value:"]=2;
  6284. self._assert_equals_(["middle",anObject],["middle",result]);
  6285. $ctx1.sendIdx["assert:equals:"]=2;
  6286. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6287. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6288. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6289. args: ["anObject"],
  6290. 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 }",
  6291. messageSends: ["value:", "assert:equals:"],
  6292. referencedClasses: []
  6293. }),
  6294. smalltalk.MethodInheritanceTest);
  6295. smalltalk.addMethod(
  6296. smalltalk.method({
  6297. selector: "shouldReturn:and:and:",
  6298. protocol: 'testing',
  6299. fn: function (anObject,anObject2,anObject3){
  6300. var self=this;
  6301. var result;
  6302. return smalltalk.withContext(function($ctx1) {
  6303. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6304. $ctx1.sendIdx["value:"]=1;
  6305. self._assert_equals_(["top",anObject],["top",result]);
  6306. $ctx1.sendIdx["assert:equals:"]=1;
  6307. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6308. $ctx1.sendIdx["value:"]=2;
  6309. self._assert_equals_(["middle",anObject2],["middle",result]);
  6310. $ctx1.sendIdx["assert:equals:"]=2;
  6311. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6312. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6313. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6314. args: ["anObject", "anObject2", "anObject3"],
  6315. 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 }",
  6316. messageSends: ["value:", "assert:equals:"],
  6317. referencedClasses: []
  6318. }),
  6319. smalltalk.MethodInheritanceTest);
  6320. smalltalk.addMethod(
  6321. smalltalk.method({
  6322. selector: "targetClassBottom",
  6323. protocol: 'accessing',
  6324. fn: function (){
  6325. var self=this;
  6326. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6327. return smalltalk.withContext(function($ctx1) {
  6328. return $JavaScriptException();
  6329. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6330. args: [],
  6331. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6332. messageSends: [],
  6333. referencedClasses: ["JavaScriptException"]
  6334. }),
  6335. smalltalk.MethodInheritanceTest);
  6336. smalltalk.addMethod(
  6337. smalltalk.method({
  6338. selector: "targetClassMiddle",
  6339. protocol: 'accessing',
  6340. fn: function (){
  6341. var self=this;
  6342. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6343. return smalltalk.withContext(function($ctx1) {
  6344. return $Error();
  6345. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6346. args: [],
  6347. source: "targetClassMiddle\x0a\x09^ Error",
  6348. messageSends: [],
  6349. referencedClasses: ["Error"]
  6350. }),
  6351. smalltalk.MethodInheritanceTest);
  6352. smalltalk.addMethod(
  6353. smalltalk.method({
  6354. selector: "targetClassTop",
  6355. protocol: 'accessing',
  6356. fn: function (){
  6357. var self=this;
  6358. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6359. return smalltalk.withContext(function($ctx1) {
  6360. return $Object();
  6361. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6362. args: [],
  6363. source: "targetClassTop\x0a\x09^ Object",
  6364. messageSends: [],
  6365. referencedClasses: ["Object"]
  6366. }),
  6367. smalltalk.MethodInheritanceTest);
  6368. smalltalk.addMethod(
  6369. smalltalk.method({
  6370. selector: "tearDown",
  6371. protocol: 'initialization',
  6372. fn: function (){
  6373. var self=this;
  6374. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6375. return smalltalk.withContext(function($ctx1) {
  6376. _st((function(){
  6377. return smalltalk.withContext(function($ctx2) {
  6378. return self._deinstallTop();
  6379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6380. return smalltalk.withContext(function($ctx2) {
  6381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6382. $ctx1.sendIdx["on:do:"]=1;
  6383. _st((function(){
  6384. return smalltalk.withContext(function($ctx2) {
  6385. return self._deinstallMiddle();
  6386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6387. return smalltalk.withContext(function($ctx2) {
  6388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6389. $ctx1.sendIdx["on:do:"]=2;
  6390. _st((function(){
  6391. return smalltalk.withContext(function($ctx2) {
  6392. return self._deinstallBottom();
  6393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6394. return smalltalk.withContext(function($ctx2) {
  6395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6396. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6397. args: [],
  6398. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6399. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6400. referencedClasses: ["Error"]
  6401. }),
  6402. smalltalk.MethodInheritanceTest);
  6403. smalltalk.addMethod(
  6404. smalltalk.method({
  6405. selector: "testMNU11",
  6406. protocol: 'tests',
  6407. fn: function (){
  6408. var self=this;
  6409. return smalltalk.withContext(function($ctx1) {
  6410. self["@performBlock"]=(function(x){
  6411. return smalltalk.withContext(function($ctx2) {
  6412. return _st(x)._foo();
  6413. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6414. self._shouldMNU();
  6415. $ctx1.sendIdx["shouldMNU"]=1;
  6416. self._installTop_("foo ^ false");
  6417. $ctx1.sendIdx["installTop:"]=1;
  6418. self._installTop_("foo ^ true");
  6419. self._deinstallTop();
  6420. self._shouldMNU();
  6421. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6422. args: [],
  6423. 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",
  6424. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6425. referencedClasses: []
  6426. }),
  6427. smalltalk.MethodInheritanceTest);
  6428. smalltalk.addMethod(
  6429. smalltalk.method({
  6430. selector: "testMNU22",
  6431. protocol: 'tests',
  6432. fn: function (){
  6433. var self=this;
  6434. return smalltalk.withContext(function($ctx1) {
  6435. self["@performBlock"]=(function(x){
  6436. return smalltalk.withContext(function($ctx2) {
  6437. return _st(x)._foo();
  6438. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6439. self._shouldMNU();
  6440. $ctx1.sendIdx["shouldMNU"]=1;
  6441. self._installMiddle_("foo ^ false");
  6442. $ctx1.sendIdx["installMiddle:"]=1;
  6443. self._installMiddle_("foo ^ true");
  6444. self._deinstallMiddle();
  6445. self._shouldMNU();
  6446. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6447. args: [],
  6448. 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",
  6449. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6450. referencedClasses: []
  6451. }),
  6452. smalltalk.MethodInheritanceTest);
  6453. smalltalk.addMethod(
  6454. smalltalk.method({
  6455. selector: "testReturns1",
  6456. protocol: 'tests',
  6457. fn: function (){
  6458. var self=this;
  6459. return smalltalk.withContext(function($ctx1) {
  6460. self["@performBlock"]=(function(x){
  6461. return smalltalk.withContext(function($ctx2) {
  6462. return _st(x)._foo();
  6463. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6464. self._installTop_("foo ^ false");
  6465. $ctx1.sendIdx["installTop:"]=1;
  6466. self._shouldReturn_(false);
  6467. $ctx1.sendIdx["shouldReturn:"]=1;
  6468. self._installTop_("foo ^ true");
  6469. self._shouldReturn_(true);
  6470. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6471. args: [],
  6472. 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",
  6473. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6474. referencedClasses: []
  6475. }),
  6476. smalltalk.MethodInheritanceTest);
  6477. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6478. smalltalk.addMethod(
  6479. smalltalk.method({
  6480. selector: "testAbs",
  6481. protocol: 'tests',
  6482. fn: function (){
  6483. var self=this;
  6484. return smalltalk.withContext(function($ctx1) {
  6485. var $1;
  6486. $1=(4)._abs();
  6487. $ctx1.sendIdx["abs"]=1;
  6488. self._assert_equals_($1,(4));
  6489. $ctx1.sendIdx["assert:equals:"]=1;
  6490. self._assert_equals_((-4)._abs(),(4));
  6491. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6492. args: [],
  6493. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6494. messageSends: ["assert:equals:", "abs"],
  6495. referencedClasses: []
  6496. }),
  6497. smalltalk.NumberTest);
  6498. smalltalk.addMethod(
  6499. smalltalk.method({
  6500. selector: "testArithmetic",
  6501. protocol: 'tests',
  6502. fn: function (){
  6503. var self=this;
  6504. return smalltalk.withContext(function($ctx1) {
  6505. var $1,$2,$3,$5,$4;
  6506. $1=(1.5).__plus((1));
  6507. $ctx1.sendIdx["+"]=1;
  6508. self._assert_equals_($1,(2.5));
  6509. $ctx1.sendIdx["assert:equals:"]=1;
  6510. $2=(2).__minus((1));
  6511. $ctx1.sendIdx["-"]=1;
  6512. self._assert_equals_($2,(1));
  6513. $ctx1.sendIdx["assert:equals:"]=2;
  6514. self._assert_equals_((-2).__minus((1)),(-3));
  6515. $ctx1.sendIdx["assert:equals:"]=3;
  6516. self._assert_equals_((12).__slash((2)),(6));
  6517. $ctx1.sendIdx["assert:equals:"]=4;
  6518. $3=(3).__star((4));
  6519. $ctx1.sendIdx["*"]=1;
  6520. self._assert_equals_($3,(12));
  6521. $ctx1.sendIdx["assert:equals:"]=5;
  6522. self._assert_equals_((7).__slash_slash((2)),(3));
  6523. $ctx1.sendIdx["assert:equals:"]=6;
  6524. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6525. $ctx1.sendIdx["assert:equals:"]=7;
  6526. $5=(1).__plus((2));
  6527. $ctx1.sendIdx["+"]=2;
  6528. $4=_st($5).__star((3));
  6529. $ctx1.sendIdx["*"]=2;
  6530. self._assert_equals_($4,(9));
  6531. $ctx1.sendIdx["assert:equals:"]=8;
  6532. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6533. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6534. args: [],
  6535. 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",
  6536. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6537. referencedClasses: []
  6538. }),
  6539. smalltalk.NumberTest);
  6540. smalltalk.addMethod(
  6541. smalltalk.method({
  6542. selector: "testAsNumber",
  6543. protocol: 'tests',
  6544. fn: function (){
  6545. var self=this;
  6546. return smalltalk.withContext(function($ctx1) {
  6547. self._assert_equals_((3)._asNumber(),(3));
  6548. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6549. args: [],
  6550. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6551. messageSends: ["assert:equals:", "asNumber"],
  6552. referencedClasses: []
  6553. }),
  6554. smalltalk.NumberTest);
  6555. smalltalk.addMethod(
  6556. smalltalk.method({
  6557. selector: "testCeiling",
  6558. protocol: 'tests',
  6559. fn: function (){
  6560. var self=this;
  6561. return smalltalk.withContext(function($ctx1) {
  6562. var $1,$2;
  6563. $1=(1.2)._ceiling();
  6564. $ctx1.sendIdx["ceiling"]=1;
  6565. self._assert_equals_($1,(2));
  6566. $ctx1.sendIdx["assert:equals:"]=1;
  6567. $2=(-1.2)._ceiling();
  6568. $ctx1.sendIdx["ceiling"]=2;
  6569. self._assert_equals_($2,(-1));
  6570. $ctx1.sendIdx["assert:equals:"]=2;
  6571. self._assert_equals_((1)._ceiling(),(1));
  6572. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6573. args: [],
  6574. 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.",
  6575. messageSends: ["assert:equals:", "ceiling"],
  6576. referencedClasses: []
  6577. }),
  6578. smalltalk.NumberTest);
  6579. smalltalk.addMethod(
  6580. smalltalk.method({
  6581. selector: "testComparison",
  6582. protocol: 'tests',
  6583. fn: function (){
  6584. var self=this;
  6585. return smalltalk.withContext(function($ctx1) {
  6586. var $1,$2,$3,$4;
  6587. $1=(3).__gt((2));
  6588. $ctx1.sendIdx[">"]=1;
  6589. self._assert_($1);
  6590. $ctx1.sendIdx["assert:"]=1;
  6591. $2=(2).__lt((3));
  6592. $ctx1.sendIdx["<"]=1;
  6593. self._assert_($2);
  6594. $ctx1.sendIdx["assert:"]=2;
  6595. self._deny_((3).__lt((2)));
  6596. $ctx1.sendIdx["deny:"]=1;
  6597. self._deny_((2).__gt((3)));
  6598. $3=(3).__gt_eq((3));
  6599. $ctx1.sendIdx[">="]=1;
  6600. self._assert_($3);
  6601. $ctx1.sendIdx["assert:"]=3;
  6602. self._assert_((3.1).__gt_eq((3)));
  6603. $ctx1.sendIdx["assert:"]=4;
  6604. $4=(3).__lt_eq((3));
  6605. $ctx1.sendIdx["<="]=1;
  6606. self._assert_($4);
  6607. $ctx1.sendIdx["assert:"]=5;
  6608. self._assert_((3).__lt_eq((3.1)));
  6609. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6610. args: [],
  6611. 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",
  6612. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6613. referencedClasses: []
  6614. }),
  6615. smalltalk.NumberTest);
  6616. smalltalk.addMethod(
  6617. smalltalk.method({
  6618. selector: "testCopying",
  6619. protocol: 'tests',
  6620. fn: function (){
  6621. var self=this;
  6622. return smalltalk.withContext(function($ctx1) {
  6623. var $1;
  6624. $1=_st((1)._copy()).__eq_eq((1));
  6625. $ctx1.sendIdx["=="]=1;
  6626. self._assert_($1);
  6627. $ctx1.sendIdx["assert:"]=1;
  6628. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6629. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6630. args: [],
  6631. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6632. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6633. referencedClasses: []
  6634. }),
  6635. smalltalk.NumberTest);
  6636. smalltalk.addMethod(
  6637. smalltalk.method({
  6638. selector: "testEquality",
  6639. protocol: 'tests',
  6640. fn: function (){
  6641. var self=this;
  6642. return smalltalk.withContext(function($ctx1) {
  6643. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6644. $1=(1).__eq((1));
  6645. $ctx1.sendIdx["="]=1;
  6646. self._assert_($1);
  6647. $ctx1.sendIdx["assert:"]=1;
  6648. $2=(0).__eq((0));
  6649. $ctx1.sendIdx["="]=2;
  6650. self._assert_($2);
  6651. $ctx1.sendIdx["assert:"]=2;
  6652. $3=(1).__eq((0));
  6653. $ctx1.sendIdx["="]=3;
  6654. self._deny_($3);
  6655. $ctx1.sendIdx["deny:"]=1;
  6656. $5=(1)._yourself();
  6657. $ctx1.sendIdx["yourself"]=1;
  6658. $4=_st($5).__eq((1));
  6659. $ctx1.sendIdx["="]=4;
  6660. self._assert_($4);
  6661. $ctx1.sendIdx["assert:"]=3;
  6662. $7=(1)._yourself();
  6663. $ctx1.sendIdx["yourself"]=2;
  6664. $6=(1).__eq($7);
  6665. $ctx1.sendIdx["="]=5;
  6666. self._assert_($6);
  6667. $ctx1.sendIdx["assert:"]=4;
  6668. $9=(1)._yourself();
  6669. $ctx1.sendIdx["yourself"]=3;
  6670. $8=_st($9).__eq((1)._yourself());
  6671. $ctx1.sendIdx["="]=6;
  6672. self._assert_($8);
  6673. $10=(0).__eq(false);
  6674. $ctx1.sendIdx["="]=7;
  6675. self._deny_($10);
  6676. $ctx1.sendIdx["deny:"]=2;
  6677. $11=false.__eq((0));
  6678. $ctx1.sendIdx["="]=8;
  6679. self._deny_($11);
  6680. $ctx1.sendIdx["deny:"]=3;
  6681. $12="".__eq((0));
  6682. $ctx1.sendIdx["="]=9;
  6683. self._deny_($12);
  6684. $ctx1.sendIdx["deny:"]=4;
  6685. self._deny_((0).__eq(""));
  6686. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6687. args: [],
  6688. 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 = ''",
  6689. messageSends: ["assert:", "=", "deny:", "yourself"],
  6690. referencedClasses: []
  6691. }),
  6692. smalltalk.NumberTest);
  6693. smalltalk.addMethod(
  6694. smalltalk.method({
  6695. selector: "testFloor",
  6696. protocol: 'tests',
  6697. fn: function (){
  6698. var self=this;
  6699. return smalltalk.withContext(function($ctx1) {
  6700. var $1,$2;
  6701. $1=(1.2)._floor();
  6702. $ctx1.sendIdx["floor"]=1;
  6703. self._assert_equals_($1,(1));
  6704. $ctx1.sendIdx["assert:equals:"]=1;
  6705. $2=(-1.2)._floor();
  6706. $ctx1.sendIdx["floor"]=2;
  6707. self._assert_equals_($2,(-2));
  6708. $ctx1.sendIdx["assert:equals:"]=2;
  6709. self._assert_equals_((1)._floor(),(1));
  6710. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6711. args: [],
  6712. 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.",
  6713. messageSends: ["assert:equals:", "floor"],
  6714. referencedClasses: []
  6715. }),
  6716. smalltalk.NumberTest);
  6717. smalltalk.addMethod(
  6718. smalltalk.method({
  6719. selector: "testHexNumbers",
  6720. protocol: 'tests',
  6721. fn: function (){
  6722. var self=this;
  6723. return smalltalk.withContext(function($ctx1) {
  6724. var $1,$2,$3,$4,$5;
  6725. self._assert_equals_((9),(9));
  6726. $ctx1.sendIdx["assert:equals:"]=1;
  6727. $1=(10)._truncated();
  6728. $ctx1.sendIdx["truncated"]=1;
  6729. self._assert_equals_($1,(10));
  6730. $ctx1.sendIdx["assert:equals:"]=2;
  6731. $2=(11)._truncated();
  6732. $ctx1.sendIdx["truncated"]=2;
  6733. self._assert_equals_($2,(11));
  6734. $ctx1.sendIdx["assert:equals:"]=3;
  6735. $3=(12)._truncated();
  6736. $ctx1.sendIdx["truncated"]=3;
  6737. self._assert_equals_($3,(12));
  6738. $ctx1.sendIdx["assert:equals:"]=4;
  6739. $4=(13)._truncated();
  6740. $ctx1.sendIdx["truncated"]=4;
  6741. self._assert_equals_($4,(13));
  6742. $ctx1.sendIdx["assert:equals:"]=5;
  6743. $5=(14)._truncated();
  6744. $ctx1.sendIdx["truncated"]=5;
  6745. self._assert_equals_($5,(14));
  6746. $ctx1.sendIdx["assert:equals:"]=6;
  6747. self._assert_equals_((15)._truncated(),(15));
  6748. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6749. args: [],
  6750. 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",
  6751. messageSends: ["assert:equals:", "truncated"],
  6752. referencedClasses: []
  6753. }),
  6754. smalltalk.NumberTest);
  6755. smalltalk.addMethod(
  6756. smalltalk.method({
  6757. selector: "testIdentity",
  6758. protocol: 'tests',
  6759. fn: function (){
  6760. var self=this;
  6761. return smalltalk.withContext(function($ctx1) {
  6762. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6763. $1=(1).__eq_eq((1));
  6764. $ctx1.sendIdx["=="]=1;
  6765. self._assert_($1);
  6766. $ctx1.sendIdx["assert:"]=1;
  6767. $2=(0).__eq_eq((0));
  6768. $ctx1.sendIdx["=="]=2;
  6769. self._assert_($2);
  6770. $ctx1.sendIdx["assert:"]=2;
  6771. $3=(1).__eq_eq((0));
  6772. $ctx1.sendIdx["=="]=3;
  6773. self._deny_($3);
  6774. $ctx1.sendIdx["deny:"]=1;
  6775. $5=(1)._yourself();
  6776. $ctx1.sendIdx["yourself"]=1;
  6777. $4=_st($5).__eq_eq((1));
  6778. $ctx1.sendIdx["=="]=4;
  6779. self._assert_($4);
  6780. $ctx1.sendIdx["assert:"]=3;
  6781. $7=(1)._yourself();
  6782. $ctx1.sendIdx["yourself"]=2;
  6783. $6=(1).__eq_eq($7);
  6784. $ctx1.sendIdx["=="]=5;
  6785. self._assert_($6);
  6786. $ctx1.sendIdx["assert:"]=4;
  6787. $9=(1)._yourself();
  6788. $ctx1.sendIdx["yourself"]=3;
  6789. $8=_st($9).__eq_eq((1)._yourself());
  6790. $ctx1.sendIdx["=="]=6;
  6791. self._assert_($8);
  6792. self._deny_((1).__eq_eq((2)));
  6793. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6794. args: [],
  6795. 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",
  6796. messageSends: ["assert:", "==", "deny:", "yourself"],
  6797. referencedClasses: []
  6798. }),
  6799. smalltalk.NumberTest);
  6800. smalltalk.addMethod(
  6801. smalltalk.method({
  6802. selector: "testInvalidHexNumbers",
  6803. protocol: 'tests',
  6804. fn: function (){
  6805. var self=this;
  6806. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6807. return smalltalk.withContext(function($ctx1) {
  6808. self._should_raise_((function(){
  6809. return smalltalk.withContext(function($ctx2) {
  6810. return (16)._rG();
  6811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6812. $ctx1.sendIdx["should:raise:"]=1;
  6813. self._should_raise_((function(){
  6814. return smalltalk.withContext(function($ctx2) {
  6815. return (16)._rg();
  6816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6817. $ctx1.sendIdx["should:raise:"]=2;
  6818. self._should_raise_((function(){
  6819. return smalltalk.withContext(function($ctx2) {
  6820. return (16)._rH();
  6821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6822. $ctx1.sendIdx["should:raise:"]=3;
  6823. self._should_raise_((function(){
  6824. return smalltalk.withContext(function($ctx2) {
  6825. return (16)._rh();
  6826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6827. $ctx1.sendIdx["should:raise:"]=4;
  6828. self._should_raise_((function(){
  6829. return smalltalk.withContext(function($ctx2) {
  6830. return (16)._rI();
  6831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6832. $ctx1.sendIdx["should:raise:"]=5;
  6833. self._should_raise_((function(){
  6834. return smalltalk.withContext(function($ctx2) {
  6835. return (16)._ri();
  6836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6837. $ctx1.sendIdx["should:raise:"]=6;
  6838. self._should_raise_((function(){
  6839. return smalltalk.withContext(function($ctx2) {
  6840. return (16)._rJ();
  6841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6842. $ctx1.sendIdx["should:raise:"]=7;
  6843. self._should_raise_((function(){
  6844. return smalltalk.withContext(function($ctx2) {
  6845. return (16)._rj();
  6846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6847. $ctx1.sendIdx["should:raise:"]=8;
  6848. self._should_raise_((function(){
  6849. return smalltalk.withContext(function($ctx2) {
  6850. return (16)._rK();
  6851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6852. $ctx1.sendIdx["should:raise:"]=9;
  6853. self._should_raise_((function(){
  6854. return smalltalk.withContext(function($ctx2) {
  6855. return (16)._rk();
  6856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6857. $ctx1.sendIdx["should:raise:"]=10;
  6858. self._should_raise_((function(){
  6859. return smalltalk.withContext(function($ctx2) {
  6860. return (16)._rL();
  6861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6862. $ctx1.sendIdx["should:raise:"]=11;
  6863. self._should_raise_((function(){
  6864. return smalltalk.withContext(function($ctx2) {
  6865. return (16)._rl();
  6866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6867. $ctx1.sendIdx["should:raise:"]=12;
  6868. self._should_raise_((function(){
  6869. return smalltalk.withContext(function($ctx2) {
  6870. return (16)._rM();
  6871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6872. $ctx1.sendIdx["should:raise:"]=13;
  6873. self._should_raise_((function(){
  6874. return smalltalk.withContext(function($ctx2) {
  6875. return (16)._rm();
  6876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6877. $ctx1.sendIdx["should:raise:"]=14;
  6878. self._should_raise_((function(){
  6879. return smalltalk.withContext(function($ctx2) {
  6880. return (16)._rN();
  6881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6882. $ctx1.sendIdx["should:raise:"]=15;
  6883. self._should_raise_((function(){
  6884. return smalltalk.withContext(function($ctx2) {
  6885. return (16)._rn();
  6886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6887. $ctx1.sendIdx["should:raise:"]=16;
  6888. self._should_raise_((function(){
  6889. return smalltalk.withContext(function($ctx2) {
  6890. return (16)._rO();
  6891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6892. $ctx1.sendIdx["should:raise:"]=17;
  6893. self._should_raise_((function(){
  6894. return smalltalk.withContext(function($ctx2) {
  6895. return (16)._ro();
  6896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6897. $ctx1.sendIdx["should:raise:"]=18;
  6898. self._should_raise_((function(){
  6899. return smalltalk.withContext(function($ctx2) {
  6900. return (16)._rP();
  6901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6902. $ctx1.sendIdx["should:raise:"]=19;
  6903. self._should_raise_((function(){
  6904. return smalltalk.withContext(function($ctx2) {
  6905. return (16)._rp();
  6906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6907. $ctx1.sendIdx["should:raise:"]=20;
  6908. self._should_raise_((function(){
  6909. return smalltalk.withContext(function($ctx2) {
  6910. return (16)._rQ();
  6911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6912. $ctx1.sendIdx["should:raise:"]=21;
  6913. self._should_raise_((function(){
  6914. return smalltalk.withContext(function($ctx2) {
  6915. return (16)._rq();
  6916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6917. $ctx1.sendIdx["should:raise:"]=22;
  6918. self._should_raise_((function(){
  6919. return smalltalk.withContext(function($ctx2) {
  6920. return (16)._rR();
  6921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6922. $ctx1.sendIdx["should:raise:"]=23;
  6923. self._should_raise_((function(){
  6924. return smalltalk.withContext(function($ctx2) {
  6925. return (16)._rr();
  6926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6927. $ctx1.sendIdx["should:raise:"]=24;
  6928. self._should_raise_((function(){
  6929. return smalltalk.withContext(function($ctx2) {
  6930. return (16)._rS();
  6931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6932. $ctx1.sendIdx["should:raise:"]=25;
  6933. self._should_raise_((function(){
  6934. return smalltalk.withContext(function($ctx2) {
  6935. return (16)._rs();
  6936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6937. $ctx1.sendIdx["should:raise:"]=26;
  6938. self._should_raise_((function(){
  6939. return smalltalk.withContext(function($ctx2) {
  6940. return (16)._rT();
  6941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6942. $ctx1.sendIdx["should:raise:"]=27;
  6943. self._should_raise_((function(){
  6944. return smalltalk.withContext(function($ctx2) {
  6945. return (16)._rt();
  6946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6947. $ctx1.sendIdx["should:raise:"]=28;
  6948. self._should_raise_((function(){
  6949. return smalltalk.withContext(function($ctx2) {
  6950. return (16)._rU();
  6951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6952. $ctx1.sendIdx["should:raise:"]=29;
  6953. self._should_raise_((function(){
  6954. return smalltalk.withContext(function($ctx2) {
  6955. return (16)._ru();
  6956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6957. $ctx1.sendIdx["should:raise:"]=30;
  6958. self._should_raise_((function(){
  6959. return smalltalk.withContext(function($ctx2) {
  6960. return (16)._rV();
  6961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6962. $ctx1.sendIdx["should:raise:"]=31;
  6963. self._should_raise_((function(){
  6964. return smalltalk.withContext(function($ctx2) {
  6965. return (16)._rv();
  6966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6967. $ctx1.sendIdx["should:raise:"]=32;
  6968. self._should_raise_((function(){
  6969. return smalltalk.withContext(function($ctx2) {
  6970. return (16)._rW();
  6971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6972. $ctx1.sendIdx["should:raise:"]=33;
  6973. self._should_raise_((function(){
  6974. return smalltalk.withContext(function($ctx2) {
  6975. return (16)._rw();
  6976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6977. $ctx1.sendIdx["should:raise:"]=34;
  6978. self._should_raise_((function(){
  6979. return smalltalk.withContext(function($ctx2) {
  6980. return (16)._rX();
  6981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6982. $ctx1.sendIdx["should:raise:"]=35;
  6983. self._should_raise_((function(){
  6984. return smalltalk.withContext(function($ctx2) {
  6985. return (16)._rx();
  6986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6987. $ctx1.sendIdx["should:raise:"]=36;
  6988. self._should_raise_((function(){
  6989. return smalltalk.withContext(function($ctx2) {
  6990. return (16)._rY();
  6991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6992. $ctx1.sendIdx["should:raise:"]=37;
  6993. self._should_raise_((function(){
  6994. return smalltalk.withContext(function($ctx2) {
  6995. return (16)._ry();
  6996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6997. $ctx1.sendIdx["should:raise:"]=38;
  6998. self._should_raise_((function(){
  6999. return smalltalk.withContext(function($ctx2) {
  7000. return (16)._rZ();
  7001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7002. $ctx1.sendIdx["should:raise:"]=39;
  7003. self._should_raise_((function(){
  7004. return smalltalk.withContext(function($ctx2) {
  7005. return (16)._rz();
  7006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7007. $ctx1.sendIdx["should:raise:"]=40;
  7008. self._should_raise_((function(){
  7009. return smalltalk.withContext(function($ctx2) {
  7010. return (11259375)._Z();
  7011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7012. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  7013. args: [],
  7014. 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.",
  7015. 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"],
  7016. referencedClasses: ["MessageNotUnderstood"]
  7017. }),
  7018. smalltalk.NumberTest);
  7019. smalltalk.addMethod(
  7020. smalltalk.method({
  7021. selector: "testLog",
  7022. protocol: 'tests',
  7023. fn: function (){
  7024. var self=this;
  7025. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  7026. return smalltalk.withContext(function($ctx1) {
  7027. self._assert_equals_((10000)._log(),(4));
  7028. $ctx1.sendIdx["assert:equals:"]=1;
  7029. self._assert_equals_((512)._log_((2)),(9));
  7030. $ctx1.sendIdx["assert:equals:"]=2;
  7031. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7032. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  7033. args: [],
  7034. 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.",
  7035. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7036. referencedClasses: ["Number"]
  7037. }),
  7038. smalltalk.NumberTest);
  7039. smalltalk.addMethod(
  7040. smalltalk.method({
  7041. selector: "testMinMax",
  7042. protocol: 'tests',
  7043. fn: function (){
  7044. var self=this;
  7045. return smalltalk.withContext(function($ctx1) {
  7046. self._assert_equals_((2)._max_((5)),(5));
  7047. $ctx1.sendIdx["assert:equals:"]=1;
  7048. self._assert_equals_((2)._min_((5)),(2));
  7049. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  7050. args: [],
  7051. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7052. messageSends: ["assert:equals:", "max:", "min:"],
  7053. referencedClasses: []
  7054. }),
  7055. smalltalk.NumberTest);
  7056. smalltalk.addMethod(
  7057. smalltalk.method({
  7058. selector: "testNegated",
  7059. protocol: 'tests',
  7060. fn: function (){
  7061. var self=this;
  7062. return smalltalk.withContext(function($ctx1) {
  7063. var $1;
  7064. $1=(3)._negated();
  7065. $ctx1.sendIdx["negated"]=1;
  7066. self._assert_equals_($1,(-3));
  7067. $ctx1.sendIdx["assert:equals:"]=1;
  7068. self._assert_equals_((-3)._negated(),(3));
  7069. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  7070. args: [],
  7071. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7072. messageSends: ["assert:equals:", "negated"],
  7073. referencedClasses: []
  7074. }),
  7075. smalltalk.NumberTest);
  7076. smalltalk.addMethod(
  7077. smalltalk.method({
  7078. selector: "testPrintShowingDecimalPlaces",
  7079. protocol: 'tests',
  7080. fn: function (){
  7081. var self=this;
  7082. return smalltalk.withContext(function($ctx1) {
  7083. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7084. $1=(23)._printShowingDecimalPlaces_((2));
  7085. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7086. self._assert_equals_($1,"23.00");
  7087. $ctx1.sendIdx["assert:equals:"]=1;
  7088. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7089. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7090. self._assert_equals_($2,"23.57");
  7091. $ctx1.sendIdx["assert:equals:"]=2;
  7092. $4=(234.567)._negated();
  7093. $ctx1.sendIdx["negated"]=1;
  7094. $3=_st($4)._printShowingDecimalPlaces_((5));
  7095. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7096. self._assert_equals_($3,"-234.56700");
  7097. $ctx1.sendIdx["assert:equals:"]=3;
  7098. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7099. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7100. self._assert_equals_($5,"23");
  7101. $ctx1.sendIdx["assert:equals:"]=4;
  7102. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7103. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7104. self._assert_equals_($6,"24");
  7105. $ctx1.sendIdx["assert:equals:"]=5;
  7106. $8=(23.4567)._negated();
  7107. $ctx1.sendIdx["negated"]=2;
  7108. $7=_st($8)._printShowingDecimalPlaces_((0));
  7109. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7110. self._assert_equals_($7,"-23");
  7111. $ctx1.sendIdx["assert:equals:"]=6;
  7112. $10=(23.5567)._negated();
  7113. $ctx1.sendIdx["negated"]=3;
  7114. $9=_st($10)._printShowingDecimalPlaces_((0));
  7115. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7116. self._assert_equals_($9,"-24");
  7117. $ctx1.sendIdx["assert:equals:"]=7;
  7118. $11=(100000000)._printShowingDecimalPlaces_((1));
  7119. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7120. self._assert_equals_($11,"100000000.0");
  7121. $ctx1.sendIdx["assert:equals:"]=8;
  7122. $12=(0.98)._printShowingDecimalPlaces_((5));
  7123. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7124. self._assert_equals_($12,"0.98000");
  7125. $ctx1.sendIdx["assert:equals:"]=9;
  7126. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7127. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7128. self._assert_equals_($13,"-0.98");
  7129. $ctx1.sendIdx["assert:equals:"]=10;
  7130. $14=(2.567)._printShowingDecimalPlaces_((2));
  7131. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7132. self._assert_equals_($14,"2.57");
  7133. $ctx1.sendIdx["assert:equals:"]=11;
  7134. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7135. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7136. self._assert_equals_($15,"-2.57");
  7137. $ctx1.sendIdx["assert:equals:"]=12;
  7138. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7139. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  7140. args: [],
  7141. 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'.",
  7142. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7143. referencedClasses: []
  7144. }),
  7145. smalltalk.NumberTest);
  7146. smalltalk.addMethod(
  7147. smalltalk.method({
  7148. selector: "testRaisedTo",
  7149. protocol: 'tests',
  7150. fn: function (){
  7151. var self=this;
  7152. return smalltalk.withContext(function($ctx1) {
  7153. var $1,$2,$3;
  7154. $1=(2)._raisedTo_((4));
  7155. $ctx1.sendIdx["raisedTo:"]=1;
  7156. self._assert_equals_($1,(16));
  7157. $ctx1.sendIdx["assert:equals:"]=1;
  7158. $2=(2)._raisedTo_((0));
  7159. $ctx1.sendIdx["raisedTo:"]=2;
  7160. self._assert_equals_($2,(1));
  7161. $ctx1.sendIdx["assert:equals:"]=2;
  7162. $3=(2)._raisedTo_((-3));
  7163. $ctx1.sendIdx["raisedTo:"]=3;
  7164. self._assert_equals_($3,(0.125));
  7165. $ctx1.sendIdx["assert:equals:"]=3;
  7166. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7167. $ctx1.sendIdx["assert:equals:"]=4;
  7168. self._assert_equals_((2).__star_star((4)),(16));
  7169. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  7170. args: [],
  7171. 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.",
  7172. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7173. referencedClasses: []
  7174. }),
  7175. smalltalk.NumberTest);
  7176. smalltalk.addMethod(
  7177. smalltalk.method({
  7178. selector: "testRounded",
  7179. protocol: 'tests',
  7180. fn: function (){
  7181. var self=this;
  7182. return smalltalk.withContext(function($ctx1) {
  7183. var $1,$2;
  7184. $1=(3)._rounded();
  7185. $ctx1.sendIdx["rounded"]=1;
  7186. self._assert_equals_($1,(3));
  7187. $ctx1.sendIdx["assert:equals:"]=1;
  7188. $2=(3.212)._rounded();
  7189. $ctx1.sendIdx["rounded"]=2;
  7190. self._assert_equals_($2,(3));
  7191. $ctx1.sendIdx["assert:equals:"]=2;
  7192. self._assert_equals_((3.51)._rounded(),(4));
  7193. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  7194. args: [],
  7195. 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",
  7196. messageSends: ["assert:equals:", "rounded"],
  7197. referencedClasses: []
  7198. }),
  7199. smalltalk.NumberTest);
  7200. smalltalk.addMethod(
  7201. smalltalk.method({
  7202. selector: "testSign",
  7203. protocol: 'tests',
  7204. fn: function (){
  7205. var self=this;
  7206. return smalltalk.withContext(function($ctx1) {
  7207. var $1,$2;
  7208. $1=(5)._sign();
  7209. $ctx1.sendIdx["sign"]=1;
  7210. self._assert_equals_($1,(1));
  7211. $ctx1.sendIdx["assert:equals:"]=1;
  7212. $2=(0)._sign();
  7213. $ctx1.sendIdx["sign"]=2;
  7214. self._assert_equals_($2,(0));
  7215. $ctx1.sendIdx["assert:equals:"]=2;
  7216. self._assert_equals_((-1.4)._sign(),(-1));
  7217. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  7218. args: [],
  7219. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7220. messageSends: ["assert:equals:", "sign"],
  7221. referencedClasses: []
  7222. }),
  7223. smalltalk.NumberTest);
  7224. smalltalk.addMethod(
  7225. smalltalk.method({
  7226. selector: "testSqrt",
  7227. protocol: 'tests',
  7228. fn: function (){
  7229. var self=this;
  7230. return smalltalk.withContext(function($ctx1) {
  7231. var $1;
  7232. $1=(4)._sqrt();
  7233. $ctx1.sendIdx["sqrt"]=1;
  7234. self._assert_equals_($1,(2));
  7235. $ctx1.sendIdx["assert:equals:"]=1;
  7236. self._assert_equals_((16)._sqrt(),(4));
  7237. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  7238. args: [],
  7239. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7240. messageSends: ["assert:equals:", "sqrt"],
  7241. referencedClasses: []
  7242. }),
  7243. smalltalk.NumberTest);
  7244. smalltalk.addMethod(
  7245. smalltalk.method({
  7246. selector: "testSquared",
  7247. protocol: 'tests',
  7248. fn: function (){
  7249. var self=this;
  7250. return smalltalk.withContext(function($ctx1) {
  7251. self._assert_equals_((4)._squared(),(16));
  7252. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  7253. args: [],
  7254. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7255. messageSends: ["assert:equals:", "squared"],
  7256. referencedClasses: []
  7257. }),
  7258. smalltalk.NumberTest);
  7259. smalltalk.addMethod(
  7260. smalltalk.method({
  7261. selector: "testTimesRepeat",
  7262. protocol: 'tests',
  7263. fn: function (){
  7264. var self=this;
  7265. var i;
  7266. return smalltalk.withContext(function($ctx1) {
  7267. i=(0);
  7268. (0)._timesRepeat_((function(){
  7269. return smalltalk.withContext(function($ctx2) {
  7270. i=_st(i).__plus((1));
  7271. $ctx2.sendIdx["+"]=1;
  7272. return i;
  7273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7274. $ctx1.sendIdx["timesRepeat:"]=1;
  7275. self._assert_equals_(i,(0));
  7276. $ctx1.sendIdx["assert:equals:"]=1;
  7277. (5)._timesRepeat_((function(){
  7278. return smalltalk.withContext(function($ctx2) {
  7279. i=_st(i).__plus((1));
  7280. return i;
  7281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7282. self._assert_equals_(i,(5));
  7283. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  7284. args: [],
  7285. 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",
  7286. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7287. referencedClasses: []
  7288. }),
  7289. smalltalk.NumberTest);
  7290. smalltalk.addMethod(
  7291. smalltalk.method({
  7292. selector: "testTo",
  7293. protocol: 'tests',
  7294. fn: function (){
  7295. var self=this;
  7296. return smalltalk.withContext(function($ctx1) {
  7297. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7298. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7299. args: [],
  7300. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7301. messageSends: ["assert:equals:", "to:"],
  7302. referencedClasses: []
  7303. }),
  7304. smalltalk.NumberTest);
  7305. smalltalk.addMethod(
  7306. smalltalk.method({
  7307. selector: "testToBy",
  7308. protocol: 'tests',
  7309. fn: function (){
  7310. var self=this;
  7311. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7312. return smalltalk.withContext(function($ctx1) {
  7313. var $1;
  7314. $1=(0)._to_by_((6),(2));
  7315. $ctx1.sendIdx["to:by:"]=1;
  7316. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7317. self._should_raise_((function(){
  7318. return smalltalk.withContext(function($ctx2) {
  7319. return (1)._to_by_((4),(0));
  7320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7321. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7322. args: [],
  7323. 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",
  7324. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7325. referencedClasses: ["Error"]
  7326. }),
  7327. smalltalk.NumberTest);
  7328. smalltalk.addMethod(
  7329. smalltalk.method({
  7330. selector: "testTrigonometry",
  7331. protocol: 'tests',
  7332. fn: function (){
  7333. var self=this;
  7334. return smalltalk.withContext(function($ctx1) {
  7335. self._assert_equals_((0)._cos(),(1));
  7336. $ctx1.sendIdx["assert:equals:"]=1;
  7337. self._assert_equals_((0)._sin(),(0));
  7338. $ctx1.sendIdx["assert:equals:"]=2;
  7339. self._assert_equals_((0)._tan(),(0));
  7340. $ctx1.sendIdx["assert:equals:"]=3;
  7341. self._assert_equals_((1)._arcCos(),(0));
  7342. $ctx1.sendIdx["assert:equals:"]=4;
  7343. self._assert_equals_((0)._arcSin(),(0));
  7344. $ctx1.sendIdx["assert:equals:"]=5;
  7345. self._assert_equals_((0)._arcTan(),(0));
  7346. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7347. args: [],
  7348. 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.",
  7349. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7350. referencedClasses: []
  7351. }),
  7352. smalltalk.NumberTest);
  7353. smalltalk.addMethod(
  7354. smalltalk.method({
  7355. selector: "testTruncated",
  7356. protocol: 'tests',
  7357. fn: function (){
  7358. var self=this;
  7359. return smalltalk.withContext(function($ctx1) {
  7360. var $1,$2;
  7361. $1=(3)._truncated();
  7362. $ctx1.sendIdx["truncated"]=1;
  7363. self._assert_equals_($1,(3));
  7364. $ctx1.sendIdx["assert:equals:"]=1;
  7365. $2=(3.212)._truncated();
  7366. $ctx1.sendIdx["truncated"]=2;
  7367. self._assert_equals_($2,(3));
  7368. $ctx1.sendIdx["assert:equals:"]=2;
  7369. self._assert_equals_((3.51)._truncated(),(3));
  7370. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7371. args: [],
  7372. 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",
  7373. messageSends: ["assert:equals:", "truncated"],
  7374. referencedClasses: []
  7375. }),
  7376. smalltalk.NumberTest);
  7377. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7378. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7379. smalltalk.addMethod(
  7380. smalltalk.method({
  7381. selector: "foo",
  7382. protocol: 'not yet classified',
  7383. fn: function (){
  7384. var self=this;
  7385. return smalltalk.withContext(function($ctx1) {
  7386. var $1;
  7387. $1=self["@foo"];
  7388. return $1;
  7389. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7390. args: [],
  7391. source: "foo\x0a\x09^ foo",
  7392. messageSends: [],
  7393. referencedClasses: []
  7394. }),
  7395. smalltalk.ObjectMock);
  7396. smalltalk.addMethod(
  7397. smalltalk.method({
  7398. selector: "foo:",
  7399. protocol: 'not yet classified',
  7400. fn: function (anObject){
  7401. var self=this;
  7402. return smalltalk.withContext(function($ctx1) {
  7403. self["@foo"]=anObject;
  7404. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7405. args: ["anObject"],
  7406. source: "foo: anObject\x0a\x09foo := anObject",
  7407. messageSends: [],
  7408. referencedClasses: []
  7409. }),
  7410. smalltalk.ObjectMock);
  7411. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7412. smalltalk.addMethod(
  7413. smalltalk.method({
  7414. selector: "notDefined",
  7415. protocol: 'tests',
  7416. fn: function (){
  7417. var self=this;
  7418. return smalltalk.withContext(function($ctx1) {
  7419. return void 0;;
  7420. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7421. args: [],
  7422. source: "notDefined\x0a\x09<return void 0;>",
  7423. messageSends: [],
  7424. referencedClasses: []
  7425. }),
  7426. smalltalk.ObjectTest);
  7427. smalltalk.addMethod(
  7428. smalltalk.method({
  7429. selector: "testBasicAccess",
  7430. protocol: 'tests',
  7431. fn: function (){
  7432. var self=this;
  7433. var o;
  7434. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7435. return smalltalk.withContext(function($ctx1) {
  7436. var $1;
  7437. o=_st($Object())._new();
  7438. _st(o)._basicAt_put_("a",(1));
  7439. $1=_st(o)._basicAt_("a");
  7440. $ctx1.sendIdx["basicAt:"]=1;
  7441. self._assert_equals_($1,(1));
  7442. $ctx1.sendIdx["assert:equals:"]=1;
  7443. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7444. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7445. args: [],
  7446. 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",
  7447. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7448. referencedClasses: ["Object"]
  7449. }),
  7450. smalltalk.ObjectTest);
  7451. smalltalk.addMethod(
  7452. smalltalk.method({
  7453. selector: "testBasicPerform",
  7454. protocol: 'tests',
  7455. fn: function (){
  7456. var self=this;
  7457. var o;
  7458. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7459. return smalltalk.withContext(function($ctx1) {
  7460. o=_st($Object())._new();
  7461. _st(o)._basicAt_put_("func",(function(){
  7462. return smalltalk.withContext(function($ctx2) {
  7463. return "hello";
  7464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7465. $ctx1.sendIdx["basicAt:put:"]=1;
  7466. _st(o)._basicAt_put_("func2",(function(a){
  7467. return smalltalk.withContext(function($ctx2) {
  7468. return _st(a).__plus((1));
  7469. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7470. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7471. $ctx1.sendIdx["assert:equals:"]=1;
  7472. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7473. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7474. args: [],
  7475. 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",
  7476. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7477. referencedClasses: ["Object"]
  7478. }),
  7479. smalltalk.ObjectTest);
  7480. smalltalk.addMethod(
  7481. smalltalk.method({
  7482. selector: "testDNU",
  7483. protocol: 'tests',
  7484. fn: function (){
  7485. var self=this;
  7486. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7487. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7488. return smalltalk.withContext(function($ctx1) {
  7489. self._should_raise_((function(){
  7490. return smalltalk.withContext(function($ctx2) {
  7491. return _st(_st($Object())._new())._foo();
  7492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7493. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7494. args: [],
  7495. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7496. messageSends: ["should:raise:", "foo", "new"],
  7497. referencedClasses: ["Object", "MessageNotUnderstood"]
  7498. }),
  7499. smalltalk.ObjectTest);
  7500. smalltalk.addMethod(
  7501. smalltalk.method({
  7502. selector: "testEquality",
  7503. protocol: 'tests',
  7504. fn: function (){
  7505. var self=this;
  7506. var o;
  7507. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7508. return smalltalk.withContext(function($ctx1) {
  7509. var $1,$2,$4,$3;
  7510. o=_st($Object())._new();
  7511. $ctx1.sendIdx["new"]=1;
  7512. $1=_st(o).__eq(_st($Object())._new());
  7513. $ctx1.sendIdx["="]=1;
  7514. self._deny_($1);
  7515. $2=_st(o).__eq(o);
  7516. $ctx1.sendIdx["="]=2;
  7517. self._assert_($2);
  7518. $ctx1.sendIdx["assert:"]=1;
  7519. $4=_st(o)._yourself();
  7520. $ctx1.sendIdx["yourself"]=1;
  7521. $3=_st($4).__eq(o);
  7522. $ctx1.sendIdx["="]=3;
  7523. self._assert_($3);
  7524. $ctx1.sendIdx["assert:"]=2;
  7525. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7526. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7527. args: [],
  7528. 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)",
  7529. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7530. referencedClasses: ["Object"]
  7531. }),
  7532. smalltalk.ObjectTest);
  7533. smalltalk.addMethod(
  7534. smalltalk.method({
  7535. selector: "testHalt",
  7536. protocol: 'tests',
  7537. fn: function (){
  7538. var self=this;
  7539. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7540. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7541. return smalltalk.withContext(function($ctx1) {
  7542. self._should_raise_((function(){
  7543. return smalltalk.withContext(function($ctx2) {
  7544. return _st(_st($Object())._new())._halt();
  7545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7546. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7547. args: [],
  7548. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7549. messageSends: ["should:raise:", "halt", "new"],
  7550. referencedClasses: ["Object", "Error"]
  7551. }),
  7552. smalltalk.ObjectTest);
  7553. smalltalk.addMethod(
  7554. smalltalk.method({
  7555. selector: "testIdentity",
  7556. protocol: 'tests',
  7557. fn: function (){
  7558. var self=this;
  7559. var o;
  7560. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7561. return smalltalk.withContext(function($ctx1) {
  7562. var $1,$2,$4,$3;
  7563. o=_st($Object())._new();
  7564. $ctx1.sendIdx["new"]=1;
  7565. $1=_st(o).__eq_eq(_st($Object())._new());
  7566. $ctx1.sendIdx["=="]=1;
  7567. self._deny_($1);
  7568. $2=_st(o).__eq_eq(o);
  7569. $ctx1.sendIdx["=="]=2;
  7570. self._assert_($2);
  7571. $ctx1.sendIdx["assert:"]=1;
  7572. $4=_st(o)._yourself();
  7573. $ctx1.sendIdx["yourself"]=1;
  7574. $3=_st($4).__eq_eq(o);
  7575. $ctx1.sendIdx["=="]=3;
  7576. self._assert_($3);
  7577. $ctx1.sendIdx["assert:"]=2;
  7578. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7579. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7580. args: [],
  7581. 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",
  7582. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7583. referencedClasses: ["Object"]
  7584. }),
  7585. smalltalk.ObjectTest);
  7586. smalltalk.addMethod(
  7587. smalltalk.method({
  7588. selector: "testIfNil",
  7589. protocol: 'tests',
  7590. fn: function (){
  7591. var self=this;
  7592. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7593. return smalltalk.withContext(function($ctx1) {
  7594. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7595. $2=_st($Object())._new();
  7596. $ctx1.sendIdx["new"]=1;
  7597. $1=_st($2)._isNil();
  7598. self._deny_($1);
  7599. $ctx1.sendIdx["deny:"]=1;
  7600. $5=_st($Object())._new();
  7601. $ctx1.sendIdx["new"]=2;
  7602. if(($receiver = $5) == nil || $receiver == null){
  7603. $4=true;
  7604. } else {
  7605. $4=$5;
  7606. };
  7607. $3=_st($4).__eq(true);
  7608. self._deny_($3);
  7609. $7=_st($Object())._new();
  7610. $ctx1.sendIdx["new"]=3;
  7611. if(($receiver = $7) == nil || $receiver == null){
  7612. $6=$7;
  7613. } else {
  7614. $6=true;
  7615. };
  7616. self._assert_equals_($6,true);
  7617. $ctx1.sendIdx["assert:equals:"]=1;
  7618. $9=_st($Object())._new();
  7619. $ctx1.sendIdx["new"]=4;
  7620. if(($receiver = $9) == nil || $receiver == null){
  7621. $8=false;
  7622. } else {
  7623. $8=true;
  7624. };
  7625. self._assert_equals_($8,true);
  7626. $ctx1.sendIdx["assert:equals:"]=2;
  7627. $11=_st($Object())._new();
  7628. if(($receiver = $11) == nil || $receiver == null){
  7629. $10=false;
  7630. } else {
  7631. $10=true;
  7632. };
  7633. self._assert_equals_($10,true);
  7634. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7635. args: [],
  7636. 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",
  7637. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7638. referencedClasses: ["Object"]
  7639. }),
  7640. smalltalk.ObjectTest);
  7641. smalltalk.addMethod(
  7642. smalltalk.method({
  7643. selector: "testInstVars",
  7644. protocol: 'tests',
  7645. fn: function (){
  7646. var self=this;
  7647. var o;
  7648. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7649. return smalltalk.withContext(function($ctx1) {
  7650. var $1,$2;
  7651. o=_st($ObjectMock())._new();
  7652. $1=_st(o)._instVarAt_("foo");
  7653. $ctx1.sendIdx["instVarAt:"]=1;
  7654. self._assert_equals_($1,nil);
  7655. $ctx1.sendIdx["assert:equals:"]=1;
  7656. _st(o)._instVarAt_put_("foo",(1));
  7657. $2=_st(o)._instVarAt_("foo");
  7658. $ctx1.sendIdx["instVarAt:"]=2;
  7659. self._assert_equals_($2,(1));
  7660. $ctx1.sendIdx["assert:equals:"]=2;
  7661. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7662. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7663. args: [],
  7664. 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",
  7665. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7666. referencedClasses: ["ObjectMock"]
  7667. }),
  7668. smalltalk.ObjectTest);
  7669. smalltalk.addMethod(
  7670. smalltalk.method({
  7671. selector: "testNilUndefined",
  7672. protocol: 'tests',
  7673. fn: function (){
  7674. var self=this;
  7675. return smalltalk.withContext(function($ctx1) {
  7676. self._assert_equals_(self._notDefined(),nil);
  7677. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7678. args: [],
  7679. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7680. messageSends: ["assert:equals:", "notDefined"],
  7681. referencedClasses: []
  7682. }),
  7683. smalltalk.ObjectTest);
  7684. smalltalk.addMethod(
  7685. smalltalk.method({
  7686. selector: "testYourself",
  7687. protocol: 'tests',
  7688. fn: function (){
  7689. var self=this;
  7690. var o;
  7691. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7692. return smalltalk.withContext(function($ctx1) {
  7693. o=_st($ObjectMock())._new();
  7694. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7695. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7696. args: [],
  7697. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7698. messageSends: ["new", "assert:", "==", "yourself"],
  7699. referencedClasses: ["ObjectMock"]
  7700. }),
  7701. smalltalk.ObjectTest);
  7702. smalltalk.addMethod(
  7703. smalltalk.method({
  7704. selector: "testidentityHash",
  7705. protocol: 'tests',
  7706. fn: function (){
  7707. var self=this;
  7708. var o1,o2;
  7709. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7710. return smalltalk.withContext(function($ctx1) {
  7711. var $2,$3,$1,$5,$4;
  7712. o1=_st($Object())._new();
  7713. $ctx1.sendIdx["new"]=1;
  7714. o2=_st($Object())._new();
  7715. $2=_st(o1)._identityHash();
  7716. $ctx1.sendIdx["identityHash"]=1;
  7717. $3=_st(o1)._identityHash();
  7718. $ctx1.sendIdx["identityHash"]=2;
  7719. $1=_st($2).__eq_eq($3);
  7720. $ctx1.sendIdx["=="]=1;
  7721. self._assert_($1);
  7722. $5=_st(o1)._identityHash();
  7723. $ctx1.sendIdx["identityHash"]=3;
  7724. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7725. self._deny_($4);
  7726. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7727. args: [],
  7728. 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",
  7729. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7730. referencedClasses: ["Object"]
  7731. }),
  7732. smalltalk.ObjectTest);
  7733. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7734. smalltalk.addMethod(
  7735. smalltalk.method({
  7736. selector: "testAccessing",
  7737. protocol: 'tests',
  7738. fn: function (){
  7739. var self=this;
  7740. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7741. return smalltalk.withContext(function($ctx1) {
  7742. var $2,$1,$3,$6,$5,$4;
  7743. $2=_st($Point())._x_y_((3),(4));
  7744. $ctx1.sendIdx["x:y:"]=1;
  7745. $1=_st($2)._x();
  7746. $ctx1.sendIdx["x"]=1;
  7747. self._assert_equals_($1,(3));
  7748. $ctx1.sendIdx["assert:equals:"]=1;
  7749. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7750. $ctx1.sendIdx["y"]=1;
  7751. self._assert_equals_($3,(4));
  7752. $ctx1.sendIdx["assert:equals:"]=2;
  7753. $6=_st($Point())._new();
  7754. $ctx1.sendIdx["new"]=1;
  7755. $5=_st($6)._x_((3));
  7756. $4=_st($5)._x();
  7757. self._assert_equals_($4,(3));
  7758. $ctx1.sendIdx["assert:equals:"]=3;
  7759. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7760. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7761. args: [],
  7762. 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",
  7763. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7764. referencedClasses: ["Point"]
  7765. }),
  7766. smalltalk.PointTest);
  7767. smalltalk.addMethod(
  7768. smalltalk.method({
  7769. selector: "testArithmetic",
  7770. protocol: 'tests',
  7771. fn: function (){
  7772. var self=this;
  7773. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7774. return smalltalk.withContext(function($ctx1) {
  7775. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7776. $2=(3).__at((4));
  7777. $ctx1.sendIdx["@"]=1;
  7778. $3=(3).__at((4));
  7779. $ctx1.sendIdx["@"]=2;
  7780. $1=_st($2).__star($3);
  7781. $4=_st($Point())._x_y_((9),(16));
  7782. $ctx1.sendIdx["x:y:"]=1;
  7783. self._assert_equals_($1,$4);
  7784. $ctx1.sendIdx["assert:equals:"]=1;
  7785. $6=(3).__at((4));
  7786. $ctx1.sendIdx["@"]=3;
  7787. $7=(3).__at((4));
  7788. $ctx1.sendIdx["@"]=4;
  7789. $5=_st($6).__plus($7);
  7790. $8=_st($Point())._x_y_((6),(8));
  7791. $ctx1.sendIdx["x:y:"]=2;
  7792. self._assert_equals_($5,$8);
  7793. $ctx1.sendIdx["assert:equals:"]=2;
  7794. $10=(3).__at((4));
  7795. $ctx1.sendIdx["@"]=5;
  7796. $11=(3).__at((4));
  7797. $ctx1.sendIdx["@"]=6;
  7798. $9=_st($10).__minus($11);
  7799. $12=_st($Point())._x_y_((0),(0));
  7800. $ctx1.sendIdx["x:y:"]=3;
  7801. self._assert_equals_($9,$12);
  7802. $ctx1.sendIdx["assert:equals:"]=3;
  7803. $14=(6).__at((8));
  7804. $ctx1.sendIdx["@"]=7;
  7805. $13=_st($14).__slash((3).__at((4)));
  7806. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7807. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7808. args: [],
  7809. 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)",
  7810. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7811. referencedClasses: ["Point"]
  7812. }),
  7813. smalltalk.PointTest);
  7814. smalltalk.addMethod(
  7815. smalltalk.method({
  7816. selector: "testAt",
  7817. protocol: 'tests',
  7818. fn: function (){
  7819. var self=this;
  7820. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7821. return smalltalk.withContext(function($ctx1) {
  7822. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7823. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7824. args: [],
  7825. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7826. messageSends: ["assert:equals:", "@", "x:y:"],
  7827. referencedClasses: ["Point"]
  7828. }),
  7829. smalltalk.PointTest);
  7830. smalltalk.addMethod(
  7831. smalltalk.method({
  7832. selector: "testEgality",
  7833. protocol: 'tests',
  7834. fn: function (){
  7835. var self=this;
  7836. return smalltalk.withContext(function($ctx1) {
  7837. var $2,$3,$1,$5,$4;
  7838. $2=(3).__at((4));
  7839. $ctx1.sendIdx["@"]=1;
  7840. $3=(3).__at((4));
  7841. $ctx1.sendIdx["@"]=2;
  7842. $1=_st($2).__eq($3);
  7843. $ctx1.sendIdx["="]=1;
  7844. self._assert_($1);
  7845. $5=(3).__at((5));
  7846. $ctx1.sendIdx["@"]=3;
  7847. $4=_st($5).__eq((3).__at((6)));
  7848. self._deny_($4);
  7849. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7850. args: [],
  7851. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7852. messageSends: ["assert:", "=", "@", "deny:"],
  7853. referencedClasses: []
  7854. }),
  7855. smalltalk.PointTest);
  7856. smalltalk.addMethod(
  7857. smalltalk.method({
  7858. selector: "testNew",
  7859. protocol: 'tests',
  7860. fn: function (){
  7861. var self=this;
  7862. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7863. return smalltalk.withContext(function($ctx1) {
  7864. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7865. $3=_st($Point())._new();
  7866. $ctx1.sendIdx["new"]=1;
  7867. $2=_st($3)._x_((3));
  7868. $ctx1.sendIdx["x:"]=1;
  7869. $1=_st($2)._y();
  7870. $ctx1.sendIdx["y"]=1;
  7871. self._assert_equals_($1,nil);
  7872. $ctx1.sendIdx["assert:equals:"]=1;
  7873. $7=_st($Point())._new();
  7874. $ctx1.sendIdx["new"]=2;
  7875. $6=_st($7)._x_((3));
  7876. $5=_st($6)._x();
  7877. $ctx1.sendIdx["x"]=1;
  7878. $4=_st($5).__eq((0));
  7879. $ctx1.sendIdx["="]=1;
  7880. self._deny_($4);
  7881. $ctx1.sendIdx["deny:"]=1;
  7882. $10=_st($Point())._new();
  7883. $ctx1.sendIdx["new"]=3;
  7884. $9=_st($10)._y_((4));
  7885. $ctx1.sendIdx["y:"]=1;
  7886. $8=_st($9)._x();
  7887. self._assert_equals_($8,nil);
  7888. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7889. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7890. args: [],
  7891. 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",
  7892. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7893. referencedClasses: ["Point"]
  7894. }),
  7895. smalltalk.PointTest);
  7896. smalltalk.addMethod(
  7897. smalltalk.method({
  7898. selector: "testTranslateBy",
  7899. protocol: 'tests',
  7900. fn: function (){
  7901. var self=this;
  7902. return smalltalk.withContext(function($ctx1) {
  7903. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7904. $2=(3).__at((3));
  7905. $ctx1.sendIdx["@"]=1;
  7906. $3=(0).__at((1));
  7907. $ctx1.sendIdx["@"]=2;
  7908. $1=_st($2)._translateBy_($3);
  7909. $ctx1.sendIdx["translateBy:"]=1;
  7910. $4=(3).__at((4));
  7911. $ctx1.sendIdx["@"]=3;
  7912. self._assert_equals_($1,$4);
  7913. $ctx1.sendIdx["assert:equals:"]=1;
  7914. $6=(3).__at((3));
  7915. $ctx1.sendIdx["@"]=4;
  7916. $8=(1)._negated();
  7917. $ctx1.sendIdx["negated"]=1;
  7918. $7=(0).__at($8);
  7919. $ctx1.sendIdx["@"]=5;
  7920. $5=_st($6)._translateBy_($7);
  7921. $ctx1.sendIdx["translateBy:"]=2;
  7922. $9=(3).__at((2));
  7923. $ctx1.sendIdx["@"]=6;
  7924. self._assert_equals_($5,$9);
  7925. $ctx1.sendIdx["assert:equals:"]=2;
  7926. $11=(3).__at((3));
  7927. $ctx1.sendIdx["@"]=7;
  7928. $12=(2).__at((3));
  7929. $ctx1.sendIdx["@"]=8;
  7930. $10=_st($11)._translateBy_($12);
  7931. $ctx1.sendIdx["translateBy:"]=3;
  7932. $13=(5).__at((6));
  7933. $ctx1.sendIdx["@"]=9;
  7934. self._assert_equals_($10,$13);
  7935. $ctx1.sendIdx["assert:equals:"]=3;
  7936. $15=(3).__at((3));
  7937. $ctx1.sendIdx["@"]=10;
  7938. $16=_st((3)._negated()).__at((0));
  7939. $ctx1.sendIdx["@"]=11;
  7940. $14=_st($15)._translateBy_($16);
  7941. self._assert_equals_($14,(0).__at((3)));
  7942. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7943. args: [],
  7944. 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.",
  7945. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7946. referencedClasses: []
  7947. }),
  7948. smalltalk.PointTest);
  7949. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7950. smalltalk.addMethod(
  7951. smalltalk.method({
  7952. selector: "testNextIfAbsent",
  7953. protocol: 'tests',
  7954. fn: function (){
  7955. var self=this;
  7956. var queue;
  7957. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7958. return smalltalk.withContext(function($ctx1) {
  7959. var $2,$1;
  7960. queue=_st($Queue())._new();
  7961. _st(queue)._nextPut_("index1");
  7962. $2=_st(queue)._nextIfAbsent_("empty");
  7963. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7964. $1=_st($2).__eq("index1");
  7965. $ctx1.sendIdx["="]=1;
  7966. self._assert_($1);
  7967. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7968. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7969. args: [],
  7970. 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'",
  7971. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7972. referencedClasses: ["Queue"]
  7973. }),
  7974. smalltalk.QueueTest);
  7975. smalltalk.addMethod(
  7976. smalltalk.method({
  7977. selector: "testQueueNext",
  7978. protocol: 'tests',
  7979. fn: function (){
  7980. var self=this;
  7981. var queue;
  7982. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7983. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7984. return smalltalk.withContext(function($ctx1) {
  7985. var $1,$2,$4,$3,$6,$5;
  7986. queue=_st($Queue())._new();
  7987. $1=queue;
  7988. _st($1)._nextPut_("index1");
  7989. $ctx1.sendIdx["nextPut:"]=1;
  7990. $2=_st($1)._nextPut_("index2");
  7991. $4=_st(queue)._next();
  7992. $ctx1.sendIdx["next"]=1;
  7993. $3=_st($4).__eq("index1");
  7994. $ctx1.sendIdx["="]=1;
  7995. self._assert_($3);
  7996. $6=_st(queue)._next();
  7997. $ctx1.sendIdx["next"]=2;
  7998. $5=_st($6).__eq("index");
  7999. self._deny_($5);
  8000. self._should_raise_((function(){
  8001. return smalltalk.withContext(function($ctx2) {
  8002. return _st(queue)._next();
  8003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8004. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  8005. args: [],
  8006. 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",
  8007. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8008. referencedClasses: ["Queue", "Error"]
  8009. }),
  8010. smalltalk.QueueTest);
  8011. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8012. smalltalk.addMethod(
  8013. smalltalk.method({
  8014. selector: "testAtRandomNumber",
  8015. protocol: 'tests',
  8016. fn: function (){
  8017. var self=this;
  8018. var val;
  8019. return smalltalk.withContext(function($ctx1) {
  8020. (100)._timesRepeat_((function(){
  8021. return smalltalk.withContext(function($ctx2) {
  8022. val=(10)._atRandom();
  8023. val;
  8024. self._assert_(_st(val).__gt((0)));
  8025. $ctx2.sendIdx["assert:"]=1;
  8026. return self._assert_(_st(val).__lt((11)));
  8027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8028. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  8029. args: [],
  8030. 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]",
  8031. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8032. referencedClasses: []
  8033. }),
  8034. smalltalk.RandomTest);
  8035. smalltalk.addMethod(
  8036. smalltalk.method({
  8037. selector: "testAtRandomSequenceableCollection",
  8038. protocol: 'tests',
  8039. fn: function (){
  8040. var self=this;
  8041. var val;
  8042. return smalltalk.withContext(function($ctx1) {
  8043. var $3,$4,$2,$1;
  8044. (100)._timesRepeat_((function(){
  8045. return smalltalk.withContext(function($ctx2) {
  8046. val="abc"._atRandom();
  8047. val;
  8048. $3=_st(val).__eq("a");
  8049. $ctx2.sendIdx["="]=1;
  8050. $4=_st(val).__eq("b");
  8051. $ctx2.sendIdx["="]=2;
  8052. $2=_st($3).__or($4);
  8053. $1=_st($2).__or(_st(val).__eq("c"));
  8054. $ctx2.sendIdx["|"]=1;
  8055. return self._assert_($1);
  8056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8057. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  8058. args: [],
  8059. 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].",
  8060. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8061. referencedClasses: []
  8062. }),
  8063. smalltalk.RandomTest);
  8064. smalltalk.addMethod(
  8065. smalltalk.method({
  8066. selector: "textNext",
  8067. protocol: 'tests',
  8068. fn: function (){
  8069. var self=this;
  8070. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  8071. return smalltalk.withContext(function($ctx1) {
  8072. var $1;
  8073. (10000)._timesRepeat_((function(){
  8074. var current,next;
  8075. return smalltalk.withContext(function($ctx2) {
  8076. next=_st(_st($Random())._new())._next();
  8077. next;
  8078. self._assert_(_st(next).__gt_eq((0)));
  8079. $ctx2.sendIdx["assert:"]=1;
  8080. self._assert_(_st(next).__lt((1)));
  8081. $1=_st(current).__eq(next);
  8082. $ctx2.sendIdx["="]=1;
  8083. self._deny_($1);
  8084. return _st(next).__eq(current);
  8085. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8086. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  8087. args: [],
  8088. 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 ]",
  8089. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8090. referencedClasses: ["Random"]
  8091. }),
  8092. smalltalk.RandomTest);
  8093. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8094. smalltalk.addMethod(
  8095. smalltalk.method({
  8096. selector: "collectionClass",
  8097. protocol: 'accessing',
  8098. fn: function (){
  8099. var self=this;
  8100. return smalltalk.withContext(function($ctx1) {
  8101. var $1;
  8102. $1=_st(self._class())._collectionClass();
  8103. return $1;
  8104. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  8105. args: [],
  8106. source: "collectionClass\x0a\x09^ self class collectionClass",
  8107. messageSends: ["collectionClass", "class"],
  8108. referencedClasses: []
  8109. }),
  8110. smalltalk.StreamTest);
  8111. smalltalk.addMethod(
  8112. smalltalk.method({
  8113. selector: "newCollection",
  8114. protocol: 'accessing',
  8115. fn: function (){
  8116. var self=this;
  8117. return smalltalk.withContext(function($ctx1) {
  8118. var $1;
  8119. $1=_st(self._collectionClass())._new();
  8120. return $1;
  8121. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  8122. args: [],
  8123. source: "newCollection\x0a\x09^ self collectionClass new",
  8124. messageSends: ["new", "collectionClass"],
  8125. referencedClasses: []
  8126. }),
  8127. smalltalk.StreamTest);
  8128. smalltalk.addMethod(
  8129. smalltalk.method({
  8130. selector: "newStream",
  8131. protocol: 'accessing',
  8132. fn: function (){
  8133. var self=this;
  8134. return smalltalk.withContext(function($ctx1) {
  8135. var $1;
  8136. $1=_st(_st(self._collectionClass())._new())._stream();
  8137. return $1;
  8138. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  8139. args: [],
  8140. source: "newStream\x0a\x09^ self collectionClass new stream",
  8141. messageSends: ["stream", "new", "collectionClass"],
  8142. referencedClasses: []
  8143. }),
  8144. smalltalk.StreamTest);
  8145. smalltalk.addMethod(
  8146. smalltalk.method({
  8147. selector: "testAtStartAtEnd",
  8148. protocol: 'tests',
  8149. fn: function (){
  8150. var self=this;
  8151. var stream;
  8152. return smalltalk.withContext(function($ctx1) {
  8153. var $1,$2,$3,$4;
  8154. stream=self._newStream();
  8155. $1=_st(stream)._atStart();
  8156. $ctx1.sendIdx["atStart"]=1;
  8157. self._assert_($1);
  8158. $ctx1.sendIdx["assert:"]=1;
  8159. $2=_st(stream)._atEnd();
  8160. $ctx1.sendIdx["atEnd"]=1;
  8161. self._assert_($2);
  8162. $ctx1.sendIdx["assert:"]=2;
  8163. _st(stream)._nextPutAll_(self._newCollection());
  8164. $3=_st(stream)._atEnd();
  8165. $ctx1.sendIdx["atEnd"]=2;
  8166. self._assert_($3);
  8167. $4=_st(stream)._atStart();
  8168. $ctx1.sendIdx["atStart"]=2;
  8169. self._deny_($4);
  8170. $ctx1.sendIdx["deny:"]=1;
  8171. _st(stream)._position_((1));
  8172. self._deny_(_st(stream)._atEnd());
  8173. $ctx1.sendIdx["deny:"]=2;
  8174. self._deny_(_st(stream)._atStart());
  8175. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  8176. args: [],
  8177. 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",
  8178. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8179. referencedClasses: []
  8180. }),
  8181. smalltalk.StreamTest);
  8182. smalltalk.addMethod(
  8183. smalltalk.method({
  8184. selector: "testContents",
  8185. protocol: 'tests',
  8186. fn: function (){
  8187. var self=this;
  8188. var stream;
  8189. return smalltalk.withContext(function($ctx1) {
  8190. var $1,$2;
  8191. stream=self._newStream();
  8192. $1=stream;
  8193. $2=self._newCollection();
  8194. $ctx1.sendIdx["newCollection"]=1;
  8195. _st($1)._nextPutAll_($2);
  8196. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8197. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  8198. args: [],
  8199. 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",
  8200. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8201. referencedClasses: []
  8202. }),
  8203. smalltalk.StreamTest);
  8204. smalltalk.addMethod(
  8205. smalltalk.method({
  8206. selector: "testIsEmpty",
  8207. protocol: 'tests',
  8208. fn: function (){
  8209. var self=this;
  8210. var stream;
  8211. return smalltalk.withContext(function($ctx1) {
  8212. var $1;
  8213. stream=self._newStream();
  8214. $1=_st(stream)._isEmpty();
  8215. $ctx1.sendIdx["isEmpty"]=1;
  8216. self._assert_($1);
  8217. _st(stream)._nextPutAll_(self._newCollection());
  8218. self._deny_(_st(stream)._isEmpty());
  8219. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  8220. args: [],
  8221. 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",
  8222. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8223. referencedClasses: []
  8224. }),
  8225. smalltalk.StreamTest);
  8226. smalltalk.addMethod(
  8227. smalltalk.method({
  8228. selector: "testPosition",
  8229. protocol: 'tests',
  8230. fn: function (){
  8231. var self=this;
  8232. var collection,stream;
  8233. return smalltalk.withContext(function($ctx1) {
  8234. var $1,$2,$3;
  8235. collection=self._newCollection();
  8236. stream=self._newStream();
  8237. _st(stream)._nextPutAll_(collection);
  8238. $1=_st(stream)._position();
  8239. $ctx1.sendIdx["position"]=1;
  8240. self._assert_equals_($1,_st(collection)._size());
  8241. $ctx1.sendIdx["assert:equals:"]=1;
  8242. _st(stream)._position_((0));
  8243. $2=_st(stream)._position();
  8244. $ctx1.sendIdx["position"]=2;
  8245. self._assert_equals_($2,(0));
  8246. $ctx1.sendIdx["assert:equals:"]=2;
  8247. _st(stream)._next();
  8248. $ctx1.sendIdx["next"]=1;
  8249. $3=_st(stream)._position();
  8250. $ctx1.sendIdx["position"]=3;
  8251. self._assert_equals_($3,(1));
  8252. $ctx1.sendIdx["assert:equals:"]=3;
  8253. _st(stream)._next();
  8254. self._assert_equals_(_st(stream)._position(),(2));
  8255. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  8256. args: [],
  8257. 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",
  8258. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8259. referencedClasses: []
  8260. }),
  8261. smalltalk.StreamTest);
  8262. smalltalk.addMethod(
  8263. smalltalk.method({
  8264. selector: "testReading",
  8265. protocol: 'tests',
  8266. fn: function (){
  8267. var self=this;
  8268. var stream,collection;
  8269. return smalltalk.withContext(function($ctx1) {
  8270. var $1,$2,$3;
  8271. collection=self._newCollection();
  8272. stream=self._newStream();
  8273. $1=stream;
  8274. _st($1)._nextPutAll_(collection);
  8275. $2=_st($1)._position_((0));
  8276. _st(collection)._do_((function(each){
  8277. return smalltalk.withContext(function($ctx2) {
  8278. $3=_st(stream)._next();
  8279. $ctx2.sendIdx["next"]=1;
  8280. return self._assert_equals_($3,each);
  8281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8282. self._assert_(_st(_st(stream)._next())._isNil());
  8283. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8284. args: [],
  8285. 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",
  8286. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8287. referencedClasses: []
  8288. }),
  8289. smalltalk.StreamTest);
  8290. smalltalk.addMethod(
  8291. smalltalk.method({
  8292. selector: "testStreamContents",
  8293. protocol: 'tests',
  8294. fn: function (){
  8295. var self=this;
  8296. return smalltalk.withContext(function($ctx1) {
  8297. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8298. args: [],
  8299. source: "testStreamContents",
  8300. messageSends: [],
  8301. referencedClasses: []
  8302. }),
  8303. smalltalk.StreamTest);
  8304. smalltalk.addMethod(
  8305. smalltalk.method({
  8306. selector: "testWrite",
  8307. protocol: 'tests',
  8308. fn: function (){
  8309. var self=this;
  8310. var stream,collection;
  8311. return smalltalk.withContext(function($ctx1) {
  8312. collection=self._newCollection();
  8313. stream=self._newStream();
  8314. _st(collection)._do_((function(each){
  8315. return smalltalk.withContext(function($ctx2) {
  8316. return _st(stream).__lt_lt(each);
  8317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8318. self._assert_equals_(_st(stream)._contents(),collection);
  8319. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8320. args: [],
  8321. 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",
  8322. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8323. referencedClasses: []
  8324. }),
  8325. smalltalk.StreamTest);
  8326. smalltalk.addMethod(
  8327. smalltalk.method({
  8328. selector: "testWriting",
  8329. protocol: 'tests',
  8330. fn: function (){
  8331. var self=this;
  8332. var stream,collection;
  8333. return smalltalk.withContext(function($ctx1) {
  8334. var $1;
  8335. collection=self._newCollection();
  8336. stream=self._newStream();
  8337. $ctx1.sendIdx["newStream"]=1;
  8338. _st(collection)._do_((function(each){
  8339. return smalltalk.withContext(function($ctx2) {
  8340. return _st(stream)._nextPut_(each);
  8341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8342. $1=_st(stream)._contents();
  8343. $ctx1.sendIdx["contents"]=1;
  8344. self._assert_equals_($1,collection);
  8345. $ctx1.sendIdx["assert:equals:"]=1;
  8346. stream=self._newStream();
  8347. _st(stream)._nextPutAll_(collection);
  8348. self._assert_equals_(_st(stream)._contents(),collection);
  8349. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8350. args: [],
  8351. 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",
  8352. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8353. referencedClasses: []
  8354. }),
  8355. smalltalk.StreamTest);
  8356. smalltalk.addMethod(
  8357. smalltalk.method({
  8358. selector: "collectionClass",
  8359. protocol: 'accessing',
  8360. fn: function (){
  8361. var self=this;
  8362. return smalltalk.withContext(function($ctx1) {
  8363. return nil;
  8364. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8365. args: [],
  8366. source: "collectionClass\x0a\x09^ nil",
  8367. messageSends: [],
  8368. referencedClasses: []
  8369. }),
  8370. smalltalk.StreamTest.klass);
  8371. smalltalk.addMethod(
  8372. smalltalk.method({
  8373. selector: "isAbstract",
  8374. protocol: 'testing',
  8375. fn: function (){
  8376. var self=this;
  8377. return smalltalk.withContext(function($ctx1) {
  8378. var $1;
  8379. $1=_st(self._collectionClass())._isNil();
  8380. return $1;
  8381. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8382. args: [],
  8383. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8384. messageSends: ["isNil", "collectionClass"],
  8385. referencedClasses: []
  8386. }),
  8387. smalltalk.StreamTest.klass);
  8388. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8389. smalltalk.addMethod(
  8390. smalltalk.method({
  8391. selector: "newCollection",
  8392. protocol: 'accessing',
  8393. fn: function (){
  8394. var self=this;
  8395. return smalltalk.withContext(function($ctx1) {
  8396. var $1;
  8397. $1=[true,(1),(3).__at((4)),"foo"];
  8398. return $1;
  8399. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8400. args: [],
  8401. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8402. messageSends: ["@"],
  8403. referencedClasses: []
  8404. }),
  8405. smalltalk.ArrayStreamTest);
  8406. smalltalk.addMethod(
  8407. smalltalk.method({
  8408. selector: "collectionClass",
  8409. protocol: 'accessing',
  8410. fn: function (){
  8411. var self=this;
  8412. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8413. return smalltalk.withContext(function($ctx1) {
  8414. return $Array();
  8415. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8416. args: [],
  8417. source: "collectionClass\x0a\x09^ Array",
  8418. messageSends: [],
  8419. referencedClasses: ["Array"]
  8420. }),
  8421. smalltalk.ArrayStreamTest.klass);
  8422. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8423. smalltalk.addMethod(
  8424. smalltalk.method({
  8425. selector: "newCollection",
  8426. protocol: 'accessing',
  8427. fn: function (){
  8428. var self=this;
  8429. return smalltalk.withContext(function($ctx1) {
  8430. return "hello world";
  8431. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8432. args: [],
  8433. source: "newCollection\x0a\x09^ 'hello world'",
  8434. messageSends: [],
  8435. referencedClasses: []
  8436. }),
  8437. smalltalk.StringStreamTest);
  8438. smalltalk.addMethod(
  8439. smalltalk.method({
  8440. selector: "collectionClass",
  8441. protocol: 'accessing',
  8442. fn: function (){
  8443. var self=this;
  8444. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8445. return smalltalk.withContext(function($ctx1) {
  8446. return $String();
  8447. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8448. args: [],
  8449. source: "collectionClass\x0a\x09^ String",
  8450. messageSends: [],
  8451. referencedClasses: ["String"]
  8452. }),
  8453. smalltalk.StringStreamTest.klass);
  8454. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8455. smalltalk.addMethod(
  8456. smalltalk.method({
  8457. selector: "testCopying",
  8458. protocol: 'tests',
  8459. fn: function (){
  8460. var self=this;
  8461. return smalltalk.withContext(function($ctx1) {
  8462. self._assert_equals_(nil._copy(),nil);
  8463. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8464. args: [],
  8465. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8466. messageSends: ["assert:equals:", "copy"],
  8467. referencedClasses: []
  8468. }),
  8469. smalltalk.UndefinedTest);
  8470. smalltalk.addMethod(
  8471. smalltalk.method({
  8472. selector: "testDeepCopy",
  8473. protocol: 'tests',
  8474. fn: function (){
  8475. var self=this;
  8476. return smalltalk.withContext(function($ctx1) {
  8477. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8478. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8479. args: [],
  8480. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8481. messageSends: ["assert:", "=", "deepCopy"],
  8482. referencedClasses: []
  8483. }),
  8484. smalltalk.UndefinedTest);
  8485. smalltalk.addMethod(
  8486. smalltalk.method({
  8487. selector: "testIfNil",
  8488. protocol: 'tests',
  8489. fn: function (){
  8490. var self=this;
  8491. return smalltalk.withContext(function($ctx1) {
  8492. var $1,$3,$2,$4,$6,$5;
  8493. if(($receiver = nil) == nil || $receiver == null){
  8494. $1=true;
  8495. } else {
  8496. $1=nil;
  8497. };
  8498. self._assert_equals_($1,true);
  8499. $ctx1.sendIdx["assert:equals:"]=1;
  8500. if(($receiver = nil) == nil || $receiver == null){
  8501. $3=nil;
  8502. } else {
  8503. $3=true;
  8504. };
  8505. $2=_st($3).__eq(true);
  8506. $ctx1.sendIdx["="]=1;
  8507. self._deny_($2);
  8508. $ctx1.sendIdx["deny:"]=1;
  8509. if(($receiver = nil) == nil || $receiver == null){
  8510. $4=true;
  8511. } else {
  8512. $4=false;
  8513. };
  8514. self._assert_equals_($4,true);
  8515. if(($receiver = nil) == nil || $receiver == null){
  8516. $6=false;
  8517. } else {
  8518. $6=true;
  8519. };
  8520. $5=_st($6).__eq(true);
  8521. self._deny_($5);
  8522. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8523. args: [],
  8524. 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",
  8525. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8526. referencedClasses: []
  8527. }),
  8528. smalltalk.UndefinedTest);
  8529. smalltalk.addMethod(
  8530. smalltalk.method({
  8531. selector: "testIsNil",
  8532. protocol: 'tests',
  8533. fn: function (){
  8534. var self=this;
  8535. return smalltalk.withContext(function($ctx1) {
  8536. self._assert_(nil._isNil());
  8537. self._deny_(nil._notNil());
  8538. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8539. args: [],
  8540. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8541. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8542. referencedClasses: []
  8543. }),
  8544. smalltalk.UndefinedTest);
  8545. });