Kernel-Tests.js 337 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174
  1. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Tests');
  4. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "testAddExtensionMethod",
  9. protocol: 'tests',
  10. fn: function (){
  11. var self=this;
  12. var method,dirty;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  15. $2=self._class();
  16. $ctx1.sendIdx["class"]=1;
  17. $1=_st($2)._package();
  18. $ctx1.sendIdx["package"]=1;
  19. dirty=_st($1)._isDirty();
  20. $ctx1.sendIdx["isDirty"]=1;
  21. $4=self._class();
  22. $ctx1.sendIdx["class"]=2;
  23. $3=_st($4)._package();
  24. $ctx1.sendIdx["package"]=2;
  25. _st($3)._beClean();
  26. $5=self._class();
  27. $ctx1.sendIdx["class"]=3;
  28. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  29. $8=self._class();
  30. $ctx1.sendIdx["class"]=4;
  31. $7=_st($8)._package();
  32. $ctx1.sendIdx["package"]=3;
  33. $6=_st($7)._isDirty();
  34. self._deny_($6);
  35. $9=self._class();
  36. $ctx1.sendIdx["class"]=5;
  37. _st($9)._removeCompiledMethod_(method);
  38. $10=dirty;
  39. if(smalltalk.assert($10)){
  40. _st(_st(self._class())._package())._beDirty();
  41. };
  42. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)})},
  43. args: [],
  44. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  45. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"],
  46. referencedClasses: []
  47. }),
  48. globals.AnnouncementSubscriptionTest);
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "testHandlesAnnouncement",
  52. protocol: 'tests',
  53. fn: function (){
  54. var self=this;
  55. var subscription,announcementClass1,announcementClass2,classBuilder;
  56. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  57. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  59. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  60. return smalltalk.withContext(function($ctx1) {
  61. var $1,$2;
  62. classBuilder=_st($ClassBuilder())._new();
  63. $ctx1.sendIdx["new"]=1;
  64. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  65. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  66. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  67. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  68. self._assert_equals_($1,true);
  69. $ctx1.sendIdx["assert:equals:"]=1;
  70. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  71. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  72. self._assert_equals_($2,true);
  73. $ctx1.sendIdx["assert:equals:"]=2;
  74. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  75. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  76. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  77. args: [],
  78. 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.",
  79. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  80. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  81. }),
  82. globals.AnnouncementSubscriptionTest);
  83. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "testOnDo",
  87. protocol: 'tests',
  88. fn: function (){
  89. var self=this;
  90. var counter,announcer;
  91. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  92. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  93. return smalltalk.withContext(function($ctx1) {
  94. var $1,$2;
  95. counter=(0);
  96. announcer=_st($Announcer())._new();
  97. $ctx1.sendIdx["new"]=1;
  98. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. counter=_st(counter).__plus((1));
  101. return counter;
  102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  103. $1=announcer;
  104. $2=_st($SystemAnnouncement())._new();
  105. $ctx1.sendIdx["new"]=2;
  106. _st($1)._announce_($2);
  107. $ctx1.sendIdx["announce:"]=1;
  108. self._assert_equals_(counter,(1));
  109. $ctx1.sendIdx["assert:equals:"]=1;
  110. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  111. self._assert_equals_(counter,(2));
  112. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  113. args: [],
  114. 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.",
  115. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  116. referencedClasses: ["Announcer", "SystemAnnouncement"]
  117. }),
  118. globals.AnnouncerTest);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "testOnDoFor",
  122. protocol: 'tests',
  123. fn: function (){
  124. var self=this;
  125. var counter,announcer;
  126. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  127. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  128. return smalltalk.withContext(function($ctx1) {
  129. var $1,$2,$3,$4;
  130. counter=(0);
  131. announcer=_st($Announcer())._new();
  132. $ctx1.sendIdx["new"]=1;
  133. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  134. return smalltalk.withContext(function($ctx2) {
  135. counter=_st(counter).__plus((1));
  136. return counter;
  137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  138. $1=announcer;
  139. $2=_st($SystemAnnouncement())._new();
  140. $ctx1.sendIdx["new"]=2;
  141. _st($1)._announce_($2);
  142. $ctx1.sendIdx["announce:"]=1;
  143. self._assert_equals_(counter,(1));
  144. $ctx1.sendIdx["assert:equals:"]=1;
  145. $3=announcer;
  146. $4=_st($SystemAnnouncement())._new();
  147. $ctx1.sendIdx["new"]=3;
  148. _st($3)._announce_($4);
  149. $ctx1.sendIdx["announce:"]=2;
  150. self._assert_equals_(counter,(2));
  151. $ctx1.sendIdx["assert:equals:"]=2;
  152. _st(announcer)._unsubscribe_(self);
  153. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  154. self._assert_equals_(counter,(2));
  155. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  156. args: [],
  157. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  158. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  159. referencedClasses: ["Announcer", "SystemAnnouncement"]
  160. }),
  161. globals.AnnouncerTest);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "testOnDoOnce",
  165. protocol: 'tests',
  166. fn: function (){
  167. var self=this;
  168. var counter,announcer;
  169. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  170. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  171. return smalltalk.withContext(function($ctx1) {
  172. var $1,$2;
  173. counter=(0);
  174. announcer=_st($Announcer())._new();
  175. $ctx1.sendIdx["new"]=1;
  176. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  177. return smalltalk.withContext(function($ctx2) {
  178. counter=_st(counter).__plus((1));
  179. return counter;
  180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  181. $1=announcer;
  182. $2=_st($SystemAnnouncement())._new();
  183. $ctx1.sendIdx["new"]=2;
  184. _st($1)._announce_($2);
  185. $ctx1.sendIdx["announce:"]=1;
  186. self._assert_equals_(counter,(1));
  187. $ctx1.sendIdx["assert:equals:"]=1;
  188. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  189. self._assert_equals_(counter,(1));
  190. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  191. args: [],
  192. 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.",
  193. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  194. referencedClasses: ["Announcer", "SystemAnnouncement"]
  195. }),
  196. globals.AnnouncerTest);
  197. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "testCanClearInterval",
  201. protocol: 'tests',
  202. fn: function (){
  203. var self=this;
  204. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  205. return smalltalk.withContext(function($ctx1) {
  206. self._shouldnt_raise_((function(){
  207. return smalltalk.withContext(function($ctx2) {
  208. return _st(_st((function(){
  209. return smalltalk.withContext(function($ctx3) {
  210. return _st(_st($Error())._new())._signal();
  211. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  213. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  214. args: [],
  215. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  216. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  217. referencedClasses: ["Error"]
  218. }),
  219. globals.BlockClosureTest);
  220. smalltalk.addMethod(
  221. smalltalk.method({
  222. selector: "testCanClearTimeout",
  223. protocol: 'tests',
  224. fn: function (){
  225. var self=this;
  226. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  227. return smalltalk.withContext(function($ctx1) {
  228. self._shouldnt_raise_((function(){
  229. return smalltalk.withContext(function($ctx2) {
  230. return _st(_st((function(){
  231. return smalltalk.withContext(function($ctx3) {
  232. return _st(_st($Error())._new())._signal();
  233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  235. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  236. args: [],
  237. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  238. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  239. referencedClasses: ["Error"]
  240. }),
  241. globals.BlockClosureTest);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "testCompiledSource",
  245. protocol: 'tests',
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) {
  249. self._assert_(_st(_st((function(){
  250. return smalltalk.withContext(function($ctx2) {
  251. return (1).__plus((1));
  252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  253. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  254. args: [],
  255. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  256. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  257. referencedClasses: []
  258. }),
  259. globals.BlockClosureTest);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "testCurrySelf",
  263. protocol: 'tests',
  264. fn: function (){
  265. var self=this;
  266. var curriedMethod,array;
  267. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  268. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  269. return smalltalk.withContext(function($ctx1) {
  270. curriedMethod=_st(_st((function(selfarg,x){
  271. return smalltalk.withContext(function($ctx2) {
  272. return _st(selfarg)._at_(x);
  273. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  274. array=[(3), (1), (4)];
  275. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  276. _st((function(){
  277. return smalltalk.withContext(function($ctx2) {
  278. return self._assert_equals_(_st(array)._foo_((2)),(1));
  279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  280. return smalltalk.withContext(function($ctx2) {
  281. return _st($Array())._removeCompiledMethod_(curriedMethod);
  282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  283. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  284. args: [],
  285. 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 ]",
  286. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  287. referencedClasses: ["ClassBuilder", "Array"]
  288. }),
  289. globals.BlockClosureTest);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "testEnsure",
  293. protocol: 'tests',
  294. fn: function (){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) {
  297. self._assert_equals_(_st((function(){
  298. return (3);
  299. }))._ensure_((function(){
  300. return (4);
  301. })),(3));
  302. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  303. args: [],
  304. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  305. messageSends: ["assert:equals:", "ensure:"],
  306. referencedClasses: []
  307. }),
  308. globals.BlockClosureTest);
  309. smalltalk.addMethod(
  310. smalltalk.method({
  311. selector: "testEnsureRaises",
  312. protocol: 'tests',
  313. fn: function (){
  314. var self=this;
  315. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  316. return smalltalk.withContext(function($ctx1) {
  317. self._should_raise_((function(){
  318. return smalltalk.withContext(function($ctx2) {
  319. return _st((function(){
  320. return smalltalk.withContext(function($ctx3) {
  321. return _st(_st($Error())._new())._signal();
  322. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  323. return true;
  324. }));
  325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  326. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  327. args: [],
  328. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  329. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  330. referencedClasses: ["Error"]
  331. }),
  332. globals.BlockClosureTest);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "testExceptionSemantics",
  336. protocol: 'tests',
  337. fn: function (){
  338. var self=this;
  339. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  340. return smalltalk.withContext(function($ctx1) {
  341. self._timeout_((100));
  342. _st(self._async_((function(){
  343. return smalltalk.withContext(function($ctx2) {
  344. return _st((function(){
  345. return smalltalk.withContext(function($ctx3) {
  346. self._assert_(true);
  347. _st($Error())._signal();
  348. self._deny_(true);
  349. return self._finished();
  350. $ctx3.sendIdx["finished"]=1;
  351. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  352. return smalltalk.withContext(function($ctx3) {
  353. return self._finished();
  354. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  356. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  357. args: [],
  358. 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",
  359. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  360. referencedClasses: ["Error"]
  361. }),
  362. globals.BlockClosureTest);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "testNewWithValues",
  366. protocol: 'tests',
  367. fn: function (){
  368. var self=this;
  369. return smalltalk.withContext(function($ctx1) {
  370. function TestConstructor(arg1, arg2, arg3) {}
  371. TestConstructor.prototype.name = 'theTestPrototype';
  372. var wrappedConstructor = _st(TestConstructor);
  373. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  374. self._assert_(result instanceof TestConstructor);
  375. self._assert_equals_(result.name, 'theTestPrototype');
  376. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  377. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  378. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  379. args: [],
  380. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  381. messageSends: [],
  382. referencedClasses: []
  383. }),
  384. globals.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testNumArgs",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st((function(){
  394. }))._numArgs();
  395. $ctx1.sendIdx["numArgs"]=1;
  396. self._assert_equals_($1,(0));
  397. $ctx1.sendIdx["assert:equals:"]=1;
  398. self._assert_equals_(_st((function(a,b){
  399. }))._numArgs(),(2));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  401. args: [],
  402. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  403. messageSends: ["assert:equals:", "numArgs"],
  404. referencedClasses: []
  405. }),
  406. globals.BlockClosureTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testOnDo",
  410. protocol: 'tests',
  411. fn: function (){
  412. var self=this;
  413. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  414. return smalltalk.withContext(function($ctx1) {
  415. self._assert_(_st((function(){
  416. return smalltalk.withContext(function($ctx2) {
  417. return _st(_st($Error())._new())._signal();
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  419. return true;
  420. })));
  421. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  422. args: [],
  423. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  424. messageSends: ["assert:", "on:do:", "signal", "new"],
  425. referencedClasses: ["Error"]
  426. }),
  427. globals.BlockClosureTest);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testValue",
  431. protocol: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $1;
  436. $1=_st((function(){
  437. return smalltalk.withContext(function($ctx2) {
  438. return (1).__plus((1));
  439. $ctx2.sendIdx["+"]=1;
  440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  441. $ctx1.sendIdx["value"]=1;
  442. self._assert_equals_($1,(2));
  443. $ctx1.sendIdx["assert:equals:"]=1;
  444. self._assert_equals_(_st((function(x){
  445. return smalltalk.withContext(function($ctx2) {
  446. return _st(x).__plus((1));
  447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  448. $ctx1.sendIdx["assert:equals:"]=2;
  449. self._assert_equals_(_st((function(x,y){
  450. return smalltalk.withContext(function($ctx2) {
  451. return _st(x).__star(y);
  452. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  453. $ctx1.sendIdx["assert:equals:"]=3;
  454. self._assert_equals_(_st((function(a,b,c){
  455. return (1);
  456. }))._value(),(1));
  457. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  458. args: [],
  459. 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",
  460. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  461. referencedClasses: []
  462. }),
  463. globals.BlockClosureTest);
  464. smalltalk.addMethod(
  465. smalltalk.method({
  466. selector: "testValueWithPossibleArguments",
  467. protocol: 'tests',
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) {
  471. var $1,$2;
  472. $1=_st((function(){
  473. return (1);
  474. }))._valueWithPossibleArguments_([(3), (4)]);
  475. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  476. self._assert_equals_($1,(1));
  477. $ctx1.sendIdx["assert:equals:"]=1;
  478. $2=_st((function(a){
  479. return smalltalk.withContext(function($ctx2) {
  480. return _st(a).__plus((4));
  481. $ctx2.sendIdx["+"]=1;
  482. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  483. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  484. self._assert_equals_($2,(7));
  485. $ctx1.sendIdx["assert:equals:"]=2;
  486. self._assert_equals_(_st((function(a,b){
  487. return smalltalk.withContext(function($ctx2) {
  488. return _st(a).__plus(b);
  489. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  490. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  491. args: [],
  492. 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.",
  493. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  494. referencedClasses: []
  495. }),
  496. globals.BlockClosureTest);
  497. smalltalk.addMethod(
  498. smalltalk.method({
  499. selector: "testWhileFalse",
  500. protocol: 'tests',
  501. fn: function (){
  502. var self=this;
  503. var i;
  504. return smalltalk.withContext(function($ctx1) {
  505. i=(0);
  506. _st((function(){
  507. return smalltalk.withContext(function($ctx2) {
  508. return _st(i).__gt((5));
  509. $ctx2.sendIdx[">"]=1;
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  511. return smalltalk.withContext(function($ctx2) {
  512. i=_st(i).__plus((1));
  513. $ctx2.sendIdx["+"]=1;
  514. return i;
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  516. self._assert_equals_(i,(6));
  517. $ctx1.sendIdx["assert:equals:"]=1;
  518. i=(0);
  519. _st((function(){
  520. return smalltalk.withContext(function($ctx2) {
  521. i=_st(i).__plus((1));
  522. i;
  523. return _st(i).__gt((5));
  524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  525. self._assert_equals_(i,(6));
  526. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  527. args: [],
  528. 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",
  529. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  530. referencedClasses: []
  531. }),
  532. globals.BlockClosureTest);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "testWhileTrue",
  536. protocol: 'tests',
  537. fn: function (){
  538. var self=this;
  539. var i;
  540. return smalltalk.withContext(function($ctx1) {
  541. i=(0);
  542. _st((function(){
  543. return smalltalk.withContext(function($ctx2) {
  544. return _st(i).__lt((5));
  545. $ctx2.sendIdx["<"]=1;
  546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  547. return smalltalk.withContext(function($ctx2) {
  548. i=_st(i).__plus((1));
  549. $ctx2.sendIdx["+"]=1;
  550. return i;
  551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  552. self._assert_equals_(i,(5));
  553. $ctx1.sendIdx["assert:equals:"]=1;
  554. i=(0);
  555. _st((function(){
  556. return smalltalk.withContext(function($ctx2) {
  557. i=_st(i).__plus((1));
  558. i;
  559. return _st(i).__lt((5));
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  561. self._assert_equals_(i,(5));
  562. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  563. args: [],
  564. 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",
  565. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  566. referencedClasses: []
  567. }),
  568. globals.BlockClosureTest);
  569. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  570. smalltalk.addMethod(
  571. smalltalk.method({
  572. selector: "testEquality",
  573. protocol: 'tests',
  574. fn: function (){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  578. $1=(0).__eq(false);
  579. $ctx1.sendIdx["="]=1;
  580. self._deny_($1);
  581. $ctx1.sendIdx["deny:"]=1;
  582. $2=false.__eq((0));
  583. $ctx1.sendIdx["="]=2;
  584. self._deny_($2);
  585. $ctx1.sendIdx["deny:"]=2;
  586. $3="".__eq(false);
  587. $ctx1.sendIdx["="]=3;
  588. self._deny_($3);
  589. $ctx1.sendIdx["deny:"]=3;
  590. $4=false.__eq("");
  591. $ctx1.sendIdx["="]=4;
  592. self._deny_($4);
  593. $ctx1.sendIdx["deny:"]=4;
  594. $5=true.__eq(true);
  595. $ctx1.sendIdx["="]=5;
  596. self._assert_($5);
  597. $ctx1.sendIdx["assert:"]=1;
  598. $6=false.__eq(true);
  599. $ctx1.sendIdx["="]=6;
  600. self._deny_($6);
  601. $ctx1.sendIdx["deny:"]=5;
  602. $7=true.__eq(false);
  603. $ctx1.sendIdx["="]=7;
  604. self._deny_($7);
  605. $8=false.__eq(false);
  606. $ctx1.sendIdx["="]=8;
  607. self._assert_($8);
  608. $ctx1.sendIdx["assert:"]=2;
  609. $10=true._yourself();
  610. $ctx1.sendIdx["yourself"]=1;
  611. $9=_st($10).__eq(true);
  612. $ctx1.sendIdx["="]=9;
  613. self._assert_($9);
  614. $ctx1.sendIdx["assert:"]=3;
  615. $12=true._yourself();
  616. $ctx1.sendIdx["yourself"]=2;
  617. $11=_st($12).__eq(true._yourself());
  618. self._assert_($11);
  619. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  620. args: [],
  621. 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)",
  622. messageSends: ["deny:", "=", "assert:", "yourself"],
  623. referencedClasses: []
  624. }),
  625. globals.BooleanTest);
  626. smalltalk.addMethod(
  627. smalltalk.method({
  628. selector: "testIdentity",
  629. protocol: 'tests',
  630. fn: function (){
  631. var self=this;
  632. return smalltalk.withContext(function($ctx1) {
  633. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  634. $1=(0).__eq_eq(false);
  635. $ctx1.sendIdx["=="]=1;
  636. self._deny_($1);
  637. $ctx1.sendIdx["deny:"]=1;
  638. $2=false.__eq_eq((0));
  639. $ctx1.sendIdx["=="]=2;
  640. self._deny_($2);
  641. $ctx1.sendIdx["deny:"]=2;
  642. $3="".__eq_eq(false);
  643. $ctx1.sendIdx["=="]=3;
  644. self._deny_($3);
  645. $ctx1.sendIdx["deny:"]=3;
  646. $4=false.__eq_eq("");
  647. $ctx1.sendIdx["=="]=4;
  648. self._deny_($4);
  649. $ctx1.sendIdx["deny:"]=4;
  650. $5=true.__eq_eq(true);
  651. $ctx1.sendIdx["=="]=5;
  652. self._assert_($5);
  653. $ctx1.sendIdx["assert:"]=1;
  654. $6=false.__eq_eq(true);
  655. $ctx1.sendIdx["=="]=6;
  656. self._deny_($6);
  657. $ctx1.sendIdx["deny:"]=5;
  658. $7=true.__eq_eq(false);
  659. $ctx1.sendIdx["=="]=7;
  660. self._deny_($7);
  661. $8=false.__eq_eq(false);
  662. $ctx1.sendIdx["=="]=8;
  663. self._assert_($8);
  664. $ctx1.sendIdx["assert:"]=2;
  665. $10=true._yourself();
  666. $ctx1.sendIdx["yourself"]=1;
  667. $9=_st($10).__eq_eq(true);
  668. $ctx1.sendIdx["=="]=9;
  669. self._assert_($9);
  670. $ctx1.sendIdx["assert:"]=3;
  671. $12=true._yourself();
  672. $ctx1.sendIdx["yourself"]=2;
  673. $11=_st($12).__eq_eq(true._yourself());
  674. self._assert_($11);
  675. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  676. args: [],
  677. 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",
  678. messageSends: ["deny:", "==", "assert:", "yourself"],
  679. referencedClasses: []
  680. }),
  681. globals.BooleanTest);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "testIfTrueIfFalse",
  685. protocol: 'tests',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1,$2,$3,$4,$5,$6,$7,$8;
  690. if(smalltalk.assert(true)){
  691. $1="alternative block";
  692. };
  693. self._assert_equals_($1,"alternative block");
  694. $ctx1.sendIdx["assert:equals:"]=1;
  695. if(! smalltalk.assert(true)){
  696. $2="alternative block";
  697. };
  698. self._assert_equals_($2,nil);
  699. $ctx1.sendIdx["assert:equals:"]=2;
  700. if(smalltalk.assert(false)){
  701. $3="alternative block";
  702. };
  703. self._assert_equals_($3,nil);
  704. $ctx1.sendIdx["assert:equals:"]=3;
  705. if(! smalltalk.assert(false)){
  706. $4="alternative block";
  707. };
  708. self._assert_equals_($4,"alternative block");
  709. $ctx1.sendIdx["assert:equals:"]=4;
  710. if(smalltalk.assert(false)){
  711. $5="alternative block";
  712. } else {
  713. $5="alternative block2";
  714. };
  715. self._assert_equals_($5,"alternative block2");
  716. $ctx1.sendIdx["assert:equals:"]=5;
  717. if(smalltalk.assert(false)){
  718. $6="alternative block2";
  719. } else {
  720. $6="alternative block";
  721. };
  722. self._assert_equals_($6,"alternative block");
  723. $ctx1.sendIdx["assert:equals:"]=6;
  724. if(smalltalk.assert(true)){
  725. $7="alternative block";
  726. } else {
  727. $7="alternative block2";
  728. };
  729. self._assert_equals_($7,"alternative block");
  730. $ctx1.sendIdx["assert:equals:"]=7;
  731. if(smalltalk.assert(true)){
  732. $8="alternative block2";
  733. } else {
  734. $8="alternative block";
  735. };
  736. self._assert_equals_($8,"alternative block2");
  737. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  738. args: [],
  739. 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'.",
  740. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  741. referencedClasses: []
  742. }),
  743. globals.BooleanTest);
  744. smalltalk.addMethod(
  745. smalltalk.method({
  746. selector: "testIfTrueIfFalseWithBoxing",
  747. protocol: 'tests',
  748. fn: function (){
  749. var self=this;
  750. return smalltalk.withContext(function($ctx1) {
  751. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  752. $2=true._yourself();
  753. $ctx1.sendIdx["yourself"]=1;
  754. if(smalltalk.assert($2)){
  755. $1="alternative block";
  756. };
  757. self._assert_equals_($1,"alternative block");
  758. $ctx1.sendIdx["assert:equals:"]=1;
  759. $4=true._yourself();
  760. $ctx1.sendIdx["yourself"]=2;
  761. if(! smalltalk.assert($4)){
  762. $3="alternative block";
  763. };
  764. self._assert_equals_($3,nil);
  765. $ctx1.sendIdx["assert:equals:"]=2;
  766. $6=false._yourself();
  767. $ctx1.sendIdx["yourself"]=3;
  768. if(smalltalk.assert($6)){
  769. $5="alternative block";
  770. };
  771. self._assert_equals_($5,nil);
  772. $ctx1.sendIdx["assert:equals:"]=3;
  773. $8=false._yourself();
  774. $ctx1.sendIdx["yourself"]=4;
  775. if(! smalltalk.assert($8)){
  776. $7="alternative block";
  777. };
  778. self._assert_equals_($7,"alternative block");
  779. $ctx1.sendIdx["assert:equals:"]=4;
  780. $10=false._yourself();
  781. $ctx1.sendIdx["yourself"]=5;
  782. if(smalltalk.assert($10)){
  783. $9="alternative block";
  784. } else {
  785. $9="alternative block2";
  786. };
  787. self._assert_equals_($9,"alternative block2");
  788. $ctx1.sendIdx["assert:equals:"]=5;
  789. $12=false._yourself();
  790. $ctx1.sendIdx["yourself"]=6;
  791. if(smalltalk.assert($12)){
  792. $11="alternative block2";
  793. } else {
  794. $11="alternative block";
  795. };
  796. self._assert_equals_($11,"alternative block");
  797. $ctx1.sendIdx["assert:equals:"]=6;
  798. $14=true._yourself();
  799. $ctx1.sendIdx["yourself"]=7;
  800. if(smalltalk.assert($14)){
  801. $13="alternative block";
  802. } else {
  803. $13="alternative block2";
  804. };
  805. self._assert_equals_($13,"alternative block");
  806. $ctx1.sendIdx["assert:equals:"]=7;
  807. $16=true._yourself();
  808. if(smalltalk.assert($16)){
  809. $15="alternative block2";
  810. } else {
  811. $15="alternative block";
  812. };
  813. self._assert_equals_($15,"alternative block2");
  814. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  815. args: [],
  816. 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'.",
  817. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  818. referencedClasses: []
  819. }),
  820. globals.BooleanTest);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "testLogic",
  824. protocol: 'tests',
  825. fn: function (){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. 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;
  829. $1=true.__and(true);
  830. $ctx1.sendIdx["&"]=1;
  831. self._assert_($1);
  832. $ctx1.sendIdx["assert:"]=1;
  833. $2=true.__and(false);
  834. $ctx1.sendIdx["&"]=2;
  835. self._deny_($2);
  836. $ctx1.sendIdx["deny:"]=1;
  837. $3=false.__and(true);
  838. $ctx1.sendIdx["&"]=3;
  839. self._deny_($3);
  840. $ctx1.sendIdx["deny:"]=2;
  841. $5=false.__and(false);
  842. $ctx1.sendIdx["&"]=4;
  843. $4=self._deny_($5);
  844. $ctx1.sendIdx["deny:"]=3;
  845. $6=true.__or(true);
  846. $ctx1.sendIdx["|"]=1;
  847. self._assert_($6);
  848. $ctx1.sendIdx["assert:"]=2;
  849. $7=true.__or(false);
  850. $ctx1.sendIdx["|"]=2;
  851. self._assert_($7);
  852. $ctx1.sendIdx["assert:"]=3;
  853. $8=false.__or(true);
  854. $ctx1.sendIdx["|"]=3;
  855. self._assert_($8);
  856. $ctx1.sendIdx["assert:"]=4;
  857. $10=false.__or(false);
  858. $ctx1.sendIdx["|"]=4;
  859. $9=self._deny_($10);
  860. $ctx1.sendIdx["deny:"]=4;
  861. $12=(1).__gt((0));
  862. $ctx1.sendIdx[">"]=1;
  863. $11=true.__and($12);
  864. $ctx1.sendIdx["&"]=5;
  865. self._assert_($11);
  866. $ctx1.sendIdx["assert:"]=5;
  867. $14=(1).__gt((0));
  868. $ctx1.sendIdx[">"]=2;
  869. $13=_st($14).__and(false);
  870. $ctx1.sendIdx["&"]=6;
  871. self._deny_($13);
  872. $ctx1.sendIdx["deny:"]=5;
  873. $17=(1).__gt((0));
  874. $ctx1.sendIdx[">"]=3;
  875. $18=(1).__gt((2));
  876. $ctx1.sendIdx[">"]=4;
  877. $16=_st($17).__and($18);
  878. $15=self._deny_($16);
  879. $20=(1).__gt((0));
  880. $ctx1.sendIdx[">"]=5;
  881. $19=false.__or($20);
  882. $ctx1.sendIdx["|"]=5;
  883. self._assert_($19);
  884. $ctx1.sendIdx["assert:"]=6;
  885. $22=(1).__gt((0));
  886. $ctx1.sendIdx[">"]=6;
  887. $21=_st($22).__or(false);
  888. $ctx1.sendIdx["|"]=6;
  889. self._assert_($21);
  890. $ctx1.sendIdx["assert:"]=7;
  891. $25=(1).__gt((0));
  892. $ctx1.sendIdx[">"]=7;
  893. $24=_st($25).__or((1).__gt((2)));
  894. $23=self._assert_($24);
  895. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  896. args: [],
  897. 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))",
  898. messageSends: ["assert:", "&", "deny:", "|", ">"],
  899. referencedClasses: []
  900. }),
  901. globals.BooleanTest);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "testLogicKeywords",
  905. protocol: 'tests',
  906. fn: function (){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  910. $1=true._and_((function(){
  911. return true;
  912. }));
  913. $ctx1.sendIdx["and:"]=1;
  914. self._assert_($1);
  915. $ctx1.sendIdx["assert:"]=1;
  916. $2=true._and_((function(){
  917. return false;
  918. }));
  919. $ctx1.sendIdx["and:"]=2;
  920. self._deny_($2);
  921. $ctx1.sendIdx["deny:"]=1;
  922. $3=false._and_((function(){
  923. return true;
  924. }));
  925. $ctx1.sendIdx["and:"]=3;
  926. self._deny_($3);
  927. $ctx1.sendIdx["deny:"]=2;
  928. $5=false._and_((function(){
  929. return false;
  930. }));
  931. $ctx1.sendIdx["and:"]=4;
  932. $4=self._deny_($5);
  933. $ctx1.sendIdx["deny:"]=3;
  934. $6=true._or_((function(){
  935. return true;
  936. }));
  937. $ctx1.sendIdx["or:"]=1;
  938. self._assert_($6);
  939. $ctx1.sendIdx["assert:"]=2;
  940. $7=true._or_((function(){
  941. return false;
  942. }));
  943. $ctx1.sendIdx["or:"]=2;
  944. self._assert_($7);
  945. $ctx1.sendIdx["assert:"]=3;
  946. $8=false._or_((function(){
  947. return true;
  948. }));
  949. $ctx1.sendIdx["or:"]=3;
  950. self._assert_($8);
  951. $ctx1.sendIdx["assert:"]=4;
  952. $10=false._or_((function(){
  953. return false;
  954. }));
  955. $ctx1.sendIdx["or:"]=4;
  956. $9=self._deny_($10);
  957. $ctx1.sendIdx["deny:"]=4;
  958. $11=true._and_((function(){
  959. return smalltalk.withContext(function($ctx2) {
  960. return (1).__gt((0));
  961. $ctx2.sendIdx[">"]=1;
  962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  963. $ctx1.sendIdx["and:"]=5;
  964. self._assert_($11);
  965. $ctx1.sendIdx["assert:"]=5;
  966. $13=(1).__gt((0));
  967. $ctx1.sendIdx[">"]=2;
  968. $12=_st($13)._and_((function(){
  969. return false;
  970. }));
  971. $ctx1.sendIdx["and:"]=6;
  972. self._deny_($12);
  973. $ctx1.sendIdx["deny:"]=5;
  974. $16=(1).__gt((0));
  975. $ctx1.sendIdx[">"]=3;
  976. $15=_st($16)._and_((function(){
  977. return smalltalk.withContext(function($ctx2) {
  978. return (1).__gt((2));
  979. $ctx2.sendIdx[">"]=4;
  980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  981. $14=self._deny_($15);
  982. $17=false._or_((function(){
  983. return smalltalk.withContext(function($ctx2) {
  984. return (1).__gt((0));
  985. $ctx2.sendIdx[">"]=5;
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  987. $ctx1.sendIdx["or:"]=5;
  988. self._assert_($17);
  989. $ctx1.sendIdx["assert:"]=6;
  990. $19=(1).__gt((0));
  991. $ctx1.sendIdx[">"]=6;
  992. $18=_st($19)._or_((function(){
  993. return false;
  994. }));
  995. $ctx1.sendIdx["or:"]=6;
  996. self._assert_($18);
  997. $ctx1.sendIdx["assert:"]=7;
  998. $22=(1).__gt((0));
  999. $ctx1.sendIdx[">"]=7;
  1000. $21=_st($22)._or_((function(){
  1001. return smalltalk.withContext(function($ctx2) {
  1002. return (1).__gt((2));
  1003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  1004. $20=self._assert_($21);
  1005. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  1006. args: [],
  1007. 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 ])",
  1008. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  1009. referencedClasses: []
  1010. }),
  1011. globals.BooleanTest);
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "testNonBooleanError",
  1015. protocol: 'tests',
  1016. fn: function (){
  1017. var self=this;
  1018. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1019. return smalltalk.withContext(function($ctx1) {
  1020. self._should_raise_((function(){
  1021. return smalltalk.withContext(function($ctx2) {
  1022. if(smalltalk.assert("")){
  1023. } else {
  1024. };
  1025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  1026. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  1027. args: [],
  1028. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1029. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1030. referencedClasses: ["NonBooleanReceiver"]
  1031. }),
  1032. globals.BooleanTest);
  1033. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1034. smalltalk.addMethod(
  1035. smalltalk.method({
  1036. selector: "setUp",
  1037. protocol: 'running',
  1038. fn: function (){
  1039. var self=this;
  1040. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1041. return smalltalk.withContext(function($ctx1) {
  1042. self["@builder"]=_st($ClassBuilder())._new();
  1043. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1044. args: [],
  1045. source: "setUp\x0a\x09builder := ClassBuilder new",
  1046. messageSends: ["new"],
  1047. referencedClasses: ["ClassBuilder"]
  1048. }),
  1049. globals.ClassBuilderTest);
  1050. smalltalk.addMethod(
  1051. smalltalk.method({
  1052. selector: "tearDown",
  1053. protocol: 'running',
  1054. fn: function (){
  1055. var self=this;
  1056. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1,$receiver;
  1059. $1=self["@theClass"];
  1060. if(($receiver = $1) == null || $receiver.isNil){
  1061. $1;
  1062. } else {
  1063. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1064. self["@theClass"]=nil;
  1065. self["@theClass"];
  1066. };
  1067. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1068. args: [],
  1069. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1070. messageSends: ["ifNotNil:", "removeClass:"],
  1071. referencedClasses: ["Smalltalk"]
  1072. }),
  1073. globals.ClassBuilderTest);
  1074. smalltalk.addMethod(
  1075. smalltalk.method({
  1076. selector: "testClassCopy",
  1077. protocol: 'tests',
  1078. fn: function (){
  1079. var self=this;
  1080. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1081. return smalltalk.withContext(function($ctx1) {
  1082. var $2,$1,$4,$3,$6,$5,$8,$7;
  1083. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1084. $2=_st(self["@theClass"])._superclass();
  1085. $ctx1.sendIdx["superclass"]=1;
  1086. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1087. $ctx1.sendIdx["=="]=1;
  1088. self._assert_($1);
  1089. $ctx1.sendIdx["assert:"]=1;
  1090. $4=_st(self["@theClass"])._instanceVariableNames();
  1091. $ctx1.sendIdx["instanceVariableNames"]=1;
  1092. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1093. $ctx1.sendIdx["=="]=2;
  1094. self._assert_($3);
  1095. $ctx1.sendIdx["assert:"]=2;
  1096. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1097. $ctx1.sendIdx["assert:equals:"]=1;
  1098. $6=_st(self["@theClass"])._package();
  1099. $ctx1.sendIdx["package"]=1;
  1100. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1101. self._assert_($5);
  1102. $8=_st(self["@theClass"])._methodDictionary();
  1103. $ctx1.sendIdx["methodDictionary"]=1;
  1104. $7=_st($8)._keys();
  1105. $ctx1.sendIdx["keys"]=1;
  1106. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1107. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1108. args: [],
  1109. 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",
  1110. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1111. referencedClasses: ["ObjectMock"]
  1112. }),
  1113. globals.ClassBuilderTest);
  1114. smalltalk.addMethod(
  1115. smalltalk.method({
  1116. selector: "testClassMigration",
  1117. protocol: 'tests',
  1118. fn: function (){
  1119. var self=this;
  1120. var instance,oldClass;
  1121. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1122. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1123. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1124. return smalltalk.withContext(function($ctx1) {
  1125. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1126. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1127. $2=_st($Smalltalk())._globals();
  1128. $ctx1.sendIdx["globals"]=1;
  1129. $1=_st($2)._at_("ObjectMock2");
  1130. $ctx1.sendIdx["at:"]=1;
  1131. instance=_st($1)._new();
  1132. $4=_st($Smalltalk())._globals();
  1133. $ctx1.sendIdx["globals"]=2;
  1134. $3=_st($4)._at_("ObjectMock2");
  1135. $ctx1.sendIdx["at:"]=2;
  1136. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1137. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1138. $ctx1.sendIdx["=="]=1;
  1139. self._deny_($5);
  1140. $ctx1.sendIdx["deny:"]=1;
  1141. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1142. $ctx1.sendIdx["=="]=2;
  1143. self._assert_($6);
  1144. $ctx1.sendIdx["assert:"]=1;
  1145. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1146. $ctx1.sendIdx["assert:"]=2;
  1147. $7=_st($ObjectMock2())._selectors();
  1148. $ctx1.sendIdx["selectors"]=1;
  1149. self._assert_equals_($7,_st(oldClass)._selectors());
  1150. $ctx1.sendIdx["assert:equals:"]=1;
  1151. $8=_st($ObjectMock2())._comment();
  1152. $ctx1.sendIdx["comment"]=1;
  1153. self._assert_equals_($8,_st(oldClass)._comment());
  1154. $ctx1.sendIdx["assert:equals:"]=2;
  1155. $9=_st(_st($ObjectMock2())._package())._name();
  1156. $ctx1.sendIdx["name"]=1;
  1157. self._assert_equals_($9,"Kernel-Tests");
  1158. $11=_st(instance)._class();
  1159. $ctx1.sendIdx["class"]=1;
  1160. $10=_st($11).__eq_eq($ObjectMock2());
  1161. self._deny_($10);
  1162. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1163. _st($Smalltalk())._removeClass_($ObjectMock2());
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1165. args: [],
  1166. 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",
  1167. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1168. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1169. }),
  1170. globals.ClassBuilderTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "testClassMigrationWithClassInstanceVariables",
  1174. protocol: 'tests',
  1175. fn: function (){
  1176. var self=this;
  1177. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1178. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1179. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1183. $1=_st($ObjectMock2())._class();
  1184. $ctx1.sendIdx["class"]=1;
  1185. _st($1)._instanceVariableNames_("foo bar");
  1186. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1187. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1188. _st($Smalltalk())._removeClass_($ObjectMock2());
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1190. args: [],
  1191. 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",
  1192. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1193. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1194. }),
  1195. globals.ClassBuilderTest);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "testClassMigrationWithSubclasses",
  1199. protocol: 'tests',
  1200. fn: function (){
  1201. var self=this;
  1202. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1203. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1204. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1205. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1206. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. var $2,$1,$4,$3;
  1209. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1210. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1211. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1212. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1213. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1214. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1215. $2=_st($ObjectMock())._subclasses();
  1216. $ctx1.sendIdx["subclasses"]=1;
  1217. $1=_st($2)._includes_($ObjectMock2());
  1218. $ctx1.sendIdx["includes:"]=1;
  1219. self._assert_($1);
  1220. $ctx1.sendIdx["assert:"]=1;
  1221. $4=_st($ObjectMock2())._subclasses();
  1222. $ctx1.sendIdx["subclasses"]=2;
  1223. $3=_st($4)._includes_($ObjectMock3());
  1224. $ctx1.sendIdx["includes:"]=2;
  1225. self._assert_($3);
  1226. $ctx1.sendIdx["assert:"]=2;
  1227. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1228. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1229. return smalltalk.withContext(function($ctx2) {
  1230. return _st($Smalltalk())._removeClass_(each);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1233. args: [],
  1234. 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 ]",
  1235. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1236. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1237. }),
  1238. globals.ClassBuilderTest);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "testInstanceVariableNames",
  1242. protocol: 'tests',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1247. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1248. args: [],
  1249. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1250. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1251. referencedClasses: []
  1252. }),
  1253. globals.ClassBuilderTest);
  1254. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "assertSameContents:as:",
  1258. protocol: 'convenience',
  1259. fn: function (aCollection,anotherCollection){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $2,$1,$4,$3;
  1263. $2=_st(aCollection)._size();
  1264. $ctx1.sendIdx["size"]=1;
  1265. $1=_st($2).__eq(_st(anotherCollection)._size());
  1266. $ctx1.sendIdx["="]=1;
  1267. self._assert_($1);
  1268. $ctx1.sendIdx["assert:"]=1;
  1269. _st(aCollection)._do_((function(each){
  1270. return smalltalk.withContext(function($ctx2) {
  1271. $4=_st(aCollection)._occurrencesOf_(each);
  1272. $ctx2.sendIdx["occurrencesOf:"]=1;
  1273. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1274. return self._assert_($3);
  1275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1276. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1277. args: ["aCollection", "anotherCollection"],
  1278. 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)) ]",
  1279. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1280. referencedClasses: []
  1281. }),
  1282. globals.CollectionTest);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "collection",
  1286. protocol: 'fixture',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. self._subclassResponsibility();
  1291. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1292. args: [],
  1293. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1294. messageSends: ["subclassResponsibility"],
  1295. referencedClasses: []
  1296. }),
  1297. globals.CollectionTest);
  1298. smalltalk.addMethod(
  1299. smalltalk.method({
  1300. selector: "collectionClass",
  1301. protocol: 'fixture',
  1302. fn: function (){
  1303. var self=this;
  1304. return smalltalk.withContext(function($ctx1) {
  1305. var $1;
  1306. $1=_st(self._class())._collectionClass();
  1307. return $1;
  1308. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1309. args: [],
  1310. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1311. messageSends: ["collectionClass", "class"],
  1312. referencedClasses: []
  1313. }),
  1314. globals.CollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "collectionOfPrintStrings",
  1318. protocol: 'fixture',
  1319. fn: function (){
  1320. var self=this;
  1321. return smalltalk.withContext(function($ctx1) {
  1322. self._subclassResponsibility();
  1323. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1324. args: [],
  1325. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1326. messageSends: ["subclassResponsibility"],
  1327. referencedClasses: []
  1328. }),
  1329. globals.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "collectionSize",
  1333. protocol: 'fixture',
  1334. fn: function (){
  1335. var self=this;
  1336. return smalltalk.withContext(function($ctx1) {
  1337. self._subclassResponsibility();
  1338. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1339. args: [],
  1340. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1341. messageSends: ["subclassResponsibility"],
  1342. referencedClasses: []
  1343. }),
  1344. globals.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "collectionWithDuplicates",
  1348. protocol: 'fixture',
  1349. fn: function (){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) {
  1352. self._subclassResponsibility();
  1353. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1354. args: [],
  1355. 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",
  1356. messageSends: ["subclassResponsibility"],
  1357. referencedClasses: []
  1358. }),
  1359. globals.CollectionTest);
  1360. smalltalk.addMethod(
  1361. smalltalk.method({
  1362. selector: "collectionWithNewValue",
  1363. protocol: 'fixture',
  1364. fn: function (){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. self._subclassResponsibility();
  1368. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1369. args: [],
  1370. 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",
  1371. messageSends: ["subclassResponsibility"],
  1372. referencedClasses: []
  1373. }),
  1374. globals.CollectionTest);
  1375. smalltalk.addMethod(
  1376. smalltalk.method({
  1377. selector: "isCollectionReadOnly",
  1378. protocol: 'testing',
  1379. fn: function (){
  1380. var self=this;
  1381. return false;
  1382. },
  1383. args: [],
  1384. source: "isCollectionReadOnly\x0a\x09^ false",
  1385. messageSends: [],
  1386. referencedClasses: []
  1387. }),
  1388. globals.CollectionTest);
  1389. smalltalk.addMethod(
  1390. smalltalk.method({
  1391. selector: "sampleNewValue",
  1392. protocol: 'fixture',
  1393. fn: function (){
  1394. var self=this;
  1395. return "N";
  1396. },
  1397. args: [],
  1398. 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'",
  1399. messageSends: [],
  1400. referencedClasses: []
  1401. }),
  1402. globals.CollectionTest);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "sampleNewValueAsCollection",
  1406. protocol: 'fixture',
  1407. fn: function (){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) {
  1410. var $1;
  1411. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1414. args: [],
  1415. 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",
  1416. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1417. referencedClasses: []
  1418. }),
  1419. globals.CollectionTest);
  1420. smalltalk.addMethod(
  1421. smalltalk.method({
  1422. selector: "testAddAll",
  1423. protocol: 'tests',
  1424. fn: function (){
  1425. var self=this;
  1426. return smalltalk.withContext(function($ctx1) {
  1427. 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;
  1428. $2=self._collection();
  1429. $ctx1.sendIdx["collection"]=1;
  1430. $3=$2;
  1431. $5=self._collectionClass();
  1432. $ctx1.sendIdx["collectionClass"]=1;
  1433. $4=_st($5)._new();
  1434. $ctx1.sendIdx["new"]=1;
  1435. _st($3)._addAll_($4);
  1436. $ctx1.sendIdx["addAll:"]=1;
  1437. $6=_st($2)._yourself();
  1438. $ctx1.sendIdx["yourself"]=1;
  1439. $1=$6;
  1440. $7=self._collection();
  1441. $ctx1.sendIdx["collection"]=2;
  1442. self._assert_equals_($1,$7);
  1443. $ctx1.sendIdx["assert:equals:"]=1;
  1444. $10=self._collectionClass();
  1445. $ctx1.sendIdx["collectionClass"]=2;
  1446. $9=_st($10)._new();
  1447. $ctx1.sendIdx["new"]=2;
  1448. $11=$9;
  1449. $12=self._collection();
  1450. $ctx1.sendIdx["collection"]=3;
  1451. _st($11)._addAll_($12);
  1452. $ctx1.sendIdx["addAll:"]=2;
  1453. $13=_st($9)._yourself();
  1454. $ctx1.sendIdx["yourself"]=2;
  1455. $8=$13;
  1456. $14=self._collection();
  1457. $ctx1.sendIdx["collection"]=4;
  1458. self._assert_equals_($8,$14);
  1459. $ctx1.sendIdx["assert:equals:"]=2;
  1460. $17=self._collectionClass();
  1461. $ctx1.sendIdx["collectionClass"]=3;
  1462. $16=_st($17)._new();
  1463. $ctx1.sendIdx["new"]=3;
  1464. $18=$16;
  1465. $20=self._collectionClass();
  1466. $ctx1.sendIdx["collectionClass"]=4;
  1467. $19=_st($20)._new();
  1468. $ctx1.sendIdx["new"]=4;
  1469. _st($18)._addAll_($19);
  1470. $ctx1.sendIdx["addAll:"]=3;
  1471. $21=_st($16)._yourself();
  1472. $ctx1.sendIdx["yourself"]=3;
  1473. $15=$21;
  1474. self._assert_equals_($15,_st(self._collectionClass())._new());
  1475. $ctx1.sendIdx["assert:equals:"]=3;
  1476. $23=self._collection();
  1477. $ctx1.sendIdx["collection"]=5;
  1478. $24=$23;
  1479. $25=self._sampleNewValueAsCollection();
  1480. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1481. _st($24)._addAll_($25);
  1482. $ctx1.sendIdx["addAll:"]=4;
  1483. $26=_st($23)._yourself();
  1484. $ctx1.sendIdx["yourself"]=4;
  1485. $22=$26;
  1486. $27=self._collectionWithNewValue();
  1487. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1488. self._assert_equals_($22,$27);
  1489. $28=self._sampleNewValueAsCollection();
  1490. _st($28)._addAll_(self._collection());
  1491. $29=_st($28)._yourself();
  1492. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1493. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1494. args: [],
  1495. 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",
  1496. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1497. referencedClasses: []
  1498. }),
  1499. globals.CollectionTest);
  1500. smalltalk.addMethod(
  1501. smalltalk.method({
  1502. selector: "testAllSatisfy",
  1503. protocol: 'tests',
  1504. fn: function (){
  1505. var self=this;
  1506. var collection,anyOne;
  1507. return smalltalk.withContext(function($ctx1) {
  1508. var $1;
  1509. collection=self._collection();
  1510. anyOne=_st(collection)._anyOne();
  1511. $1=_st(collection)._allSatisfy_((function(each){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. return _st(collection)._includes_(each);
  1514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1515. $ctx1.sendIdx["allSatisfy:"]=1;
  1516. self._assert_($1);
  1517. self._deny_(_st(collection)._allSatisfy_((function(each){
  1518. return smalltalk.withContext(function($ctx2) {
  1519. return _st(each).__tild_eq(anyOne);
  1520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1522. args: [],
  1523. 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 ])",
  1524. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1525. referencedClasses: []
  1526. }),
  1527. globals.CollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testAnyOne",
  1531. protocol: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1535. return smalltalk.withContext(function($ctx1) {
  1536. var $2,$1;
  1537. self._should_raise_((function(){
  1538. return smalltalk.withContext(function($ctx2) {
  1539. return _st(_st(self._collectionClass())._new())._anyOne();
  1540. $ctx2.sendIdx["anyOne"]=1;
  1541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1542. $2=self._collection();
  1543. $ctx1.sendIdx["collection"]=1;
  1544. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1545. self._assert_($1);
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1547. args: [],
  1548. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1549. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1550. referencedClasses: ["Error"]
  1551. }),
  1552. globals.CollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testAnySatisfy",
  1556. protocol: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var anyOne;
  1560. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $1,$3,$2;
  1563. $1=self._collection();
  1564. $ctx1.sendIdx["collection"]=1;
  1565. anyOne=_st($1)._anyOne();
  1566. $3=self._collection();
  1567. $ctx1.sendIdx["collection"]=2;
  1568. $2=_st($3)._anySatisfy_((function(each){
  1569. return smalltalk.withContext(function($ctx2) {
  1570. return _st(each).__eq(anyOne);
  1571. $ctx2.sendIdx["="]=1;
  1572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1573. $ctx1.sendIdx["anySatisfy:"]=1;
  1574. self._assert_($2);
  1575. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1576. return smalltalk.withContext(function($ctx2) {
  1577. return _st(each).__eq(_st($Object())._new());
  1578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1579. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1580. args: [],
  1581. 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 ])",
  1582. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1583. referencedClasses: ["Object"]
  1584. }),
  1585. globals.CollectionTest);
  1586. smalltalk.addMethod(
  1587. smalltalk.method({
  1588. selector: "testAsArray",
  1589. protocol: 'tests',
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $1;
  1594. $1=self._collection();
  1595. $ctx1.sendIdx["collection"]=1;
  1596. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1597. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1598. args: [],
  1599. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1600. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1601. referencedClasses: []
  1602. }),
  1603. globals.CollectionTest);
  1604. smalltalk.addMethod(
  1605. smalltalk.method({
  1606. selector: "testAsOrderedCollection",
  1607. protocol: 'tests',
  1608. fn: function (){
  1609. var self=this;
  1610. return smalltalk.withContext(function($ctx1) {
  1611. var $1;
  1612. $1=self._collection();
  1613. $ctx1.sendIdx["collection"]=1;
  1614. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1615. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1616. args: [],
  1617. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1618. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1619. referencedClasses: []
  1620. }),
  1621. globals.CollectionTest);
  1622. smalltalk.addMethod(
  1623. smalltalk.method({
  1624. selector: "testAsSet",
  1625. protocol: 'tests',
  1626. fn: function (){
  1627. var self=this;
  1628. var c,set;
  1629. return smalltalk.withContext(function($ctx1) {
  1630. c=self._collectionWithDuplicates();
  1631. set=_st(c)._asSet();
  1632. self._assert_equals_(_st(set)._size(),(5));
  1633. _st(c)._do_((function(each){
  1634. return smalltalk.withContext(function($ctx2) {
  1635. return self._assert_(_st(set)._includes_(each));
  1636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1637. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1638. args: [],
  1639. 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) ]",
  1640. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1641. referencedClasses: []
  1642. }),
  1643. globals.CollectionTest);
  1644. smalltalk.addMethod(
  1645. smalltalk.method({
  1646. selector: "testCollect",
  1647. protocol: 'tests',
  1648. fn: function (){
  1649. var self=this;
  1650. return smalltalk.withContext(function($ctx1) {
  1651. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1652. $2=self._collection();
  1653. $ctx1.sendIdx["collection"]=1;
  1654. $1=_st($2)._collect_((function(each){
  1655. return each;
  1656. }));
  1657. $ctx1.sendIdx["collect:"]=1;
  1658. $3=self._collection();
  1659. $ctx1.sendIdx["collection"]=2;
  1660. self._assert_equals_($1,$3);
  1661. $ctx1.sendIdx["assert:equals:"]=1;
  1662. $5=self._collectionWithNewValue();
  1663. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1664. $4=_st($5)._collect_((function(each){
  1665. return each;
  1666. }));
  1667. $ctx1.sendIdx["collect:"]=2;
  1668. self._assert_equals_($4,self._collectionWithNewValue());
  1669. $ctx1.sendIdx["assert:equals:"]=2;
  1670. $8=self._collectionClass();
  1671. $ctx1.sendIdx["collectionClass"]=1;
  1672. $7=_st($8)._new();
  1673. $ctx1.sendIdx["new"]=1;
  1674. $6=_st($7)._collect_((function(each){
  1675. return smalltalk.withContext(function($ctx2) {
  1676. return _st(each)._printString();
  1677. $ctx2.sendIdx["printString"]=1;
  1678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1679. $ctx1.sendIdx["collect:"]=3;
  1680. self._assert_equals_($6,_st(self._collectionClass())._new());
  1681. $ctx1.sendIdx["assert:equals:"]=3;
  1682. $11=self._collection();
  1683. $ctx1.sendIdx["collection"]=3;
  1684. $10=_st($11)._collect_((function(){
  1685. return smalltalk.withContext(function($ctx2) {
  1686. return self._sampleNewValue();
  1687. $ctx2.sendIdx["sampleNewValue"]=1;
  1688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1689. $ctx1.sendIdx["collect:"]=4;
  1690. $9=_st($10)._detect_((function(){
  1691. return true;
  1692. }));
  1693. self._assert_equals_($9,self._sampleNewValue());
  1694. $ctx1.sendIdx["assert:equals:"]=4;
  1695. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1696. return smalltalk.withContext(function($ctx2) {
  1697. return _st(each)._printString();
  1698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1699. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1700. args: [],
  1701. 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",
  1702. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1703. referencedClasses: []
  1704. }),
  1705. globals.CollectionTest);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "testComma",
  1709. protocol: 'tests',
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1714. $2=self._collection();
  1715. $ctx1.sendIdx["collection"]=1;
  1716. $4=self._collectionClass();
  1717. $ctx1.sendIdx["collectionClass"]=1;
  1718. $3=_st($4)._new();
  1719. $ctx1.sendIdx["new"]=1;
  1720. $1=_st($2).__comma($3);
  1721. $ctx1.sendIdx[","]=1;
  1722. $5=self._collection();
  1723. $ctx1.sendIdx["collection"]=2;
  1724. self._assert_equals_($1,$5);
  1725. $ctx1.sendIdx["assert:equals:"]=1;
  1726. $8=self._collectionClass();
  1727. $ctx1.sendIdx["collectionClass"]=2;
  1728. $7=_st($8)._new();
  1729. $ctx1.sendIdx["new"]=2;
  1730. $9=self._collection();
  1731. $ctx1.sendIdx["collection"]=3;
  1732. $6=_st($7).__comma($9);
  1733. $ctx1.sendIdx[","]=2;
  1734. $10=self._collection();
  1735. $ctx1.sendIdx["collection"]=4;
  1736. self._assert_equals_($6,$10);
  1737. $ctx1.sendIdx["assert:equals:"]=2;
  1738. $13=self._collectionClass();
  1739. $ctx1.sendIdx["collectionClass"]=3;
  1740. $12=_st($13)._new();
  1741. $ctx1.sendIdx["new"]=3;
  1742. $15=self._collectionClass();
  1743. $ctx1.sendIdx["collectionClass"]=4;
  1744. $14=_st($15)._new();
  1745. $ctx1.sendIdx["new"]=4;
  1746. $11=_st($12).__comma($14);
  1747. $ctx1.sendIdx[","]=3;
  1748. self._assert_equals_($11,_st(self._collectionClass())._new());
  1749. $ctx1.sendIdx["assert:equals:"]=3;
  1750. $17=self._collection();
  1751. $ctx1.sendIdx["collection"]=5;
  1752. $18=self._sampleNewValueAsCollection();
  1753. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1754. $16=_st($17).__comma($18);
  1755. $ctx1.sendIdx[","]=4;
  1756. $19=self._collectionWithNewValue();
  1757. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1758. self._assert_equals_($16,$19);
  1759. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1761. args: [],
  1762. 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",
  1763. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1764. referencedClasses: []
  1765. }),
  1766. globals.CollectionTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testDetect",
  1770. protocol: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1774. return smalltalk.withContext(function($ctx1) {
  1775. var $1,$2,$3,$4,$6,$5,$7;
  1776. self._shouldnt_raise_((function(){
  1777. return smalltalk.withContext(function($ctx2) {
  1778. $1=self._collection();
  1779. $ctx2.sendIdx["collection"]=1;
  1780. return _st($1)._detect_((function(){
  1781. return true;
  1782. }));
  1783. $ctx2.sendIdx["detect:"]=1;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1785. self._should_raise_((function(){
  1786. return smalltalk.withContext(function($ctx2) {
  1787. $2=self._collection();
  1788. $ctx2.sendIdx["collection"]=2;
  1789. return _st($2)._detect_((function(){
  1790. return false;
  1791. }));
  1792. $ctx2.sendIdx["detect:"]=2;
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1794. $ctx1.sendIdx["should:raise:"]=1;
  1795. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1796. return true;
  1797. }));
  1798. $ctx1.sendIdx["detect:"]=3;
  1799. $4=self._sampleNewValue();
  1800. $ctx1.sendIdx["sampleNewValue"]=1;
  1801. self._assert_equals_($3,$4);
  1802. $ctx1.sendIdx["assert:equals:"]=1;
  1803. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. $6=self._sampleNewValue();
  1806. $ctx2.sendIdx["sampleNewValue"]=2;
  1807. return _st(each).__eq($6);
  1808. $ctx2.sendIdx["="]=1;
  1809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1810. $ctx1.sendIdx["detect:"]=4;
  1811. $7=self._sampleNewValue();
  1812. $ctx1.sendIdx["sampleNewValue"]=3;
  1813. self._assert_equals_($5,$7);
  1814. self._should_raise_((function(){
  1815. return smalltalk.withContext(function($ctx2) {
  1816. return _st(self._collection())._detect_((function(each){
  1817. return smalltalk.withContext(function($ctx3) {
  1818. return _st(each).__eq(self._sampleNewValue());
  1819. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1821. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1822. args: [],
  1823. 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",
  1824. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1825. referencedClasses: ["Error"]
  1826. }),
  1827. globals.CollectionTest);
  1828. smalltalk.addMethod(
  1829. smalltalk.method({
  1830. selector: "testDetectIfNone",
  1831. protocol: 'tests',
  1832. fn: function (){
  1833. var self=this;
  1834. var sentinel;
  1835. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1836. return smalltalk.withContext(function($ctx1) {
  1837. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1838. sentinel=_st($Object())._new();
  1839. $3=self._collection();
  1840. $ctx1.sendIdx["collection"]=1;
  1841. $2=_st($3)._detect_ifNone_((function(){
  1842. return true;
  1843. }),(function(){
  1844. return sentinel;
  1845. }));
  1846. $ctx1.sendIdx["detect:ifNone:"]=1;
  1847. $1=_st($2).__tild_eq(sentinel);
  1848. self._assert_($1);
  1849. $5=self._collection();
  1850. $ctx1.sendIdx["collection"]=2;
  1851. $4=_st($5)._detect_ifNone_((function(){
  1852. return false;
  1853. }),(function(){
  1854. return sentinel;
  1855. }));
  1856. $ctx1.sendIdx["detect:ifNone:"]=2;
  1857. self._assert_equals_($4,sentinel);
  1858. $ctx1.sendIdx["assert:equals:"]=1;
  1859. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1860. return true;
  1861. }),(function(){
  1862. return sentinel;
  1863. }));
  1864. $ctx1.sendIdx["detect:ifNone:"]=3;
  1865. $7=self._sampleNewValue();
  1866. $ctx1.sendIdx["sampleNewValue"]=1;
  1867. self._assert_equals_($6,$7);
  1868. $ctx1.sendIdx["assert:equals:"]=2;
  1869. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1870. return smalltalk.withContext(function($ctx2) {
  1871. $9=self._sampleNewValue();
  1872. $ctx2.sendIdx["sampleNewValue"]=2;
  1873. return _st(each).__eq($9);
  1874. $ctx2.sendIdx["="]=1;
  1875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1876. return sentinel;
  1877. }));
  1878. $ctx1.sendIdx["detect:ifNone:"]=4;
  1879. $10=self._sampleNewValue();
  1880. $ctx1.sendIdx["sampleNewValue"]=3;
  1881. self._assert_equals_($8,$10);
  1882. $ctx1.sendIdx["assert:equals:"]=3;
  1883. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1884. return smalltalk.withContext(function($ctx2) {
  1885. return _st(each).__eq(self._sampleNewValue());
  1886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1887. return sentinel;
  1888. })),sentinel);
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1890. args: [],
  1891. 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",
  1892. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1893. referencedClasses: ["Object"]
  1894. }),
  1895. globals.CollectionTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testDo",
  1899. protocol: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. var newCollection;
  1903. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1904. return smalltalk.withContext(function($ctx1) {
  1905. var $1,$2;
  1906. newCollection=_st($OrderedCollection())._new();
  1907. $ctx1.sendIdx["new"]=1;
  1908. $1=self._collection();
  1909. $ctx1.sendIdx["collection"]=1;
  1910. _st($1)._do_((function(each){
  1911. return smalltalk.withContext(function($ctx2) {
  1912. return _st(newCollection)._add_(each);
  1913. $ctx2.sendIdx["add:"]=1;
  1914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1915. $ctx1.sendIdx["do:"]=1;
  1916. self._assertSameContents_as_(self._collection(),newCollection);
  1917. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1918. newCollection=_st($OrderedCollection())._new();
  1919. $2=self._collectionWithDuplicates();
  1920. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1921. _st($2)._do_((function(each){
  1922. return smalltalk.withContext(function($ctx2) {
  1923. return _st(newCollection)._add_(each);
  1924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1925. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1926. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1927. args: [],
  1928. 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",
  1929. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1930. referencedClasses: ["OrderedCollection"]
  1931. }),
  1932. globals.CollectionTest);
  1933. smalltalk.addMethod(
  1934. smalltalk.method({
  1935. selector: "testIfEmptyFamily",
  1936. protocol: 'tests',
  1937. fn: function (){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) {
  1940. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  1941. $3=self._collectionClass();
  1942. $ctx1.sendIdx["collectionClass"]=1;
  1943. $2=_st($3)._new();
  1944. $ctx1.sendIdx["new"]=1;
  1945. $1=_st($2)._ifEmpty_((function(){
  1946. return (42);
  1947. }));
  1948. $ctx1.sendIdx["ifEmpty:"]=1;
  1949. self._assert_equals_($1,(42));
  1950. $ctx1.sendIdx["assert:equals:"]=1;
  1951. $5=self._collection();
  1952. $ctx1.sendIdx["collection"]=1;
  1953. $4=_st($5)._ifEmpty_((function(){
  1954. return (42);
  1955. }));
  1956. $6=self._collection();
  1957. $ctx1.sendIdx["collection"]=2;
  1958. self._assert_equals_($4,$6);
  1959. $ctx1.sendIdx["assert:equals:"]=2;
  1960. $9=self._collectionClass();
  1961. $ctx1.sendIdx["collectionClass"]=2;
  1962. $8=_st($9)._new();
  1963. $ctx1.sendIdx["new"]=2;
  1964. $7=_st($8)._ifNotEmpty_((function(){
  1965. return (42);
  1966. }));
  1967. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1968. $11=self._collectionClass();
  1969. $ctx1.sendIdx["collectionClass"]=3;
  1970. $10=_st($11)._new();
  1971. $ctx1.sendIdx["new"]=3;
  1972. self._assert_equals_($7,$10);
  1973. $ctx1.sendIdx["assert:equals:"]=3;
  1974. $13=self._collection();
  1975. $ctx1.sendIdx["collection"]=3;
  1976. $12=_st($13)._ifNotEmpty_((function(){
  1977. return (42);
  1978. }));
  1979. $ctx1.sendIdx["ifNotEmpty:"]=2;
  1980. self._assert_equals_($12,(42));
  1981. $ctx1.sendIdx["assert:equals:"]=4;
  1982. $15=self._collection();
  1983. $ctx1.sendIdx["collection"]=4;
  1984. $14=_st($15)._ifNotEmpty_((function(col){
  1985. return col;
  1986. }));
  1987. $16=self._collection();
  1988. $ctx1.sendIdx["collection"]=5;
  1989. self._assert_equals_($14,$16);
  1990. $ctx1.sendIdx["assert:equals:"]=5;
  1991. $19=self._collectionClass();
  1992. $ctx1.sendIdx["collectionClass"]=4;
  1993. $18=_st($19)._new();
  1994. $ctx1.sendIdx["new"]=4;
  1995. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1996. return (42);
  1997. }),(function(){
  1998. return (999);
  1999. }));
  2000. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  2001. self._assert_equals_($17,(42));
  2002. $ctx1.sendIdx["assert:equals:"]=6;
  2003. $21=self._collection();
  2004. $ctx1.sendIdx["collection"]=6;
  2005. $20=_st($21)._ifEmpty_ifNotEmpty_((function(){
  2006. return (42);
  2007. }),(function(){
  2008. return (999);
  2009. }));
  2010. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  2011. self._assert_equals_($20,(999));
  2012. $ctx1.sendIdx["assert:equals:"]=7;
  2013. $23=self._collection();
  2014. $ctx1.sendIdx["collection"]=7;
  2015. $22=_st($23)._ifEmpty_ifNotEmpty_((function(){
  2016. return (42);
  2017. }),(function(col){
  2018. return col;
  2019. }));
  2020. $24=self._collection();
  2021. $ctx1.sendIdx["collection"]=8;
  2022. self._assert_equals_($22,$24);
  2023. $ctx1.sendIdx["assert:equals:"]=8;
  2024. $25=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  2025. return (42);
  2026. }),(function(){
  2027. return (999);
  2028. }));
  2029. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  2030. self._assert_equals_($25,(999));
  2031. $ctx1.sendIdx["assert:equals:"]=9;
  2032. $27=self._collection();
  2033. $ctx1.sendIdx["collection"]=9;
  2034. $26=_st($27)._ifNotEmpty_ifEmpty_((function(){
  2035. return (42);
  2036. }),(function(){
  2037. return (999);
  2038. }));
  2039. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  2040. self._assert_equals_($26,(42));
  2041. $ctx1.sendIdx["assert:equals:"]=10;
  2042. $29=self._collection();
  2043. $ctx1.sendIdx["collection"]=10;
  2044. $28=_st($29)._ifNotEmpty_ifEmpty_((function(col){
  2045. return col;
  2046. }),(function(){
  2047. return (999);
  2048. }));
  2049. self._assert_equals_($28,self._collection());
  2050. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  2051. args: [],
  2052. 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\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\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\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  2053. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2054. referencedClasses: []
  2055. }),
  2056. globals.CollectionTest);
  2057. smalltalk.addMethod(
  2058. smalltalk.method({
  2059. selector: "testIsEmpty",
  2060. protocol: 'tests',
  2061. fn: function (){
  2062. var self=this;
  2063. return smalltalk.withContext(function($ctx1) {
  2064. var $1;
  2065. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2066. $ctx1.sendIdx["isEmpty"]=1;
  2067. self._assert_($1);
  2068. self._deny_(_st(self._collection())._isEmpty());
  2069. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  2070. args: [],
  2071. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2072. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2073. referencedClasses: []
  2074. }),
  2075. globals.CollectionTest);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "testNoneSatisfy",
  2079. protocol: 'tests',
  2080. fn: function (){
  2081. var self=this;
  2082. var anyOne;
  2083. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2084. return smalltalk.withContext(function($ctx1) {
  2085. var $1,$3,$2;
  2086. $1=self._collection();
  2087. $ctx1.sendIdx["collection"]=1;
  2088. anyOne=_st($1)._anyOne();
  2089. $3=self._collection();
  2090. $ctx1.sendIdx["collection"]=2;
  2091. $2=_st($3)._noneSatisfy_((function(each){
  2092. return smalltalk.withContext(function($ctx2) {
  2093. return _st(each).__eq(anyOne);
  2094. $ctx2.sendIdx["="]=1;
  2095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2096. $ctx1.sendIdx["noneSatisfy:"]=1;
  2097. self._deny_($2);
  2098. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2099. return smalltalk.withContext(function($ctx2) {
  2100. return _st(each).__eq(_st($Object())._new());
  2101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2102. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2103. args: [],
  2104. 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 ])",
  2105. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2106. referencedClasses: ["Object"]
  2107. }),
  2108. globals.CollectionTest);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "testRemoveAll",
  2112. protocol: 'tests',
  2113. fn: function (){
  2114. var self=this;
  2115. return smalltalk.withContext(function($ctx1) {
  2116. var $1,$2;
  2117. $1=self._collection();
  2118. _st($1)._removeAll();
  2119. $2=_st($1)._yourself();
  2120. self._assert_equals_($2,_st(self._collectionClass())._new());
  2121. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2122. args: [],
  2123. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2124. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2125. referencedClasses: []
  2126. }),
  2127. globals.CollectionTest);
  2128. smalltalk.addMethod(
  2129. smalltalk.method({
  2130. selector: "testSelect",
  2131. protocol: 'tests',
  2132. fn: function (){
  2133. var self=this;
  2134. return smalltalk.withContext(function($ctx1) {
  2135. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2136. $2=self._collection();
  2137. $ctx1.sendIdx["collection"]=1;
  2138. $1=_st($2)._select_((function(){
  2139. return false;
  2140. }));
  2141. $ctx1.sendIdx["select:"]=1;
  2142. $4=self._collectionClass();
  2143. $ctx1.sendIdx["collectionClass"]=1;
  2144. $3=_st($4)._new();
  2145. $ctx1.sendIdx["new"]=1;
  2146. self._assert_equals_($1,$3);
  2147. $ctx1.sendIdx["assert:equals:"]=1;
  2148. $6=self._collection();
  2149. $ctx1.sendIdx["collection"]=2;
  2150. $5=_st($6)._select_((function(){
  2151. return true;
  2152. }));
  2153. $ctx1.sendIdx["select:"]=2;
  2154. $7=self._collection();
  2155. $ctx1.sendIdx["collection"]=3;
  2156. self._assert_equals_($5,$7);
  2157. $ctx1.sendIdx["assert:equals:"]=2;
  2158. $9=self._collectionWithNewValue();
  2159. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2160. $8=_st($9)._select_((function(each){
  2161. return smalltalk.withContext(function($ctx2) {
  2162. $10=self._sampleNewValue();
  2163. $ctx2.sendIdx["sampleNewValue"]=1;
  2164. return _st(each).__eq($10);
  2165. $ctx2.sendIdx["="]=1;
  2166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2167. $ctx1.sendIdx["select:"]=3;
  2168. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2169. $ctx1.sendIdx["assert:equals:"]=3;
  2170. $12=self._collectionWithNewValue();
  2171. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2172. $11=_st($12)._select_((function(each){
  2173. return smalltalk.withContext(function($ctx2) {
  2174. $13=self._sampleNewValue();
  2175. $ctx2.sendIdx["sampleNewValue"]=2;
  2176. return _st(each).__tild_eq($13);
  2177. $ctx2.sendIdx["~="]=1;
  2178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2179. $ctx1.sendIdx["select:"]=4;
  2180. $14=self._collection();
  2181. $ctx1.sendIdx["collection"]=4;
  2182. self._assert_equals_($11,$14);
  2183. $ctx1.sendIdx["assert:equals:"]=4;
  2184. $16=self._collection();
  2185. $ctx1.sendIdx["collection"]=5;
  2186. $15=_st($16)._select_((function(each){
  2187. return smalltalk.withContext(function($ctx2) {
  2188. $17=self._sampleNewValue();
  2189. $ctx2.sendIdx["sampleNewValue"]=3;
  2190. return _st(each).__eq($17);
  2191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2192. $ctx1.sendIdx["select:"]=5;
  2193. self._assert_equals_($15,_st(self._collectionClass())._new());
  2194. $ctx1.sendIdx["assert:equals:"]=5;
  2195. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2196. return smalltalk.withContext(function($ctx2) {
  2197. return _st(each).__tild_eq(self._sampleNewValue());
  2198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2199. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2200. args: [],
  2201. 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",
  2202. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2203. referencedClasses: []
  2204. }),
  2205. globals.CollectionTest);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "testSize",
  2209. protocol: 'tests',
  2210. fn: function (){
  2211. var self=this;
  2212. return smalltalk.withContext(function($ctx1) {
  2213. var $1,$2;
  2214. $1=_st(_st(self._collectionClass())._new())._size();
  2215. $ctx1.sendIdx["size"]=1;
  2216. self._assert_equals_($1,(0));
  2217. $ctx1.sendIdx["assert:equals:"]=1;
  2218. $2=_st(self._sampleNewValueAsCollection())._size();
  2219. $ctx1.sendIdx["size"]=2;
  2220. self._assert_equals_($2,(1));
  2221. $ctx1.sendIdx["assert:equals:"]=2;
  2222. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2223. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2224. args: [],
  2225. 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",
  2226. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2227. referencedClasses: []
  2228. }),
  2229. globals.CollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "collectionClass",
  2233. protocol: 'fixture',
  2234. fn: function (){
  2235. var self=this;
  2236. return nil;
  2237. },
  2238. args: [],
  2239. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2240. messageSends: [],
  2241. referencedClasses: []
  2242. }),
  2243. globals.CollectionTest.klass);
  2244. smalltalk.addMethod(
  2245. smalltalk.method({
  2246. selector: "isAbstract",
  2247. protocol: 'testing',
  2248. fn: function (){
  2249. var self=this;
  2250. return smalltalk.withContext(function($ctx1) {
  2251. var $1;
  2252. $1=_st(self._collectionClass())._isNil();
  2253. return $1;
  2254. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2255. args: [],
  2256. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2257. messageSends: ["isNil", "collectionClass"],
  2258. referencedClasses: []
  2259. }),
  2260. globals.CollectionTest.klass);
  2261. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "collectionWithNewValue",
  2265. protocol: 'fixture',
  2266. fn: function (){
  2267. var self=this;
  2268. return smalltalk.withContext(function($ctx1) {
  2269. self._subclassResponsibility();
  2270. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2271. args: [],
  2272. 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",
  2273. messageSends: ["subclassResponsibility"],
  2274. referencedClasses: []
  2275. }),
  2276. globals.IndexableCollectionTest);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "sampleNewIndex",
  2280. protocol: 'fixture',
  2281. fn: function (){
  2282. var self=this;
  2283. return smalltalk.withContext(function($ctx1) {
  2284. self._subclassResponsibility();
  2285. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2286. args: [],
  2287. 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",
  2288. messageSends: ["subclassResponsibility"],
  2289. referencedClasses: []
  2290. }),
  2291. globals.IndexableCollectionTest);
  2292. smalltalk.addMethod(
  2293. smalltalk.method({
  2294. selector: "sampleNonIndexesDo:",
  2295. protocol: 'fixture',
  2296. fn: function (aBlock){
  2297. var self=this;
  2298. return smalltalk.withContext(function($ctx1) {
  2299. self._subclassResponsibility();
  2300. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2301. args: ["aBlock"],
  2302. 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",
  2303. messageSends: ["subclassResponsibility"],
  2304. referencedClasses: []
  2305. }),
  2306. globals.IndexableCollectionTest);
  2307. smalltalk.addMethod(
  2308. smalltalk.method({
  2309. selector: "samplesDo:",
  2310. protocol: 'fixture',
  2311. fn: function (aBlock){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) {
  2314. self._subclassResponsibility();
  2315. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2316. args: ["aBlock"],
  2317. 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",
  2318. messageSends: ["subclassResponsibility"],
  2319. referencedClasses: []
  2320. }),
  2321. globals.IndexableCollectionTest);
  2322. smalltalk.addMethod(
  2323. smalltalk.method({
  2324. selector: "testAt",
  2325. protocol: 'tests',
  2326. fn: function (){
  2327. var self=this;
  2328. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2329. return smalltalk.withContext(function($ctx1) {
  2330. var $1;
  2331. self._nonIndexesDo_((function(each){
  2332. return smalltalk.withContext(function($ctx2) {
  2333. return self._should_raise_((function(){
  2334. return smalltalk.withContext(function($ctx3) {
  2335. $1=self._collection();
  2336. $ctx3.sendIdx["collection"]=1;
  2337. return _st($1)._at_(each);
  2338. $ctx3.sendIdx["at:"]=1;
  2339. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2341. self._samplesDo_((function(index,value){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2344. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2345. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2346. args: [],
  2347. 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 ]",
  2348. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2349. referencedClasses: ["Error"]
  2350. }),
  2351. globals.IndexableCollectionTest);
  2352. smalltalk.addMethod(
  2353. smalltalk.method({
  2354. selector: "testAtIfAbsent",
  2355. protocol: 'tests',
  2356. fn: function (){
  2357. var self=this;
  2358. return smalltalk.withContext(function($ctx1) {
  2359. var $2,$1,$3;
  2360. self._nonIndexesDo_((function(each){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. $2=self._collection();
  2363. $ctx2.sendIdx["collection"]=1;
  2364. $1=_st($2)._at_ifAbsent_(each,(function(){
  2365. return smalltalk.withContext(function($ctx3) {
  2366. return self._sampleNewValue();
  2367. $ctx3.sendIdx["sampleNewValue"]=1;
  2368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2369. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2370. $3=self._sampleNewValue();
  2371. $ctx2.sendIdx["sampleNewValue"]=2;
  2372. return self._assert_equals_($1,$3);
  2373. $ctx2.sendIdx["assert:equals:"]=1;
  2374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2375. self._samplesDo_((function(index,value){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2378. return smalltalk.withContext(function($ctx3) {
  2379. return self._sampleNewValue();
  2380. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2381. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2382. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2383. args: [],
  2384. 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 ].",
  2385. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2386. referencedClasses: []
  2387. }),
  2388. globals.IndexableCollectionTest);
  2389. smalltalk.addMethod(
  2390. smalltalk.method({
  2391. selector: "testAtIfAbsentPut",
  2392. protocol: 'tests',
  2393. fn: function (){
  2394. var self=this;
  2395. var newCollection;
  2396. return smalltalk.withContext(function($ctx1) {
  2397. var $1;
  2398. newCollection=self._collection();
  2399. $ctx1.sendIdx["collection"]=1;
  2400. self._samplesDo_((function(index,value){
  2401. return smalltalk.withContext(function($ctx2) {
  2402. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2403. return smalltalk.withContext(function($ctx3) {
  2404. return self._sampleNewValue();
  2405. $ctx3.sendIdx["sampleNewValue"]=1;
  2406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2407. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2408. return self._assert_equals_($1,value);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2411. self._assert_equals_(newCollection,self._collection());
  2412. $ctx1.sendIdx["assert:equals:"]=2;
  2413. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2414. return smalltalk.withContext(function($ctx2) {
  2415. return self._sampleNewValue();
  2416. $ctx2.sendIdx["sampleNewValue"]=2;
  2417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2418. $ctx1.sendIdx["assert:equals:"]=3;
  2419. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2420. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2421. args: [],
  2422. 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",
  2423. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2424. referencedClasses: []
  2425. }),
  2426. globals.IndexableCollectionTest);
  2427. smalltalk.addMethod(
  2428. smalltalk.method({
  2429. selector: "testAtIfPresent",
  2430. protocol: 'tests',
  2431. fn: function (){
  2432. var self=this;
  2433. var visited,sentinel;
  2434. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2435. return smalltalk.withContext(function($ctx1) {
  2436. var $2,$1,$4,$3;
  2437. sentinel=_st($Object())._new();
  2438. self._nonIndexesDo_((function(each){
  2439. return smalltalk.withContext(function($ctx2) {
  2440. visited=nil;
  2441. visited;
  2442. $2=self._collection();
  2443. $ctx2.sendIdx["collection"]=1;
  2444. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2445. visited=value1;
  2446. visited;
  2447. return sentinel;
  2448. }));
  2449. $ctx2.sendIdx["at:ifPresent:"]=1;
  2450. self._assert_equals_($1,nil);
  2451. $ctx2.sendIdx["assert:equals:"]=1;
  2452. return self._assert_(_st(visited)._isNil());
  2453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2454. self._samplesDo_((function(index,value){
  2455. return smalltalk.withContext(function($ctx2) {
  2456. visited=nil;
  2457. visited;
  2458. $4=self._collection();
  2459. $ctx2.sendIdx["collection"]=2;
  2460. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2461. visited=value2;
  2462. visited;
  2463. return sentinel;
  2464. }));
  2465. self._assert_equals_($3,sentinel);
  2466. $ctx2.sendIdx["assert:equals:"]=2;
  2467. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2468. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2470. args: [],
  2471. 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) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. globals.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtIfPresentIfAbsent",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var visited,sentinel;
  2483. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2484. return smalltalk.withContext(function($ctx1) {
  2485. var $2,$1,$3,$5,$4;
  2486. sentinel=_st($Object())._new();
  2487. self._nonIndexesDo_((function(each){
  2488. return smalltalk.withContext(function($ctx2) {
  2489. visited=nil;
  2490. visited;
  2491. $2=self._collection();
  2492. $ctx2.sendIdx["collection"]=1;
  2493. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2494. visited=value1;
  2495. visited;
  2496. return sentinel;
  2497. }),(function(){
  2498. return smalltalk.withContext(function($ctx3) {
  2499. return self._sampleNewValue();
  2500. $ctx3.sendIdx["sampleNewValue"]=1;
  2501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2502. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2503. $3=self._sampleNewValue();
  2504. $ctx2.sendIdx["sampleNewValue"]=2;
  2505. self._assert_equals_($1,$3);
  2506. $ctx2.sendIdx["assert:equals:"]=1;
  2507. return self._assert_(_st(visited)._isNil());
  2508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2509. self._samplesDo_((function(index,value){
  2510. return smalltalk.withContext(function($ctx2) {
  2511. visited=nil;
  2512. visited;
  2513. $5=self._collection();
  2514. $ctx2.sendIdx["collection"]=2;
  2515. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2516. visited=value2;
  2517. visited;
  2518. return sentinel;
  2519. }),(function(){
  2520. return smalltalk.withContext(function($ctx3) {
  2521. return self._sampleNewValue();
  2522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2523. self._assert_equals_($4,sentinel);
  2524. $ctx2.sendIdx["assert:equals:"]=2;
  2525. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2526. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2527. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2528. args: [],
  2529. 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) ]",
  2530. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2531. referencedClasses: ["Object"]
  2532. }),
  2533. globals.IndexableCollectionTest);
  2534. smalltalk.addMethod(
  2535. smalltalk.method({
  2536. selector: "testAtPut",
  2537. protocol: 'tests',
  2538. fn: function (){
  2539. var self=this;
  2540. var newCollection;
  2541. return smalltalk.withContext(function($ctx1) {
  2542. newCollection=self._collection();
  2543. $ctx1.sendIdx["collection"]=1;
  2544. self._samplesDo_((function(index,value){
  2545. return smalltalk.withContext(function($ctx2) {
  2546. return _st(newCollection)._at_put_(index,value);
  2547. $ctx2.sendIdx["at:put:"]=1;
  2548. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2549. self._assert_equals_(newCollection,self._collection());
  2550. $ctx1.sendIdx["assert:equals:"]=1;
  2551. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2552. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2553. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2554. args: [],
  2555. 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",
  2556. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2557. referencedClasses: []
  2558. }),
  2559. globals.IndexableCollectionTest);
  2560. smalltalk.addMethod(
  2561. smalltalk.method({
  2562. selector: "testEquality",
  2563. protocol: 'tests',
  2564. fn: function (){
  2565. var self=this;
  2566. return smalltalk.withContext(function($ctx1) {
  2567. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2568. $2=self._collectionClass();
  2569. $ctx1.sendIdx["collectionClass"]=1;
  2570. $1=_st($2)._new();
  2571. $ctx1.sendIdx["new"]=1;
  2572. $4=self._collectionClass();
  2573. $ctx1.sendIdx["collectionClass"]=2;
  2574. $3=_st($4)._new();
  2575. $ctx1.sendIdx["new"]=2;
  2576. self._assert_equals_($1,$3);
  2577. $ctx1.sendIdx["assert:equals:"]=1;
  2578. $5=self._collection();
  2579. $ctx1.sendIdx["collection"]=1;
  2580. $6=self._collection();
  2581. $ctx1.sendIdx["collection"]=2;
  2582. self._assert_equals_($5,$6);
  2583. $ctx1.sendIdx["assert:equals:"]=2;
  2584. $7=self._collectionWithNewValue();
  2585. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2586. self._assert_equals_($7,self._collectionWithNewValue());
  2587. $10=self._collectionClass();
  2588. $ctx1.sendIdx["collectionClass"]=3;
  2589. $9=_st($10)._new();
  2590. $ctx1.sendIdx["new"]=3;
  2591. $11=self._collection();
  2592. $ctx1.sendIdx["collection"]=3;
  2593. $8=_st($9).__eq($11);
  2594. $ctx1.sendIdx["="]=1;
  2595. self._deny_($8);
  2596. $ctx1.sendIdx["deny:"]=1;
  2597. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2598. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2599. args: [],
  2600. 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",
  2601. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2602. referencedClasses: []
  2603. }),
  2604. globals.IndexableCollectionTest);
  2605. smalltalk.addMethod(
  2606. smalltalk.method({
  2607. selector: "testIndexOf",
  2608. protocol: 'tests',
  2609. fn: function (){
  2610. var self=this;
  2611. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2612. return smalltalk.withContext(function($ctx1) {
  2613. var $1;
  2614. self._should_raise_((function(){
  2615. return smalltalk.withContext(function($ctx2) {
  2616. $1=self._collection();
  2617. $ctx2.sendIdx["collection"]=1;
  2618. return _st($1)._indexOf_(self._sampleNewValue());
  2619. $ctx2.sendIdx["indexOf:"]=1;
  2620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2621. self._samplesDo_((function(index,value){
  2622. return smalltalk.withContext(function($ctx2) {
  2623. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2624. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2625. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2626. args: [],
  2627. 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 ]",
  2628. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2629. referencedClasses: ["Error"]
  2630. }),
  2631. globals.IndexableCollectionTest);
  2632. smalltalk.addMethod(
  2633. smalltalk.method({
  2634. selector: "testIndexOfWithNull",
  2635. protocol: 'tests',
  2636. fn: function (){
  2637. var self=this;
  2638. var jsNull;
  2639. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2640. return smalltalk.withContext(function($ctx1) {
  2641. var $1,$2;
  2642. jsNull=_st($JSON())._parse_("null");
  2643. self._samplesDo_((function(index,value){
  2644. return smalltalk.withContext(function($ctx2) {
  2645. $1=self._collection();
  2646. _st($1)._at_put_(index,jsNull);
  2647. $2=_st($1)._indexOf_(jsNull);
  2648. return self._assert_equals_($2,index);
  2649. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2650. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2651. args: [],
  2652. 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 ]",
  2653. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2654. referencedClasses: ["JSON"]
  2655. }),
  2656. globals.IndexableCollectionTest);
  2657. smalltalk.addMethod(
  2658. smalltalk.method({
  2659. selector: "testWithIndexDo",
  2660. protocol: 'tests',
  2661. fn: function (){
  2662. var self=this;
  2663. var collection;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. collection=self._collection();
  2666. $ctx1.sendIdx["collection"]=1;
  2667. _st(self._collection())._withIndexDo_((function(each,index){
  2668. return smalltalk.withContext(function($ctx2) {
  2669. return self._assert_equals_(_st(collection)._at_(index),each);
  2670. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2671. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2672. args: [],
  2673. 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 ]",
  2674. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2675. referencedClasses: []
  2676. }),
  2677. globals.IndexableCollectionTest);
  2678. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2679. smalltalk.addMethod(
  2680. smalltalk.method({
  2681. selector: "collectionKeys",
  2682. protocol: 'fixture',
  2683. fn: function (){
  2684. var self=this;
  2685. return smalltalk.withContext(function($ctx1) {
  2686. self._subclassResponsibility();
  2687. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2688. args: [],
  2689. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2690. messageSends: ["subclassResponsibility"],
  2691. referencedClasses: []
  2692. }),
  2693. globals.AssociativeCollectionTest);
  2694. smalltalk.addMethod(
  2695. smalltalk.method({
  2696. selector: "collectionValues",
  2697. protocol: 'fixture',
  2698. fn: function (){
  2699. var self=this;
  2700. return smalltalk.withContext(function($ctx1) {
  2701. self._subclassResponsibility();
  2702. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2703. args: [],
  2704. source: "collectionValues\x0a\x09self subclassResponsibility",
  2705. messageSends: ["subclassResponsibility"],
  2706. referencedClasses: []
  2707. }),
  2708. globals.AssociativeCollectionTest);
  2709. smalltalk.addMethod(
  2710. smalltalk.method({
  2711. selector: "nonIndexesDo:",
  2712. protocol: 'fixture',
  2713. fn: function (aBlock){
  2714. var self=this;
  2715. return smalltalk.withContext(function($ctx1) {
  2716. _st(aBlock)._value_((5));
  2717. $ctx1.sendIdx["value:"]=1;
  2718. _st(aBlock)._value_("z");
  2719. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2720. args: ["aBlock"],
  2721. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2722. messageSends: ["value:"],
  2723. referencedClasses: []
  2724. }),
  2725. globals.AssociativeCollectionTest);
  2726. smalltalk.addMethod(
  2727. smalltalk.method({
  2728. selector: "sampleNewIndex",
  2729. protocol: 'fixture',
  2730. fn: function (){
  2731. var self=this;
  2732. return "new";
  2733. },
  2734. args: [],
  2735. source: "sampleNewIndex\x0a\x09^ 'new'",
  2736. messageSends: [],
  2737. referencedClasses: []
  2738. }),
  2739. globals.AssociativeCollectionTest);
  2740. smalltalk.addMethod(
  2741. smalltalk.method({
  2742. selector: "samplesDo:",
  2743. protocol: 'fixture',
  2744. fn: function (aBlock){
  2745. var self=this;
  2746. return smalltalk.withContext(function($ctx1) {
  2747. _st(aBlock)._value_value_("a",(2));
  2748. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2749. args: ["aBlock"],
  2750. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2751. messageSends: ["value:value:"],
  2752. referencedClasses: []
  2753. }),
  2754. globals.AssociativeCollectionTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testAddAll",
  2758. protocol: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. return smalltalk.withContext(function($ctx1) {
  2762. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2763. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2764. $ctx1.supercall = false;
  2765. $2=self._collection();
  2766. $ctx1.sendIdx["collection"]=1;
  2767. $3=$2;
  2768. $4=self._collection();
  2769. $ctx1.sendIdx["collection"]=2;
  2770. _st($3)._addAll_($4);
  2771. $ctx1.sendIdx["addAll:"]=1;
  2772. $5=_st($2)._yourself();
  2773. $ctx1.sendIdx["yourself"]=1;
  2774. $1=$5;
  2775. $6=self._collection();
  2776. $ctx1.sendIdx["collection"]=3;
  2777. self._assert_equals_($1,$6);
  2778. $ctx1.sendIdx["assert:equals:"]=1;
  2779. $8=self._collection();
  2780. $ctx1.sendIdx["collection"]=4;
  2781. $9=$8;
  2782. $10=self._collectionWithNewValue();
  2783. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2784. _st($9)._addAll_($10);
  2785. $ctx1.sendIdx["addAll:"]=2;
  2786. $11=_st($8)._yourself();
  2787. $ctx1.sendIdx["yourself"]=2;
  2788. $7=$11;
  2789. $12=self._collectionWithNewValue();
  2790. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2791. self._assert_equals_($7,$12);
  2792. $ctx1.sendIdx["assert:equals:"]=2;
  2793. $14=self._collectionWithNewValue();
  2794. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2795. _st($14)._addAll_(self._collection());
  2796. $15=_st($14)._yourself();
  2797. $13=$15;
  2798. self._assert_equals_($13,self._collectionWithNewValue());
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2800. args: [],
  2801. 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",
  2802. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2803. referencedClasses: []
  2804. }),
  2805. globals.AssociativeCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testAsDictionary",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2813. return smalltalk.withContext(function($ctx1) {
  2814. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2815. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2816. args: [],
  2817. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2818. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2819. referencedClasses: ["Dictionary"]
  2820. }),
  2821. globals.AssociativeCollectionTest);
  2822. smalltalk.addMethod(
  2823. smalltalk.method({
  2824. selector: "testAsHashedCollection",
  2825. protocol: 'tests',
  2826. fn: function (){
  2827. var self=this;
  2828. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2829. return smalltalk.withContext(function($ctx1) {
  2830. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2831. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2832. args: [],
  2833. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2834. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2835. referencedClasses: ["HashedCollection"]
  2836. }),
  2837. globals.AssociativeCollectionTest);
  2838. smalltalk.addMethod(
  2839. smalltalk.method({
  2840. selector: "testComma",
  2841. protocol: 'tests',
  2842. fn: function (){
  2843. var self=this;
  2844. return smalltalk.withContext(function($ctx1) {
  2845. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2846. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2847. $ctx1.supercall = false;
  2848. $2=self._collection();
  2849. $ctx1.sendIdx["collection"]=1;
  2850. $3=self._collection();
  2851. $ctx1.sendIdx["collection"]=2;
  2852. $1=_st($2).__comma($3);
  2853. $ctx1.sendIdx[","]=1;
  2854. $4=self._collection();
  2855. $ctx1.sendIdx["collection"]=3;
  2856. self._assert_equals_($1,$4);
  2857. $ctx1.sendIdx["assert:equals:"]=1;
  2858. $6=self._collection();
  2859. $ctx1.sendIdx["collection"]=4;
  2860. $7=self._collectionWithNewValue();
  2861. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2862. $5=_st($6).__comma($7);
  2863. $ctx1.sendIdx[","]=2;
  2864. $8=self._collectionWithNewValue();
  2865. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2866. self._assert_equals_($5,$8);
  2867. $ctx1.sendIdx["assert:equals:"]=2;
  2868. $10=self._collectionWithNewValue();
  2869. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2870. $9=_st($10).__comma(self._collection());
  2871. self._assert_equals_($9,self._collectionWithNewValue());
  2872. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2873. args: [],
  2874. 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",
  2875. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2876. referencedClasses: []
  2877. }),
  2878. globals.AssociativeCollectionTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "testFrom",
  2882. protocol: 'tests',
  2883. fn: function (){
  2884. var self=this;
  2885. var associations;
  2886. return smalltalk.withContext(function($ctx1) {
  2887. var $1;
  2888. $1="a".__minus_gt((1));
  2889. $ctx1.sendIdx["->"]=1;
  2890. associations=[$1,"b".__minus_gt((2))];
  2891. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2892. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2893. args: [],
  2894. 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 }.",
  2895. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2896. referencedClasses: []
  2897. }),
  2898. globals.AssociativeCollectionTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "testKeys",
  2902. protocol: 'tests',
  2903. fn: function (){
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) {
  2906. var $2,$1,$3,$4;
  2907. $2=_st(_st(self._collectionClass())._new())._keys();
  2908. $ctx1.sendIdx["keys"]=1;
  2909. $1=_st($2)._isEmpty();
  2910. self._assert_($1);
  2911. $3=_st(self._collection())._keys();
  2912. $ctx1.sendIdx["keys"]=2;
  2913. $4=self._collectionKeys();
  2914. $ctx1.sendIdx["collectionKeys"]=1;
  2915. self._assertSameContents_as_($3,$4);
  2916. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2917. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2918. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2919. args: [],
  2920. 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 }",
  2921. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2922. referencedClasses: []
  2923. }),
  2924. globals.AssociativeCollectionTest);
  2925. smalltalk.addMethod(
  2926. smalltalk.method({
  2927. selector: "testNewFromPairs",
  2928. protocol: 'tests',
  2929. fn: function (){
  2930. var self=this;
  2931. var flattenedAssociations;
  2932. return smalltalk.withContext(function($ctx1) {
  2933. flattenedAssociations=["a",(1),"b",(2)];
  2934. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2935. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2936. args: [],
  2937. 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 }.",
  2938. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2939. referencedClasses: []
  2940. }),
  2941. globals.AssociativeCollectionTest);
  2942. smalltalk.addMethod(
  2943. smalltalk.method({
  2944. selector: "testPrintString",
  2945. protocol: 'tests',
  2946. fn: function (){
  2947. var self=this;
  2948. return smalltalk.withContext(function($ctx1) {
  2949. var $3,$2,$4,$1,$5;
  2950. $3=self._collectionClass();
  2951. $ctx1.sendIdx["collectionClass"]=1;
  2952. $2=_st($3)._new();
  2953. _st($2)._at_put_("firstname","James");
  2954. $ctx1.sendIdx["at:put:"]=1;
  2955. _st($2)._at_put_("lastname","Bond");
  2956. $4=_st($2)._printString();
  2957. $1=$4;
  2958. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2959. $ctx1.sendIdx[","]=1;
  2960. self._assert_equals_($1,$5);
  2961. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2962. args: [],
  2963. 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'')'",
  2964. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2965. referencedClasses: []
  2966. }),
  2967. globals.AssociativeCollectionTest);
  2968. smalltalk.addMethod(
  2969. smalltalk.method({
  2970. selector: "testRemoveKey",
  2971. protocol: 'tests',
  2972. fn: function (){
  2973. var self=this;
  2974. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2975. return smalltalk.withContext(function($ctx1) {
  2976. var $1,$2,$3,$5,$6,$4,$7,$8;
  2977. self._nonIndexesDo_((function(each){
  2978. var collection;
  2979. return smalltalk.withContext(function($ctx2) {
  2980. collection=self._collection();
  2981. $ctx2.sendIdx["collection"]=1;
  2982. collection;
  2983. self._should_raise_((function(){
  2984. return smalltalk.withContext(function($ctx3) {
  2985. return _st(collection)._removeKey_(each);
  2986. $ctx3.sendIdx["removeKey:"]=1;
  2987. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2988. $1=collection;
  2989. $2=self._collection();
  2990. $ctx2.sendIdx["collection"]=2;
  2991. return self._assert_equals_($1,$2);
  2992. $ctx2.sendIdx["assert:equals:"]=1;
  2993. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2994. self._samplesDo_((function(index,value){
  2995. var collection;
  2996. return smalltalk.withContext(function($ctx2) {
  2997. collection=self._collection();
  2998. $ctx2.sendIdx["collection"]=3;
  2999. collection;
  3000. $3=_st(collection)._removeKey_(index);
  3001. $ctx2.sendIdx["removeKey:"]=2;
  3002. self._assert_equals_($3,value);
  3003. $ctx2.sendIdx["assert:equals:"]=2;
  3004. $5=collection;
  3005. $6=self._collection();
  3006. $ctx2.sendIdx["collection"]=4;
  3007. $4=_st($5).__eq($6);
  3008. return self._deny_($4);
  3009. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3010. $7=self._collectionWithNewValue();
  3011. _st($7)._removeKey_(self._sampleNewIndex());
  3012. $8=_st($7)._yourself();
  3013. self._assert_equals_($8,self._collection());
  3014. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  3015. args: [],
  3016. 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",
  3017. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  3018. referencedClasses: ["Error"]
  3019. }),
  3020. globals.AssociativeCollectionTest);
  3021. smalltalk.addMethod(
  3022. smalltalk.method({
  3023. selector: "testRemoveKeyIfAbsent",
  3024. protocol: 'tests',
  3025. fn: function (){
  3026. var self=this;
  3027. return smalltalk.withContext(function($ctx1) {
  3028. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  3029. self._nonIndexesDo_((function(each){
  3030. var collection;
  3031. return smalltalk.withContext(function($ctx2) {
  3032. collection=self._collection();
  3033. $ctx2.sendIdx["collection"]=1;
  3034. collection;
  3035. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  3036. return smalltalk.withContext(function($ctx3) {
  3037. return self._sampleNewValue();
  3038. $ctx3.sendIdx["sampleNewValue"]=1;
  3039. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  3040. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  3041. $2=self._sampleNewValue();
  3042. $ctx2.sendIdx["sampleNewValue"]=2;
  3043. self._assert_equals_($1,$2);
  3044. $ctx2.sendIdx["assert:equals:"]=1;
  3045. $3=collection;
  3046. $4=self._collection();
  3047. $ctx2.sendIdx["collection"]=2;
  3048. return self._assert_equals_($3,$4);
  3049. $ctx2.sendIdx["assert:equals:"]=2;
  3050. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  3051. self._samplesDo_((function(index,value){
  3052. var collection;
  3053. return smalltalk.withContext(function($ctx2) {
  3054. collection=self._collection();
  3055. $ctx2.sendIdx["collection"]=3;
  3056. collection;
  3057. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3058. return smalltalk.withContext(function($ctx3) {
  3059. return self._sampleNewValue();
  3060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3061. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3062. self._assert_equals_($5,value);
  3063. $ctx2.sendIdx["assert:equals:"]=3;
  3064. $7=collection;
  3065. $8=self._collection();
  3066. $ctx2.sendIdx["collection"]=4;
  3067. $6=_st($7).__eq($8);
  3068. return self._deny_($6);
  3069. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3070. $9=self._collectionWithNewValue();
  3071. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3072. return smalltalk.withContext(function($ctx2) {
  3073. return self._assert_(false);
  3074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3075. $10=_st($9)._yourself();
  3076. self._assert_equals_($10,self._collection());
  3077. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3078. args: [],
  3079. 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",
  3080. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3081. referencedClasses: []
  3082. }),
  3083. globals.AssociativeCollectionTest);
  3084. smalltalk.addMethod(
  3085. smalltalk.method({
  3086. selector: "testValues",
  3087. protocol: 'tests',
  3088. fn: function (){
  3089. var self=this;
  3090. return smalltalk.withContext(function($ctx1) {
  3091. var $2,$1,$3,$4;
  3092. $2=_st(_st(self._collectionClass())._new())._values();
  3093. $ctx1.sendIdx["values"]=1;
  3094. $1=_st($2)._isEmpty();
  3095. self._assert_($1);
  3096. $3=_st(self._collection())._values();
  3097. $ctx1.sendIdx["values"]=2;
  3098. $4=self._collectionValues();
  3099. $ctx1.sendIdx["collectionValues"]=1;
  3100. self._assertSameContents_as_($3,$4);
  3101. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3102. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3103. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3104. args: [],
  3105. 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 }",
  3106. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3107. referencedClasses: []
  3108. }),
  3109. globals.AssociativeCollectionTest);
  3110. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3111. smalltalk.addMethod(
  3112. smalltalk.method({
  3113. selector: "collection",
  3114. protocol: 'fixture',
  3115. fn: function (){
  3116. var self=this;
  3117. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3118. return smalltalk.withContext(function($ctx1) {
  3119. var $2,$3,$1;
  3120. $2=_st($Dictionary())._new();
  3121. _st($2)._at_put_((1),(1));
  3122. $ctx1.sendIdx["at:put:"]=1;
  3123. _st($2)._at_put_("a",(2));
  3124. $ctx1.sendIdx["at:put:"]=2;
  3125. _st($2)._at_put_(true,(3));
  3126. $ctx1.sendIdx["at:put:"]=3;
  3127. _st($2)._at_put_((1).__at((3)),(-4));
  3128. $3=_st($2)._yourself();
  3129. $1=$3;
  3130. return $1;
  3131. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3132. args: [],
  3133. 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",
  3134. messageSends: ["at:put:", "new", "@", "yourself"],
  3135. referencedClasses: ["Dictionary"]
  3136. }),
  3137. globals.DictionaryTest);
  3138. smalltalk.addMethod(
  3139. smalltalk.method({
  3140. selector: "collectionKeys",
  3141. protocol: 'fixture',
  3142. fn: function (){
  3143. var self=this;
  3144. return smalltalk.withContext(function($ctx1) {
  3145. var $1;
  3146. $1=[(1),"a",true,(1).__at((3))];
  3147. return $1;
  3148. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3149. args: [],
  3150. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3151. messageSends: ["@"],
  3152. referencedClasses: []
  3153. }),
  3154. globals.DictionaryTest);
  3155. smalltalk.addMethod(
  3156. smalltalk.method({
  3157. selector: "collectionOfPrintStrings",
  3158. protocol: 'fixture',
  3159. fn: function (){
  3160. var self=this;
  3161. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3162. return smalltalk.withContext(function($ctx1) {
  3163. var $2,$3,$1;
  3164. $2=_st($Dictionary())._new();
  3165. _st($2)._at_put_((1),"1");
  3166. $ctx1.sendIdx["at:put:"]=1;
  3167. _st($2)._at_put_("a","2");
  3168. $ctx1.sendIdx["at:put:"]=2;
  3169. _st($2)._at_put_(true,"3");
  3170. $ctx1.sendIdx["at:put:"]=3;
  3171. _st($2)._at_put_((1).__at((3)),"-4");
  3172. $3=_st($2)._yourself();
  3173. $1=$3;
  3174. return $1;
  3175. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3176. args: [],
  3177. 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",
  3178. messageSends: ["at:put:", "new", "@", "yourself"],
  3179. referencedClasses: ["Dictionary"]
  3180. }),
  3181. globals.DictionaryTest);
  3182. smalltalk.addMethod(
  3183. smalltalk.method({
  3184. selector: "collectionSize",
  3185. protocol: 'fixture',
  3186. fn: function (){
  3187. var self=this;
  3188. return (4);
  3189. },
  3190. args: [],
  3191. source: "collectionSize\x0a\x09^ 4",
  3192. messageSends: [],
  3193. referencedClasses: []
  3194. }),
  3195. globals.DictionaryTest);
  3196. smalltalk.addMethod(
  3197. smalltalk.method({
  3198. selector: "collectionValues",
  3199. protocol: 'fixture',
  3200. fn: function (){
  3201. var self=this;
  3202. var $1;
  3203. $1=[(1),(2),(3),(-4)];
  3204. return $1;
  3205. },
  3206. args: [],
  3207. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3208. messageSends: [],
  3209. referencedClasses: []
  3210. }),
  3211. globals.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "collectionWithDuplicates",
  3215. protocol: 'fixture',
  3216. fn: function (){
  3217. var self=this;
  3218. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3219. return smalltalk.withContext(function($ctx1) {
  3220. var $2,$3,$1;
  3221. $2=_st($Dictionary())._new();
  3222. _st($2)._at_put_((1),(1));
  3223. $ctx1.sendIdx["at:put:"]=1;
  3224. _st($2)._at_put_("a",(2));
  3225. $ctx1.sendIdx["at:put:"]=2;
  3226. _st($2)._at_put_(true,(3));
  3227. $ctx1.sendIdx["at:put:"]=3;
  3228. _st($2)._at_put_((4),(-4));
  3229. $ctx1.sendIdx["at:put:"]=4;
  3230. _st($2)._at_put_("b",(1));
  3231. $ctx1.sendIdx["at:put:"]=5;
  3232. _st($2)._at_put_((3),(3));
  3233. $ctx1.sendIdx["at:put:"]=6;
  3234. _st($2)._at_put_(false,(12));
  3235. $3=_st($2)._yourself();
  3236. $1=$3;
  3237. return $1;
  3238. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3239. args: [],
  3240. 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",
  3241. messageSends: ["at:put:", "new", "yourself"],
  3242. referencedClasses: ["Dictionary"]
  3243. }),
  3244. globals.DictionaryTest);
  3245. smalltalk.addMethod(
  3246. smalltalk.method({
  3247. selector: "collectionWithNewValue",
  3248. protocol: 'fixture',
  3249. fn: function (){
  3250. var self=this;
  3251. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3252. return smalltalk.withContext(function($ctx1) {
  3253. var $2,$3,$1;
  3254. $2=_st($Dictionary())._new();
  3255. _st($2)._at_put_((1),(1));
  3256. $ctx1.sendIdx["at:put:"]=1;
  3257. _st($2)._at_put_("a",(2));
  3258. $ctx1.sendIdx["at:put:"]=2;
  3259. _st($2)._at_put_(true,(3));
  3260. $ctx1.sendIdx["at:put:"]=3;
  3261. _st($2)._at_put_((1).__at((3)),(-4));
  3262. $ctx1.sendIdx["at:put:"]=4;
  3263. _st($2)._at_put_("new","N");
  3264. $3=_st($2)._yourself();
  3265. $1=$3;
  3266. return $1;
  3267. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3268. args: [],
  3269. 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",
  3270. messageSends: ["at:put:", "new", "@", "yourself"],
  3271. referencedClasses: ["Dictionary"]
  3272. }),
  3273. globals.DictionaryTest);
  3274. smalltalk.addMethod(
  3275. smalltalk.method({
  3276. selector: "sampleNewValueAsCollection",
  3277. protocol: 'fixture',
  3278. fn: function (){
  3279. var self=this;
  3280. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3281. return smalltalk.withContext(function($ctx1) {
  3282. var $2,$3,$1;
  3283. $2=_st($Dictionary())._new();
  3284. _st($2)._at_put_("new","N");
  3285. $3=_st($2)._yourself();
  3286. $1=$3;
  3287. return $1;
  3288. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3289. args: [],
  3290. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3291. messageSends: ["at:put:", "new", "yourself"],
  3292. referencedClasses: ["Dictionary"]
  3293. }),
  3294. globals.DictionaryTest);
  3295. smalltalk.addMethod(
  3296. smalltalk.method({
  3297. selector: "samplesDo:",
  3298. protocol: 'fixture',
  3299. fn: function (aBlock){
  3300. var self=this;
  3301. return smalltalk.withContext(function($ctx1) {
  3302. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3303. $ctx1.supercall = false;
  3304. _st(aBlock)._value_value_(true,(3));
  3305. $ctx1.sendIdx["value:value:"]=1;
  3306. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3307. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3308. args: ["aBlock"],
  3309. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3310. messageSends: ["samplesDo:", "value:value:", "@"],
  3311. referencedClasses: []
  3312. }),
  3313. globals.DictionaryTest);
  3314. smalltalk.addMethod(
  3315. smalltalk.method({
  3316. selector: "testAccessing",
  3317. protocol: 'tests',
  3318. fn: function (){
  3319. var self=this;
  3320. var d;
  3321. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3322. return smalltalk.withContext(function($ctx1) {
  3323. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3324. d=_st($Dictionary())._new();
  3325. _st(d)._at_put_("hello","world");
  3326. $ctx1.sendIdx["at:put:"]=1;
  3327. $1=_st(d)._at_("hello");
  3328. $ctx1.sendIdx["at:"]=1;
  3329. self._assert_equals_($1,"world");
  3330. $ctx1.sendIdx["assert:equals:"]=1;
  3331. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3332. return nil;
  3333. }));
  3334. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3335. self._assert_equals_($2,"world");
  3336. $ctx1.sendIdx["assert:equals:"]=2;
  3337. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3338. return nil;
  3339. }))).__eq("world"));
  3340. $ctx1.sendIdx["deny:"]=1;
  3341. $3=_st(d)._includesKey_("hello");
  3342. $ctx1.sendIdx["includesKey:"]=1;
  3343. self._assert_($3);
  3344. $ctx1.sendIdx["assert:"]=1;
  3345. $4=_st(d)._includesKey_("foo");
  3346. $ctx1.sendIdx["includesKey:"]=2;
  3347. self._deny_($4);
  3348. $ctx1.sendIdx["deny:"]=2;
  3349. _st(d)._at_put_((1),(2));
  3350. $ctx1.sendIdx["at:put:"]=2;
  3351. $5=_st(d)._at_((1));
  3352. $ctx1.sendIdx["at:"]=2;
  3353. self._assert_equals_($5,(2));
  3354. $ctx1.sendIdx["assert:equals:"]=3;
  3355. $6=d;
  3356. $7=(1).__at((3));
  3357. $ctx1.sendIdx["@"]=1;
  3358. _st($6)._at_put_($7,(3));
  3359. $9=d;
  3360. $10=(1).__at((3));
  3361. $ctx1.sendIdx["@"]=2;
  3362. $8=_st($9)._at_($10);
  3363. self._assert_equals_($8,(3));
  3364. $12=d;
  3365. $13=(1).__at((3));
  3366. $ctx1.sendIdx["@"]=3;
  3367. $11=_st($12)._includesKey_($13);
  3368. $ctx1.sendIdx["includesKey:"]=3;
  3369. self._assert_($11);
  3370. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3371. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3372. args: [],
  3373. 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)",
  3374. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3375. referencedClasses: ["Dictionary"]
  3376. }),
  3377. globals.DictionaryTest);
  3378. smalltalk.addMethod(
  3379. smalltalk.method({
  3380. selector: "testDynamicDictionaries",
  3381. protocol: 'tests',
  3382. fn: function (){
  3383. var self=this;
  3384. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3385. return smalltalk.withContext(function($ctx1) {
  3386. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3387. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3388. args: [],
  3389. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3390. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3391. referencedClasses: ["Dictionary"]
  3392. }),
  3393. globals.DictionaryTest);
  3394. smalltalk.addMethod(
  3395. smalltalk.method({
  3396. selector: "collectionClass",
  3397. protocol: 'fixture',
  3398. fn: function (){
  3399. var self=this;
  3400. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3401. return $Dictionary();
  3402. },
  3403. args: [],
  3404. source: "collectionClass\x0a\x09^ Dictionary",
  3405. messageSends: [],
  3406. referencedClasses: ["Dictionary"]
  3407. }),
  3408. globals.DictionaryTest.klass);
  3409. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3410. smalltalk.addMethod(
  3411. smalltalk.method({
  3412. selector: "collection",
  3413. protocol: 'fixture',
  3414. fn: function (){
  3415. var self=this;
  3416. var $1;
  3417. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3418. return $1;
  3419. },
  3420. args: [],
  3421. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3422. messageSends: [],
  3423. referencedClasses: []
  3424. }),
  3425. globals.HashedCollectionTest);
  3426. smalltalk.addMethod(
  3427. smalltalk.method({
  3428. selector: "collectionKeys",
  3429. protocol: 'fixture',
  3430. fn: function (){
  3431. var self=this;
  3432. var $1;
  3433. $1=["b","a","c","d"];
  3434. return $1;
  3435. },
  3436. args: [],
  3437. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3438. messageSends: [],
  3439. referencedClasses: []
  3440. }),
  3441. globals.HashedCollectionTest);
  3442. smalltalk.addMethod(
  3443. smalltalk.method({
  3444. selector: "collectionOfPrintStrings",
  3445. protocol: 'fixture',
  3446. fn: function (){
  3447. var self=this;
  3448. var $1;
  3449. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3450. return $1;
  3451. },
  3452. args: [],
  3453. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3454. messageSends: [],
  3455. referencedClasses: []
  3456. }),
  3457. globals.HashedCollectionTest);
  3458. smalltalk.addMethod(
  3459. smalltalk.method({
  3460. selector: "collectionSize",
  3461. protocol: 'fixture',
  3462. fn: function (){
  3463. var self=this;
  3464. return (4);
  3465. },
  3466. args: [],
  3467. source: "collectionSize\x0a\x09^ 4",
  3468. messageSends: [],
  3469. referencedClasses: []
  3470. }),
  3471. globals.HashedCollectionTest);
  3472. smalltalk.addMethod(
  3473. smalltalk.method({
  3474. selector: "collectionValues",
  3475. protocol: 'fixture',
  3476. fn: function (){
  3477. var self=this;
  3478. var $1;
  3479. $1=[(1),(2),(3),(-4)];
  3480. return $1;
  3481. },
  3482. args: [],
  3483. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3484. messageSends: [],
  3485. referencedClasses: []
  3486. }),
  3487. globals.HashedCollectionTest);
  3488. smalltalk.addMethod(
  3489. smalltalk.method({
  3490. selector: "collectionWithDuplicates",
  3491. protocol: 'fixture',
  3492. fn: function (){
  3493. var self=this;
  3494. var $1;
  3495. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3496. return $1;
  3497. },
  3498. args: [],
  3499. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3500. messageSends: [],
  3501. referencedClasses: []
  3502. }),
  3503. globals.HashedCollectionTest);
  3504. smalltalk.addMethod(
  3505. smalltalk.method({
  3506. selector: "collectionWithNewValue",
  3507. protocol: 'fixture',
  3508. fn: function (){
  3509. var self=this;
  3510. var $1;
  3511. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3512. return $1;
  3513. },
  3514. args: [],
  3515. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3516. messageSends: [],
  3517. referencedClasses: []
  3518. }),
  3519. globals.HashedCollectionTest);
  3520. smalltalk.addMethod(
  3521. smalltalk.method({
  3522. selector: "sampleNewValueAsCollection",
  3523. protocol: 'fixture',
  3524. fn: function (){
  3525. var self=this;
  3526. var $1;
  3527. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3528. return $1;
  3529. },
  3530. args: [],
  3531. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3532. messageSends: [],
  3533. referencedClasses: []
  3534. }),
  3535. globals.HashedCollectionTest);
  3536. smalltalk.addMethod(
  3537. smalltalk.method({
  3538. selector: "testDynamicDictionaries",
  3539. protocol: 'tests',
  3540. fn: function (){
  3541. var self=this;
  3542. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3543. return smalltalk.withContext(function($ctx1) {
  3544. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3545. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3546. args: [],
  3547. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3548. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3549. referencedClasses: ["HashedCollection"]
  3550. }),
  3551. globals.HashedCollectionTest);
  3552. smalltalk.addMethod(
  3553. smalltalk.method({
  3554. selector: "collectionClass",
  3555. protocol: 'fixture',
  3556. fn: function (){
  3557. var self=this;
  3558. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3559. return $HashedCollection();
  3560. },
  3561. args: [],
  3562. source: "collectionClass\x0a\x09^ HashedCollection",
  3563. messageSends: [],
  3564. referencedClasses: ["HashedCollection"]
  3565. }),
  3566. globals.HashedCollectionTest.klass);
  3567. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "collectionFirst",
  3571. protocol: 'fixture',
  3572. fn: function (){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. self._subclassResponsibility();
  3576. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3577. args: [],
  3578. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3579. messageSends: ["subclassResponsibility"],
  3580. referencedClasses: []
  3581. }),
  3582. globals.SequenceableCollectionTest);
  3583. smalltalk.addMethod(
  3584. smalltalk.method({
  3585. selector: "collectionFirstTwo",
  3586. protocol: 'fixture',
  3587. fn: function (){
  3588. var self=this;
  3589. return smalltalk.withContext(function($ctx1) {
  3590. self._subclassResponsibility();
  3591. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3592. args: [],
  3593. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3594. messageSends: ["subclassResponsibility"],
  3595. referencedClasses: []
  3596. }),
  3597. globals.SequenceableCollectionTest);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "collectionLast",
  3601. protocol: 'fixture',
  3602. fn: function (){
  3603. var self=this;
  3604. return smalltalk.withContext(function($ctx1) {
  3605. self._subclassResponsibility();
  3606. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3607. args: [],
  3608. source: "collectionLast\x0a\x09self subclassResponsibility",
  3609. messageSends: ["subclassResponsibility"],
  3610. referencedClasses: []
  3611. }),
  3612. globals.SequenceableCollectionTest);
  3613. smalltalk.addMethod(
  3614. smalltalk.method({
  3615. selector: "collectionLastTwo",
  3616. protocol: 'fixture',
  3617. fn: function (){
  3618. var self=this;
  3619. return smalltalk.withContext(function($ctx1) {
  3620. self._subclassResponsibility();
  3621. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3622. args: [],
  3623. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3624. messageSends: ["subclassResponsibility"],
  3625. referencedClasses: []
  3626. }),
  3627. globals.SequenceableCollectionTest);
  3628. smalltalk.addMethod(
  3629. smalltalk.method({
  3630. selector: "nonIndexesDo:",
  3631. protocol: 'fixture',
  3632. fn: function (aBlock){
  3633. var self=this;
  3634. return smalltalk.withContext(function($ctx1) {
  3635. _st(aBlock)._value_((0));
  3636. $ctx1.sendIdx["value:"]=1;
  3637. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3638. $ctx1.sendIdx["value:"]=2;
  3639. _st(aBlock)._value_("z");
  3640. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3641. args: ["aBlock"],
  3642. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3643. messageSends: ["value:", "+", "collectionSize"],
  3644. referencedClasses: []
  3645. }),
  3646. globals.SequenceableCollectionTest);
  3647. smalltalk.addMethod(
  3648. smalltalk.method({
  3649. selector: "samplesDo:",
  3650. protocol: 'fixture',
  3651. fn: function (aBlock){
  3652. var self=this;
  3653. return smalltalk.withContext(function($ctx1) {
  3654. _st(aBlock)._value_value_((1),self._collectionFirst());
  3655. $ctx1.sendIdx["value:value:"]=1;
  3656. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3657. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3658. args: ["aBlock"],
  3659. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3660. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3661. referencedClasses: []
  3662. }),
  3663. globals.SequenceableCollectionTest);
  3664. smalltalk.addMethod(
  3665. smalltalk.method({
  3666. selector: "testBeginsWith",
  3667. protocol: 'tests',
  3668. fn: function (){
  3669. var self=this;
  3670. return smalltalk.withContext(function($ctx1) {
  3671. var $2,$1,$4,$5,$3,$7,$6;
  3672. $2=self._collection();
  3673. $ctx1.sendIdx["collection"]=1;
  3674. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3675. $ctx1.sendIdx["beginsWith:"]=1;
  3676. self._assert_($1);
  3677. $ctx1.sendIdx["assert:"]=1;
  3678. $4=self._collection();
  3679. $ctx1.sendIdx["collection"]=2;
  3680. $5=self._collection();
  3681. $ctx1.sendIdx["collection"]=3;
  3682. $3=_st($4)._beginsWith_($5);
  3683. $ctx1.sendIdx["beginsWith:"]=2;
  3684. self._assert_($3);
  3685. $ctx1.sendIdx["assert:"]=2;
  3686. $7=self._collection();
  3687. $ctx1.sendIdx["collection"]=4;
  3688. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3689. $ctx1.sendIdx["beginsWith:"]=3;
  3690. self._assert_($6);
  3691. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3692. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3693. args: [],
  3694. 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)",
  3695. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3696. referencedClasses: []
  3697. }),
  3698. globals.SequenceableCollectionTest);
  3699. smalltalk.addMethod(
  3700. smalltalk.method({
  3701. selector: "testEndsWith",
  3702. protocol: 'tests',
  3703. fn: function (){
  3704. var self=this;
  3705. return smalltalk.withContext(function($ctx1) {
  3706. var $2,$1,$4,$5,$3,$7,$6;
  3707. $2=self._collection();
  3708. $ctx1.sendIdx["collection"]=1;
  3709. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3710. $ctx1.sendIdx["endsWith:"]=1;
  3711. self._assert_($1);
  3712. $ctx1.sendIdx["assert:"]=1;
  3713. $4=self._collection();
  3714. $ctx1.sendIdx["collection"]=2;
  3715. $5=self._collection();
  3716. $ctx1.sendIdx["collection"]=3;
  3717. $3=_st($4)._endsWith_($5);
  3718. $ctx1.sendIdx["endsWith:"]=2;
  3719. self._assert_($3);
  3720. $ctx1.sendIdx["assert:"]=2;
  3721. $7=self._collection();
  3722. $ctx1.sendIdx["collection"]=4;
  3723. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3724. $ctx1.sendIdx["endsWith:"]=3;
  3725. self._assert_($6);
  3726. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3727. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3728. args: [],
  3729. 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)",
  3730. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3731. referencedClasses: []
  3732. }),
  3733. globals.SequenceableCollectionTest);
  3734. smalltalk.addMethod(
  3735. smalltalk.method({
  3736. selector: "testFirst",
  3737. protocol: 'tests',
  3738. fn: function (){
  3739. var self=this;
  3740. return smalltalk.withContext(function($ctx1) {
  3741. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3742. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3743. args: [],
  3744. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3745. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3746. referencedClasses: []
  3747. }),
  3748. globals.SequenceableCollectionTest);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "testFirstN",
  3752. protocol: 'tests',
  3753. fn: function (){
  3754. var self=this;
  3755. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3756. return smalltalk.withContext(function($ctx1) {
  3757. var $2,$1,$4,$3,$6,$5,$7;
  3758. $2=self._collection();
  3759. $ctx1.sendIdx["collection"]=1;
  3760. $1=_st($2)._first_((2));
  3761. $ctx1.sendIdx["first:"]=1;
  3762. self._assert_equals_($1,self._collectionFirstTwo());
  3763. $ctx1.sendIdx["assert:equals:"]=1;
  3764. $4=self._collection();
  3765. $ctx1.sendIdx["collection"]=2;
  3766. $3=_st($4)._first_((0));
  3767. $ctx1.sendIdx["first:"]=2;
  3768. self._assert_equals_($3,_st(self._collectionClass())._new());
  3769. $ctx1.sendIdx["assert:equals:"]=2;
  3770. $6=self._collection();
  3771. $ctx1.sendIdx["collection"]=3;
  3772. $5=_st($6)._first_(self._collectionSize());
  3773. $ctx1.sendIdx["first:"]=3;
  3774. $7=self._collection();
  3775. $ctx1.sendIdx["collection"]=4;
  3776. self._assert_equals_($5,$7);
  3777. self._should_raise_((function(){
  3778. return smalltalk.withContext(function($ctx2) {
  3779. return _st(self._collection())._first_((33));
  3780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3781. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3782. args: [],
  3783. 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",
  3784. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3785. referencedClasses: ["Error"]
  3786. }),
  3787. globals.SequenceableCollectionTest);
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "testFourth",
  3791. protocol: 'tests',
  3792. fn: function (){
  3793. var self=this;
  3794. return smalltalk.withContext(function($ctx1) {
  3795. var $2,$1;
  3796. $2=self._collection();
  3797. $ctx1.sendIdx["collection"]=1;
  3798. $1=_st($2)._fourth();
  3799. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3800. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3801. args: [],
  3802. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3803. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3804. referencedClasses: []
  3805. }),
  3806. globals.SequenceableCollectionTest);
  3807. smalltalk.addMethod(
  3808. smalltalk.method({
  3809. selector: "testIndexOfStartingAt",
  3810. protocol: 'tests',
  3811. fn: function (){
  3812. var self=this;
  3813. var jsNull;
  3814. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3815. return smalltalk.withContext(function($ctx1) {
  3816. var $2,$1,$4,$3;
  3817. jsNull=_st($JSON())._parse_("null");
  3818. self._samplesDo_((function(index,value){
  3819. return smalltalk.withContext(function($ctx2) {
  3820. $2=self._collection();
  3821. $ctx2.sendIdx["collection"]=1;
  3822. $1=_st($2)._indexOf_startingAt_(value,(1));
  3823. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3824. self._assert_equals_($1,index);
  3825. $ctx2.sendIdx["assert:equals:"]=1;
  3826. $4=self._collection();
  3827. $ctx2.sendIdx["collection"]=2;
  3828. $3=_st($4)._indexOf_startingAt_(value,index);
  3829. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3830. self._assert_equals_($3,index);
  3831. $ctx2.sendIdx["assert:equals:"]=2;
  3832. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3833. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3834. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3835. args: [],
  3836. 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 ]",
  3837. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3838. referencedClasses: ["JSON"]
  3839. }),
  3840. globals.SequenceableCollectionTest);
  3841. smalltalk.addMethod(
  3842. smalltalk.method({
  3843. selector: "testIndexOfStartingAtWithNull",
  3844. protocol: 'tests',
  3845. fn: function (){
  3846. var self=this;
  3847. var jsNull;
  3848. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3849. return smalltalk.withContext(function($ctx1) {
  3850. var $1,$2;
  3851. jsNull=_st($JSON())._parse_("null");
  3852. self._samplesDo_((function(index,value){
  3853. var collection;
  3854. return smalltalk.withContext(function($ctx2) {
  3855. collection=self._collection();
  3856. collection;
  3857. _st(collection)._at_put_(index,jsNull);
  3858. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3859. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3860. self._assert_equals_($1,index);
  3861. $ctx2.sendIdx["assert:equals:"]=1;
  3862. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3863. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3864. self._assert_equals_($2,index);
  3865. $ctx2.sendIdx["assert:equals:"]=2;
  3866. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3867. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3868. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3869. args: [],
  3870. 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 ]",
  3871. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3872. referencedClasses: ["JSON"]
  3873. }),
  3874. globals.SequenceableCollectionTest);
  3875. smalltalk.addMethod(
  3876. smalltalk.method({
  3877. selector: "testLast",
  3878. protocol: 'tests',
  3879. fn: function (){
  3880. var self=this;
  3881. return smalltalk.withContext(function($ctx1) {
  3882. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3883. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3884. args: [],
  3885. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3886. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3887. referencedClasses: []
  3888. }),
  3889. globals.SequenceableCollectionTest);
  3890. smalltalk.addMethod(
  3891. smalltalk.method({
  3892. selector: "testLastN",
  3893. protocol: 'tests',
  3894. fn: function (){
  3895. var self=this;
  3896. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3897. return smalltalk.withContext(function($ctx1) {
  3898. var $2,$1,$4,$3,$6,$5,$7;
  3899. $2=self._collection();
  3900. $ctx1.sendIdx["collection"]=1;
  3901. $1=_st($2)._last_((2));
  3902. $ctx1.sendIdx["last:"]=1;
  3903. self._assert_equals_($1,self._collectionLastTwo());
  3904. $ctx1.sendIdx["assert:equals:"]=1;
  3905. $4=self._collection();
  3906. $ctx1.sendIdx["collection"]=2;
  3907. $3=_st($4)._last_((0));
  3908. $ctx1.sendIdx["last:"]=2;
  3909. self._assert_equals_($3,_st(self._collectionClass())._new());
  3910. $ctx1.sendIdx["assert:equals:"]=2;
  3911. $6=self._collection();
  3912. $ctx1.sendIdx["collection"]=3;
  3913. $5=_st($6)._last_(self._collectionSize());
  3914. $ctx1.sendIdx["last:"]=3;
  3915. $7=self._collection();
  3916. $ctx1.sendIdx["collection"]=4;
  3917. self._assert_equals_($5,$7);
  3918. self._should_raise_((function(){
  3919. return smalltalk.withContext(function($ctx2) {
  3920. return _st(self._collection())._last_((33));
  3921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3922. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3923. args: [],
  3924. 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",
  3925. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3926. referencedClasses: ["Error"]
  3927. }),
  3928. globals.SequenceableCollectionTest);
  3929. smalltalk.addMethod(
  3930. smalltalk.method({
  3931. selector: "testSecond",
  3932. protocol: 'tests',
  3933. fn: function (){
  3934. var self=this;
  3935. return smalltalk.withContext(function($ctx1) {
  3936. var $2,$1;
  3937. $2=self._collection();
  3938. $ctx1.sendIdx["collection"]=1;
  3939. $1=_st($2)._second();
  3940. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3941. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3942. args: [],
  3943. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3944. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3945. referencedClasses: []
  3946. }),
  3947. globals.SequenceableCollectionTest);
  3948. smalltalk.addMethod(
  3949. smalltalk.method({
  3950. selector: "testThird",
  3951. protocol: 'tests',
  3952. fn: function (){
  3953. var self=this;
  3954. return smalltalk.withContext(function($ctx1) {
  3955. var $2,$1;
  3956. $2=self._collection();
  3957. $ctx1.sendIdx["collection"]=1;
  3958. $1=_st($2)._third();
  3959. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3960. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3961. args: [],
  3962. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3963. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3964. referencedClasses: []
  3965. }),
  3966. globals.SequenceableCollectionTest);
  3967. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3968. smalltalk.addMethod(
  3969. smalltalk.method({
  3970. selector: "collection",
  3971. protocol: 'fixture',
  3972. fn: function (){
  3973. var self=this;
  3974. var $1;
  3975. $1=[(1), (2), (3), (-4)];
  3976. return $1;
  3977. },
  3978. args: [],
  3979. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3980. messageSends: [],
  3981. referencedClasses: []
  3982. }),
  3983. globals.ArrayTest);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "collectionFirst",
  3987. protocol: 'fixture',
  3988. fn: function (){
  3989. var self=this;
  3990. return (1);
  3991. },
  3992. args: [],
  3993. source: "collectionFirst\x0a\x09^ 1",
  3994. messageSends: [],
  3995. referencedClasses: []
  3996. }),
  3997. globals.ArrayTest);
  3998. smalltalk.addMethod(
  3999. smalltalk.method({
  4000. selector: "collectionFirstTwo",
  4001. protocol: 'fixture',
  4002. fn: function (){
  4003. var self=this;
  4004. var $1;
  4005. $1=[(1), (2)];
  4006. return $1;
  4007. },
  4008. args: [],
  4009. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. globals.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "collectionLast",
  4017. protocol: 'fixture',
  4018. fn: function (){
  4019. var self=this;
  4020. return (-4);
  4021. },
  4022. args: [],
  4023. source: "collectionLast\x0a\x09^ -4",
  4024. messageSends: [],
  4025. referencedClasses: []
  4026. }),
  4027. globals.ArrayTest);
  4028. smalltalk.addMethod(
  4029. smalltalk.method({
  4030. selector: "collectionLastTwo",
  4031. protocol: 'fixture',
  4032. fn: function (){
  4033. var self=this;
  4034. var $1;
  4035. $1=[(3), (-4)];
  4036. return $1;
  4037. },
  4038. args: [],
  4039. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4040. messageSends: [],
  4041. referencedClasses: []
  4042. }),
  4043. globals.ArrayTest);
  4044. smalltalk.addMethod(
  4045. smalltalk.method({
  4046. selector: "collectionOfPrintStrings",
  4047. protocol: 'fixture',
  4048. fn: function (){
  4049. var self=this;
  4050. var $1;
  4051. $1=["1", "2", "3", "-4"];
  4052. return $1;
  4053. },
  4054. args: [],
  4055. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4056. messageSends: [],
  4057. referencedClasses: []
  4058. }),
  4059. globals.ArrayTest);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "collectionSize",
  4063. protocol: 'fixture',
  4064. fn: function (){
  4065. var self=this;
  4066. return (4);
  4067. },
  4068. args: [],
  4069. source: "collectionSize\x0a\x09^ 4",
  4070. messageSends: [],
  4071. referencedClasses: []
  4072. }),
  4073. globals.ArrayTest);
  4074. smalltalk.addMethod(
  4075. smalltalk.method({
  4076. selector: "collectionWithDuplicates",
  4077. protocol: 'fixture',
  4078. fn: function (){
  4079. var self=this;
  4080. var $1;
  4081. $1=["a", "b", "c", (1), (2), (1), "a"];
  4082. return $1;
  4083. },
  4084. args: [],
  4085. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4086. messageSends: [],
  4087. referencedClasses: []
  4088. }),
  4089. globals.ArrayTest);
  4090. smalltalk.addMethod(
  4091. smalltalk.method({
  4092. selector: "collectionWithNewValue",
  4093. protocol: 'fixture',
  4094. fn: function (){
  4095. var self=this;
  4096. var $1;
  4097. $1=[(1), (2), (3), (-4), "N"];
  4098. return $1;
  4099. },
  4100. args: [],
  4101. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4102. messageSends: [],
  4103. referencedClasses: []
  4104. }),
  4105. globals.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "sampleNewIndex",
  4109. protocol: 'fixture',
  4110. fn: function (){
  4111. var self=this;
  4112. return (5);
  4113. },
  4114. args: [],
  4115. source: "sampleNewIndex\x0a\x09^ 5",
  4116. messageSends: [],
  4117. referencedClasses: []
  4118. }),
  4119. globals.ArrayTest);
  4120. smalltalk.addMethod(
  4121. smalltalk.method({
  4122. selector: "samplesDo:",
  4123. protocol: 'fixture',
  4124. fn: function (aBlock){
  4125. var self=this;
  4126. return smalltalk.withContext(function($ctx1) {
  4127. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4128. $ctx1.supercall = false;
  4129. _st(aBlock)._value_value_((3),(3));
  4130. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4131. args: ["aBlock"],
  4132. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4133. messageSends: ["samplesDo:", "value:value:"],
  4134. referencedClasses: []
  4135. }),
  4136. globals.ArrayTest);
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "testAdd",
  4140. protocol: 'tests',
  4141. fn: function (){
  4142. var self=this;
  4143. var array;
  4144. return smalltalk.withContext(function($ctx1) {
  4145. array=self._collection();
  4146. _st(array)._add_((6));
  4147. self._assert_equals_(_st(array)._last(),(6));
  4148. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4149. args: [],
  4150. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4151. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4152. referencedClasses: []
  4153. }),
  4154. globals.ArrayTest);
  4155. smalltalk.addMethod(
  4156. smalltalk.method({
  4157. selector: "testAddFirst",
  4158. protocol: 'tests',
  4159. fn: function (){
  4160. var self=this;
  4161. return smalltalk.withContext(function($ctx1) {
  4162. var $1,$2;
  4163. $1=self._collection();
  4164. _st($1)._addFirst_((0));
  4165. $2=_st($1)._yourself();
  4166. self._assert_equals_(_st($2)._first(),(0));
  4167. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4168. args: [],
  4169. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4170. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4171. referencedClasses: []
  4172. }),
  4173. globals.ArrayTest);
  4174. smalltalk.addMethod(
  4175. smalltalk.method({
  4176. selector: "testPrintString",
  4177. protocol: 'tests',
  4178. fn: function (){
  4179. var self=this;
  4180. var array;
  4181. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4182. return smalltalk.withContext(function($ctx1) {
  4183. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4184. array=_st($Array())._new();
  4185. $1=_st(array)._printString();
  4186. $ctx1.sendIdx["printString"]=1;
  4187. self._assert_equals_($1,"an Array ()");
  4188. $ctx1.sendIdx["assert:equals:"]=1;
  4189. $2=array;
  4190. _st($2)._add_((1));
  4191. $ctx1.sendIdx["add:"]=1;
  4192. $3=_st($2)._add_((3));
  4193. $ctx1.sendIdx["add:"]=2;
  4194. $4=_st(array)._printString();
  4195. $ctx1.sendIdx["printString"]=2;
  4196. self._assert_equals_($4,"an Array (1 3)");
  4197. $ctx1.sendIdx["assert:equals:"]=2;
  4198. _st(array)._add_("foo");
  4199. $5=_st(array)._printString();
  4200. $ctx1.sendIdx["printString"]=3;
  4201. self._assert_equals_($5,"an Array (1 3 'foo')");
  4202. $ctx1.sendIdx["assert:equals:"]=3;
  4203. $6=array;
  4204. _st($6)._remove_((1));
  4205. $ctx1.sendIdx["remove:"]=1;
  4206. $7=_st($6)._remove_((3));
  4207. $8=_st(array)._printString();
  4208. $ctx1.sendIdx["printString"]=4;
  4209. self._assert_equals_($8,"an Array ('foo')");
  4210. $ctx1.sendIdx["assert:equals:"]=4;
  4211. _st(array)._addLast_((3));
  4212. $ctx1.sendIdx["addLast:"]=1;
  4213. $9=_st(array)._printString();
  4214. $ctx1.sendIdx["printString"]=5;
  4215. self._assert_equals_($9,"an Array ('foo' 3)");
  4216. $ctx1.sendIdx["assert:equals:"]=5;
  4217. _st(array)._addLast_((3));
  4218. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4219. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4220. args: [],
  4221. 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)'.",
  4222. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4223. referencedClasses: ["Array"]
  4224. }),
  4225. globals.ArrayTest);
  4226. smalltalk.addMethod(
  4227. smalltalk.method({
  4228. selector: "testRemove",
  4229. protocol: 'tests',
  4230. fn: function (){
  4231. var self=this;
  4232. var array;
  4233. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4234. return smalltalk.withContext(function($ctx1) {
  4235. array=[(1), (2), (3), (4), (5)];
  4236. _st(array)._remove_((3));
  4237. $ctx1.sendIdx["remove:"]=1;
  4238. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4239. self._should_raise_((function(){
  4240. return smalltalk.withContext(function($ctx2) {
  4241. return _st(array)._remove_((3));
  4242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4243. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4244. args: [],
  4245. 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",
  4246. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4247. referencedClasses: ["Error"]
  4248. }),
  4249. globals.ArrayTest);
  4250. smalltalk.addMethod(
  4251. smalltalk.method({
  4252. selector: "testRemoveFromTo",
  4253. protocol: 'tests',
  4254. fn: function (){
  4255. var self=this;
  4256. return smalltalk.withContext(function($ctx1) {
  4257. var $1,$2;
  4258. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4259. $ctx1.sendIdx["removeFrom:to:"]=1;
  4260. self._assert_equals_($1,[(4)]);
  4261. $ctx1.sendIdx["assert:equals:"]=1;
  4262. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4263. $ctx1.sendIdx["removeFrom:to:"]=2;
  4264. self._assert_equals_($2,[(1), (4)]);
  4265. $ctx1.sendIdx["assert:equals:"]=2;
  4266. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4267. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4268. args: [],
  4269. 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)",
  4270. messageSends: ["assert:equals:", "removeFrom:to:"],
  4271. referencedClasses: []
  4272. }),
  4273. globals.ArrayTest);
  4274. smalltalk.addMethod(
  4275. smalltalk.method({
  4276. selector: "testRemoveIndex",
  4277. protocol: 'tests',
  4278. fn: function (){
  4279. var self=this;
  4280. return smalltalk.withContext(function($ctx1) {
  4281. var $1,$2;
  4282. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4283. $ctx1.sendIdx["removeIndex:"]=1;
  4284. self._assert_equals_($1,[(1), (3), (4)]);
  4285. $ctx1.sendIdx["assert:equals:"]=1;
  4286. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4287. $ctx1.sendIdx["removeIndex:"]=2;
  4288. self._assert_equals_($2,[(2), (3), (4)]);
  4289. $ctx1.sendIdx["assert:equals:"]=2;
  4290. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4291. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4292. args: [],
  4293. 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: #()",
  4294. messageSends: ["assert:equals:", "removeIndex:"],
  4295. referencedClasses: []
  4296. }),
  4297. globals.ArrayTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "testRemoveLast",
  4301. protocol: 'tests',
  4302. fn: function (){
  4303. var self=this;
  4304. var array;
  4305. return smalltalk.withContext(function($ctx1) {
  4306. array=[(1), (2)];
  4307. _st(array)._removeLast();
  4308. self._assert_equals_(_st(array)._last(),(1));
  4309. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4310. args: [],
  4311. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4312. messageSends: ["removeLast", "assert:equals:", "last"],
  4313. referencedClasses: []
  4314. }),
  4315. globals.ArrayTest);
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "testReversed",
  4319. protocol: 'tests',
  4320. fn: function (){
  4321. var self=this;
  4322. var array;
  4323. return smalltalk.withContext(function($ctx1) {
  4324. array=[(5), (4), (3), (2), (1)];
  4325. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4326. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4327. args: [],
  4328. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4329. messageSends: ["assert:equals:", "reversed"],
  4330. referencedClasses: []
  4331. }),
  4332. globals.ArrayTest);
  4333. smalltalk.addMethod(
  4334. smalltalk.method({
  4335. selector: "testSort",
  4336. protocol: 'tests',
  4337. fn: function (){
  4338. var self=this;
  4339. var array;
  4340. return smalltalk.withContext(function($ctx1) {
  4341. array=[(10), (1), (5)];
  4342. _st(array)._sort();
  4343. self._assert_equals_(array,[(1), (5), (10)]);
  4344. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4345. args: [],
  4346. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4347. messageSends: ["sort", "assert:equals:"],
  4348. referencedClasses: []
  4349. }),
  4350. globals.ArrayTest);
  4351. smalltalk.addMethod(
  4352. smalltalk.method({
  4353. selector: "collectionClass",
  4354. protocol: 'fixture',
  4355. fn: function (){
  4356. var self=this;
  4357. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4358. return $Array();
  4359. },
  4360. args: [],
  4361. source: "collectionClass\x0a\x09^ Array",
  4362. messageSends: [],
  4363. referencedClasses: ["Array"]
  4364. }),
  4365. globals.ArrayTest.klass);
  4366. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4367. smalltalk.addMethod(
  4368. smalltalk.method({
  4369. selector: "collection",
  4370. protocol: 'fixture',
  4371. fn: function (){
  4372. var self=this;
  4373. return "helLo";
  4374. },
  4375. args: [],
  4376. source: "collection\x0a\x09^ 'helLo'",
  4377. messageSends: [],
  4378. referencedClasses: []
  4379. }),
  4380. globals.StringTest);
  4381. smalltalk.addMethod(
  4382. smalltalk.method({
  4383. selector: "collectionFirst",
  4384. protocol: 'fixture',
  4385. fn: function (){
  4386. var self=this;
  4387. return "h";
  4388. },
  4389. args: [],
  4390. source: "collectionFirst\x0a\x09^ 'h'",
  4391. messageSends: [],
  4392. referencedClasses: []
  4393. }),
  4394. globals.StringTest);
  4395. smalltalk.addMethod(
  4396. smalltalk.method({
  4397. selector: "collectionFirstTwo",
  4398. protocol: 'fixture',
  4399. fn: function (){
  4400. var self=this;
  4401. return "he";
  4402. },
  4403. args: [],
  4404. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4405. messageSends: [],
  4406. referencedClasses: []
  4407. }),
  4408. globals.StringTest);
  4409. smalltalk.addMethod(
  4410. smalltalk.method({
  4411. selector: "collectionLast",
  4412. protocol: 'fixture',
  4413. fn: function (){
  4414. var self=this;
  4415. return "o";
  4416. },
  4417. args: [],
  4418. source: "collectionLast\x0a\x09^ 'o'",
  4419. messageSends: [],
  4420. referencedClasses: []
  4421. }),
  4422. globals.StringTest);
  4423. smalltalk.addMethod(
  4424. smalltalk.method({
  4425. selector: "collectionLastTwo",
  4426. protocol: 'fixture',
  4427. fn: function (){
  4428. var self=this;
  4429. return "Lo";
  4430. },
  4431. args: [],
  4432. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4433. messageSends: [],
  4434. referencedClasses: []
  4435. }),
  4436. globals.StringTest);
  4437. smalltalk.addMethod(
  4438. smalltalk.method({
  4439. selector: "collectionOfPrintStrings",
  4440. protocol: 'fixture',
  4441. fn: function (){
  4442. var self=this;
  4443. return "'h''e''l''L''o'";
  4444. },
  4445. args: [],
  4446. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4447. messageSends: [],
  4448. referencedClasses: []
  4449. }),
  4450. globals.StringTest);
  4451. smalltalk.addMethod(
  4452. smalltalk.method({
  4453. selector: "collectionSize",
  4454. protocol: 'fixture',
  4455. fn: function (){
  4456. var self=this;
  4457. return (5);
  4458. },
  4459. args: [],
  4460. source: "collectionSize\x0a\x09^ 5",
  4461. messageSends: [],
  4462. referencedClasses: []
  4463. }),
  4464. globals.StringTest);
  4465. smalltalk.addMethod(
  4466. smalltalk.method({
  4467. selector: "collectionWithDuplicates",
  4468. protocol: 'fixture',
  4469. fn: function (){
  4470. var self=this;
  4471. return "abbaerte";
  4472. },
  4473. args: [],
  4474. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4475. messageSends: [],
  4476. referencedClasses: []
  4477. }),
  4478. globals.StringTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "collectionWithNewValue",
  4482. protocol: 'fixture',
  4483. fn: function (){
  4484. var self=this;
  4485. return "helLoN";
  4486. },
  4487. args: [],
  4488. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4489. messageSends: [],
  4490. referencedClasses: []
  4491. }),
  4492. globals.StringTest);
  4493. smalltalk.addMethod(
  4494. smalltalk.method({
  4495. selector: "sampleNewValueAsCollection",
  4496. protocol: 'fixture',
  4497. fn: function (){
  4498. var self=this;
  4499. return "N";
  4500. },
  4501. args: [],
  4502. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4503. messageSends: [],
  4504. referencedClasses: []
  4505. }),
  4506. globals.StringTest);
  4507. smalltalk.addMethod(
  4508. smalltalk.method({
  4509. selector: "samplesDo:",
  4510. protocol: 'fixture',
  4511. fn: function (aBlock){
  4512. var self=this;
  4513. return smalltalk.withContext(function($ctx1) {
  4514. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4515. $ctx1.supercall = false;
  4516. _st(aBlock)._value_value_((3),"l");
  4517. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4518. args: ["aBlock"],
  4519. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4520. messageSends: ["samplesDo:", "value:value:"],
  4521. referencedClasses: []
  4522. }),
  4523. globals.StringTest);
  4524. smalltalk.addMethod(
  4525. smalltalk.method({
  4526. selector: "testAddAll",
  4527. protocol: 'tests',
  4528. fn: function (){
  4529. var self=this;
  4530. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4531. return smalltalk.withContext(function($ctx1) {
  4532. var $1;
  4533. self._should_raise_((function(){
  4534. return smalltalk.withContext(function($ctx2) {
  4535. $1=self._collection();
  4536. $ctx2.sendIdx["collection"]=1;
  4537. return _st($1)._addAll_(self._collection());
  4538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4539. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4540. args: [],
  4541. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4542. messageSends: ["should:raise:", "addAll:", "collection"],
  4543. referencedClasses: ["Error"]
  4544. }),
  4545. globals.StringTest);
  4546. smalltalk.addMethod(
  4547. smalltalk.method({
  4548. selector: "testAddRemove",
  4549. protocol: 'tests',
  4550. fn: function (){
  4551. var self=this;
  4552. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4553. return smalltalk.withContext(function($ctx1) {
  4554. self._should_raise_((function(){
  4555. return smalltalk.withContext(function($ctx2) {
  4556. return "hello"._add_("a");
  4557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4558. $ctx1.sendIdx["should:raise:"]=1;
  4559. self._should_raise_((function(){
  4560. return smalltalk.withContext(function($ctx2) {
  4561. return "hello"._remove_("h");
  4562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4563. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4564. args: [],
  4565. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4566. messageSends: ["should:raise:", "add:", "remove:"],
  4567. referencedClasses: ["Error"]
  4568. }),
  4569. globals.StringTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testAsArray",
  4573. protocol: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. return smalltalk.withContext(function($ctx1) {
  4577. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4578. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4579. args: [],
  4580. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4581. messageSends: ["assert:equals:", "asArray"],
  4582. referencedClasses: []
  4583. }),
  4584. globals.StringTest);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "testAsLowerCase",
  4588. protocol: 'tests',
  4589. fn: function (){
  4590. var self=this;
  4591. return smalltalk.withContext(function($ctx1) {
  4592. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4593. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4594. args: [],
  4595. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4596. messageSends: ["assert:equals:", "asLowercase"],
  4597. referencedClasses: []
  4598. }),
  4599. globals.StringTest);
  4600. smalltalk.addMethod(
  4601. smalltalk.method({
  4602. selector: "testAsNumber",
  4603. protocol: 'tests',
  4604. fn: function (){
  4605. var self=this;
  4606. return smalltalk.withContext(function($ctx1) {
  4607. var $1,$2;
  4608. $1="3"._asNumber();
  4609. $ctx1.sendIdx["asNumber"]=1;
  4610. self._assert_equals_($1,(3));
  4611. $ctx1.sendIdx["assert:equals:"]=1;
  4612. $2="-3"._asNumber();
  4613. $ctx1.sendIdx["asNumber"]=2;
  4614. self._assert_equals_($2,(-3));
  4615. $ctx1.sendIdx["assert:equals:"]=2;
  4616. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4617. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4618. args: [],
  4619. 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.",
  4620. messageSends: ["assert:equals:", "asNumber"],
  4621. referencedClasses: []
  4622. }),
  4623. globals.StringTest);
  4624. smalltalk.addMethod(
  4625. smalltalk.method({
  4626. selector: "testAsUpperCase",
  4627. protocol: 'tests',
  4628. fn: function (){
  4629. var self=this;
  4630. return smalltalk.withContext(function($ctx1) {
  4631. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4632. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4633. args: [],
  4634. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4635. messageSends: ["assert:equals:", "asUppercase"],
  4636. referencedClasses: []
  4637. }),
  4638. globals.StringTest);
  4639. smalltalk.addMethod(
  4640. smalltalk.method({
  4641. selector: "testAsciiValue",
  4642. protocol: 'tests',
  4643. fn: function (){
  4644. var self=this;
  4645. var characterA,characterU;
  4646. return smalltalk.withContext(function($ctx1) {
  4647. var $1;
  4648. characterA="A";
  4649. characterU="U";
  4650. $1=_st(characterA)._asciiValue();
  4651. $ctx1.sendIdx["asciiValue"]=1;
  4652. self._assert_equals_($1,(65));
  4653. $ctx1.sendIdx["assert:equals:"]=1;
  4654. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4655. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4656. args: [],
  4657. 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",
  4658. messageSends: ["assert:equals:", "asciiValue"],
  4659. referencedClasses: []
  4660. }),
  4661. globals.StringTest);
  4662. smalltalk.addMethod(
  4663. smalltalk.method({
  4664. selector: "testAtIfAbsentPut",
  4665. protocol: 'tests',
  4666. fn: function (){
  4667. var self=this;
  4668. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4669. return smalltalk.withContext(function($ctx1) {
  4670. self._should_raise_((function(){
  4671. return smalltalk.withContext(function($ctx2) {
  4672. return "hello"._at_ifAbsentPut_((6),(function(){
  4673. return "a";
  4674. }));
  4675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4676. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4677. args: [],
  4678. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4679. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4680. referencedClasses: ["Error"]
  4681. }),
  4682. globals.StringTest);
  4683. smalltalk.addMethod(
  4684. smalltalk.method({
  4685. selector: "testAtPut",
  4686. protocol: 'tests',
  4687. fn: function (){
  4688. var self=this;
  4689. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4690. return smalltalk.withContext(function($ctx1) {
  4691. self._should_raise_((function(){
  4692. return smalltalk.withContext(function($ctx2) {
  4693. return "hello"._at_put_((1),"a");
  4694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4695. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4696. args: [],
  4697. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4698. messageSends: ["should:raise:", "at:put:"],
  4699. referencedClasses: ["Error"]
  4700. }),
  4701. globals.StringTest);
  4702. smalltalk.addMethod(
  4703. smalltalk.method({
  4704. selector: "testCapitalized",
  4705. protocol: 'tests',
  4706. fn: function (){
  4707. var self=this;
  4708. return smalltalk.withContext(function($ctx1) {
  4709. var $1,$2,$3;
  4710. $1="test"._capitalized();
  4711. $ctx1.sendIdx["capitalized"]=1;
  4712. self._assert_equals_($1,"Test");
  4713. $ctx1.sendIdx["assert:equals:"]=1;
  4714. $2="Test"._capitalized();
  4715. $ctx1.sendIdx["capitalized"]=2;
  4716. self._assert_equals_($2,"Test");
  4717. $ctx1.sendIdx["assert:equals:"]=2;
  4718. self._assert_equals_(""._capitalized(),"");
  4719. $ctx1.sendIdx["assert:equals:"]=3;
  4720. $3="Test"._isCapitalized();
  4721. $ctx1.sendIdx["isCapitalized"]=1;
  4722. self._assert_equals_($3,true);
  4723. $ctx1.sendIdx["assert:equals:"]=4;
  4724. self._assert_equals_("test"._isCapitalized(),false);
  4725. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4726. args: [],
  4727. 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.",
  4728. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4729. referencedClasses: []
  4730. }),
  4731. globals.StringTest);
  4732. smalltalk.addMethod(
  4733. smalltalk.method({
  4734. selector: "testCharCodeAt",
  4735. protocol: 'tests',
  4736. fn: function (){
  4737. var self=this;
  4738. return smalltalk.withContext(function($ctx1) {
  4739. var $1,$2,$3,$4,$5;
  4740. $1="jackie"._charCodeAt_((1));
  4741. $ctx1.sendIdx["charCodeAt:"]=1;
  4742. self._assert_equals_($1,(106));
  4743. $ctx1.sendIdx["assert:equals:"]=1;
  4744. $2="jackie"._charCodeAt_((2));
  4745. $ctx1.sendIdx["charCodeAt:"]=2;
  4746. self._assert_equals_($2,(97));
  4747. $ctx1.sendIdx["assert:equals:"]=2;
  4748. $3="jackie"._charCodeAt_((3));
  4749. $ctx1.sendIdx["charCodeAt:"]=3;
  4750. self._assert_equals_($3,(99));
  4751. $ctx1.sendIdx["assert:equals:"]=3;
  4752. $4="jackie"._charCodeAt_((4));
  4753. $ctx1.sendIdx["charCodeAt:"]=4;
  4754. self._assert_equals_($4,(107));
  4755. $ctx1.sendIdx["assert:equals:"]=4;
  4756. $5="jackie"._charCodeAt_((5));
  4757. $ctx1.sendIdx["charCodeAt:"]=5;
  4758. self._assert_equals_($5,(105));
  4759. $ctx1.sendIdx["assert:equals:"]=5;
  4760. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4761. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4762. args: [],
  4763. 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",
  4764. messageSends: ["assert:equals:", "charCodeAt:"],
  4765. referencedClasses: []
  4766. }),
  4767. globals.StringTest);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "testCopyFromTo",
  4771. protocol: 'tests',
  4772. fn: function (){
  4773. var self=this;
  4774. return smalltalk.withContext(function($ctx1) {
  4775. var $1;
  4776. $1="jackie"._copyFrom_to_((1),(3));
  4777. $ctx1.sendIdx["copyFrom:to:"]=1;
  4778. self._assert_equals_($1,"jac");
  4779. $ctx1.sendIdx["assert:equals:"]=1;
  4780. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4781. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4782. args: [],
  4783. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4784. messageSends: ["assert:equals:", "copyFrom:to:"],
  4785. referencedClasses: []
  4786. }),
  4787. globals.StringTest);
  4788. smalltalk.addMethod(
  4789. smalltalk.method({
  4790. selector: "testCopyWithoutAll",
  4791. protocol: 'tests',
  4792. fn: function (){
  4793. var self=this;
  4794. return smalltalk.withContext(function($ctx1) {
  4795. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4796. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4797. args: [],
  4798. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4799. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4800. referencedClasses: []
  4801. }),
  4802. globals.StringTest);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "testEquality",
  4806. protocol: 'tests',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. var $1,$2,$3;
  4811. self._assert_equals_("hello","hello");
  4812. $ctx1.sendIdx["assert:equals:"]=1;
  4813. $1="hello".__eq("world");
  4814. $ctx1.sendIdx["="]=1;
  4815. self._deny_($1);
  4816. $ctx1.sendIdx["deny:"]=1;
  4817. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4818. })));
  4819. $ctx1.sendIdx["="]=2;
  4820. self._deny_($2);
  4821. $ctx1.sendIdx["deny:"]=2;
  4822. $3="hello"._yourself();
  4823. $ctx1.sendIdx["yourself"]=1;
  4824. self._assert_equals_("hello",$3);
  4825. $ctx1.sendIdx["assert:equals:"]=2;
  4826. self._assert_equals_("hello"._yourself(),"hello");
  4827. self._deny_("".__eq((0)));
  4828. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4829. args: [],
  4830. 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",
  4831. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4832. referencedClasses: []
  4833. }),
  4834. globals.StringTest);
  4835. smalltalk.addMethod(
  4836. smalltalk.method({
  4837. selector: "testIdentity",
  4838. protocol: 'tests',
  4839. fn: function (){
  4840. var self=this;
  4841. return smalltalk.withContext(function($ctx1) {
  4842. var $1,$2,$4,$3,$5;
  4843. $1="hello".__eq_eq("hello");
  4844. $ctx1.sendIdx["=="]=1;
  4845. self._assert_($1);
  4846. $ctx1.sendIdx["assert:"]=1;
  4847. $2="hello".__eq_eq("world");
  4848. $ctx1.sendIdx["=="]=2;
  4849. self._deny_($2);
  4850. $ctx1.sendIdx["deny:"]=1;
  4851. $4="hello"._yourself();
  4852. $ctx1.sendIdx["yourself"]=1;
  4853. $3="hello".__eq_eq($4);
  4854. $ctx1.sendIdx["=="]=3;
  4855. self._assert_($3);
  4856. $ctx1.sendIdx["assert:"]=2;
  4857. $5=_st("hello"._yourself()).__eq_eq("hello");
  4858. $ctx1.sendIdx["=="]=4;
  4859. self._assert_($5);
  4860. self._deny_("".__eq_eq((0)));
  4861. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4862. args: [],
  4863. 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",
  4864. messageSends: ["assert:", "==", "deny:", "yourself"],
  4865. referencedClasses: []
  4866. }),
  4867. globals.StringTest);
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "testIdentityHash",
  4871. protocol: 'tests',
  4872. fn: function (){
  4873. var self=this;
  4874. return smalltalk.withContext(function($ctx1) {
  4875. var $1,$2,$4,$3;
  4876. $1="foo"._identityHash();
  4877. $ctx1.sendIdx["identityHash"]=1;
  4878. $2="foo"._identityHash();
  4879. $ctx1.sendIdx["identityHash"]=2;
  4880. self._assert_equals_($1,$2);
  4881. $4="foo"._identityHash();
  4882. $ctx1.sendIdx["identityHash"]=3;
  4883. $3=_st($4).__eq("bar"._identityHash());
  4884. self._deny_($3);
  4885. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4886. args: [],
  4887. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4888. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4889. referencedClasses: []
  4890. }),
  4891. globals.StringTest);
  4892. smalltalk.addMethod(
  4893. smalltalk.method({
  4894. selector: "testIncludesSubString",
  4895. protocol: 'tests',
  4896. fn: function (){
  4897. var self=this;
  4898. return smalltalk.withContext(function($ctx1) {
  4899. var $1;
  4900. $1="amber"._includesSubString_("ber");
  4901. $ctx1.sendIdx["includesSubString:"]=1;
  4902. self._assert_($1);
  4903. self._deny_("amber"._includesSubString_("zork"));
  4904. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4905. args: [],
  4906. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4907. messageSends: ["assert:", "includesSubString:", "deny:"],
  4908. referencedClasses: []
  4909. }),
  4910. globals.StringTest);
  4911. smalltalk.addMethod(
  4912. smalltalk.method({
  4913. selector: "testIndexOfStartingAtWithNull",
  4914. protocol: 'tests',
  4915. fn: function (){
  4916. var self=this;
  4917. return self},
  4918. args: [],
  4919. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4920. messageSends: [],
  4921. referencedClasses: []
  4922. }),
  4923. globals.StringTest);
  4924. smalltalk.addMethod(
  4925. smalltalk.method({
  4926. selector: "testIndexOfWithNull",
  4927. protocol: 'tests',
  4928. fn: function (){
  4929. var self=this;
  4930. return self},
  4931. args: [],
  4932. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4933. messageSends: [],
  4934. referencedClasses: []
  4935. }),
  4936. globals.StringTest);
  4937. smalltalk.addMethod(
  4938. smalltalk.method({
  4939. selector: "testIsVowel",
  4940. protocol: 'tests',
  4941. fn: function (){
  4942. var self=this;
  4943. var vowel,consonant;
  4944. return smalltalk.withContext(function($ctx1) {
  4945. var $1;
  4946. vowel="u";
  4947. consonant="z";
  4948. $1=_st(vowel)._isVowel();
  4949. $ctx1.sendIdx["isVowel"]=1;
  4950. self._assert_equals_($1,true);
  4951. $ctx1.sendIdx["assert:equals:"]=1;
  4952. self._assert_equals_(_st(consonant)._isVowel(),false);
  4953. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4954. args: [],
  4955. 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",
  4956. messageSends: ["assert:equals:", "isVowel"],
  4957. referencedClasses: []
  4958. }),
  4959. globals.StringTest);
  4960. smalltalk.addMethod(
  4961. smalltalk.method({
  4962. selector: "testJoin",
  4963. protocol: 'tests',
  4964. fn: function (){
  4965. var self=this;
  4966. return smalltalk.withContext(function($ctx1) {
  4967. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4968. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4969. args: [],
  4970. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4971. messageSends: ["assert:equals:", "join:"],
  4972. referencedClasses: []
  4973. }),
  4974. globals.StringTest);
  4975. smalltalk.addMethod(
  4976. smalltalk.method({
  4977. selector: "testRemoveAll",
  4978. protocol: 'tests',
  4979. fn: function (){
  4980. var self=this;
  4981. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4982. return smalltalk.withContext(function($ctx1) {
  4983. self._should_raise_((function(){
  4984. return smalltalk.withContext(function($ctx2) {
  4985. return _st(self._collection())._removeAll();
  4986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4987. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4988. args: [],
  4989. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4990. messageSends: ["should:raise:", "removeAll", "collection"],
  4991. referencedClasses: ["Error"]
  4992. }),
  4993. globals.StringTest);
  4994. smalltalk.addMethod(
  4995. smalltalk.method({
  4996. selector: "testReversed",
  4997. protocol: 'tests',
  4998. fn: function (){
  4999. var self=this;
  5000. return smalltalk.withContext(function($ctx1) {
  5001. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5002. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  5003. args: [],
  5004. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5005. messageSends: ["assert:equals:", "reversed"],
  5006. referencedClasses: []
  5007. }),
  5008. globals.StringTest);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "testStreamContents",
  5012. protocol: 'tests',
  5013. fn: function (){
  5014. var self=this;
  5015. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5016. return smalltalk.withContext(function($ctx1) {
  5017. var $1;
  5018. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5019. return smalltalk.withContext(function($ctx2) {
  5020. _st(aStream)._nextPutAll_("hello");
  5021. $ctx2.sendIdx["nextPutAll:"]=1;
  5022. _st(aStream)._space();
  5023. $1=_st(aStream)._nextPutAll_("world");
  5024. return $1;
  5025. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5026. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  5027. args: [],
  5028. 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'",
  5029. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5030. referencedClasses: ["String"]
  5031. }),
  5032. globals.StringTest);
  5033. smalltalk.addMethod(
  5034. smalltalk.method({
  5035. selector: "testSubStrings",
  5036. protocol: 'tests',
  5037. fn: function (){
  5038. var self=this;
  5039. return smalltalk.withContext(function($ctx1) {
  5040. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5041. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  5042. args: [],
  5043. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5044. messageSends: ["assert:equals:", "subStrings:"],
  5045. referencedClasses: []
  5046. }),
  5047. globals.StringTest);
  5048. smalltalk.addMethod(
  5049. smalltalk.method({
  5050. selector: "testTrim",
  5051. protocol: 'tests',
  5052. fn: function (){
  5053. var self=this;
  5054. return smalltalk.withContext(function($ctx1) {
  5055. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5056. $ctx1.sendIdx["assert:equals:"]=1;
  5057. self._assert_equals_("jackie "._trimRight(),"jackie");
  5058. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5059. args: [],
  5060. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5061. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5062. referencedClasses: []
  5063. }),
  5064. globals.StringTest);
  5065. smalltalk.addMethod(
  5066. smalltalk.method({
  5067. selector: "testValue",
  5068. protocol: 'tests',
  5069. fn: function (){
  5070. var self=this;
  5071. return smalltalk.withContext(function($ctx1) {
  5072. self._assert_equals_("asString"._value_((1)),"1");
  5073. $ctx1.sendIdx["assert:equals:"]=1;
  5074. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5075. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  5076. args: [],
  5077. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  5078. messageSends: ["assert:equals:", "value:", "collect:"],
  5079. referencedClasses: []
  5080. }),
  5081. globals.StringTest);
  5082. smalltalk.addMethod(
  5083. smalltalk.method({
  5084. selector: "collectionClass",
  5085. protocol: 'fixture',
  5086. fn: function (){
  5087. var self=this;
  5088. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5089. return $String();
  5090. },
  5091. args: [],
  5092. source: "collectionClass\x0a\x09^ String",
  5093. messageSends: [],
  5094. referencedClasses: ["String"]
  5095. }),
  5096. globals.StringTest.klass);
  5097. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5098. smalltalk.addMethod(
  5099. smalltalk.method({
  5100. selector: "collection",
  5101. protocol: 'fixture',
  5102. fn: function (){
  5103. var self=this;
  5104. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5105. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5106. return smalltalk.withContext(function($ctx1) {
  5107. var $2,$3,$1;
  5108. $2=_st($Set())._new();
  5109. _st($2)._add_($Smalltalk());
  5110. $ctx1.sendIdx["add:"]=1;
  5111. _st($2)._add_(nil);
  5112. $ctx1.sendIdx["add:"]=2;
  5113. _st($2)._add_((3).__at((3)));
  5114. $ctx1.sendIdx["add:"]=3;
  5115. _st($2)._add_(false);
  5116. $3=_st($2)._yourself();
  5117. $1=$3;
  5118. return $1;
  5119. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5120. args: [],
  5121. 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",
  5122. messageSends: ["add:", "new", "@", "yourself"],
  5123. referencedClasses: ["Set", "Smalltalk"]
  5124. }),
  5125. globals.SetTest);
  5126. smalltalk.addMethod(
  5127. smalltalk.method({
  5128. selector: "collectionOfPrintStrings",
  5129. protocol: 'fixture',
  5130. fn: function (){
  5131. var self=this;
  5132. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5133. return smalltalk.withContext(function($ctx1) {
  5134. var $2,$3,$1;
  5135. $2=_st($Set())._new();
  5136. _st($2)._add_("a SmalltalkImage");
  5137. $ctx1.sendIdx["add:"]=1;
  5138. _st($2)._add_("nil");
  5139. $ctx1.sendIdx["add:"]=2;
  5140. _st($2)._add_("3@3");
  5141. $ctx1.sendIdx["add:"]=3;
  5142. _st($2)._add_("false");
  5143. $3=_st($2)._yourself();
  5144. $1=$3;
  5145. return $1;
  5146. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5147. args: [],
  5148. 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",
  5149. messageSends: ["add:", "new", "yourself"],
  5150. referencedClasses: ["Set"]
  5151. }),
  5152. globals.SetTest);
  5153. smalltalk.addMethod(
  5154. smalltalk.method({
  5155. selector: "collectionSize",
  5156. protocol: 'fixture',
  5157. fn: function (){
  5158. var self=this;
  5159. return (4);
  5160. },
  5161. args: [],
  5162. source: "collectionSize\x0a\x09^ 4",
  5163. messageSends: [],
  5164. referencedClasses: []
  5165. }),
  5166. globals.SetTest);
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "collectionWithDuplicates",
  5170. protocol: 'fixture',
  5171. fn: function (){
  5172. var self=this;
  5173. return smalltalk.withContext(function($ctx1) {
  5174. var $2,$3,$1;
  5175. $2=self._collection();
  5176. _st($2)._add_((0));
  5177. $3=_st($2)._yourself();
  5178. $1=$3;
  5179. return $1;
  5180. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5181. args: [],
  5182. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5183. messageSends: ["add:", "collection", "yourself"],
  5184. referencedClasses: []
  5185. }),
  5186. globals.SetTest);
  5187. smalltalk.addMethod(
  5188. smalltalk.method({
  5189. selector: "collectionWithNewValue",
  5190. protocol: 'fixture',
  5191. fn: function (){
  5192. var self=this;
  5193. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5194. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5195. return smalltalk.withContext(function($ctx1) {
  5196. var $2,$3,$1;
  5197. $2=_st($Set())._new();
  5198. _st($2)._add_($Smalltalk());
  5199. $ctx1.sendIdx["add:"]=1;
  5200. _st($2)._add_(nil);
  5201. $ctx1.sendIdx["add:"]=2;
  5202. _st($2)._add_((3).__at((3)));
  5203. $ctx1.sendIdx["add:"]=3;
  5204. _st($2)._add_("N");
  5205. $ctx1.sendIdx["add:"]=4;
  5206. _st($2)._add_(false);
  5207. $3=_st($2)._yourself();
  5208. $1=$3;
  5209. return $1;
  5210. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5211. args: [],
  5212. 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",
  5213. messageSends: ["add:", "new", "@", "yourself"],
  5214. referencedClasses: ["Set", "Smalltalk"]
  5215. }),
  5216. globals.SetTest);
  5217. smalltalk.addMethod(
  5218. smalltalk.method({
  5219. selector: "testAddAll",
  5220. protocol: 'tests',
  5221. fn: function (){
  5222. var self=this;
  5223. return smalltalk.withContext(function($ctx1) {
  5224. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5225. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5226. $ctx1.supercall = false;
  5227. $2=self._collection();
  5228. $ctx1.sendIdx["collection"]=1;
  5229. $3=$2;
  5230. $4=self._collection();
  5231. $ctx1.sendIdx["collection"]=2;
  5232. _st($3)._addAll_($4);
  5233. $ctx1.sendIdx["addAll:"]=1;
  5234. $5=_st($2)._yourself();
  5235. $ctx1.sendIdx["yourself"]=1;
  5236. $1=$5;
  5237. $6=self._collection();
  5238. $ctx1.sendIdx["collection"]=3;
  5239. self._assert_equals_($1,$6);
  5240. $ctx1.sendIdx["assert:equals:"]=1;
  5241. $8=self._collection();
  5242. $ctx1.sendIdx["collection"]=4;
  5243. $9=$8;
  5244. $10=self._collectionWithNewValue();
  5245. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5246. _st($9)._addAll_($10);
  5247. $ctx1.sendIdx["addAll:"]=2;
  5248. $11=_st($8)._yourself();
  5249. $ctx1.sendIdx["yourself"]=2;
  5250. $7=$11;
  5251. $12=self._collectionWithNewValue();
  5252. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5253. self._assert_equals_($7,$12);
  5254. $ctx1.sendIdx["assert:equals:"]=2;
  5255. $14=self._collectionWithNewValue();
  5256. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5257. _st($14)._addAll_(self._collection());
  5258. $15=_st($14)._yourself();
  5259. $13=$15;
  5260. self._assert_equals_($13,self._collectionWithNewValue());
  5261. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5262. args: [],
  5263. 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",
  5264. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5265. referencedClasses: []
  5266. }),
  5267. globals.SetTest);
  5268. smalltalk.addMethod(
  5269. smalltalk.method({
  5270. selector: "testAddRemove",
  5271. protocol: 'tests',
  5272. fn: function (){
  5273. var self=this;
  5274. var set;
  5275. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5276. return smalltalk.withContext(function($ctx1) {
  5277. var $1,$2;
  5278. set=_st($Set())._new();
  5279. self._assert_(_st(set)._isEmpty());
  5280. $ctx1.sendIdx["assert:"]=1;
  5281. _st(set)._add_((3));
  5282. $ctx1.sendIdx["add:"]=1;
  5283. $1=_st(set)._includes_((3));
  5284. $ctx1.sendIdx["includes:"]=1;
  5285. self._assert_($1);
  5286. $ctx1.sendIdx["assert:"]=2;
  5287. _st(set)._add_((5));
  5288. $2=_st(set)._includes_((5));
  5289. $ctx1.sendIdx["includes:"]=2;
  5290. self._assert_($2);
  5291. _st(set)._remove_((3));
  5292. self._deny_(_st(set)._includes_((3)));
  5293. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5294. args: [],
  5295. 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)",
  5296. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5297. referencedClasses: ["Set"]
  5298. }),
  5299. globals.SetTest);
  5300. smalltalk.addMethod(
  5301. smalltalk.method({
  5302. selector: "testAt",
  5303. protocol: 'tests',
  5304. fn: function (){
  5305. var self=this;
  5306. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5307. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5308. return smalltalk.withContext(function($ctx1) {
  5309. self._should_raise_((function(){
  5310. return smalltalk.withContext(function($ctx2) {
  5311. return _st(_st($Set())._new())._at_put_((1),(2));
  5312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5313. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5314. args: [],
  5315. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5316. messageSends: ["should:raise:", "at:put:", "new"],
  5317. referencedClasses: ["Set", "Error"]
  5318. }),
  5319. globals.SetTest);
  5320. smalltalk.addMethod(
  5321. smalltalk.method({
  5322. selector: "testCollect",
  5323. protocol: 'tests',
  5324. fn: function (){
  5325. var self=this;
  5326. return smalltalk.withContext(function($ctx1) {
  5327. var $2,$1;
  5328. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5329. $ctx1.supercall = false;
  5330. $2=[(5), (6), (8)]._asSet();
  5331. $ctx1.sendIdx["asSet"]=1;
  5332. $1=_st($2)._collect_((function(x){
  5333. return smalltalk.withContext(function($ctx2) {
  5334. return _st(x).__backslash_backslash((3));
  5335. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5336. self._assert_equals_($1,[(0), (2)]._asSet());
  5337. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5338. args: [],
  5339. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5340. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5341. referencedClasses: []
  5342. }),
  5343. globals.SetTest);
  5344. smalltalk.addMethod(
  5345. smalltalk.method({
  5346. selector: "testComma",
  5347. protocol: 'tests',
  5348. fn: function (){
  5349. var self=this;
  5350. return smalltalk.withContext(function($ctx1) {
  5351. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5352. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5353. $ctx1.supercall = false;
  5354. $2=self._collection();
  5355. $ctx1.sendIdx["collection"]=1;
  5356. $3=self._collection();
  5357. $ctx1.sendIdx["collection"]=2;
  5358. $1=_st($2).__comma($3);
  5359. $ctx1.sendIdx[","]=1;
  5360. $4=self._collection();
  5361. $ctx1.sendIdx["collection"]=3;
  5362. self._assert_equals_($1,$4);
  5363. $ctx1.sendIdx["assert:equals:"]=1;
  5364. $6=self._collection();
  5365. $ctx1.sendIdx["collection"]=4;
  5366. $7=self._collectionWithNewValue();
  5367. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5368. $5=_st($6).__comma($7);
  5369. $ctx1.sendIdx[","]=2;
  5370. $8=self._collectionWithNewValue();
  5371. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5372. self._assert_equals_($5,$8);
  5373. $ctx1.sendIdx["assert:equals:"]=2;
  5374. $10=self._collectionWithNewValue();
  5375. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5376. $9=_st($10).__comma(self._collection());
  5377. self._assert_equals_($9,self._collectionWithNewValue());
  5378. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5379. args: [],
  5380. 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",
  5381. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5382. referencedClasses: []
  5383. }),
  5384. globals.SetTest);
  5385. smalltalk.addMethod(
  5386. smalltalk.method({
  5387. selector: "testComparing",
  5388. protocol: 'tests',
  5389. fn: function (){
  5390. var self=this;
  5391. return smalltalk.withContext(function($ctx1) {
  5392. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5393. $1=[(0), (2)]._asSet();
  5394. $ctx1.sendIdx["asSet"]=1;
  5395. $2=[(0), (2)]._asSet();
  5396. $ctx1.sendIdx["asSet"]=2;
  5397. self._assert_equals_($1,$2);
  5398. $ctx1.sendIdx["assert:equals:"]=1;
  5399. $3=[(2), (0)]._asSet();
  5400. $ctx1.sendIdx["asSet"]=3;
  5401. $4=[(0), (2)]._asSet();
  5402. $ctx1.sendIdx["asSet"]=4;
  5403. self._assert_equals_($3,$4);
  5404. $6=[(0), (2), (3)]._asSet();
  5405. $ctx1.sendIdx["asSet"]=5;
  5406. $7=[(0), (2)]._asSet();
  5407. $ctx1.sendIdx["asSet"]=6;
  5408. $5=_st($6).__eq($7);
  5409. $ctx1.sendIdx["="]=1;
  5410. self._deny_($5);
  5411. $ctx1.sendIdx["deny:"]=1;
  5412. $9=[(1), (2)]._asSet();
  5413. $ctx1.sendIdx["asSet"]=7;
  5414. $8=_st($9).__eq([(0), (2)]._asSet());
  5415. self._deny_($8);
  5416. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5417. args: [],
  5418. 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",
  5419. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5420. referencedClasses: []
  5421. }),
  5422. globals.SetTest);
  5423. smalltalk.addMethod(
  5424. smalltalk.method({
  5425. selector: "testPrintString",
  5426. protocol: 'tests',
  5427. fn: function (){
  5428. var self=this;
  5429. var set;
  5430. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5431. return smalltalk.withContext(function($ctx1) {
  5432. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5433. set=_st($Set())._new();
  5434. $1=_st(set)._printString();
  5435. $ctx1.sendIdx["printString"]=1;
  5436. self._assert_equals_($1,"a Set ()");
  5437. $ctx1.sendIdx["assert:equals:"]=1;
  5438. $2=set;
  5439. _st($2)._add_((1));
  5440. $ctx1.sendIdx["add:"]=1;
  5441. $3=_st($2)._add_((3));
  5442. $ctx1.sendIdx["add:"]=2;
  5443. $4=_st(set)._printString();
  5444. $ctx1.sendIdx["printString"]=2;
  5445. self._assert_equals_($4,"a Set (1 3)");
  5446. $ctx1.sendIdx["assert:equals:"]=2;
  5447. _st(set)._add_("foo");
  5448. $ctx1.sendIdx["add:"]=3;
  5449. $5=_st(set)._printString();
  5450. $ctx1.sendIdx["printString"]=3;
  5451. self._assert_equals_($5,"a Set (1 3 'foo')");
  5452. $ctx1.sendIdx["assert:equals:"]=3;
  5453. $6=set;
  5454. _st($6)._remove_((1));
  5455. $ctx1.sendIdx["remove:"]=1;
  5456. $7=_st($6)._remove_((3));
  5457. $8=_st(set)._printString();
  5458. $ctx1.sendIdx["printString"]=4;
  5459. self._assert_equals_($8,"a Set ('foo')");
  5460. $ctx1.sendIdx["assert:equals:"]=4;
  5461. _st(set)._add_((3));
  5462. $ctx1.sendIdx["add:"]=4;
  5463. $9=_st(set)._printString();
  5464. $ctx1.sendIdx["printString"]=5;
  5465. self._assert_equals_($9,"a Set (3 'foo')");
  5466. $ctx1.sendIdx["assert:equals:"]=5;
  5467. _st(set)._add_((3));
  5468. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5469. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5470. args: [],
  5471. 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'')'",
  5472. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5473. referencedClasses: ["Set"]
  5474. }),
  5475. globals.SetTest);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "testUnboxedObjects",
  5479. protocol: 'tests',
  5480. fn: function (){
  5481. var self=this;
  5482. return smalltalk.withContext(function($ctx1) {
  5483. var $4,$3,$2,$1;
  5484. $4="foo"._yourself();
  5485. $ctx1.sendIdx["yourself"]=1;
  5486. $3=[$4,"foo"._yourself()];
  5487. $2=_st($3)._asSet();
  5488. $1=_st($2)._asArray();
  5489. self._assert_equals_($1,["foo"]);
  5490. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5491. args: [],
  5492. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5493. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5494. referencedClasses: []
  5495. }),
  5496. globals.SetTest);
  5497. smalltalk.addMethod(
  5498. smalltalk.method({
  5499. selector: "testUnicity",
  5500. protocol: 'tests',
  5501. fn: function (){
  5502. var self=this;
  5503. var set;
  5504. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5505. return smalltalk.withContext(function($ctx1) {
  5506. var $1;
  5507. set=_st($Set())._new();
  5508. _st(set)._add_((21));
  5509. $ctx1.sendIdx["add:"]=1;
  5510. _st(set)._add_("hello");
  5511. $ctx1.sendIdx["add:"]=2;
  5512. _st(set)._add_((21));
  5513. $ctx1.sendIdx["add:"]=3;
  5514. $1=_st(set)._size();
  5515. $ctx1.sendIdx["size"]=1;
  5516. self._assert_equals_($1,(2));
  5517. $ctx1.sendIdx["assert:equals:"]=1;
  5518. _st(set)._add_("hello");
  5519. self._assert_equals_(_st(set)._size(),(2));
  5520. $ctx1.sendIdx["assert:equals:"]=2;
  5521. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5522. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5523. args: [],
  5524. 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')",
  5525. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5526. referencedClasses: ["Set"]
  5527. }),
  5528. globals.SetTest);
  5529. smalltalk.addMethod(
  5530. smalltalk.method({
  5531. selector: "collectionClass",
  5532. protocol: 'fixture',
  5533. fn: function (){
  5534. var self=this;
  5535. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5536. return $Set();
  5537. },
  5538. args: [],
  5539. source: "collectionClass\x0a\x09^ Set",
  5540. messageSends: [],
  5541. referencedClasses: ["Set"]
  5542. }),
  5543. globals.SetTest.klass);
  5544. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5545. smalltalk.addMethod(
  5546. smalltalk.method({
  5547. selector: "testShow",
  5548. protocol: 'tests',
  5549. fn: function (){
  5550. var self=this;
  5551. var originalTranscript;
  5552. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5553. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5554. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5555. return smalltalk.withContext(function($ctx1) {
  5556. originalTranscript=_st($Transcript())._current();
  5557. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5558. $ctx1.sendIdx["register:"]=1;
  5559. self._shouldnt_raise_((function(){
  5560. return smalltalk.withContext(function($ctx2) {
  5561. return _st($Transcript())._show_("Hello console!");
  5562. $ctx2.sendIdx["show:"]=1;
  5563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5564. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5565. self._shouldnt_raise_((function(){
  5566. return smalltalk.withContext(function($ctx2) {
  5567. return _st($Transcript())._show_(console);
  5568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5569. _st($Transcript())._register_(originalTranscript);
  5570. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5571. args: [],
  5572. 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.",
  5573. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5574. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5575. }),
  5576. globals.ConsoleTranscriptTest);
  5577. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "jsNull",
  5581. protocol: 'accessing',
  5582. fn: function (){
  5583. var self=this;
  5584. return smalltalk.withContext(function($ctx1) {
  5585. return null;
  5586. return self}, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)})},
  5587. args: [],
  5588. source: "jsNull\x0a\x09<return null>",
  5589. messageSends: [],
  5590. referencedClasses: []
  5591. }),
  5592. globals.JSObjectProxyTest);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "jsObject",
  5596. protocol: 'accessing',
  5597. fn: function (){
  5598. var self=this;
  5599. return smalltalk.withContext(function($ctx1) {
  5600. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5601. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5602. args: [],
  5603. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5604. messageSends: [],
  5605. referencedClasses: []
  5606. }),
  5607. globals.JSObjectProxyTest);
  5608. smalltalk.addMethod(
  5609. smalltalk.method({
  5610. selector: "jsUndefined",
  5611. protocol: 'accessing',
  5612. fn: function (){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) {
  5615. return;
  5616. return self}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)})},
  5617. args: [],
  5618. source: "jsUndefined\x0a\x09<return>",
  5619. messageSends: [],
  5620. referencedClasses: []
  5621. }),
  5622. globals.JSObjectProxyTest);
  5623. smalltalk.addMethod(
  5624. smalltalk.method({
  5625. selector: "testAtIfAbsent",
  5626. protocol: 'tests',
  5627. fn: function (){
  5628. var self=this;
  5629. var testObject;
  5630. return smalltalk.withContext(function($ctx1) {
  5631. var $1,$2,$3;
  5632. testObject=self._jsObject();
  5633. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5634. return "Property does not exist";
  5635. }));
  5636. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5637. self._assert_equals_($1,"Property does not exist");
  5638. $ctx1.sendIdx["assert:equals:"]=1;
  5639. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5640. return "Property does not exist";
  5641. }));
  5642. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5643. self._assert_equals_($2,nil);
  5644. $ctx1.sendIdx["assert:equals:"]=2;
  5645. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5646. return "Property does not exist";
  5647. }));
  5648. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5649. self._assert_equals_($3,(1));
  5650. $ctx1.sendIdx["assert:equals:"]=3;
  5651. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5652. return "Property does not exist";
  5653. })),nil);
  5654. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5655. args: [],
  5656. 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.",
  5657. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5658. referencedClasses: []
  5659. }),
  5660. globals.JSObjectProxyTest);
  5661. smalltalk.addMethod(
  5662. smalltalk.method({
  5663. selector: "testAtIfPresent",
  5664. protocol: 'tests',
  5665. fn: function (){
  5666. var self=this;
  5667. var testObject;
  5668. return smalltalk.withContext(function($ctx1) {
  5669. var $2,$1,$4,$3,$6,$5;
  5670. testObject=self._jsObject();
  5671. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5672. return smalltalk.withContext(function($ctx2) {
  5673. $2=_st(x)._asString();
  5674. $ctx2.sendIdx["asString"]=1;
  5675. return "hello ".__comma($2);
  5676. $ctx2.sendIdx[","]=1;
  5677. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5678. $ctx1.sendIdx["at:ifPresent:"]=1;
  5679. self._assert_equals_($1,nil);
  5680. $ctx1.sendIdx["assert:equals:"]=1;
  5681. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5682. return smalltalk.withContext(function($ctx2) {
  5683. $4=_st(x)._asString();
  5684. $ctx2.sendIdx["asString"]=2;
  5685. return "hello ".__comma($4);
  5686. $ctx2.sendIdx[","]=2;
  5687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5688. $ctx1.sendIdx["at:ifPresent:"]=2;
  5689. self._assert_equals_($3,"hello nil");
  5690. $ctx1.sendIdx["assert:equals:"]=2;
  5691. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5692. return smalltalk.withContext(function($ctx2) {
  5693. $6=_st(x)._asString();
  5694. $ctx2.sendIdx["asString"]=3;
  5695. return "hello ".__comma($6);
  5696. $ctx2.sendIdx[","]=3;
  5697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5698. $ctx1.sendIdx["at:ifPresent:"]=3;
  5699. self._assert_equals_($5,"hello 1");
  5700. $ctx1.sendIdx["assert:equals:"]=3;
  5701. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5702. return smalltalk.withContext(function($ctx2) {
  5703. return "hello ".__comma(_st(x)._asString());
  5704. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5705. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5706. args: [],
  5707. 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'.",
  5708. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5709. referencedClasses: []
  5710. }),
  5711. globals.JSObjectProxyTest);
  5712. smalltalk.addMethod(
  5713. smalltalk.method({
  5714. selector: "testAtIfPresentIfAbsent",
  5715. protocol: 'tests',
  5716. fn: function (){
  5717. var self=this;
  5718. var testObject;
  5719. return smalltalk.withContext(function($ctx1) {
  5720. var $2,$1,$4,$3,$6,$5;
  5721. testObject=self._jsObject();
  5722. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5723. return smalltalk.withContext(function($ctx2) {
  5724. $2=_st(x)._asString();
  5725. $ctx2.sendIdx["asString"]=1;
  5726. return "hello ".__comma($2);
  5727. $ctx2.sendIdx[","]=1;
  5728. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5729. return "not present";
  5730. }));
  5731. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5732. self._assert_equals_($1,"not present");
  5733. $ctx1.sendIdx["assert:equals:"]=1;
  5734. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5735. return smalltalk.withContext(function($ctx2) {
  5736. $4=_st(x)._asString();
  5737. $ctx2.sendIdx["asString"]=2;
  5738. return "hello ".__comma($4);
  5739. $ctx2.sendIdx[","]=2;
  5740. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5741. return "not present";
  5742. }));
  5743. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5744. self._assert_equals_($3,"hello nil");
  5745. $ctx1.sendIdx["assert:equals:"]=2;
  5746. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5747. return smalltalk.withContext(function($ctx2) {
  5748. $6=_st(x)._asString();
  5749. $ctx2.sendIdx["asString"]=3;
  5750. return "hello ".__comma($6);
  5751. $ctx2.sendIdx[","]=3;
  5752. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5753. return "not present";
  5754. }));
  5755. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5756. self._assert_equals_($5,"hello 1");
  5757. $ctx1.sendIdx["assert:equals:"]=3;
  5758. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5759. return smalltalk.withContext(function($ctx2) {
  5760. return "hello ".__comma(_st(x)._asString());
  5761. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5762. return "not present";
  5763. })),"hello nil");
  5764. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5765. args: [],
  5766. 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'.",
  5767. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5768. referencedClasses: []
  5769. }),
  5770. globals.JSObjectProxyTest);
  5771. smalltalk.addMethod(
  5772. smalltalk.method({
  5773. selector: "testAtPut",
  5774. protocol: 'tests',
  5775. fn: function (){
  5776. var self=this;
  5777. var testObject;
  5778. return smalltalk.withContext(function($ctx1) {
  5779. var $2,$1;
  5780. testObject=self._jsObject();
  5781. $2=_st(testObject)._at_("abc");
  5782. $ctx1.sendIdx["at:"]=1;
  5783. $1=_st($2).__tild_eq("xyz");
  5784. self._assert_($1);
  5785. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5786. $ctx1.sendIdx["assert:equals:"]=1;
  5787. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5788. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5789. args: [],
  5790. 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'",
  5791. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5792. referencedClasses: []
  5793. }),
  5794. globals.JSObjectProxyTest);
  5795. smalltalk.addMethod(
  5796. smalltalk.method({
  5797. selector: "testComparison",
  5798. protocol: 'tests',
  5799. fn: function (){
  5800. var self=this;
  5801. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5802. return smalltalk.withContext(function($ctx1) {
  5803. var $1,$2;
  5804. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5805. $1=_st(console).__eq(console);
  5806. $ctx1.sendIdx["="]=1;
  5807. self._assert_($1);
  5808. $2=_st(console).__eq(_st($Object())._new());
  5809. $ctx1.sendIdx["="]=2;
  5810. self._deny_($2);
  5811. $ctx1.sendIdx["deny:"]=1;
  5812. self._deny_(_st(console).__eq(self._jsObject()));
  5813. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5814. args: [],
  5815. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5816. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5817. referencedClasses: ["Object"]
  5818. }),
  5819. globals.JSObjectProxyTest);
  5820. smalltalk.addMethod(
  5821. smalltalk.method({
  5822. selector: "testDNU",
  5823. protocol: 'tests',
  5824. fn: function (){
  5825. var self=this;
  5826. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5827. return smalltalk.withContext(function($ctx1) {
  5828. self._should_raise_((function(){
  5829. return smalltalk.withContext(function($ctx2) {
  5830. return _st(self._jsObject())._foo();
  5831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5832. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5833. args: [],
  5834. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5835. messageSends: ["should:raise:", "foo", "jsObject"],
  5836. referencedClasses: ["MessageNotUnderstood"]
  5837. }),
  5838. globals.JSObjectProxyTest);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "testDNURegression1057",
  5842. protocol: 'tests',
  5843. fn: function (){
  5844. var self=this;
  5845. var jsObject;
  5846. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5847. return smalltalk.withContext(function($ctx1) {
  5848. var $1;
  5849. jsObject=[];
  5850. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  5851. $ctx1.sendIdx["basicAt:put:"]=1;
  5852. _st(jsObject)._basicAt_put_("foo",(3));
  5853. self._shouldnt_raise_((function(){
  5854. return smalltalk.withContext(function($ctx2) {
  5855. return _st(jsObject)._foo();
  5856. $ctx2.sendIdx["foo"]=1;
  5857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5858. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5859. $1=_st(jsObject)._foo();
  5860. $ctx1.sendIdx["foo"]=2;
  5861. self._assert_equals_($1,(3));
  5862. $ctx1.sendIdx["assert:equals:"]=1;
  5863. self._shouldnt_raise_((function(){
  5864. return smalltalk.withContext(function($ctx2) {
  5865. return _st(jsObject)._foo_((4));
  5866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5867. self._assert_equals_(_st(jsObject)._foo(),(4));
  5868. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  5869. args: [],
  5870. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  5871. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"],
  5872. referencedClasses: ["Error"]
  5873. }),
  5874. globals.JSObjectProxyTest);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "testDNURegression1059",
  5878. protocol: 'tests',
  5879. fn: function (){
  5880. var self=this;
  5881. var jsObject;
  5882. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5883. return smalltalk.withContext(function($ctx1) {
  5884. jsObject=[];
  5885. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  5886. $ctx1.sendIdx["basicAt:put:"]=1;
  5887. _st(jsObject)._basicAt_put_("x",(3));
  5888. $ctx1.sendIdx["basicAt:put:"]=2;
  5889. _st(jsObject)._basicAt_put_("x:",(function(){
  5890. return smalltalk.withContext(function($ctx2) {
  5891. return self._error();
  5892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5893. self._shouldnt_raise_((function(){
  5894. return smalltalk.withContext(function($ctx2) {
  5895. return _st(jsObject)._x_((4));
  5896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5897. self._assert_equals_(_st(jsObject)._x(),(4));
  5898. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  5899. args: [],
  5900. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  5901. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"],
  5902. referencedClasses: ["Error"]
  5903. }),
  5904. globals.JSObjectProxyTest);
  5905. smalltalk.addMethod(
  5906. smalltalk.method({
  5907. selector: "testDNURegression1062",
  5908. protocol: 'tests',
  5909. fn: function (){
  5910. var self=this;
  5911. var jsObject,stored;
  5912. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5913. return smalltalk.withContext(function($ctx1) {
  5914. jsObject=[];
  5915. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  5916. $ctx1.sendIdx["basicAt:put:"]=1;
  5917. _st(jsObject)._basicAt_put_("x",(function(v){
  5918. stored=v;
  5919. return stored;
  5920. }));
  5921. self._shouldnt_raise_((function(){
  5922. return smalltalk.withContext(function($ctx2) {
  5923. return _st(jsObject)._x_((4));
  5924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5925. self._assert_equals_(stored,(4));
  5926. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},globals.JSObjectProxyTest)})},
  5927. args: [],
  5928. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  5929. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"],
  5930. referencedClasses: ["Error"]
  5931. }),
  5932. globals.JSObjectProxyTest);
  5933. smalltalk.addMethod(
  5934. smalltalk.method({
  5935. selector: "testMessageSend",
  5936. protocol: 'tests',
  5937. fn: function (){
  5938. var self=this;
  5939. return smalltalk.withContext(function($ctx1) {
  5940. var $2,$1,$4,$3;
  5941. $2=self._jsObject();
  5942. $ctx1.sendIdx["jsObject"]=1;
  5943. $1=_st($2)._a();
  5944. self._assert_equals_($1,(1));
  5945. $ctx1.sendIdx["assert:equals:"]=1;
  5946. $4=self._jsObject();
  5947. $ctx1.sendIdx["jsObject"]=2;
  5948. $3=_st($4)._b();
  5949. self._assert_equals_($3,(2));
  5950. $ctx1.sendIdx["assert:equals:"]=2;
  5951. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5952. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5953. args: [],
  5954. 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",
  5955. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5956. referencedClasses: []
  5957. }),
  5958. globals.JSObjectProxyTest);
  5959. smalltalk.addMethod(
  5960. smalltalk.method({
  5961. selector: "testMethodWithArguments",
  5962. protocol: 'tests',
  5963. fn: function (){
  5964. var self=this;
  5965. return smalltalk.withContext(function($ctx1) {
  5966. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5967. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5968. args: [],
  5969. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5970. messageSends: ["assert:equals:", "c:", "jsObject"],
  5971. referencedClasses: []
  5972. }),
  5973. globals.JSObjectProxyTest);
  5974. smalltalk.addMethod(
  5975. smalltalk.method({
  5976. selector: "testPrinting",
  5977. protocol: 'tests',
  5978. fn: function (){
  5979. var self=this;
  5980. return smalltalk.withContext(function($ctx1) {
  5981. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5982. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5983. args: [],
  5984. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5985. messageSends: ["assert:equals:", "printString", "jsObject"],
  5986. referencedClasses: []
  5987. }),
  5988. globals.JSObjectProxyTest);
  5989. smalltalk.addMethod(
  5990. smalltalk.method({
  5991. selector: "testPropertyThatReturnsEmptyString",
  5992. protocol: 'tests',
  5993. fn: function (){
  5994. var self=this;
  5995. var object;
  5996. return smalltalk.withContext(function($ctx1) {
  5997. var $1;
  5998. object=self._jsObject();
  5999. $1=_st(object)._d();
  6000. $ctx1.sendIdx["d"]=1;
  6001. self._assert_equals_($1,"");
  6002. $ctx1.sendIdx["assert:equals:"]=1;
  6003. _st(object)._d_("hello");
  6004. self._assert_equals_(_st(object)._d(),"hello");
  6005. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  6006. args: [],
  6007. 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'",
  6008. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  6009. referencedClasses: []
  6010. }),
  6011. globals.JSObjectProxyTest);
  6012. smalltalk.addMethod(
  6013. smalltalk.method({
  6014. selector: "testPropertyThatReturnsUndefined",
  6015. protocol: 'tests',
  6016. fn: function (){
  6017. var self=this;
  6018. var object;
  6019. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6020. return smalltalk.withContext(function($ctx1) {
  6021. object=self._jsObject();
  6022. self._shouldnt_raise_((function(){
  6023. return smalltalk.withContext(function($ctx2) {
  6024. return _st(object)._e();
  6025. $ctx2.sendIdx["e"]=1;
  6026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6027. self._assert_(_st(_st(object)._e())._isNil());
  6028. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  6029. args: [],
  6030. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  6031. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  6032. referencedClasses: ["MessageNotUnderstood"]
  6033. }),
  6034. globals.JSObjectProxyTest);
  6035. smalltalk.addMethod(
  6036. smalltalk.method({
  6037. selector: "testSetPropertyWithFalsyValue",
  6038. protocol: 'tests',
  6039. fn: function (){
  6040. var self=this;
  6041. var jsObject;
  6042. return smalltalk.withContext(function($ctx1) {
  6043. var $1,$2,$3,$4,$5;
  6044. jsObject=self._jsObject();
  6045. $1=_st(jsObject)._a();
  6046. $ctx1.sendIdx["a"]=1;
  6047. self._assert_equals_($1,(1));
  6048. $ctx1.sendIdx["assert:equals:"]=1;
  6049. _st(jsObject)._a_(self._jsNull());
  6050. $ctx1.sendIdx["a:"]=1;
  6051. $2=_st(jsObject)._a();
  6052. $ctx1.sendIdx["a"]=2;
  6053. self._assert_equals_($2,nil);
  6054. $ctx1.sendIdx["assert:equals:"]=2;
  6055. _st(jsObject)._a_((0));
  6056. $ctx1.sendIdx["a:"]=2;
  6057. $3=_st(jsObject)._a();
  6058. $ctx1.sendIdx["a"]=3;
  6059. self._assert_equals_($3,(0));
  6060. $ctx1.sendIdx["assert:equals:"]=3;
  6061. _st(jsObject)._a_(self._jsUndefined());
  6062. $ctx1.sendIdx["a:"]=3;
  6063. $4=_st(jsObject)._a();
  6064. $ctx1.sendIdx["a"]=4;
  6065. self._assert_equals_($4,nil);
  6066. $ctx1.sendIdx["assert:equals:"]=4;
  6067. _st(jsObject)._a_("");
  6068. $ctx1.sendIdx["a:"]=4;
  6069. $5=_st(jsObject)._a();
  6070. $ctx1.sendIdx["a"]=5;
  6071. self._assert_equals_($5,"");
  6072. $ctx1.sendIdx["assert:equals:"]=5;
  6073. _st(jsObject)._a_(false);
  6074. self._assert_equals_(_st(jsObject)._a(),false);
  6075. return self}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  6076. args: [],
  6077. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  6078. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"],
  6079. referencedClasses: []
  6080. }),
  6081. globals.JSObjectProxyTest);
  6082. smalltalk.addMethod(
  6083. smalltalk.method({
  6084. selector: "testValue",
  6085. protocol: 'tests',
  6086. fn: function (){
  6087. var self=this;
  6088. var testObject;
  6089. return smalltalk.withContext(function($ctx1) {
  6090. testObject=self._jsObject();
  6091. _st(testObject)._at_put_("value","aValue");
  6092. self._assert_equals_(_st(testObject)._value(),"aValue");
  6093. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  6094. args: [],
  6095. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  6096. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  6097. referencedClasses: []
  6098. }),
  6099. globals.JSObjectProxyTest);
  6100. smalltalk.addMethod(
  6101. smalltalk.method({
  6102. selector: "testYourself",
  6103. protocol: 'tests',
  6104. fn: function (){
  6105. var self=this;
  6106. var object;
  6107. return smalltalk.withContext(function($ctx1) {
  6108. var $1,$2;
  6109. $1=self._jsObject();
  6110. _st($1)._d_("test");
  6111. $2=_st($1)._yourself();
  6112. object=$2;
  6113. self._assert_equals_(_st(object)._d(),"test");
  6114. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  6115. args: [],
  6116. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  6117. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  6118. referencedClasses: []
  6119. }),
  6120. globals.JSObjectProxyTest);
  6121. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  6122. smalltalk.addMethod(
  6123. smalltalk.method({
  6124. selector: "testCatchingException",
  6125. protocol: 'tests',
  6126. fn: function (){
  6127. var self=this;
  6128. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6129. return smalltalk.withContext(function($ctx1) {
  6130. _st((function(){
  6131. return smalltalk.withContext(function($ctx2) {
  6132. return self._throwException();
  6133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  6134. return smalltalk.withContext(function($ctx2) {
  6135. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  6136. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  6137. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  6138. args: [],
  6139. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  6140. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  6141. referencedClasses: ["Error"]
  6142. }),
  6143. globals.JavaScriptExceptionTest);
  6144. smalltalk.addMethod(
  6145. smalltalk.method({
  6146. selector: "testRaisingException",
  6147. protocol: 'tests',
  6148. fn: function (){
  6149. var self=this;
  6150. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6151. return smalltalk.withContext(function($ctx1) {
  6152. self._should_raise_((function(){
  6153. return smalltalk.withContext(function($ctx2) {
  6154. return self._throwException();
  6155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  6156. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  6157. args: [],
  6158. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  6159. messageSends: ["should:raise:", "throwException"],
  6160. referencedClasses: ["JavaScriptException"]
  6161. }),
  6162. globals.JavaScriptExceptionTest);
  6163. smalltalk.addMethod(
  6164. smalltalk.method({
  6165. selector: "throwException",
  6166. protocol: 'helpers',
  6167. fn: function (){
  6168. var self=this;
  6169. return smalltalk.withContext(function($ctx1) {
  6170. throw 'test';
  6171. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  6172. args: [],
  6173. source: "throwException\x0a\x09<throw 'test'>",
  6174. messageSends: [],
  6175. referencedClasses: []
  6176. }),
  6177. globals.JavaScriptExceptionTest);
  6178. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  6179. smalltalk.addMethod(
  6180. smalltalk.method({
  6181. selector: "testValue",
  6182. protocol: 'tests',
  6183. fn: function (){
  6184. var self=this;
  6185. var messageSend;
  6186. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6187. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6188. return smalltalk.withContext(function($ctx1) {
  6189. var $1,$2;
  6190. $1=_st($MessageSend())._new();
  6191. $ctx1.sendIdx["new"]=1;
  6192. _st($1)._receiver_(_st($Object())._new());
  6193. _st($1)._selector_("asString");
  6194. $2=_st($1)._yourself();
  6195. messageSend=$2;
  6196. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6197. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  6198. args: [],
  6199. 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'",
  6200. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6201. referencedClasses: ["MessageSend", "Object"]
  6202. }),
  6203. globals.MessageSendTest);
  6204. smalltalk.addMethod(
  6205. smalltalk.method({
  6206. selector: "testValueWithArguments",
  6207. protocol: 'tests',
  6208. fn: function (){
  6209. var self=this;
  6210. var messageSend;
  6211. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6212. return smalltalk.withContext(function($ctx1) {
  6213. var $1,$2;
  6214. $1=_st($MessageSend())._new();
  6215. _st($1)._receiver_((2));
  6216. _st($1)._selector_("+");
  6217. $2=_st($1)._yourself();
  6218. messageSend=$2;
  6219. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6220. $ctx1.sendIdx["assert:equals:"]=1;
  6221. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6222. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  6223. args: [],
  6224. 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",
  6225. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6226. referencedClasses: ["MessageSend"]
  6227. }),
  6228. globals.MessageSendTest);
  6229. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6230. smalltalk.addMethod(
  6231. smalltalk.method({
  6232. selector: "codeGeneratorClass",
  6233. protocol: 'accessing',
  6234. fn: function (){
  6235. var self=this;
  6236. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6237. return $CodeGenerator();
  6238. },
  6239. args: [],
  6240. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6241. messageSends: [],
  6242. referencedClasses: ["CodeGenerator"]
  6243. }),
  6244. globals.MethodInheritanceTest);
  6245. smalltalk.addMethod(
  6246. smalltalk.method({
  6247. selector: "compiler",
  6248. protocol: 'factory',
  6249. fn: function (){
  6250. var self=this;
  6251. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6252. return smalltalk.withContext(function($ctx1) {
  6253. var $2,$3,$1;
  6254. $2=_st($Compiler())._new();
  6255. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6256. $3=_st($2)._yourself();
  6257. $1=$3;
  6258. return $1;
  6259. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6260. args: [],
  6261. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6262. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6263. referencedClasses: ["Compiler"]
  6264. }),
  6265. globals.MethodInheritanceTest);
  6266. smalltalk.addMethod(
  6267. smalltalk.method({
  6268. selector: "deinstallBottom",
  6269. protocol: 'testing',
  6270. fn: function (){
  6271. var self=this;
  6272. return smalltalk.withContext(function($ctx1) {
  6273. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6274. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6275. args: [],
  6276. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6277. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6278. referencedClasses: []
  6279. }),
  6280. globals.MethodInheritanceTest);
  6281. smalltalk.addMethod(
  6282. smalltalk.method({
  6283. selector: "deinstallMiddle",
  6284. protocol: 'testing',
  6285. fn: function (){
  6286. var self=this;
  6287. return smalltalk.withContext(function($ctx1) {
  6288. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6289. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6290. args: [],
  6291. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6292. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6293. referencedClasses: []
  6294. }),
  6295. globals.MethodInheritanceTest);
  6296. smalltalk.addMethod(
  6297. smalltalk.method({
  6298. selector: "deinstallTop",
  6299. protocol: 'testing',
  6300. fn: function (){
  6301. var self=this;
  6302. return smalltalk.withContext(function($ctx1) {
  6303. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6304. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6305. args: [],
  6306. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6307. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6308. referencedClasses: []
  6309. }),
  6310. globals.MethodInheritanceTest);
  6311. smalltalk.addMethod(
  6312. smalltalk.method({
  6313. selector: "installBottom:",
  6314. protocol: 'testing',
  6315. fn: function (aString){
  6316. var self=this;
  6317. return smalltalk.withContext(function($ctx1) {
  6318. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6319. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6320. args: ["aString"],
  6321. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6322. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6323. referencedClasses: []
  6324. }),
  6325. globals.MethodInheritanceTest);
  6326. smalltalk.addMethod(
  6327. smalltalk.method({
  6328. selector: "installMiddle:",
  6329. protocol: 'testing',
  6330. fn: function (aString){
  6331. var self=this;
  6332. return smalltalk.withContext(function($ctx1) {
  6333. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6334. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6335. args: ["aString"],
  6336. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6337. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6338. referencedClasses: []
  6339. }),
  6340. globals.MethodInheritanceTest);
  6341. smalltalk.addMethod(
  6342. smalltalk.method({
  6343. selector: "installTop:",
  6344. protocol: 'testing',
  6345. fn: function (aString){
  6346. var self=this;
  6347. return smalltalk.withContext(function($ctx1) {
  6348. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6349. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6350. args: ["aString"],
  6351. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6352. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6353. referencedClasses: []
  6354. }),
  6355. globals.MethodInheritanceTest);
  6356. smalltalk.addMethod(
  6357. smalltalk.method({
  6358. selector: "setUp",
  6359. protocol: 'initialization',
  6360. fn: function (){
  6361. var self=this;
  6362. return smalltalk.withContext(function($ctx1) {
  6363. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6364. $ctx1.sendIdx["new"]=1;
  6365. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6366. $ctx1.sendIdx["new"]=2;
  6367. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6368. self["@method"]=nil;
  6369. self["@performBlock"]=(function(){
  6370. return smalltalk.withContext(function($ctx2) {
  6371. return self._error_("performBlock not initialized");
  6372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6373. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6374. args: [],
  6375. 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' ]",
  6376. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6377. referencedClasses: []
  6378. }),
  6379. globals.MethodInheritanceTest);
  6380. smalltalk.addMethod(
  6381. smalltalk.method({
  6382. selector: "shouldMNU",
  6383. protocol: 'testing',
  6384. fn: function (){
  6385. var self=this;
  6386. return smalltalk.withContext(function($ctx1) {
  6387. self._shouldMNUTop();
  6388. self._shouldMNUMiddle();
  6389. self._shouldMNUBottom();
  6390. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6391. args: [],
  6392. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6393. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6394. referencedClasses: []
  6395. }),
  6396. globals.MethodInheritanceTest);
  6397. smalltalk.addMethod(
  6398. smalltalk.method({
  6399. selector: "shouldMNUBottom",
  6400. protocol: 'testing',
  6401. fn: function (){
  6402. var self=this;
  6403. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6404. return smalltalk.withContext(function($ctx1) {
  6405. self._should_raise_((function(){
  6406. return smalltalk.withContext(function($ctx2) {
  6407. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6409. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6410. args: [],
  6411. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6412. messageSends: ["should:raise:", "value:"],
  6413. referencedClasses: ["MessageNotUnderstood"]
  6414. }),
  6415. globals.MethodInheritanceTest);
  6416. smalltalk.addMethod(
  6417. smalltalk.method({
  6418. selector: "shouldMNUMiddle",
  6419. protocol: 'testing',
  6420. fn: function (){
  6421. var self=this;
  6422. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6423. return smalltalk.withContext(function($ctx1) {
  6424. self._should_raise_((function(){
  6425. return smalltalk.withContext(function($ctx2) {
  6426. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6428. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6429. args: [],
  6430. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6431. messageSends: ["should:raise:", "value:"],
  6432. referencedClasses: ["MessageNotUnderstood"]
  6433. }),
  6434. globals.MethodInheritanceTest);
  6435. smalltalk.addMethod(
  6436. smalltalk.method({
  6437. selector: "shouldMNUTop",
  6438. protocol: 'testing',
  6439. fn: function (){
  6440. var self=this;
  6441. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6442. return smalltalk.withContext(function($ctx1) {
  6443. self._should_raise_((function(){
  6444. return smalltalk.withContext(function($ctx2) {
  6445. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6447. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6448. args: [],
  6449. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6450. messageSends: ["should:raise:", "value:"],
  6451. referencedClasses: ["MessageNotUnderstood"]
  6452. }),
  6453. globals.MethodInheritanceTest);
  6454. smalltalk.addMethod(
  6455. smalltalk.method({
  6456. selector: "shouldReturn:",
  6457. protocol: 'testing',
  6458. fn: function (anObject){
  6459. var self=this;
  6460. var result;
  6461. return smalltalk.withContext(function($ctx1) {
  6462. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6463. $ctx1.sendIdx["value:"]=1;
  6464. self._assert_equals_(["top",anObject],["top",result]);
  6465. $ctx1.sendIdx["assert:equals:"]=1;
  6466. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6467. $ctx1.sendIdx["value:"]=2;
  6468. self._assert_equals_(["middle",anObject],["middle",result]);
  6469. $ctx1.sendIdx["assert:equals:"]=2;
  6470. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6471. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6472. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6473. args: ["anObject"],
  6474. 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 }",
  6475. messageSends: ["value:", "assert:equals:"],
  6476. referencedClasses: []
  6477. }),
  6478. globals.MethodInheritanceTest);
  6479. smalltalk.addMethod(
  6480. smalltalk.method({
  6481. selector: "shouldReturn:and:and:",
  6482. protocol: 'testing',
  6483. fn: function (anObject,anObject2,anObject3){
  6484. var self=this;
  6485. var result;
  6486. return smalltalk.withContext(function($ctx1) {
  6487. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6488. $ctx1.sendIdx["value:"]=1;
  6489. self._assert_equals_(["top",anObject],["top",result]);
  6490. $ctx1.sendIdx["assert:equals:"]=1;
  6491. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6492. $ctx1.sendIdx["value:"]=2;
  6493. self._assert_equals_(["middle",anObject2],["middle",result]);
  6494. $ctx1.sendIdx["assert:equals:"]=2;
  6495. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6496. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6497. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6498. args: ["anObject", "anObject2", "anObject3"],
  6499. 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 }",
  6500. messageSends: ["value:", "assert:equals:"],
  6501. referencedClasses: []
  6502. }),
  6503. globals.MethodInheritanceTest);
  6504. smalltalk.addMethod(
  6505. smalltalk.method({
  6506. selector: "targetClassBottom",
  6507. protocol: 'accessing',
  6508. fn: function (){
  6509. var self=this;
  6510. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6511. return $JavaScriptException();
  6512. },
  6513. args: [],
  6514. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6515. messageSends: [],
  6516. referencedClasses: ["JavaScriptException"]
  6517. }),
  6518. globals.MethodInheritanceTest);
  6519. smalltalk.addMethod(
  6520. smalltalk.method({
  6521. selector: "targetClassMiddle",
  6522. protocol: 'accessing',
  6523. fn: function (){
  6524. var self=this;
  6525. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6526. return $Error();
  6527. },
  6528. args: [],
  6529. source: "targetClassMiddle\x0a\x09^ Error",
  6530. messageSends: [],
  6531. referencedClasses: ["Error"]
  6532. }),
  6533. globals.MethodInheritanceTest);
  6534. smalltalk.addMethod(
  6535. smalltalk.method({
  6536. selector: "targetClassTop",
  6537. protocol: 'accessing',
  6538. fn: function (){
  6539. var self=this;
  6540. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6541. return $Object();
  6542. },
  6543. args: [],
  6544. source: "targetClassTop\x0a\x09^ Object",
  6545. messageSends: [],
  6546. referencedClasses: ["Object"]
  6547. }),
  6548. globals.MethodInheritanceTest);
  6549. smalltalk.addMethod(
  6550. smalltalk.method({
  6551. selector: "tearDown",
  6552. protocol: 'initialization',
  6553. fn: function (){
  6554. var self=this;
  6555. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6556. return smalltalk.withContext(function($ctx1) {
  6557. _st((function(){
  6558. return smalltalk.withContext(function($ctx2) {
  6559. return self._deinstallTop();
  6560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6561. }));
  6562. $ctx1.sendIdx["on:do:"]=1;
  6563. _st((function(){
  6564. return smalltalk.withContext(function($ctx2) {
  6565. return self._deinstallMiddle();
  6566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6567. }));
  6568. $ctx1.sendIdx["on:do:"]=2;
  6569. _st((function(){
  6570. return smalltalk.withContext(function($ctx2) {
  6571. return self._deinstallBottom();
  6572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6573. }));
  6574. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6575. args: [],
  6576. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6577. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6578. referencedClasses: ["Error"]
  6579. }),
  6580. globals.MethodInheritanceTest);
  6581. smalltalk.addMethod(
  6582. smalltalk.method({
  6583. selector: "testMNU11",
  6584. protocol: 'tests',
  6585. fn: function (){
  6586. var self=this;
  6587. return smalltalk.withContext(function($ctx1) {
  6588. self["@performBlock"]=(function(x){
  6589. return smalltalk.withContext(function($ctx2) {
  6590. return _st(x)._foo();
  6591. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6592. self._shouldMNU();
  6593. $ctx1.sendIdx["shouldMNU"]=1;
  6594. self._installTop_("foo ^ false");
  6595. $ctx1.sendIdx["installTop:"]=1;
  6596. self._installTop_("foo ^ true");
  6597. self._deinstallTop();
  6598. self._shouldMNU();
  6599. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6600. args: [],
  6601. 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",
  6602. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6603. referencedClasses: []
  6604. }),
  6605. globals.MethodInheritanceTest);
  6606. smalltalk.addMethod(
  6607. smalltalk.method({
  6608. selector: "testMNU22",
  6609. protocol: 'tests',
  6610. fn: function (){
  6611. var self=this;
  6612. return smalltalk.withContext(function($ctx1) {
  6613. self["@performBlock"]=(function(x){
  6614. return smalltalk.withContext(function($ctx2) {
  6615. return _st(x)._foo();
  6616. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6617. self._shouldMNU();
  6618. $ctx1.sendIdx["shouldMNU"]=1;
  6619. self._installMiddle_("foo ^ false");
  6620. $ctx1.sendIdx["installMiddle:"]=1;
  6621. self._installMiddle_("foo ^ true");
  6622. self._deinstallMiddle();
  6623. self._shouldMNU();
  6624. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6625. args: [],
  6626. 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",
  6627. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6628. referencedClasses: []
  6629. }),
  6630. globals.MethodInheritanceTest);
  6631. smalltalk.addMethod(
  6632. smalltalk.method({
  6633. selector: "testReturns1",
  6634. protocol: 'tests',
  6635. fn: function (){
  6636. var self=this;
  6637. return smalltalk.withContext(function($ctx1) {
  6638. self["@performBlock"]=(function(x){
  6639. return smalltalk.withContext(function($ctx2) {
  6640. return _st(x)._foo();
  6641. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6642. self._installTop_("foo ^ false");
  6643. $ctx1.sendIdx["installTop:"]=1;
  6644. self._shouldReturn_(false);
  6645. $ctx1.sendIdx["shouldReturn:"]=1;
  6646. self._installTop_("foo ^ true");
  6647. self._shouldReturn_(true);
  6648. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6649. args: [],
  6650. 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",
  6651. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6652. referencedClasses: []
  6653. }),
  6654. globals.MethodInheritanceTest);
  6655. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6656. smalltalk.addMethod(
  6657. smalltalk.method({
  6658. selector: "testAbs",
  6659. protocol: 'tests',
  6660. fn: function (){
  6661. var self=this;
  6662. return smalltalk.withContext(function($ctx1) {
  6663. var $1;
  6664. $1=(4)._abs();
  6665. $ctx1.sendIdx["abs"]=1;
  6666. self._assert_equals_($1,(4));
  6667. $ctx1.sendIdx["assert:equals:"]=1;
  6668. self._assert_equals_((-4)._abs(),(4));
  6669. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6670. args: [],
  6671. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6672. messageSends: ["assert:equals:", "abs"],
  6673. referencedClasses: []
  6674. }),
  6675. globals.NumberTest);
  6676. smalltalk.addMethod(
  6677. smalltalk.method({
  6678. selector: "testArithmetic",
  6679. protocol: 'tests',
  6680. fn: function (){
  6681. var self=this;
  6682. return smalltalk.withContext(function($ctx1) {
  6683. var $1,$2,$3,$5,$4;
  6684. $1=(1.5).__plus((1));
  6685. $ctx1.sendIdx["+"]=1;
  6686. self._assert_equals_($1,(2.5));
  6687. $ctx1.sendIdx["assert:equals:"]=1;
  6688. $2=(2).__minus((1));
  6689. $ctx1.sendIdx["-"]=1;
  6690. self._assert_equals_($2,(1));
  6691. $ctx1.sendIdx["assert:equals:"]=2;
  6692. self._assert_equals_((-2).__minus((1)),(-3));
  6693. $ctx1.sendIdx["assert:equals:"]=3;
  6694. self._assert_equals_((12).__slash((2)),(6));
  6695. $ctx1.sendIdx["assert:equals:"]=4;
  6696. $3=(3).__star((4));
  6697. $ctx1.sendIdx["*"]=1;
  6698. self._assert_equals_($3,(12));
  6699. $ctx1.sendIdx["assert:equals:"]=5;
  6700. self._assert_equals_((7).__slash_slash((2)),(3));
  6701. $ctx1.sendIdx["assert:equals:"]=6;
  6702. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6703. $ctx1.sendIdx["assert:equals:"]=7;
  6704. $5=(1).__plus((2));
  6705. $ctx1.sendIdx["+"]=2;
  6706. $4=_st($5).__star((3));
  6707. $ctx1.sendIdx["*"]=2;
  6708. self._assert_equals_($4,(9));
  6709. $ctx1.sendIdx["assert:equals:"]=8;
  6710. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6711. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6712. args: [],
  6713. 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",
  6714. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6715. referencedClasses: []
  6716. }),
  6717. globals.NumberTest);
  6718. smalltalk.addMethod(
  6719. smalltalk.method({
  6720. selector: "testAsNumber",
  6721. protocol: 'tests',
  6722. fn: function (){
  6723. var self=this;
  6724. return smalltalk.withContext(function($ctx1) {
  6725. self._assert_equals_((3)._asNumber(),(3));
  6726. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6727. args: [],
  6728. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6729. messageSends: ["assert:equals:", "asNumber"],
  6730. referencedClasses: []
  6731. }),
  6732. globals.NumberTest);
  6733. smalltalk.addMethod(
  6734. smalltalk.method({
  6735. selector: "testCeiling",
  6736. protocol: 'tests',
  6737. fn: function (){
  6738. var self=this;
  6739. return smalltalk.withContext(function($ctx1) {
  6740. var $1,$2;
  6741. $1=(1.2)._ceiling();
  6742. $ctx1.sendIdx["ceiling"]=1;
  6743. self._assert_equals_($1,(2));
  6744. $ctx1.sendIdx["assert:equals:"]=1;
  6745. $2=(-1.2)._ceiling();
  6746. $ctx1.sendIdx["ceiling"]=2;
  6747. self._assert_equals_($2,(-1));
  6748. $ctx1.sendIdx["assert:equals:"]=2;
  6749. self._assert_equals_((1)._ceiling(),(1));
  6750. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6751. args: [],
  6752. 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.",
  6753. messageSends: ["assert:equals:", "ceiling"],
  6754. referencedClasses: []
  6755. }),
  6756. globals.NumberTest);
  6757. smalltalk.addMethod(
  6758. smalltalk.method({
  6759. selector: "testComparison",
  6760. protocol: 'tests',
  6761. fn: function (){
  6762. var self=this;
  6763. return smalltalk.withContext(function($ctx1) {
  6764. var $1,$2,$3,$4;
  6765. $1=(3).__gt((2));
  6766. $ctx1.sendIdx[">"]=1;
  6767. self._assert_($1);
  6768. $ctx1.sendIdx["assert:"]=1;
  6769. $2=(2).__lt((3));
  6770. $ctx1.sendIdx["<"]=1;
  6771. self._assert_($2);
  6772. $ctx1.sendIdx["assert:"]=2;
  6773. self._deny_((3).__lt((2)));
  6774. $ctx1.sendIdx["deny:"]=1;
  6775. self._deny_((2).__gt((3)));
  6776. $3=(3).__gt_eq((3));
  6777. $ctx1.sendIdx[">="]=1;
  6778. self._assert_($3);
  6779. $ctx1.sendIdx["assert:"]=3;
  6780. self._assert_((3.1).__gt_eq((3)));
  6781. $ctx1.sendIdx["assert:"]=4;
  6782. $4=(3).__lt_eq((3));
  6783. $ctx1.sendIdx["<="]=1;
  6784. self._assert_($4);
  6785. $ctx1.sendIdx["assert:"]=5;
  6786. self._assert_((3).__lt_eq((3.1)));
  6787. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6788. args: [],
  6789. 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",
  6790. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6791. referencedClasses: []
  6792. }),
  6793. globals.NumberTest);
  6794. smalltalk.addMethod(
  6795. smalltalk.method({
  6796. selector: "testCopying",
  6797. protocol: 'tests',
  6798. fn: function (){
  6799. var self=this;
  6800. return smalltalk.withContext(function($ctx1) {
  6801. var $1;
  6802. $1=_st((1)._copy()).__eq_eq((1));
  6803. $ctx1.sendIdx["=="]=1;
  6804. self._assert_($1);
  6805. $ctx1.sendIdx["assert:"]=1;
  6806. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6807. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6808. args: [],
  6809. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6810. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6811. referencedClasses: []
  6812. }),
  6813. globals.NumberTest);
  6814. smalltalk.addMethod(
  6815. smalltalk.method({
  6816. selector: "testEquality",
  6817. protocol: 'tests',
  6818. fn: function (){
  6819. var self=this;
  6820. return smalltalk.withContext(function($ctx1) {
  6821. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6822. $1=(1).__eq((1));
  6823. $ctx1.sendIdx["="]=1;
  6824. self._assert_($1);
  6825. $ctx1.sendIdx["assert:"]=1;
  6826. $2=(0).__eq((0));
  6827. $ctx1.sendIdx["="]=2;
  6828. self._assert_($2);
  6829. $ctx1.sendIdx["assert:"]=2;
  6830. $3=(1).__eq((0));
  6831. $ctx1.sendIdx["="]=3;
  6832. self._deny_($3);
  6833. $ctx1.sendIdx["deny:"]=1;
  6834. $5=(1)._yourself();
  6835. $ctx1.sendIdx["yourself"]=1;
  6836. $4=_st($5).__eq((1));
  6837. $ctx1.sendIdx["="]=4;
  6838. self._assert_($4);
  6839. $ctx1.sendIdx["assert:"]=3;
  6840. $7=(1)._yourself();
  6841. $ctx1.sendIdx["yourself"]=2;
  6842. $6=(1).__eq($7);
  6843. $ctx1.sendIdx["="]=5;
  6844. self._assert_($6);
  6845. $ctx1.sendIdx["assert:"]=4;
  6846. $9=(1)._yourself();
  6847. $ctx1.sendIdx["yourself"]=3;
  6848. $8=_st($9).__eq((1)._yourself());
  6849. $ctx1.sendIdx["="]=6;
  6850. self._assert_($8);
  6851. $10=(0).__eq(false);
  6852. $ctx1.sendIdx["="]=7;
  6853. self._deny_($10);
  6854. $ctx1.sendIdx["deny:"]=2;
  6855. $11=false.__eq((0));
  6856. $ctx1.sendIdx["="]=8;
  6857. self._deny_($11);
  6858. $ctx1.sendIdx["deny:"]=3;
  6859. $12="".__eq((0));
  6860. $ctx1.sendIdx["="]=9;
  6861. self._deny_($12);
  6862. $ctx1.sendIdx["deny:"]=4;
  6863. self._deny_((0).__eq(""));
  6864. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6865. args: [],
  6866. 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 = ''",
  6867. messageSends: ["assert:", "=", "deny:", "yourself"],
  6868. referencedClasses: []
  6869. }),
  6870. globals.NumberTest);
  6871. smalltalk.addMethod(
  6872. smalltalk.method({
  6873. selector: "testFloor",
  6874. protocol: 'tests',
  6875. fn: function (){
  6876. var self=this;
  6877. return smalltalk.withContext(function($ctx1) {
  6878. var $1,$2;
  6879. $1=(1.2)._floor();
  6880. $ctx1.sendIdx["floor"]=1;
  6881. self._assert_equals_($1,(1));
  6882. $ctx1.sendIdx["assert:equals:"]=1;
  6883. $2=(-1.2)._floor();
  6884. $ctx1.sendIdx["floor"]=2;
  6885. self._assert_equals_($2,(-2));
  6886. $ctx1.sendIdx["assert:equals:"]=2;
  6887. self._assert_equals_((1)._floor(),(1));
  6888. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6889. args: [],
  6890. 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.",
  6891. messageSends: ["assert:equals:", "floor"],
  6892. referencedClasses: []
  6893. }),
  6894. globals.NumberTest);
  6895. smalltalk.addMethod(
  6896. smalltalk.method({
  6897. selector: "testHexNumbers",
  6898. protocol: 'tests',
  6899. fn: function (){
  6900. var self=this;
  6901. return smalltalk.withContext(function($ctx1) {
  6902. var $1,$2,$3,$4,$5;
  6903. self._assert_equals_((9),(9));
  6904. $ctx1.sendIdx["assert:equals:"]=1;
  6905. $1=(10)._truncated();
  6906. $ctx1.sendIdx["truncated"]=1;
  6907. self._assert_equals_($1,(10));
  6908. $ctx1.sendIdx["assert:equals:"]=2;
  6909. $2=(11)._truncated();
  6910. $ctx1.sendIdx["truncated"]=2;
  6911. self._assert_equals_($2,(11));
  6912. $ctx1.sendIdx["assert:equals:"]=3;
  6913. $3=(12)._truncated();
  6914. $ctx1.sendIdx["truncated"]=3;
  6915. self._assert_equals_($3,(12));
  6916. $ctx1.sendIdx["assert:equals:"]=4;
  6917. $4=(13)._truncated();
  6918. $ctx1.sendIdx["truncated"]=4;
  6919. self._assert_equals_($4,(13));
  6920. $ctx1.sendIdx["assert:equals:"]=5;
  6921. $5=(14)._truncated();
  6922. $ctx1.sendIdx["truncated"]=5;
  6923. self._assert_equals_($5,(14));
  6924. $ctx1.sendIdx["assert:equals:"]=6;
  6925. self._assert_equals_((15)._truncated(),(15));
  6926. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6927. args: [],
  6928. 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",
  6929. messageSends: ["assert:equals:", "truncated"],
  6930. referencedClasses: []
  6931. }),
  6932. globals.NumberTest);
  6933. smalltalk.addMethod(
  6934. smalltalk.method({
  6935. selector: "testIdentity",
  6936. protocol: 'tests',
  6937. fn: function (){
  6938. var self=this;
  6939. return smalltalk.withContext(function($ctx1) {
  6940. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6941. $1=(1).__eq_eq((1));
  6942. $ctx1.sendIdx["=="]=1;
  6943. self._assert_($1);
  6944. $ctx1.sendIdx["assert:"]=1;
  6945. $2=(0).__eq_eq((0));
  6946. $ctx1.sendIdx["=="]=2;
  6947. self._assert_($2);
  6948. $ctx1.sendIdx["assert:"]=2;
  6949. $3=(1).__eq_eq((0));
  6950. $ctx1.sendIdx["=="]=3;
  6951. self._deny_($3);
  6952. $ctx1.sendIdx["deny:"]=1;
  6953. $5=(1)._yourself();
  6954. $ctx1.sendIdx["yourself"]=1;
  6955. $4=_st($5).__eq_eq((1));
  6956. $ctx1.sendIdx["=="]=4;
  6957. self._assert_($4);
  6958. $ctx1.sendIdx["assert:"]=3;
  6959. $7=(1)._yourself();
  6960. $ctx1.sendIdx["yourself"]=2;
  6961. $6=(1).__eq_eq($7);
  6962. $ctx1.sendIdx["=="]=5;
  6963. self._assert_($6);
  6964. $ctx1.sendIdx["assert:"]=4;
  6965. $9=(1)._yourself();
  6966. $ctx1.sendIdx["yourself"]=3;
  6967. $8=_st($9).__eq_eq((1)._yourself());
  6968. $ctx1.sendIdx["=="]=6;
  6969. self._assert_($8);
  6970. self._deny_((1).__eq_eq((2)));
  6971. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6972. args: [],
  6973. 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",
  6974. messageSends: ["assert:", "==", "deny:", "yourself"],
  6975. referencedClasses: []
  6976. }),
  6977. globals.NumberTest);
  6978. smalltalk.addMethod(
  6979. smalltalk.method({
  6980. selector: "testInvalidHexNumbers",
  6981. protocol: 'tests',
  6982. fn: function (){
  6983. var self=this;
  6984. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6985. return smalltalk.withContext(function($ctx1) {
  6986. self._should_raise_((function(){
  6987. return smalltalk.withContext(function($ctx2) {
  6988. return (16)._rG();
  6989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6990. $ctx1.sendIdx["should:raise:"]=1;
  6991. self._should_raise_((function(){
  6992. return smalltalk.withContext(function($ctx2) {
  6993. return (16)._rg();
  6994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6995. $ctx1.sendIdx["should:raise:"]=2;
  6996. self._should_raise_((function(){
  6997. return smalltalk.withContext(function($ctx2) {
  6998. return (16)._rH();
  6999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  7000. $ctx1.sendIdx["should:raise:"]=3;
  7001. self._should_raise_((function(){
  7002. return smalltalk.withContext(function($ctx2) {
  7003. return (16)._rh();
  7004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  7005. $ctx1.sendIdx["should:raise:"]=4;
  7006. self._should_raise_((function(){
  7007. return smalltalk.withContext(function($ctx2) {
  7008. return (16)._rI();
  7009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  7010. $ctx1.sendIdx["should:raise:"]=5;
  7011. self._should_raise_((function(){
  7012. return smalltalk.withContext(function($ctx2) {
  7013. return (16)._ri();
  7014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  7015. $ctx1.sendIdx["should:raise:"]=6;
  7016. self._should_raise_((function(){
  7017. return smalltalk.withContext(function($ctx2) {
  7018. return (16)._rJ();
  7019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  7020. $ctx1.sendIdx["should:raise:"]=7;
  7021. self._should_raise_((function(){
  7022. return smalltalk.withContext(function($ctx2) {
  7023. return (16)._rj();
  7024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  7025. $ctx1.sendIdx["should:raise:"]=8;
  7026. self._should_raise_((function(){
  7027. return smalltalk.withContext(function($ctx2) {
  7028. return (16)._rK();
  7029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  7030. $ctx1.sendIdx["should:raise:"]=9;
  7031. self._should_raise_((function(){
  7032. return smalltalk.withContext(function($ctx2) {
  7033. return (16)._rk();
  7034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  7035. $ctx1.sendIdx["should:raise:"]=10;
  7036. self._should_raise_((function(){
  7037. return smalltalk.withContext(function($ctx2) {
  7038. return (16)._rL();
  7039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  7040. $ctx1.sendIdx["should:raise:"]=11;
  7041. self._should_raise_((function(){
  7042. return smalltalk.withContext(function($ctx2) {
  7043. return (16)._rl();
  7044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  7045. $ctx1.sendIdx["should:raise:"]=12;
  7046. self._should_raise_((function(){
  7047. return smalltalk.withContext(function($ctx2) {
  7048. return (16)._rM();
  7049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  7050. $ctx1.sendIdx["should:raise:"]=13;
  7051. self._should_raise_((function(){
  7052. return smalltalk.withContext(function($ctx2) {
  7053. return (16)._rm();
  7054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  7055. $ctx1.sendIdx["should:raise:"]=14;
  7056. self._should_raise_((function(){
  7057. return smalltalk.withContext(function($ctx2) {
  7058. return (16)._rN();
  7059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  7060. $ctx1.sendIdx["should:raise:"]=15;
  7061. self._should_raise_((function(){
  7062. return smalltalk.withContext(function($ctx2) {
  7063. return (16)._rn();
  7064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  7065. $ctx1.sendIdx["should:raise:"]=16;
  7066. self._should_raise_((function(){
  7067. return smalltalk.withContext(function($ctx2) {
  7068. return (16)._rO();
  7069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  7070. $ctx1.sendIdx["should:raise:"]=17;
  7071. self._should_raise_((function(){
  7072. return smalltalk.withContext(function($ctx2) {
  7073. return (16)._ro();
  7074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  7075. $ctx1.sendIdx["should:raise:"]=18;
  7076. self._should_raise_((function(){
  7077. return smalltalk.withContext(function($ctx2) {
  7078. return (16)._rP();
  7079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  7080. $ctx1.sendIdx["should:raise:"]=19;
  7081. self._should_raise_((function(){
  7082. return smalltalk.withContext(function($ctx2) {
  7083. return (16)._rp();
  7084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  7085. $ctx1.sendIdx["should:raise:"]=20;
  7086. self._should_raise_((function(){
  7087. return smalltalk.withContext(function($ctx2) {
  7088. return (16)._rQ();
  7089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  7090. $ctx1.sendIdx["should:raise:"]=21;
  7091. self._should_raise_((function(){
  7092. return smalltalk.withContext(function($ctx2) {
  7093. return (16)._rq();
  7094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  7095. $ctx1.sendIdx["should:raise:"]=22;
  7096. self._should_raise_((function(){
  7097. return smalltalk.withContext(function($ctx2) {
  7098. return (16)._rR();
  7099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  7100. $ctx1.sendIdx["should:raise:"]=23;
  7101. self._should_raise_((function(){
  7102. return smalltalk.withContext(function($ctx2) {
  7103. return (16)._rr();
  7104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  7105. $ctx1.sendIdx["should:raise:"]=24;
  7106. self._should_raise_((function(){
  7107. return smalltalk.withContext(function($ctx2) {
  7108. return (16)._rS();
  7109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  7110. $ctx1.sendIdx["should:raise:"]=25;
  7111. self._should_raise_((function(){
  7112. return smalltalk.withContext(function($ctx2) {
  7113. return (16)._rs();
  7114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  7115. $ctx1.sendIdx["should:raise:"]=26;
  7116. self._should_raise_((function(){
  7117. return smalltalk.withContext(function($ctx2) {
  7118. return (16)._rT();
  7119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  7120. $ctx1.sendIdx["should:raise:"]=27;
  7121. self._should_raise_((function(){
  7122. return smalltalk.withContext(function($ctx2) {
  7123. return (16)._rt();
  7124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  7125. $ctx1.sendIdx["should:raise:"]=28;
  7126. self._should_raise_((function(){
  7127. return smalltalk.withContext(function($ctx2) {
  7128. return (16)._rU();
  7129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  7130. $ctx1.sendIdx["should:raise:"]=29;
  7131. self._should_raise_((function(){
  7132. return smalltalk.withContext(function($ctx2) {
  7133. return (16)._ru();
  7134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  7135. $ctx1.sendIdx["should:raise:"]=30;
  7136. self._should_raise_((function(){
  7137. return smalltalk.withContext(function($ctx2) {
  7138. return (16)._rV();
  7139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  7140. $ctx1.sendIdx["should:raise:"]=31;
  7141. self._should_raise_((function(){
  7142. return smalltalk.withContext(function($ctx2) {
  7143. return (16)._rv();
  7144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  7145. $ctx1.sendIdx["should:raise:"]=32;
  7146. self._should_raise_((function(){
  7147. return smalltalk.withContext(function($ctx2) {
  7148. return (16)._rW();
  7149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  7150. $ctx1.sendIdx["should:raise:"]=33;
  7151. self._should_raise_((function(){
  7152. return smalltalk.withContext(function($ctx2) {
  7153. return (16)._rw();
  7154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  7155. $ctx1.sendIdx["should:raise:"]=34;
  7156. self._should_raise_((function(){
  7157. return smalltalk.withContext(function($ctx2) {
  7158. return (16)._rX();
  7159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  7160. $ctx1.sendIdx["should:raise:"]=35;
  7161. self._should_raise_((function(){
  7162. return smalltalk.withContext(function($ctx2) {
  7163. return (16)._rx();
  7164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  7165. $ctx1.sendIdx["should:raise:"]=36;
  7166. self._should_raise_((function(){
  7167. return smalltalk.withContext(function($ctx2) {
  7168. return (16)._rY();
  7169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7170. $ctx1.sendIdx["should:raise:"]=37;
  7171. self._should_raise_((function(){
  7172. return smalltalk.withContext(function($ctx2) {
  7173. return (16)._ry();
  7174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7175. $ctx1.sendIdx["should:raise:"]=38;
  7176. self._should_raise_((function(){
  7177. return smalltalk.withContext(function($ctx2) {
  7178. return (16)._rZ();
  7179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7180. $ctx1.sendIdx["should:raise:"]=39;
  7181. self._should_raise_((function(){
  7182. return smalltalk.withContext(function($ctx2) {
  7183. return (16)._rz();
  7184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7185. $ctx1.sendIdx["should:raise:"]=40;
  7186. self._should_raise_((function(){
  7187. return smalltalk.withContext(function($ctx2) {
  7188. return (11259375)._Z();
  7189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7190. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  7191. args: [],
  7192. 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.",
  7193. 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"],
  7194. referencedClasses: ["MessageNotUnderstood"]
  7195. }),
  7196. globals.NumberTest);
  7197. smalltalk.addMethod(
  7198. smalltalk.method({
  7199. selector: "testLog",
  7200. protocol: 'tests',
  7201. fn: function (){
  7202. var self=this;
  7203. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7204. return smalltalk.withContext(function($ctx1) {
  7205. self._assert_equals_((10000)._log(),(4));
  7206. $ctx1.sendIdx["assert:equals:"]=1;
  7207. self._assert_equals_((512)._log_((2)),(9));
  7208. $ctx1.sendIdx["assert:equals:"]=2;
  7209. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7210. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  7211. args: [],
  7212. 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.",
  7213. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7214. referencedClasses: ["Number"]
  7215. }),
  7216. globals.NumberTest);
  7217. smalltalk.addMethod(
  7218. smalltalk.method({
  7219. selector: "testMinMax",
  7220. protocol: 'tests',
  7221. fn: function (){
  7222. var self=this;
  7223. return smalltalk.withContext(function($ctx1) {
  7224. self._assert_equals_((2)._max_((5)),(5));
  7225. $ctx1.sendIdx["assert:equals:"]=1;
  7226. self._assert_equals_((2)._min_((5)),(2));
  7227. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7228. args: [],
  7229. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7230. messageSends: ["assert:equals:", "max:", "min:"],
  7231. referencedClasses: []
  7232. }),
  7233. globals.NumberTest);
  7234. smalltalk.addMethod(
  7235. smalltalk.method({
  7236. selector: "testNegated",
  7237. protocol: 'tests',
  7238. fn: function (){
  7239. var self=this;
  7240. return smalltalk.withContext(function($ctx1) {
  7241. var $1;
  7242. $1=(3)._negated();
  7243. $ctx1.sendIdx["negated"]=1;
  7244. self._assert_equals_($1,(-3));
  7245. $ctx1.sendIdx["assert:equals:"]=1;
  7246. self._assert_equals_((-3)._negated(),(3));
  7247. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7248. args: [],
  7249. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7250. messageSends: ["assert:equals:", "negated"],
  7251. referencedClasses: []
  7252. }),
  7253. globals.NumberTest);
  7254. smalltalk.addMethod(
  7255. smalltalk.method({
  7256. selector: "testPrintShowingDecimalPlaces",
  7257. protocol: 'tests',
  7258. fn: function (){
  7259. var self=this;
  7260. return smalltalk.withContext(function($ctx1) {
  7261. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7262. $1=(23)._printShowingDecimalPlaces_((2));
  7263. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7264. self._assert_equals_($1,"23.00");
  7265. $ctx1.sendIdx["assert:equals:"]=1;
  7266. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7267. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7268. self._assert_equals_($2,"23.57");
  7269. $ctx1.sendIdx["assert:equals:"]=2;
  7270. $4=(234.567)._negated();
  7271. $ctx1.sendIdx["negated"]=1;
  7272. $3=_st($4)._printShowingDecimalPlaces_((5));
  7273. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7274. self._assert_equals_($3,"-234.56700");
  7275. $ctx1.sendIdx["assert:equals:"]=3;
  7276. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7277. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7278. self._assert_equals_($5,"23");
  7279. $ctx1.sendIdx["assert:equals:"]=4;
  7280. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7281. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7282. self._assert_equals_($6,"24");
  7283. $ctx1.sendIdx["assert:equals:"]=5;
  7284. $8=(23.4567)._negated();
  7285. $ctx1.sendIdx["negated"]=2;
  7286. $7=_st($8)._printShowingDecimalPlaces_((0));
  7287. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7288. self._assert_equals_($7,"-23");
  7289. $ctx1.sendIdx["assert:equals:"]=6;
  7290. $10=(23.5567)._negated();
  7291. $ctx1.sendIdx["negated"]=3;
  7292. $9=_st($10)._printShowingDecimalPlaces_((0));
  7293. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7294. self._assert_equals_($9,"-24");
  7295. $ctx1.sendIdx["assert:equals:"]=7;
  7296. $11=(100000000)._printShowingDecimalPlaces_((1));
  7297. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7298. self._assert_equals_($11,"100000000.0");
  7299. $ctx1.sendIdx["assert:equals:"]=8;
  7300. $12=(0.98)._printShowingDecimalPlaces_((5));
  7301. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7302. self._assert_equals_($12,"0.98000");
  7303. $ctx1.sendIdx["assert:equals:"]=9;
  7304. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7305. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7306. self._assert_equals_($13,"-0.98");
  7307. $ctx1.sendIdx["assert:equals:"]=10;
  7308. $14=(2.567)._printShowingDecimalPlaces_((2));
  7309. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7310. self._assert_equals_($14,"2.57");
  7311. $ctx1.sendIdx["assert:equals:"]=11;
  7312. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7313. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7314. self._assert_equals_($15,"-2.57");
  7315. $ctx1.sendIdx["assert:equals:"]=12;
  7316. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7317. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7318. args: [],
  7319. 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'.",
  7320. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7321. referencedClasses: []
  7322. }),
  7323. globals.NumberTest);
  7324. smalltalk.addMethod(
  7325. smalltalk.method({
  7326. selector: "testRaisedTo",
  7327. protocol: 'tests',
  7328. fn: function (){
  7329. var self=this;
  7330. return smalltalk.withContext(function($ctx1) {
  7331. var $1,$2,$3;
  7332. $1=(2)._raisedTo_((4));
  7333. $ctx1.sendIdx["raisedTo:"]=1;
  7334. self._assert_equals_($1,(16));
  7335. $ctx1.sendIdx["assert:equals:"]=1;
  7336. $2=(2)._raisedTo_((0));
  7337. $ctx1.sendIdx["raisedTo:"]=2;
  7338. self._assert_equals_($2,(1));
  7339. $ctx1.sendIdx["assert:equals:"]=2;
  7340. $3=(2)._raisedTo_((-3));
  7341. $ctx1.sendIdx["raisedTo:"]=3;
  7342. self._assert_equals_($3,(0.125));
  7343. $ctx1.sendIdx["assert:equals:"]=3;
  7344. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7345. $ctx1.sendIdx["assert:equals:"]=4;
  7346. self._assert_equals_((2).__star_star((4)),(16));
  7347. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7348. args: [],
  7349. 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.",
  7350. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7351. referencedClasses: []
  7352. }),
  7353. globals.NumberTest);
  7354. smalltalk.addMethod(
  7355. smalltalk.method({
  7356. selector: "testRounded",
  7357. protocol: 'tests',
  7358. fn: function (){
  7359. var self=this;
  7360. return smalltalk.withContext(function($ctx1) {
  7361. var $1,$2;
  7362. $1=(3)._rounded();
  7363. $ctx1.sendIdx["rounded"]=1;
  7364. self._assert_equals_($1,(3));
  7365. $ctx1.sendIdx["assert:equals:"]=1;
  7366. $2=(3.212)._rounded();
  7367. $ctx1.sendIdx["rounded"]=2;
  7368. self._assert_equals_($2,(3));
  7369. $ctx1.sendIdx["assert:equals:"]=2;
  7370. self._assert_equals_((3.51)._rounded(),(4));
  7371. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7372. args: [],
  7373. 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",
  7374. messageSends: ["assert:equals:", "rounded"],
  7375. referencedClasses: []
  7376. }),
  7377. globals.NumberTest);
  7378. smalltalk.addMethod(
  7379. smalltalk.method({
  7380. selector: "testSign",
  7381. protocol: 'tests',
  7382. fn: function (){
  7383. var self=this;
  7384. return smalltalk.withContext(function($ctx1) {
  7385. var $1,$2;
  7386. $1=(5)._sign();
  7387. $ctx1.sendIdx["sign"]=1;
  7388. self._assert_equals_($1,(1));
  7389. $ctx1.sendIdx["assert:equals:"]=1;
  7390. $2=(0)._sign();
  7391. $ctx1.sendIdx["sign"]=2;
  7392. self._assert_equals_($2,(0));
  7393. $ctx1.sendIdx["assert:equals:"]=2;
  7394. self._assert_equals_((-1.4)._sign(),(-1));
  7395. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7396. args: [],
  7397. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7398. messageSends: ["assert:equals:", "sign"],
  7399. referencedClasses: []
  7400. }),
  7401. globals.NumberTest);
  7402. smalltalk.addMethod(
  7403. smalltalk.method({
  7404. selector: "testSqrt",
  7405. protocol: 'tests',
  7406. fn: function (){
  7407. var self=this;
  7408. return smalltalk.withContext(function($ctx1) {
  7409. var $1;
  7410. $1=(4)._sqrt();
  7411. $ctx1.sendIdx["sqrt"]=1;
  7412. self._assert_equals_($1,(2));
  7413. $ctx1.sendIdx["assert:equals:"]=1;
  7414. self._assert_equals_((16)._sqrt(),(4));
  7415. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7416. args: [],
  7417. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7418. messageSends: ["assert:equals:", "sqrt"],
  7419. referencedClasses: []
  7420. }),
  7421. globals.NumberTest);
  7422. smalltalk.addMethod(
  7423. smalltalk.method({
  7424. selector: "testSquared",
  7425. protocol: 'tests',
  7426. fn: function (){
  7427. var self=this;
  7428. return smalltalk.withContext(function($ctx1) {
  7429. self._assert_equals_((4)._squared(),(16));
  7430. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7431. args: [],
  7432. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7433. messageSends: ["assert:equals:", "squared"],
  7434. referencedClasses: []
  7435. }),
  7436. globals.NumberTest);
  7437. smalltalk.addMethod(
  7438. smalltalk.method({
  7439. selector: "testTimesRepeat",
  7440. protocol: 'tests',
  7441. fn: function (){
  7442. var self=this;
  7443. var i;
  7444. return smalltalk.withContext(function($ctx1) {
  7445. i=(0);
  7446. (0)._timesRepeat_((function(){
  7447. return smalltalk.withContext(function($ctx2) {
  7448. i=_st(i).__plus((1));
  7449. $ctx2.sendIdx["+"]=1;
  7450. return i;
  7451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7452. $ctx1.sendIdx["timesRepeat:"]=1;
  7453. self._assert_equals_(i,(0));
  7454. $ctx1.sendIdx["assert:equals:"]=1;
  7455. (5)._timesRepeat_((function(){
  7456. return smalltalk.withContext(function($ctx2) {
  7457. i=_st(i).__plus((1));
  7458. return i;
  7459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7460. self._assert_equals_(i,(5));
  7461. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7462. args: [],
  7463. 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",
  7464. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7465. referencedClasses: []
  7466. }),
  7467. globals.NumberTest);
  7468. smalltalk.addMethod(
  7469. smalltalk.method({
  7470. selector: "testTo",
  7471. protocol: 'tests',
  7472. fn: function (){
  7473. var self=this;
  7474. return smalltalk.withContext(function($ctx1) {
  7475. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7476. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7477. args: [],
  7478. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7479. messageSends: ["assert:equals:", "to:"],
  7480. referencedClasses: []
  7481. }),
  7482. globals.NumberTest);
  7483. smalltalk.addMethod(
  7484. smalltalk.method({
  7485. selector: "testToBy",
  7486. protocol: 'tests',
  7487. fn: function (){
  7488. var self=this;
  7489. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7490. return smalltalk.withContext(function($ctx1) {
  7491. var $1;
  7492. $1=(0)._to_by_((6),(2));
  7493. $ctx1.sendIdx["to:by:"]=1;
  7494. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7495. self._should_raise_((function(){
  7496. return smalltalk.withContext(function($ctx2) {
  7497. return (1)._to_by_((4),(0));
  7498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7499. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7500. args: [],
  7501. 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",
  7502. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7503. referencedClasses: ["Error"]
  7504. }),
  7505. globals.NumberTest);
  7506. smalltalk.addMethod(
  7507. smalltalk.method({
  7508. selector: "testTrigonometry",
  7509. protocol: 'tests',
  7510. fn: function (){
  7511. var self=this;
  7512. return smalltalk.withContext(function($ctx1) {
  7513. self._assert_equals_((0)._cos(),(1));
  7514. $ctx1.sendIdx["assert:equals:"]=1;
  7515. self._assert_equals_((0)._sin(),(0));
  7516. $ctx1.sendIdx["assert:equals:"]=2;
  7517. self._assert_equals_((0)._tan(),(0));
  7518. $ctx1.sendIdx["assert:equals:"]=3;
  7519. self._assert_equals_((1)._arcCos(),(0));
  7520. $ctx1.sendIdx["assert:equals:"]=4;
  7521. self._assert_equals_((0)._arcSin(),(0));
  7522. $ctx1.sendIdx["assert:equals:"]=5;
  7523. self._assert_equals_((0)._arcTan(),(0));
  7524. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7525. args: [],
  7526. 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.",
  7527. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7528. referencedClasses: []
  7529. }),
  7530. globals.NumberTest);
  7531. smalltalk.addMethod(
  7532. smalltalk.method({
  7533. selector: "testTruncated",
  7534. protocol: 'tests',
  7535. fn: function (){
  7536. var self=this;
  7537. return smalltalk.withContext(function($ctx1) {
  7538. var $1,$2;
  7539. $1=(3)._truncated();
  7540. $ctx1.sendIdx["truncated"]=1;
  7541. self._assert_equals_($1,(3));
  7542. $ctx1.sendIdx["assert:equals:"]=1;
  7543. $2=(3.212)._truncated();
  7544. $ctx1.sendIdx["truncated"]=2;
  7545. self._assert_equals_($2,(3));
  7546. $ctx1.sendIdx["assert:equals:"]=2;
  7547. self._assert_equals_((3.51)._truncated(),(3));
  7548. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7549. args: [],
  7550. 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",
  7551. messageSends: ["assert:equals:", "truncated"],
  7552. referencedClasses: []
  7553. }),
  7554. globals.NumberTest);
  7555. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7556. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7557. smalltalk.addMethod(
  7558. smalltalk.method({
  7559. selector: "foo",
  7560. protocol: 'not yet classified',
  7561. fn: function (){
  7562. var self=this;
  7563. var $1;
  7564. $1=self["@foo"];
  7565. return $1;
  7566. },
  7567. args: [],
  7568. source: "foo\x0a\x09^ foo",
  7569. messageSends: [],
  7570. referencedClasses: []
  7571. }),
  7572. globals.ObjectMock);
  7573. smalltalk.addMethod(
  7574. smalltalk.method({
  7575. selector: "foo:",
  7576. protocol: 'not yet classified',
  7577. fn: function (anObject){
  7578. var self=this;
  7579. self["@foo"]=anObject;
  7580. return self},
  7581. args: ["anObject"],
  7582. source: "foo: anObject\x0a\x09foo := anObject",
  7583. messageSends: [],
  7584. referencedClasses: []
  7585. }),
  7586. globals.ObjectMock);
  7587. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7588. smalltalk.addMethod(
  7589. smalltalk.method({
  7590. selector: "notDefined",
  7591. protocol: 'tests',
  7592. fn: function (){
  7593. var self=this;
  7594. return smalltalk.withContext(function($ctx1) {
  7595. return void 0;;
  7596. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7597. args: [],
  7598. source: "notDefined\x0a\x09<return void 0;>",
  7599. messageSends: [],
  7600. referencedClasses: []
  7601. }),
  7602. globals.ObjectTest);
  7603. smalltalk.addMethod(
  7604. smalltalk.method({
  7605. selector: "testBasicAccess",
  7606. protocol: 'tests',
  7607. fn: function (){
  7608. var self=this;
  7609. var o;
  7610. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7611. return smalltalk.withContext(function($ctx1) {
  7612. var $1;
  7613. o=_st($Object())._new();
  7614. _st(o)._basicAt_put_("a",(1));
  7615. $1=_st(o)._basicAt_("a");
  7616. $ctx1.sendIdx["basicAt:"]=1;
  7617. self._assert_equals_($1,(1));
  7618. $ctx1.sendIdx["assert:equals:"]=1;
  7619. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7620. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7621. args: [],
  7622. 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",
  7623. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7624. referencedClasses: ["Object"]
  7625. }),
  7626. globals.ObjectTest);
  7627. smalltalk.addMethod(
  7628. smalltalk.method({
  7629. selector: "testBasicPerform",
  7630. protocol: 'tests',
  7631. fn: function (){
  7632. var self=this;
  7633. var o;
  7634. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7635. return smalltalk.withContext(function($ctx1) {
  7636. o=_st($Object())._new();
  7637. _st(o)._basicAt_put_("func",(function(){
  7638. return "hello";
  7639. }));
  7640. $ctx1.sendIdx["basicAt:put:"]=1;
  7641. _st(o)._basicAt_put_("func2",(function(a){
  7642. return smalltalk.withContext(function($ctx2) {
  7643. return _st(a).__plus((1));
  7644. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7645. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7646. $ctx1.sendIdx["assert:equals:"]=1;
  7647. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7648. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7649. args: [],
  7650. 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",
  7651. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7652. referencedClasses: ["Object"]
  7653. }),
  7654. globals.ObjectTest);
  7655. smalltalk.addMethod(
  7656. smalltalk.method({
  7657. selector: "testDNU",
  7658. protocol: 'tests',
  7659. fn: function (){
  7660. var self=this;
  7661. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7662. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7663. return smalltalk.withContext(function($ctx1) {
  7664. self._should_raise_((function(){
  7665. return smalltalk.withContext(function($ctx2) {
  7666. return _st(_st($Object())._new())._foo();
  7667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7668. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7669. args: [],
  7670. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7671. messageSends: ["should:raise:", "foo", "new"],
  7672. referencedClasses: ["Object", "MessageNotUnderstood"]
  7673. }),
  7674. globals.ObjectTest);
  7675. smalltalk.addMethod(
  7676. smalltalk.method({
  7677. selector: "testEquality",
  7678. protocol: 'tests',
  7679. fn: function (){
  7680. var self=this;
  7681. var o;
  7682. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7683. return smalltalk.withContext(function($ctx1) {
  7684. var $1,$2,$4,$3;
  7685. o=_st($Object())._new();
  7686. $ctx1.sendIdx["new"]=1;
  7687. $1=_st(o).__eq(_st($Object())._new());
  7688. $ctx1.sendIdx["="]=1;
  7689. self._deny_($1);
  7690. $2=_st(o).__eq(o);
  7691. $ctx1.sendIdx["="]=2;
  7692. self._assert_($2);
  7693. $ctx1.sendIdx["assert:"]=1;
  7694. $4=_st(o)._yourself();
  7695. $ctx1.sendIdx["yourself"]=1;
  7696. $3=_st($4).__eq(o);
  7697. $ctx1.sendIdx["="]=3;
  7698. self._assert_($3);
  7699. $ctx1.sendIdx["assert:"]=2;
  7700. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7701. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7702. args: [],
  7703. 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)",
  7704. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7705. referencedClasses: ["Object"]
  7706. }),
  7707. globals.ObjectTest);
  7708. smalltalk.addMethod(
  7709. smalltalk.method({
  7710. selector: "testHalt",
  7711. protocol: 'tests',
  7712. fn: function (){
  7713. var self=this;
  7714. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7715. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7716. return smalltalk.withContext(function($ctx1) {
  7717. self._should_raise_((function(){
  7718. return smalltalk.withContext(function($ctx2) {
  7719. return _st(_st($Object())._new())._halt();
  7720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7721. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7722. args: [],
  7723. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7724. messageSends: ["should:raise:", "halt", "new"],
  7725. referencedClasses: ["Object", "Error"]
  7726. }),
  7727. globals.ObjectTest);
  7728. smalltalk.addMethod(
  7729. smalltalk.method({
  7730. selector: "testIdentity",
  7731. protocol: 'tests',
  7732. fn: function (){
  7733. var self=this;
  7734. var o;
  7735. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7736. return smalltalk.withContext(function($ctx1) {
  7737. var $1,$2,$4,$3;
  7738. o=_st($Object())._new();
  7739. $ctx1.sendIdx["new"]=1;
  7740. $1=_st(o).__eq_eq(_st($Object())._new());
  7741. $ctx1.sendIdx["=="]=1;
  7742. self._deny_($1);
  7743. $2=_st(o).__eq_eq(o);
  7744. $ctx1.sendIdx["=="]=2;
  7745. self._assert_($2);
  7746. $ctx1.sendIdx["assert:"]=1;
  7747. $4=_st(o)._yourself();
  7748. $ctx1.sendIdx["yourself"]=1;
  7749. $3=_st($4).__eq_eq(o);
  7750. $ctx1.sendIdx["=="]=3;
  7751. self._assert_($3);
  7752. $ctx1.sendIdx["assert:"]=2;
  7753. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7754. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7755. args: [],
  7756. 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",
  7757. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7758. referencedClasses: ["Object"]
  7759. }),
  7760. globals.ObjectTest);
  7761. smalltalk.addMethod(
  7762. smalltalk.method({
  7763. selector: "testIfNil",
  7764. protocol: 'tests',
  7765. fn: function (){
  7766. var self=this;
  7767. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7768. return smalltalk.withContext(function($ctx1) {
  7769. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7770. $2=_st($Object())._new();
  7771. $ctx1.sendIdx["new"]=1;
  7772. $1=_st($2)._isNil();
  7773. self._deny_($1);
  7774. $ctx1.sendIdx["deny:"]=1;
  7775. $5=_st($Object())._new();
  7776. $ctx1.sendIdx["new"]=2;
  7777. if(($receiver = $5) == null || $receiver.isNil){
  7778. $4=true;
  7779. } else {
  7780. $4=$5;
  7781. };
  7782. $3=_st($4).__eq(true);
  7783. self._deny_($3);
  7784. $7=_st($Object())._new();
  7785. $ctx1.sendIdx["new"]=3;
  7786. if(($receiver = $7) == null || $receiver.isNil){
  7787. $6=$7;
  7788. } else {
  7789. $6=true;
  7790. };
  7791. self._assert_equals_($6,true);
  7792. $ctx1.sendIdx["assert:equals:"]=1;
  7793. $9=_st($Object())._new();
  7794. $ctx1.sendIdx["new"]=4;
  7795. if(($receiver = $9) == null || $receiver.isNil){
  7796. $8=false;
  7797. } else {
  7798. $8=true;
  7799. };
  7800. self._assert_equals_($8,true);
  7801. $ctx1.sendIdx["assert:equals:"]=2;
  7802. $11=_st($Object())._new();
  7803. if(($receiver = $11) == null || $receiver.isNil){
  7804. $10=false;
  7805. } else {
  7806. $10=true;
  7807. };
  7808. self._assert_equals_($10,true);
  7809. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7810. args: [],
  7811. 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",
  7812. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7813. referencedClasses: ["Object"]
  7814. }),
  7815. globals.ObjectTest);
  7816. smalltalk.addMethod(
  7817. smalltalk.method({
  7818. selector: "testInstVars",
  7819. protocol: 'tests',
  7820. fn: function (){
  7821. var self=this;
  7822. var o;
  7823. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7824. return smalltalk.withContext(function($ctx1) {
  7825. var $1,$2;
  7826. o=_st($ObjectMock())._new();
  7827. $1=_st(o)._instVarAt_("foo");
  7828. $ctx1.sendIdx["instVarAt:"]=1;
  7829. self._assert_equals_($1,nil);
  7830. $ctx1.sendIdx["assert:equals:"]=1;
  7831. _st(o)._instVarAt_put_("foo",(1));
  7832. $2=_st(o)._instVarAt_("foo");
  7833. $ctx1.sendIdx["instVarAt:"]=2;
  7834. self._assert_equals_($2,(1));
  7835. $ctx1.sendIdx["assert:equals:"]=2;
  7836. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7837. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7838. args: [],
  7839. 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",
  7840. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7841. referencedClasses: ["ObjectMock"]
  7842. }),
  7843. globals.ObjectTest);
  7844. smalltalk.addMethod(
  7845. smalltalk.method({
  7846. selector: "testNilUndefined",
  7847. protocol: 'tests',
  7848. fn: function (){
  7849. var self=this;
  7850. return smalltalk.withContext(function($ctx1) {
  7851. self._assert_equals_(self._notDefined(),nil);
  7852. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7853. args: [],
  7854. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7855. messageSends: ["assert:equals:", "notDefined"],
  7856. referencedClasses: []
  7857. }),
  7858. globals.ObjectTest);
  7859. smalltalk.addMethod(
  7860. smalltalk.method({
  7861. selector: "testYourself",
  7862. protocol: 'tests',
  7863. fn: function (){
  7864. var self=this;
  7865. var o;
  7866. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7867. return smalltalk.withContext(function($ctx1) {
  7868. o=_st($ObjectMock())._new();
  7869. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7870. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7871. args: [],
  7872. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7873. messageSends: ["new", "assert:", "==", "yourself"],
  7874. referencedClasses: ["ObjectMock"]
  7875. }),
  7876. globals.ObjectTest);
  7877. smalltalk.addMethod(
  7878. smalltalk.method({
  7879. selector: "testidentityHash",
  7880. protocol: 'tests',
  7881. fn: function (){
  7882. var self=this;
  7883. var o1,o2;
  7884. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7885. return smalltalk.withContext(function($ctx1) {
  7886. var $2,$3,$1,$5,$4;
  7887. o1=_st($Object())._new();
  7888. $ctx1.sendIdx["new"]=1;
  7889. o2=_st($Object())._new();
  7890. $2=_st(o1)._identityHash();
  7891. $ctx1.sendIdx["identityHash"]=1;
  7892. $3=_st(o1)._identityHash();
  7893. $ctx1.sendIdx["identityHash"]=2;
  7894. $1=_st($2).__eq_eq($3);
  7895. $ctx1.sendIdx["=="]=1;
  7896. self._assert_($1);
  7897. $5=_st(o1)._identityHash();
  7898. $ctx1.sendIdx["identityHash"]=3;
  7899. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7900. self._deny_($4);
  7901. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7902. args: [],
  7903. 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",
  7904. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7905. referencedClasses: ["Object"]
  7906. }),
  7907. globals.ObjectTest);
  7908. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7909. smalltalk.addMethod(
  7910. smalltalk.method({
  7911. selector: "testAccessing",
  7912. protocol: 'tests',
  7913. fn: function (){
  7914. var self=this;
  7915. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7916. return smalltalk.withContext(function($ctx1) {
  7917. var $2,$1,$3,$6,$5,$4;
  7918. $2=_st($Point())._x_y_((3),(4));
  7919. $ctx1.sendIdx["x:y:"]=1;
  7920. $1=_st($2)._x();
  7921. $ctx1.sendIdx["x"]=1;
  7922. self._assert_equals_($1,(3));
  7923. $ctx1.sendIdx["assert:equals:"]=1;
  7924. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7925. $ctx1.sendIdx["y"]=1;
  7926. self._assert_equals_($3,(4));
  7927. $ctx1.sendIdx["assert:equals:"]=2;
  7928. $6=_st($Point())._new();
  7929. $ctx1.sendIdx["new"]=1;
  7930. $5=_st($6)._x_((3));
  7931. $4=_st($5)._x();
  7932. self._assert_equals_($4,(3));
  7933. $ctx1.sendIdx["assert:equals:"]=3;
  7934. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7935. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7936. args: [],
  7937. 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",
  7938. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7939. referencedClasses: ["Point"]
  7940. }),
  7941. globals.PointTest);
  7942. smalltalk.addMethod(
  7943. smalltalk.method({
  7944. selector: "testArithmetic",
  7945. protocol: 'tests',
  7946. fn: function (){
  7947. var self=this;
  7948. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7949. return smalltalk.withContext(function($ctx1) {
  7950. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7951. $2=(3).__at((4));
  7952. $ctx1.sendIdx["@"]=1;
  7953. $3=(3).__at((4));
  7954. $ctx1.sendIdx["@"]=2;
  7955. $1=_st($2).__star($3);
  7956. $4=_st($Point())._x_y_((9),(16));
  7957. $ctx1.sendIdx["x:y:"]=1;
  7958. self._assert_equals_($1,$4);
  7959. $ctx1.sendIdx["assert:equals:"]=1;
  7960. $6=(3).__at((4));
  7961. $ctx1.sendIdx["@"]=3;
  7962. $7=(3).__at((4));
  7963. $ctx1.sendIdx["@"]=4;
  7964. $5=_st($6).__plus($7);
  7965. $8=_st($Point())._x_y_((6),(8));
  7966. $ctx1.sendIdx["x:y:"]=2;
  7967. self._assert_equals_($5,$8);
  7968. $ctx1.sendIdx["assert:equals:"]=2;
  7969. $10=(3).__at((4));
  7970. $ctx1.sendIdx["@"]=5;
  7971. $11=(3).__at((4));
  7972. $ctx1.sendIdx["@"]=6;
  7973. $9=_st($10).__minus($11);
  7974. $12=_st($Point())._x_y_((0),(0));
  7975. $ctx1.sendIdx["x:y:"]=3;
  7976. self._assert_equals_($9,$12);
  7977. $ctx1.sendIdx["assert:equals:"]=3;
  7978. $14=(6).__at((8));
  7979. $ctx1.sendIdx["@"]=7;
  7980. $13=_st($14).__slash((3).__at((4)));
  7981. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7982. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7983. args: [],
  7984. 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)",
  7985. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7986. referencedClasses: ["Point"]
  7987. }),
  7988. globals.PointTest);
  7989. smalltalk.addMethod(
  7990. smalltalk.method({
  7991. selector: "testAt",
  7992. protocol: 'tests',
  7993. fn: function (){
  7994. var self=this;
  7995. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7996. return smalltalk.withContext(function($ctx1) {
  7997. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7998. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7999. args: [],
  8000. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  8001. messageSends: ["assert:equals:", "@", "x:y:"],
  8002. referencedClasses: ["Point"]
  8003. }),
  8004. globals.PointTest);
  8005. smalltalk.addMethod(
  8006. smalltalk.method({
  8007. selector: "testComparison",
  8008. protocol: 'tests',
  8009. fn: function (){
  8010. var self=this;
  8011. return smalltalk.withContext(function($ctx1) {
  8012. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  8013. $2=(3).__at((4));
  8014. $ctx1.sendIdx["@"]=1;
  8015. $3=(4).__at((5));
  8016. $ctx1.sendIdx["@"]=2;
  8017. $1=_st($2).__lt($3);
  8018. $ctx1.sendIdx["<"]=1;
  8019. self._assert_($1);
  8020. $ctx1.sendIdx["assert:"]=1;
  8021. $5=(3).__at((4));
  8022. $ctx1.sendIdx["@"]=3;
  8023. $6=(4).__at((4));
  8024. $ctx1.sendIdx["@"]=4;
  8025. $4=_st($5).__lt($6);
  8026. self._deny_($4);
  8027. $ctx1.sendIdx["deny:"]=1;
  8028. $8=(4).__at((5));
  8029. $ctx1.sendIdx["@"]=5;
  8030. $9=(4).__at((5));
  8031. $ctx1.sendIdx["@"]=6;
  8032. $7=_st($8).__lt_eq($9);
  8033. $ctx1.sendIdx["<="]=1;
  8034. self._assert_($7);
  8035. $ctx1.sendIdx["assert:"]=2;
  8036. $11=(4).__at((5));
  8037. $ctx1.sendIdx["@"]=7;
  8038. $12=(3).__at((5));
  8039. $ctx1.sendIdx["@"]=8;
  8040. $10=_st($11).__lt_eq($12);
  8041. self._deny_($10);
  8042. $ctx1.sendIdx["deny:"]=2;
  8043. $14=(5).__at((6));
  8044. $ctx1.sendIdx["@"]=9;
  8045. $15=(4).__at((5));
  8046. $ctx1.sendIdx["@"]=10;
  8047. $13=_st($14).__gt($15);
  8048. $ctx1.sendIdx[">"]=1;
  8049. self._assert_($13);
  8050. $ctx1.sendIdx["assert:"]=3;
  8051. $17=(5).__at((6));
  8052. $ctx1.sendIdx["@"]=11;
  8053. $18=(6).__at((6));
  8054. $ctx1.sendIdx["@"]=12;
  8055. $16=_st($17).__gt($18);
  8056. self._deny_($16);
  8057. $ctx1.sendIdx["deny:"]=3;
  8058. $20=(4).__at((5));
  8059. $ctx1.sendIdx["@"]=13;
  8060. $21=(4).__at((5));
  8061. $ctx1.sendIdx["@"]=14;
  8062. $19=_st($20).__gt_eq($21);
  8063. $ctx1.sendIdx[">="]=1;
  8064. self._assert_($19);
  8065. $23=(4).__at((5));
  8066. $ctx1.sendIdx["@"]=15;
  8067. $22=_st($23).__gt_eq((5).__at((5)));
  8068. self._deny_($22);
  8069. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  8070. args: [],
  8071. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  8072. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  8073. referencedClasses: []
  8074. }),
  8075. globals.PointTest);
  8076. smalltalk.addMethod(
  8077. smalltalk.method({
  8078. selector: "testEgality",
  8079. protocol: 'tests',
  8080. fn: function (){
  8081. var self=this;
  8082. return smalltalk.withContext(function($ctx1) {
  8083. var $2,$3,$1,$5,$4;
  8084. $2=(3).__at((4));
  8085. $ctx1.sendIdx["@"]=1;
  8086. $3=(3).__at((4));
  8087. $ctx1.sendIdx["@"]=2;
  8088. $1=_st($2).__eq($3);
  8089. $ctx1.sendIdx["="]=1;
  8090. self._assert_($1);
  8091. $5=(3).__at((5));
  8092. $ctx1.sendIdx["@"]=3;
  8093. $4=_st($5).__eq((3).__at((6)));
  8094. self._deny_($4);
  8095. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  8096. args: [],
  8097. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  8098. messageSends: ["assert:", "=", "@", "deny:"],
  8099. referencedClasses: []
  8100. }),
  8101. globals.PointTest);
  8102. smalltalk.addMethod(
  8103. smalltalk.method({
  8104. selector: "testNew",
  8105. protocol: 'tests',
  8106. fn: function (){
  8107. var self=this;
  8108. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8109. return smalltalk.withContext(function($ctx1) {
  8110. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  8111. $3=_st($Point())._new();
  8112. $ctx1.sendIdx["new"]=1;
  8113. $2=_st($3)._x_((3));
  8114. $ctx1.sendIdx["x:"]=1;
  8115. $1=_st($2)._y();
  8116. $ctx1.sendIdx["y"]=1;
  8117. self._assert_equals_($1,nil);
  8118. $ctx1.sendIdx["assert:equals:"]=1;
  8119. $7=_st($Point())._new();
  8120. $ctx1.sendIdx["new"]=2;
  8121. $6=_st($7)._x_((3));
  8122. $5=_st($6)._x();
  8123. $ctx1.sendIdx["x"]=1;
  8124. $4=_st($5).__eq((0));
  8125. $ctx1.sendIdx["="]=1;
  8126. self._deny_($4);
  8127. $ctx1.sendIdx["deny:"]=1;
  8128. $10=_st($Point())._new();
  8129. $ctx1.sendIdx["new"]=3;
  8130. $9=_st($10)._y_((4));
  8131. $ctx1.sendIdx["y:"]=1;
  8132. $8=_st($9)._x();
  8133. self._assert_equals_($8,nil);
  8134. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  8135. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  8136. args: [],
  8137. 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",
  8138. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  8139. referencedClasses: ["Point"]
  8140. }),
  8141. globals.PointTest);
  8142. smalltalk.addMethod(
  8143. smalltalk.method({
  8144. selector: "testTranslateBy",
  8145. protocol: 'tests',
  8146. fn: function (){
  8147. var self=this;
  8148. return smalltalk.withContext(function($ctx1) {
  8149. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  8150. $2=(3).__at((3));
  8151. $ctx1.sendIdx["@"]=1;
  8152. $3=(0).__at((1));
  8153. $ctx1.sendIdx["@"]=2;
  8154. $1=_st($2)._translateBy_($3);
  8155. $ctx1.sendIdx["translateBy:"]=1;
  8156. $4=(3).__at((4));
  8157. $ctx1.sendIdx["@"]=3;
  8158. self._assert_equals_($1,$4);
  8159. $ctx1.sendIdx["assert:equals:"]=1;
  8160. $6=(3).__at((3));
  8161. $ctx1.sendIdx["@"]=4;
  8162. $8=(1)._negated();
  8163. $ctx1.sendIdx["negated"]=1;
  8164. $7=(0).__at($8);
  8165. $ctx1.sendIdx["@"]=5;
  8166. $5=_st($6)._translateBy_($7);
  8167. $ctx1.sendIdx["translateBy:"]=2;
  8168. $9=(3).__at((2));
  8169. $ctx1.sendIdx["@"]=6;
  8170. self._assert_equals_($5,$9);
  8171. $ctx1.sendIdx["assert:equals:"]=2;
  8172. $11=(3).__at((3));
  8173. $ctx1.sendIdx["@"]=7;
  8174. $12=(2).__at((3));
  8175. $ctx1.sendIdx["@"]=8;
  8176. $10=_st($11)._translateBy_($12);
  8177. $ctx1.sendIdx["translateBy:"]=3;
  8178. $13=(5).__at((6));
  8179. $ctx1.sendIdx["@"]=9;
  8180. self._assert_equals_($10,$13);
  8181. $ctx1.sendIdx["assert:equals:"]=3;
  8182. $15=(3).__at((3));
  8183. $ctx1.sendIdx["@"]=10;
  8184. $16=_st((3)._negated()).__at((0));
  8185. $ctx1.sendIdx["@"]=11;
  8186. $14=_st($15)._translateBy_($16);
  8187. self._assert_equals_($14,(0).__at((3)));
  8188. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  8189. args: [],
  8190. 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.",
  8191. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  8192. referencedClasses: []
  8193. }),
  8194. globals.PointTest);
  8195. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  8196. smalltalk.addMethod(
  8197. smalltalk.method({
  8198. selector: "testNextIfAbsent",
  8199. protocol: 'tests',
  8200. fn: function (){
  8201. var self=this;
  8202. var queue;
  8203. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8204. return smalltalk.withContext(function($ctx1) {
  8205. var $2,$1;
  8206. queue=_st($Queue())._new();
  8207. _st(queue)._nextPut_("index1");
  8208. $2=_st(queue)._nextIfAbsent_("empty");
  8209. $ctx1.sendIdx["nextIfAbsent:"]=1;
  8210. $1=_st($2).__eq("index1");
  8211. $ctx1.sendIdx["="]=1;
  8212. self._assert_($1);
  8213. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  8214. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  8215. args: [],
  8216. 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'",
  8217. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  8218. referencedClasses: ["Queue"]
  8219. }),
  8220. globals.QueueTest);
  8221. smalltalk.addMethod(
  8222. smalltalk.method({
  8223. selector: "testQueueNext",
  8224. protocol: 'tests',
  8225. fn: function (){
  8226. var self=this;
  8227. var queue;
  8228. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8229. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8230. return smalltalk.withContext(function($ctx1) {
  8231. var $1,$2,$4,$3,$6,$5;
  8232. queue=_st($Queue())._new();
  8233. $1=queue;
  8234. _st($1)._nextPut_("index1");
  8235. $ctx1.sendIdx["nextPut:"]=1;
  8236. $2=_st($1)._nextPut_("index2");
  8237. $4=_st(queue)._next();
  8238. $ctx1.sendIdx["next"]=1;
  8239. $3=_st($4).__eq("index1");
  8240. $ctx1.sendIdx["="]=1;
  8241. self._assert_($3);
  8242. $6=_st(queue)._next();
  8243. $ctx1.sendIdx["next"]=2;
  8244. $5=_st($6).__eq("index");
  8245. self._deny_($5);
  8246. self._should_raise_((function(){
  8247. return smalltalk.withContext(function($ctx2) {
  8248. return _st(queue)._next();
  8249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8250. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  8251. args: [],
  8252. 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",
  8253. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8254. referencedClasses: ["Queue", "Error"]
  8255. }),
  8256. globals.QueueTest);
  8257. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8258. smalltalk.addMethod(
  8259. smalltalk.method({
  8260. selector: "testAtRandomNumber",
  8261. protocol: 'tests',
  8262. fn: function (){
  8263. var self=this;
  8264. var val;
  8265. return smalltalk.withContext(function($ctx1) {
  8266. (100)._timesRepeat_((function(){
  8267. return smalltalk.withContext(function($ctx2) {
  8268. val=(10)._atRandom();
  8269. val;
  8270. self._assert_(_st(val).__gt((0)));
  8271. $ctx2.sendIdx["assert:"]=1;
  8272. return self._assert_(_st(val).__lt((11)));
  8273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8274. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8275. args: [],
  8276. 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]",
  8277. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8278. referencedClasses: []
  8279. }),
  8280. globals.RandomTest);
  8281. smalltalk.addMethod(
  8282. smalltalk.method({
  8283. selector: "testAtRandomSequenceableCollection",
  8284. protocol: 'tests',
  8285. fn: function (){
  8286. var self=this;
  8287. var val;
  8288. return smalltalk.withContext(function($ctx1) {
  8289. var $3,$4,$2,$1;
  8290. (100)._timesRepeat_((function(){
  8291. return smalltalk.withContext(function($ctx2) {
  8292. val="abc"._atRandom();
  8293. val;
  8294. $3=_st(val).__eq("a");
  8295. $ctx2.sendIdx["="]=1;
  8296. $4=_st(val).__eq("b");
  8297. $ctx2.sendIdx["="]=2;
  8298. $2=_st($3).__or($4);
  8299. $1=_st($2).__or(_st(val).__eq("c"));
  8300. $ctx2.sendIdx["|"]=1;
  8301. return self._assert_($1);
  8302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8303. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8304. args: [],
  8305. 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].",
  8306. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8307. referencedClasses: []
  8308. }),
  8309. globals.RandomTest);
  8310. smalltalk.addMethod(
  8311. smalltalk.method({
  8312. selector: "textNext",
  8313. protocol: 'tests',
  8314. fn: function (){
  8315. var self=this;
  8316. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8317. return smalltalk.withContext(function($ctx1) {
  8318. var $1;
  8319. (10000)._timesRepeat_((function(){
  8320. var current,next;
  8321. return smalltalk.withContext(function($ctx2) {
  8322. next=_st(_st($Random())._new())._next();
  8323. next;
  8324. self._assert_(_st(next).__gt_eq((0)));
  8325. $ctx2.sendIdx["assert:"]=1;
  8326. self._assert_(_st(next).__lt((1)));
  8327. $1=_st(current).__eq(next);
  8328. $ctx2.sendIdx["="]=1;
  8329. self._deny_($1);
  8330. return _st(next).__eq(current);
  8331. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8332. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8333. args: [],
  8334. 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 ]",
  8335. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8336. referencedClasses: ["Random"]
  8337. }),
  8338. globals.RandomTest);
  8339. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8340. smalltalk.addMethod(
  8341. smalltalk.method({
  8342. selector: "collectionClass",
  8343. protocol: 'accessing',
  8344. fn: function (){
  8345. var self=this;
  8346. return smalltalk.withContext(function($ctx1) {
  8347. var $1;
  8348. $1=_st(self._class())._collectionClass();
  8349. return $1;
  8350. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8351. args: [],
  8352. source: "collectionClass\x0a\x09^ self class collectionClass",
  8353. messageSends: ["collectionClass", "class"],
  8354. referencedClasses: []
  8355. }),
  8356. globals.StreamTest);
  8357. smalltalk.addMethod(
  8358. smalltalk.method({
  8359. selector: "newCollection",
  8360. protocol: 'accessing',
  8361. fn: function (){
  8362. var self=this;
  8363. return smalltalk.withContext(function($ctx1) {
  8364. var $1;
  8365. $1=_st(self._collectionClass())._new();
  8366. return $1;
  8367. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8368. args: [],
  8369. source: "newCollection\x0a\x09^ self collectionClass new",
  8370. messageSends: ["new", "collectionClass"],
  8371. referencedClasses: []
  8372. }),
  8373. globals.StreamTest);
  8374. smalltalk.addMethod(
  8375. smalltalk.method({
  8376. selector: "newStream",
  8377. protocol: 'accessing',
  8378. fn: function (){
  8379. var self=this;
  8380. return smalltalk.withContext(function($ctx1) {
  8381. var $1;
  8382. $1=_st(_st(self._collectionClass())._new())._stream();
  8383. return $1;
  8384. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8385. args: [],
  8386. source: "newStream\x0a\x09^ self collectionClass new stream",
  8387. messageSends: ["stream", "new", "collectionClass"],
  8388. referencedClasses: []
  8389. }),
  8390. globals.StreamTest);
  8391. smalltalk.addMethod(
  8392. smalltalk.method({
  8393. selector: "testAtStartAtEnd",
  8394. protocol: 'tests',
  8395. fn: function (){
  8396. var self=this;
  8397. var stream;
  8398. return smalltalk.withContext(function($ctx1) {
  8399. var $1,$2,$3,$4;
  8400. stream=self._newStream();
  8401. $1=_st(stream)._atStart();
  8402. $ctx1.sendIdx["atStart"]=1;
  8403. self._assert_($1);
  8404. $ctx1.sendIdx["assert:"]=1;
  8405. $2=_st(stream)._atEnd();
  8406. $ctx1.sendIdx["atEnd"]=1;
  8407. self._assert_($2);
  8408. $ctx1.sendIdx["assert:"]=2;
  8409. _st(stream)._nextPutAll_(self._newCollection());
  8410. $3=_st(stream)._atEnd();
  8411. $ctx1.sendIdx["atEnd"]=2;
  8412. self._assert_($3);
  8413. $4=_st(stream)._atStart();
  8414. $ctx1.sendIdx["atStart"]=2;
  8415. self._deny_($4);
  8416. $ctx1.sendIdx["deny:"]=1;
  8417. _st(stream)._position_((1));
  8418. self._deny_(_st(stream)._atEnd());
  8419. $ctx1.sendIdx["deny:"]=2;
  8420. self._deny_(_st(stream)._atStart());
  8421. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8422. args: [],
  8423. 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",
  8424. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8425. referencedClasses: []
  8426. }),
  8427. globals.StreamTest);
  8428. smalltalk.addMethod(
  8429. smalltalk.method({
  8430. selector: "testContents",
  8431. protocol: 'tests',
  8432. fn: function (){
  8433. var self=this;
  8434. var stream;
  8435. return smalltalk.withContext(function($ctx1) {
  8436. var $1,$2;
  8437. stream=self._newStream();
  8438. $1=stream;
  8439. $2=self._newCollection();
  8440. $ctx1.sendIdx["newCollection"]=1;
  8441. _st($1)._nextPutAll_($2);
  8442. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8443. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8444. args: [],
  8445. 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",
  8446. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8447. referencedClasses: []
  8448. }),
  8449. globals.StreamTest);
  8450. smalltalk.addMethod(
  8451. smalltalk.method({
  8452. selector: "testIsEmpty",
  8453. protocol: 'tests',
  8454. fn: function (){
  8455. var self=this;
  8456. var stream;
  8457. return smalltalk.withContext(function($ctx1) {
  8458. var $1;
  8459. stream=self._newStream();
  8460. $1=_st(stream)._isEmpty();
  8461. $ctx1.sendIdx["isEmpty"]=1;
  8462. self._assert_($1);
  8463. _st(stream)._nextPutAll_(self._newCollection());
  8464. self._deny_(_st(stream)._isEmpty());
  8465. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8466. args: [],
  8467. 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",
  8468. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8469. referencedClasses: []
  8470. }),
  8471. globals.StreamTest);
  8472. smalltalk.addMethod(
  8473. smalltalk.method({
  8474. selector: "testPosition",
  8475. protocol: 'tests',
  8476. fn: function (){
  8477. var self=this;
  8478. var collection,stream;
  8479. return smalltalk.withContext(function($ctx1) {
  8480. var $1,$2,$3;
  8481. collection=self._newCollection();
  8482. stream=self._newStream();
  8483. _st(stream)._nextPutAll_(collection);
  8484. $1=_st(stream)._position();
  8485. $ctx1.sendIdx["position"]=1;
  8486. self._assert_equals_($1,_st(collection)._size());
  8487. $ctx1.sendIdx["assert:equals:"]=1;
  8488. _st(stream)._position_((0));
  8489. $2=_st(stream)._position();
  8490. $ctx1.sendIdx["position"]=2;
  8491. self._assert_equals_($2,(0));
  8492. $ctx1.sendIdx["assert:equals:"]=2;
  8493. _st(stream)._next();
  8494. $ctx1.sendIdx["next"]=1;
  8495. $3=_st(stream)._position();
  8496. $ctx1.sendIdx["position"]=3;
  8497. self._assert_equals_($3,(1));
  8498. $ctx1.sendIdx["assert:equals:"]=3;
  8499. _st(stream)._next();
  8500. self._assert_equals_(_st(stream)._position(),(2));
  8501. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8502. args: [],
  8503. 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",
  8504. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8505. referencedClasses: []
  8506. }),
  8507. globals.StreamTest);
  8508. smalltalk.addMethod(
  8509. smalltalk.method({
  8510. selector: "testReading",
  8511. protocol: 'tests',
  8512. fn: function (){
  8513. var self=this;
  8514. var stream,collection;
  8515. return smalltalk.withContext(function($ctx1) {
  8516. var $1,$2,$3;
  8517. collection=self._newCollection();
  8518. stream=self._newStream();
  8519. $1=stream;
  8520. _st($1)._nextPutAll_(collection);
  8521. $2=_st($1)._position_((0));
  8522. _st(collection)._do_((function(each){
  8523. return smalltalk.withContext(function($ctx2) {
  8524. $3=_st(stream)._next();
  8525. $ctx2.sendIdx["next"]=1;
  8526. return self._assert_equals_($3,each);
  8527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8528. self._assert_(_st(_st(stream)._next())._isNil());
  8529. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8530. args: [],
  8531. 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",
  8532. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8533. referencedClasses: []
  8534. }),
  8535. globals.StreamTest);
  8536. smalltalk.addMethod(
  8537. smalltalk.method({
  8538. selector: "testStreamContents",
  8539. protocol: 'tests',
  8540. fn: function (){
  8541. var self=this;
  8542. return self},
  8543. args: [],
  8544. source: "testStreamContents",
  8545. messageSends: [],
  8546. referencedClasses: []
  8547. }),
  8548. globals.StreamTest);
  8549. smalltalk.addMethod(
  8550. smalltalk.method({
  8551. selector: "testWrite",
  8552. protocol: 'tests',
  8553. fn: function (){
  8554. var self=this;
  8555. var stream,collection;
  8556. return smalltalk.withContext(function($ctx1) {
  8557. collection=self._newCollection();
  8558. stream=self._newStream();
  8559. _st(collection)._do_((function(each){
  8560. return smalltalk.withContext(function($ctx2) {
  8561. return _st(stream).__lt_lt(each);
  8562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8563. self._assert_equals_(_st(stream)._contents(),collection);
  8564. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8565. args: [],
  8566. 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",
  8567. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8568. referencedClasses: []
  8569. }),
  8570. globals.StreamTest);
  8571. smalltalk.addMethod(
  8572. smalltalk.method({
  8573. selector: "testWriting",
  8574. protocol: 'tests',
  8575. fn: function (){
  8576. var self=this;
  8577. var stream,collection;
  8578. return smalltalk.withContext(function($ctx1) {
  8579. var $1;
  8580. collection=self._newCollection();
  8581. stream=self._newStream();
  8582. $ctx1.sendIdx["newStream"]=1;
  8583. _st(collection)._do_((function(each){
  8584. return smalltalk.withContext(function($ctx2) {
  8585. return _st(stream)._nextPut_(each);
  8586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8587. $1=_st(stream)._contents();
  8588. $ctx1.sendIdx["contents"]=1;
  8589. self._assert_equals_($1,collection);
  8590. $ctx1.sendIdx["assert:equals:"]=1;
  8591. stream=self._newStream();
  8592. _st(stream)._nextPutAll_(collection);
  8593. self._assert_equals_(_st(stream)._contents(),collection);
  8594. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8595. args: [],
  8596. 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",
  8597. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8598. referencedClasses: []
  8599. }),
  8600. globals.StreamTest);
  8601. smalltalk.addMethod(
  8602. smalltalk.method({
  8603. selector: "collectionClass",
  8604. protocol: 'accessing',
  8605. fn: function (){
  8606. var self=this;
  8607. return nil;
  8608. },
  8609. args: [],
  8610. source: "collectionClass\x0a\x09^ nil",
  8611. messageSends: [],
  8612. referencedClasses: []
  8613. }),
  8614. globals.StreamTest.klass);
  8615. smalltalk.addMethod(
  8616. smalltalk.method({
  8617. selector: "isAbstract",
  8618. protocol: 'testing',
  8619. fn: function (){
  8620. var self=this;
  8621. return smalltalk.withContext(function($ctx1) {
  8622. var $1;
  8623. $1=_st(self._collectionClass())._isNil();
  8624. return $1;
  8625. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8626. args: [],
  8627. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8628. messageSends: ["isNil", "collectionClass"],
  8629. referencedClasses: []
  8630. }),
  8631. globals.StreamTest.klass);
  8632. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8633. smalltalk.addMethod(
  8634. smalltalk.method({
  8635. selector: "newCollection",
  8636. protocol: 'accessing',
  8637. fn: function (){
  8638. var self=this;
  8639. return smalltalk.withContext(function($ctx1) {
  8640. var $1;
  8641. $1=[true,(1),(3).__at((4)),"foo"];
  8642. return $1;
  8643. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8644. args: [],
  8645. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8646. messageSends: ["@"],
  8647. referencedClasses: []
  8648. }),
  8649. globals.ArrayStreamTest);
  8650. smalltalk.addMethod(
  8651. smalltalk.method({
  8652. selector: "collectionClass",
  8653. protocol: 'accessing',
  8654. fn: function (){
  8655. var self=this;
  8656. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8657. return $Array();
  8658. },
  8659. args: [],
  8660. source: "collectionClass\x0a\x09^ Array",
  8661. messageSends: [],
  8662. referencedClasses: ["Array"]
  8663. }),
  8664. globals.ArrayStreamTest.klass);
  8665. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8666. smalltalk.addMethod(
  8667. smalltalk.method({
  8668. selector: "newCollection",
  8669. protocol: 'accessing',
  8670. fn: function (){
  8671. var self=this;
  8672. return "hello world";
  8673. },
  8674. args: [],
  8675. source: "newCollection\x0a\x09^ 'hello world'",
  8676. messageSends: [],
  8677. referencedClasses: []
  8678. }),
  8679. globals.StringStreamTest);
  8680. smalltalk.addMethod(
  8681. smalltalk.method({
  8682. selector: "collectionClass",
  8683. protocol: 'accessing',
  8684. fn: function (){
  8685. var self=this;
  8686. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8687. return $String();
  8688. },
  8689. args: [],
  8690. source: "collectionClass\x0a\x09^ String",
  8691. messageSends: [],
  8692. referencedClasses: ["String"]
  8693. }),
  8694. globals.StringStreamTest.klass);
  8695. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8696. smalltalk.addMethod(
  8697. smalltalk.method({
  8698. selector: "testCopying",
  8699. protocol: 'tests',
  8700. fn: function (){
  8701. var self=this;
  8702. return smalltalk.withContext(function($ctx1) {
  8703. self._assert_equals_(nil._copy(),nil);
  8704. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8705. args: [],
  8706. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8707. messageSends: ["assert:equals:", "copy"],
  8708. referencedClasses: []
  8709. }),
  8710. globals.UndefinedTest);
  8711. smalltalk.addMethod(
  8712. smalltalk.method({
  8713. selector: "testDeepCopy",
  8714. protocol: 'tests',
  8715. fn: function (){
  8716. var self=this;
  8717. return smalltalk.withContext(function($ctx1) {
  8718. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8719. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8720. args: [],
  8721. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8722. messageSends: ["assert:", "=", "deepCopy"],
  8723. referencedClasses: []
  8724. }),
  8725. globals.UndefinedTest);
  8726. smalltalk.addMethod(
  8727. smalltalk.method({
  8728. selector: "testIfNil",
  8729. protocol: 'tests',
  8730. fn: function (){
  8731. var self=this;
  8732. return smalltalk.withContext(function($ctx1) {
  8733. var $1,$3,$2,$4,$6,$5,$receiver;
  8734. if(($receiver = nil) == null || $receiver.isNil){
  8735. $1=true;
  8736. } else {
  8737. $1=nil;
  8738. };
  8739. self._assert_equals_($1,true);
  8740. $ctx1.sendIdx["assert:equals:"]=1;
  8741. if(($receiver = nil) == null || $receiver.isNil){
  8742. $3=nil;
  8743. } else {
  8744. $3=true;
  8745. };
  8746. $2=_st($3).__eq(true);
  8747. $ctx1.sendIdx["="]=1;
  8748. self._deny_($2);
  8749. $ctx1.sendIdx["deny:"]=1;
  8750. if(($receiver = nil) == null || $receiver.isNil){
  8751. $4=true;
  8752. } else {
  8753. $4=false;
  8754. };
  8755. self._assert_equals_($4,true);
  8756. if(($receiver = nil) == null || $receiver.isNil){
  8757. $6=false;
  8758. } else {
  8759. $6=true;
  8760. };
  8761. $5=_st($6).__eq(true);
  8762. self._deny_($5);
  8763. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8764. args: [],
  8765. 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",
  8766. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8767. referencedClasses: []
  8768. }),
  8769. globals.UndefinedTest);
  8770. smalltalk.addMethod(
  8771. smalltalk.method({
  8772. selector: "testIsNil",
  8773. protocol: 'tests',
  8774. fn: function (){
  8775. var self=this;
  8776. return smalltalk.withContext(function($ctx1) {
  8777. self._assert_(nil._isNil());
  8778. self._deny_(nil._notNil());
  8779. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8780. args: [],
  8781. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8782. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8783. referencedClasses: []
  8784. }),
  8785. globals.UndefinedTest);
  8786. });