Kernel-Tests.js 338 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759
  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. },
  44. args: [],
  45. 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 ]",
  46. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"],
  47. referencedClasses: []
  48. }),
  49. globals.AnnouncementSubscriptionTest);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "testHandlesAnnouncement",
  53. protocol: 'tests',
  54. fn: function (){
  55. var self=this;
  56. var subscription,announcementClass1,announcementClass2,classBuilder;
  57. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  58. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  59. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  60. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  61. return smalltalk.withContext(function($ctx1) {
  62. var $1,$2;
  63. classBuilder=_st($ClassBuilder())._new();
  64. $ctx1.sendIdx["new"]=1;
  65. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  66. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  67. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  68. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  69. self._assert_equals_($1,true);
  70. $ctx1.sendIdx["assert:equals:"]=1;
  71. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  72. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  73. self._assert_equals_($2,true);
  74. $ctx1.sendIdx["assert:equals:"]=2;
  75. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  76. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  77. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)});
  78. },
  79. args: [],
  80. 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.",
  81. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  82. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  83. }),
  84. globals.AnnouncementSubscriptionTest);
  85. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  86. smalltalk.addMethod(
  87. smalltalk.method({
  88. selector: "testOnDo",
  89. protocol: 'tests',
  90. fn: function (){
  91. var self=this;
  92. var counter,announcer;
  93. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  94. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  95. return smalltalk.withContext(function($ctx1) {
  96. var $1,$2;
  97. counter=(0);
  98. announcer=_st($Announcer())._new();
  99. $ctx1.sendIdx["new"]=1;
  100. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  101. return smalltalk.withContext(function($ctx2) {
  102. counter=_st(counter).__plus((1));
  103. return counter;
  104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  105. }));
  106. $1=announcer;
  107. $2=_st($SystemAnnouncement())._new();
  108. $ctx1.sendIdx["new"]=2;
  109. _st($1)._announce_($2);
  110. $ctx1.sendIdx["announce:"]=1;
  111. self._assert_equals_(counter,(1));
  112. $ctx1.sendIdx["assert:equals:"]=1;
  113. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  114. self._assert_equals_(counter,(2));
  115. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  116. },
  117. args: [],
  118. 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.",
  119. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  120. referencedClasses: ["Announcer", "SystemAnnouncement"]
  121. }),
  122. globals.AnnouncerTest);
  123. smalltalk.addMethod(
  124. smalltalk.method({
  125. selector: "testOnDoFor",
  126. protocol: 'tests',
  127. fn: function (){
  128. var self=this;
  129. var counter,announcer;
  130. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  131. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  132. return smalltalk.withContext(function($ctx1) {
  133. var $1,$2,$3,$4;
  134. counter=(0);
  135. announcer=_st($Announcer())._new();
  136. $ctx1.sendIdx["new"]=1;
  137. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  138. return smalltalk.withContext(function($ctx2) {
  139. counter=_st(counter).__plus((1));
  140. return counter;
  141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  142. }),self);
  143. $1=announcer;
  144. $2=_st($SystemAnnouncement())._new();
  145. $ctx1.sendIdx["new"]=2;
  146. _st($1)._announce_($2);
  147. $ctx1.sendIdx["announce:"]=1;
  148. self._assert_equals_(counter,(1));
  149. $ctx1.sendIdx["assert:equals:"]=1;
  150. $3=announcer;
  151. $4=_st($SystemAnnouncement())._new();
  152. $ctx1.sendIdx["new"]=3;
  153. _st($3)._announce_($4);
  154. $ctx1.sendIdx["announce:"]=2;
  155. self._assert_equals_(counter,(2));
  156. $ctx1.sendIdx["assert:equals:"]=2;
  157. _st(announcer)._unsubscribe_(self);
  158. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  159. self._assert_equals_(counter,(2));
  160. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  161. },
  162. args: [],
  163. 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.",
  164. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  165. referencedClasses: ["Announcer", "SystemAnnouncement"]
  166. }),
  167. globals.AnnouncerTest);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "testOnDoOnce",
  171. protocol: 'tests',
  172. fn: function (){
  173. var self=this;
  174. var counter,announcer;
  175. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  176. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  177. return smalltalk.withContext(function($ctx1) {
  178. var $1,$2;
  179. counter=(0);
  180. announcer=_st($Announcer())._new();
  181. $ctx1.sendIdx["new"]=1;
  182. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  183. return smalltalk.withContext(function($ctx2) {
  184. counter=_st(counter).__plus((1));
  185. return counter;
  186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  187. }));
  188. $1=announcer;
  189. $2=_st($SystemAnnouncement())._new();
  190. $ctx1.sendIdx["new"]=2;
  191. _st($1)._announce_($2);
  192. $ctx1.sendIdx["announce:"]=1;
  193. self._assert_equals_(counter,(1));
  194. $ctx1.sendIdx["assert:equals:"]=1;
  195. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  196. self._assert_equals_(counter,(1));
  197. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  198. },
  199. args: [],
  200. 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.",
  201. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  202. referencedClasses: ["Announcer", "SystemAnnouncement"]
  203. }),
  204. globals.AnnouncerTest);
  205. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  206. smalltalk.addMethod(
  207. smalltalk.method({
  208. selector: "testCanClearInterval",
  209. protocol: 'tests',
  210. fn: function (){
  211. var self=this;
  212. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  213. return smalltalk.withContext(function($ctx1) {
  214. self._shouldnt_raise_((function(){
  215. return smalltalk.withContext(function($ctx2) {
  216. return _st(_st((function(){
  217. return smalltalk.withContext(function($ctx3) {
  218. return _st(_st($Error())._new())._signal();
  219. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  220. }))._valueWithInterval_((0)))._clearInterval();
  221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  222. }),$Error());
  223. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)});
  224. },
  225. args: [],
  226. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  227. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  228. referencedClasses: ["Error"]
  229. }),
  230. globals.BlockClosureTest);
  231. smalltalk.addMethod(
  232. smalltalk.method({
  233. selector: "testCanClearTimeout",
  234. protocol: 'tests',
  235. fn: function (){
  236. var self=this;
  237. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  238. return smalltalk.withContext(function($ctx1) {
  239. self._shouldnt_raise_((function(){
  240. return smalltalk.withContext(function($ctx2) {
  241. return _st(_st((function(){
  242. return smalltalk.withContext(function($ctx3) {
  243. return _st(_st($Error())._new())._signal();
  244. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  245. }))._valueWithTimeout_((0)))._clearTimeout();
  246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  247. }),$Error());
  248. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)});
  249. },
  250. args: [],
  251. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  252. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  253. referencedClasses: ["Error"]
  254. }),
  255. globals.BlockClosureTest);
  256. smalltalk.addMethod(
  257. smalltalk.method({
  258. selector: "testCompiledSource",
  259. protocol: 'tests',
  260. fn: function (){
  261. var self=this;
  262. return smalltalk.withContext(function($ctx1) {
  263. self._assert_(_st(_st((function(){
  264. return smalltalk.withContext(function($ctx2) {
  265. return (1).__plus((1));
  266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  267. }))._compiledSource())._includesSubString_("function"));
  268. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)});
  269. },
  270. args: [],
  271. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  272. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  273. referencedClasses: []
  274. }),
  275. globals.BlockClosureTest);
  276. smalltalk.addMethod(
  277. smalltalk.method({
  278. selector: "testCurrySelf",
  279. protocol: 'tests',
  280. fn: function (){
  281. var self=this;
  282. var curriedMethod,array;
  283. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  284. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  285. return smalltalk.withContext(function($ctx1) {
  286. curriedMethod=_st(_st((function(selfarg,x){
  287. return smalltalk.withContext(function($ctx2) {
  288. return _st(selfarg)._at_(x);
  289. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  290. }))._currySelf())._asCompiledMethod_("foo:");
  291. array=[(3), (1), (4)];
  292. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  293. _st((function(){
  294. return smalltalk.withContext(function($ctx2) {
  295. return self._assert_equals_(_st(array)._foo_((2)),(1));
  296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  297. }))._ensure_((function(){
  298. return smalltalk.withContext(function($ctx2) {
  299. return _st($Array())._removeCompiledMethod_(curriedMethod);
  300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  301. }));
  302. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)});
  303. },
  304. args: [],
  305. 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 ]",
  306. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  307. referencedClasses: ["ClassBuilder", "Array"]
  308. }),
  309. globals.BlockClosureTest);
  310. smalltalk.addMethod(
  311. smalltalk.method({
  312. selector: "testEnsure",
  313. protocol: 'tests',
  314. fn: function (){
  315. var self=this;
  316. return smalltalk.withContext(function($ctx1) {
  317. self._assert_equals_(_st((function(){
  318. return (3);
  319. }))._ensure_((function(){
  320. return (4);
  321. })),(3));
  322. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)});
  323. },
  324. args: [],
  325. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  326. messageSends: ["assert:equals:", "ensure:"],
  327. referencedClasses: []
  328. }),
  329. globals.BlockClosureTest);
  330. smalltalk.addMethod(
  331. smalltalk.method({
  332. selector: "testEnsureRaises",
  333. protocol: 'tests',
  334. fn: function (){
  335. var self=this;
  336. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  337. return smalltalk.withContext(function($ctx1) {
  338. self._should_raise_((function(){
  339. return smalltalk.withContext(function($ctx2) {
  340. return _st((function(){
  341. return smalltalk.withContext(function($ctx3) {
  342. return _st(_st($Error())._new())._signal();
  343. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  344. }))._ensure_((function(){
  345. return true;
  346. }));
  347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  348. }),$Error());
  349. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)});
  350. },
  351. args: [],
  352. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  353. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  354. referencedClasses: ["Error"]
  355. }),
  356. globals.BlockClosureTest);
  357. smalltalk.addMethod(
  358. smalltalk.method({
  359. selector: "testExceptionSemantics",
  360. protocol: 'tests',
  361. fn: function (){
  362. var self=this;
  363. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  364. return smalltalk.withContext(function($ctx1) {
  365. self._timeout_((100));
  366. _st(self._async_((function(){
  367. return smalltalk.withContext(function($ctx2) {
  368. return _st((function(){
  369. return smalltalk.withContext(function($ctx3) {
  370. self._assert_(true);
  371. _st($Error())._signal();
  372. self._deny_(true);
  373. return self._finished();
  374. $ctx3.sendIdx["finished"]=1;
  375. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  376. }))._on_do_($Error(),(function(ex){
  377. return smalltalk.withContext(function($ctx3) {
  378. return self._finished();
  379. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  380. }));
  381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  382. })))._valueWithTimeout_((0));
  383. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)});
  384. },
  385. args: [],
  386. 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",
  387. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  388. referencedClasses: ["Error"]
  389. }),
  390. globals.BlockClosureTest);
  391. smalltalk.addMethod(
  392. smalltalk.method({
  393. selector: "testNewWithValues",
  394. protocol: 'tests',
  395. fn: function (){
  396. var self=this;
  397. return smalltalk.withContext(function($ctx1) {
  398. function TestConstructor(arg1, arg2, arg3) {}
  399. TestConstructor.prototype.name = 'theTestPrototype';
  400. var wrappedConstructor = _st(TestConstructor);
  401. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  402. self._assert_(result instanceof TestConstructor);
  403. self._assert_equals_(result.name, 'theTestPrototype');
  404. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  405. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  406. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)});
  407. },
  408. args: [],
  409. 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>",
  410. messageSends: [],
  411. referencedClasses: []
  412. }),
  413. globals.BlockClosureTest);
  414. smalltalk.addMethod(
  415. smalltalk.method({
  416. selector: "testNumArgs",
  417. protocol: 'tests',
  418. fn: function (){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) {
  421. var $1;
  422. $1=_st((function(){
  423. }))._numArgs();
  424. $ctx1.sendIdx["numArgs"]=1;
  425. self._assert_equals_($1,(0));
  426. $ctx1.sendIdx["assert:equals:"]=1;
  427. self._assert_equals_(_st((function(a,b){
  428. }))._numArgs(),(2));
  429. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)});
  430. },
  431. args: [],
  432. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  433. messageSends: ["assert:equals:", "numArgs"],
  434. referencedClasses: []
  435. }),
  436. globals.BlockClosureTest);
  437. smalltalk.addMethod(
  438. smalltalk.method({
  439. selector: "testOnDo",
  440. protocol: 'tests',
  441. fn: function (){
  442. var self=this;
  443. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  444. return smalltalk.withContext(function($ctx1) {
  445. self._assert_(_st((function(){
  446. return smalltalk.withContext(function($ctx2) {
  447. return _st(_st($Error())._new())._signal();
  448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  449. }))._on_do_($Error(),(function(ex){
  450. return true;
  451. })));
  452. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)});
  453. },
  454. args: [],
  455. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  456. messageSends: ["assert:", "on:do:", "signal", "new"],
  457. referencedClasses: ["Error"]
  458. }),
  459. globals.BlockClosureTest);
  460. smalltalk.addMethod(
  461. smalltalk.method({
  462. selector: "testValue",
  463. protocol: 'tests',
  464. fn: function (){
  465. var self=this;
  466. return smalltalk.withContext(function($ctx1) {
  467. var $1;
  468. $1=_st((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. return (1).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  473. }))._value();
  474. $ctx1.sendIdx["value"]=1;
  475. self._assert_equals_($1,(2));
  476. $ctx1.sendIdx["assert:equals:"]=1;
  477. self._assert_equals_(_st((function(x){
  478. return smalltalk.withContext(function($ctx2) {
  479. return _st(x).__plus((1));
  480. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  481. }))._value_((2)),(3));
  482. $ctx1.sendIdx["assert:equals:"]=2;
  483. self._assert_equals_(_st((function(x,y){
  484. return smalltalk.withContext(function($ctx2) {
  485. return _st(x).__star(y);
  486. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  487. }))._value_value_((2),(4)),(8));
  488. $ctx1.sendIdx["assert:equals:"]=3;
  489. self._assert_equals_(_st((function(a,b,c){
  490. return (1);
  491. }))._value(),(1));
  492. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)});
  493. },
  494. args: [],
  495. 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",
  496. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  497. referencedClasses: []
  498. }),
  499. globals.BlockClosureTest);
  500. smalltalk.addMethod(
  501. smalltalk.method({
  502. selector: "testValueWithPossibleArguments",
  503. protocol: 'tests',
  504. fn: function (){
  505. var self=this;
  506. return smalltalk.withContext(function($ctx1) {
  507. var $1,$2;
  508. $1=_st((function(){
  509. return (1);
  510. }))._valueWithPossibleArguments_([(3), (4)]);
  511. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  512. self._assert_equals_($1,(1));
  513. $ctx1.sendIdx["assert:equals:"]=1;
  514. $2=_st((function(a){
  515. return smalltalk.withContext(function($ctx2) {
  516. return _st(a).__plus((4));
  517. $ctx2.sendIdx["+"]=1;
  518. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  519. }))._valueWithPossibleArguments_([(3), (4)]);
  520. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  521. self._assert_equals_($2,(7));
  522. $ctx1.sendIdx["assert:equals:"]=2;
  523. self._assert_equals_(_st((function(a,b){
  524. return smalltalk.withContext(function($ctx2) {
  525. return _st(a).__plus(b);
  526. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  527. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  528. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)});
  529. },
  530. args: [],
  531. 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.",
  532. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  533. referencedClasses: []
  534. }),
  535. globals.BlockClosureTest);
  536. smalltalk.addMethod(
  537. smalltalk.method({
  538. selector: "testWhileFalse",
  539. protocol: 'tests',
  540. fn: function (){
  541. var self=this;
  542. var i;
  543. return smalltalk.withContext(function($ctx1) {
  544. i=(0);
  545. _st((function(){
  546. return smalltalk.withContext(function($ctx2) {
  547. return _st(i).__gt((5));
  548. $ctx2.sendIdx[">"]=1;
  549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  550. }))._whileFalse_((function(){
  551. return smalltalk.withContext(function($ctx2) {
  552. i=_st(i).__plus((1));
  553. $ctx2.sendIdx["+"]=1;
  554. return i;
  555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  556. }));
  557. self._assert_equals_(i,(6));
  558. $ctx1.sendIdx["assert:equals:"]=1;
  559. i=(0);
  560. _st((function(){
  561. return smalltalk.withContext(function($ctx2) {
  562. i=_st(i).__plus((1));
  563. i;
  564. return _st(i).__gt((5));
  565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  566. }))._whileFalse();
  567. self._assert_equals_(i,(6));
  568. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)});
  569. },
  570. args: [],
  571. 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",
  572. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  573. referencedClasses: []
  574. }),
  575. globals.BlockClosureTest);
  576. smalltalk.addMethod(
  577. smalltalk.method({
  578. selector: "testWhileTrue",
  579. protocol: 'tests',
  580. fn: function (){
  581. var self=this;
  582. var i;
  583. return smalltalk.withContext(function($ctx1) {
  584. i=(0);
  585. _st((function(){
  586. return smalltalk.withContext(function($ctx2) {
  587. return _st(i).__lt((5));
  588. $ctx2.sendIdx["<"]=1;
  589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  590. }))._whileTrue_((function(){
  591. return smalltalk.withContext(function($ctx2) {
  592. i=_st(i).__plus((1));
  593. $ctx2.sendIdx["+"]=1;
  594. return i;
  595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  596. }));
  597. self._assert_equals_(i,(5));
  598. $ctx1.sendIdx["assert:equals:"]=1;
  599. i=(0);
  600. _st((function(){
  601. return smalltalk.withContext(function($ctx2) {
  602. i=_st(i).__plus((1));
  603. i;
  604. return _st(i).__lt((5));
  605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  606. }))._whileTrue();
  607. self._assert_equals_(i,(5));
  608. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)});
  609. },
  610. args: [],
  611. 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",
  612. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  613. referencedClasses: []
  614. }),
  615. globals.BlockClosureTest);
  616. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  617. smalltalk.addMethod(
  618. smalltalk.method({
  619. selector: "testEquality",
  620. protocol: 'tests',
  621. fn: function (){
  622. var self=this;
  623. return smalltalk.withContext(function($ctx1) {
  624. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  625. $1=(0).__eq(false);
  626. $ctx1.sendIdx["="]=1;
  627. self._deny_($1);
  628. $ctx1.sendIdx["deny:"]=1;
  629. $2=false.__eq((0));
  630. $ctx1.sendIdx["="]=2;
  631. self._deny_($2);
  632. $ctx1.sendIdx["deny:"]=2;
  633. $3="".__eq(false);
  634. $ctx1.sendIdx["="]=3;
  635. self._deny_($3);
  636. $ctx1.sendIdx["deny:"]=3;
  637. $4=false.__eq("");
  638. $ctx1.sendIdx["="]=4;
  639. self._deny_($4);
  640. $ctx1.sendIdx["deny:"]=4;
  641. $5=true.__eq(true);
  642. $ctx1.sendIdx["="]=5;
  643. self._assert_($5);
  644. $ctx1.sendIdx["assert:"]=1;
  645. $6=false.__eq(true);
  646. $ctx1.sendIdx["="]=6;
  647. self._deny_($6);
  648. $ctx1.sendIdx["deny:"]=5;
  649. $7=true.__eq(false);
  650. $ctx1.sendIdx["="]=7;
  651. self._deny_($7);
  652. $8=false.__eq(false);
  653. $ctx1.sendIdx["="]=8;
  654. self._assert_($8);
  655. $ctx1.sendIdx["assert:"]=2;
  656. $10=true._yourself();
  657. $ctx1.sendIdx["yourself"]=1;
  658. $9=_st($10).__eq(true);
  659. $ctx1.sendIdx["="]=9;
  660. self._assert_($9);
  661. $ctx1.sendIdx["assert:"]=3;
  662. $12=true._yourself();
  663. $ctx1.sendIdx["yourself"]=2;
  664. $11=_st($12).__eq(true._yourself());
  665. self._assert_($11);
  666. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)});
  667. },
  668. args: [],
  669. 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)",
  670. messageSends: ["deny:", "=", "assert:", "yourself"],
  671. referencedClasses: []
  672. }),
  673. globals.BooleanTest);
  674. smalltalk.addMethod(
  675. smalltalk.method({
  676. selector: "testIdentity",
  677. protocol: 'tests',
  678. fn: function (){
  679. var self=this;
  680. return smalltalk.withContext(function($ctx1) {
  681. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  682. $1=(0).__eq_eq(false);
  683. $ctx1.sendIdx["=="]=1;
  684. self._deny_($1);
  685. $ctx1.sendIdx["deny:"]=1;
  686. $2=false.__eq_eq((0));
  687. $ctx1.sendIdx["=="]=2;
  688. self._deny_($2);
  689. $ctx1.sendIdx["deny:"]=2;
  690. $3="".__eq_eq(false);
  691. $ctx1.sendIdx["=="]=3;
  692. self._deny_($3);
  693. $ctx1.sendIdx["deny:"]=3;
  694. $4=false.__eq_eq("");
  695. $ctx1.sendIdx["=="]=4;
  696. self._deny_($4);
  697. $ctx1.sendIdx["deny:"]=4;
  698. $5=true.__eq_eq(true);
  699. $ctx1.sendIdx["=="]=5;
  700. self._assert_($5);
  701. $ctx1.sendIdx["assert:"]=1;
  702. $6=false.__eq_eq(true);
  703. $ctx1.sendIdx["=="]=6;
  704. self._deny_($6);
  705. $ctx1.sendIdx["deny:"]=5;
  706. $7=true.__eq_eq(false);
  707. $ctx1.sendIdx["=="]=7;
  708. self._deny_($7);
  709. $8=false.__eq_eq(false);
  710. $ctx1.sendIdx["=="]=8;
  711. self._assert_($8);
  712. $ctx1.sendIdx["assert:"]=2;
  713. $10=true._yourself();
  714. $ctx1.sendIdx["yourself"]=1;
  715. $9=_st($10).__eq_eq(true);
  716. $ctx1.sendIdx["=="]=9;
  717. self._assert_($9);
  718. $ctx1.sendIdx["assert:"]=3;
  719. $12=true._yourself();
  720. $ctx1.sendIdx["yourself"]=2;
  721. $11=_st($12).__eq_eq(true._yourself());
  722. self._assert_($11);
  723. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)});
  724. },
  725. args: [],
  726. 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",
  727. messageSends: ["deny:", "==", "assert:", "yourself"],
  728. referencedClasses: []
  729. }),
  730. globals.BooleanTest);
  731. smalltalk.addMethod(
  732. smalltalk.method({
  733. selector: "testIfTrueIfFalse",
  734. protocol: 'tests',
  735. fn: function (){
  736. var self=this;
  737. return smalltalk.withContext(function($ctx1) {
  738. var $1,$2,$3,$4,$5,$6,$7,$8;
  739. if(smalltalk.assert(true)){
  740. $1="alternative block";
  741. };
  742. self._assert_equals_($1,"alternative block");
  743. $ctx1.sendIdx["assert:equals:"]=1;
  744. if(! smalltalk.assert(true)){
  745. $2="alternative block";
  746. };
  747. self._assert_equals_($2,nil);
  748. $ctx1.sendIdx["assert:equals:"]=2;
  749. if(smalltalk.assert(false)){
  750. $3="alternative block";
  751. };
  752. self._assert_equals_($3,nil);
  753. $ctx1.sendIdx["assert:equals:"]=3;
  754. if(! smalltalk.assert(false)){
  755. $4="alternative block";
  756. };
  757. self._assert_equals_($4,"alternative block");
  758. $ctx1.sendIdx["assert:equals:"]=4;
  759. if(smalltalk.assert(false)){
  760. $5="alternative block";
  761. } else {
  762. $5="alternative block2";
  763. };
  764. self._assert_equals_($5,"alternative block2");
  765. $ctx1.sendIdx["assert:equals:"]=5;
  766. if(smalltalk.assert(false)){
  767. $6="alternative block2";
  768. } else {
  769. $6="alternative block";
  770. };
  771. self._assert_equals_($6,"alternative block");
  772. $ctx1.sendIdx["assert:equals:"]=6;
  773. if(smalltalk.assert(true)){
  774. $7="alternative block";
  775. } else {
  776. $7="alternative block2";
  777. };
  778. self._assert_equals_($7,"alternative block");
  779. $ctx1.sendIdx["assert:equals:"]=7;
  780. if(smalltalk.assert(true)){
  781. $8="alternative block2";
  782. } else {
  783. $8="alternative block";
  784. };
  785. self._assert_equals_($8,"alternative block2");
  786. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)});
  787. },
  788. args: [],
  789. 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'.",
  790. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  791. referencedClasses: []
  792. }),
  793. globals.BooleanTest);
  794. smalltalk.addMethod(
  795. smalltalk.method({
  796. selector: "testIfTrueIfFalseWithBoxing",
  797. protocol: 'tests',
  798. fn: function (){
  799. var self=this;
  800. return smalltalk.withContext(function($ctx1) {
  801. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  802. $2=true._yourself();
  803. $ctx1.sendIdx["yourself"]=1;
  804. if(smalltalk.assert($2)){
  805. $1="alternative block";
  806. };
  807. self._assert_equals_($1,"alternative block");
  808. $ctx1.sendIdx["assert:equals:"]=1;
  809. $4=true._yourself();
  810. $ctx1.sendIdx["yourself"]=2;
  811. if(! smalltalk.assert($4)){
  812. $3="alternative block";
  813. };
  814. self._assert_equals_($3,nil);
  815. $ctx1.sendIdx["assert:equals:"]=2;
  816. $6=false._yourself();
  817. $ctx1.sendIdx["yourself"]=3;
  818. if(smalltalk.assert($6)){
  819. $5="alternative block";
  820. };
  821. self._assert_equals_($5,nil);
  822. $ctx1.sendIdx["assert:equals:"]=3;
  823. $8=false._yourself();
  824. $ctx1.sendIdx["yourself"]=4;
  825. if(! smalltalk.assert($8)){
  826. $7="alternative block";
  827. };
  828. self._assert_equals_($7,"alternative block");
  829. $ctx1.sendIdx["assert:equals:"]=4;
  830. $10=false._yourself();
  831. $ctx1.sendIdx["yourself"]=5;
  832. if(smalltalk.assert($10)){
  833. $9="alternative block";
  834. } else {
  835. $9="alternative block2";
  836. };
  837. self._assert_equals_($9,"alternative block2");
  838. $ctx1.sendIdx["assert:equals:"]=5;
  839. $12=false._yourself();
  840. $ctx1.sendIdx["yourself"]=6;
  841. if(smalltalk.assert($12)){
  842. $11="alternative block2";
  843. } else {
  844. $11="alternative block";
  845. };
  846. self._assert_equals_($11,"alternative block");
  847. $ctx1.sendIdx["assert:equals:"]=6;
  848. $14=true._yourself();
  849. $ctx1.sendIdx["yourself"]=7;
  850. if(smalltalk.assert($14)){
  851. $13="alternative block";
  852. } else {
  853. $13="alternative block2";
  854. };
  855. self._assert_equals_($13,"alternative block");
  856. $ctx1.sendIdx["assert:equals:"]=7;
  857. $16=true._yourself();
  858. if(smalltalk.assert($16)){
  859. $15="alternative block2";
  860. } else {
  861. $15="alternative block";
  862. };
  863. self._assert_equals_($15,"alternative block2");
  864. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)});
  865. },
  866. args: [],
  867. 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'.",
  868. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  869. referencedClasses: []
  870. }),
  871. globals.BooleanTest);
  872. smalltalk.addMethod(
  873. smalltalk.method({
  874. selector: "testLogic",
  875. protocol: 'tests',
  876. fn: function (){
  877. var self=this;
  878. return smalltalk.withContext(function($ctx1) {
  879. 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;
  880. $1=true.__and(true);
  881. $ctx1.sendIdx["&"]=1;
  882. self._assert_($1);
  883. $ctx1.sendIdx["assert:"]=1;
  884. $2=true.__and(false);
  885. $ctx1.sendIdx["&"]=2;
  886. self._deny_($2);
  887. $ctx1.sendIdx["deny:"]=1;
  888. $3=false.__and(true);
  889. $ctx1.sendIdx["&"]=3;
  890. self._deny_($3);
  891. $ctx1.sendIdx["deny:"]=2;
  892. $5=false.__and(false);
  893. $ctx1.sendIdx["&"]=4;
  894. $4=self._deny_($5);
  895. $ctx1.sendIdx["deny:"]=3;
  896. $6=true.__or(true);
  897. $ctx1.sendIdx["|"]=1;
  898. self._assert_($6);
  899. $ctx1.sendIdx["assert:"]=2;
  900. $7=true.__or(false);
  901. $ctx1.sendIdx["|"]=2;
  902. self._assert_($7);
  903. $ctx1.sendIdx["assert:"]=3;
  904. $8=false.__or(true);
  905. $ctx1.sendIdx["|"]=3;
  906. self._assert_($8);
  907. $ctx1.sendIdx["assert:"]=4;
  908. $10=false.__or(false);
  909. $ctx1.sendIdx["|"]=4;
  910. $9=self._deny_($10);
  911. $ctx1.sendIdx["deny:"]=4;
  912. $12=(1).__gt((0));
  913. $ctx1.sendIdx[">"]=1;
  914. $11=true.__and($12);
  915. $ctx1.sendIdx["&"]=5;
  916. self._assert_($11);
  917. $ctx1.sendIdx["assert:"]=5;
  918. $14=(1).__gt((0));
  919. $ctx1.sendIdx[">"]=2;
  920. $13=_st($14).__and(false);
  921. $ctx1.sendIdx["&"]=6;
  922. self._deny_($13);
  923. $ctx1.sendIdx["deny:"]=5;
  924. $17=(1).__gt((0));
  925. $ctx1.sendIdx[">"]=3;
  926. $18=(1).__gt((2));
  927. $ctx1.sendIdx[">"]=4;
  928. $16=_st($17).__and($18);
  929. $15=self._deny_($16);
  930. $20=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=5;
  932. $19=false.__or($20);
  933. $ctx1.sendIdx["|"]=5;
  934. self._assert_($19);
  935. $ctx1.sendIdx["assert:"]=6;
  936. $22=(1).__gt((0));
  937. $ctx1.sendIdx[">"]=6;
  938. $21=_st($22).__or(false);
  939. $ctx1.sendIdx["|"]=6;
  940. self._assert_($21);
  941. $ctx1.sendIdx["assert:"]=7;
  942. $25=(1).__gt((0));
  943. $ctx1.sendIdx[">"]=7;
  944. $24=_st($25).__or((1).__gt((2)));
  945. $23=self._assert_($24);
  946. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)});
  947. },
  948. args: [],
  949. 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))",
  950. messageSends: ["assert:", "&", "deny:", "|", ">"],
  951. referencedClasses: []
  952. }),
  953. globals.BooleanTest);
  954. smalltalk.addMethod(
  955. smalltalk.method({
  956. selector: "testLogicKeywords",
  957. protocol: 'tests',
  958. fn: function (){
  959. var self=this;
  960. return smalltalk.withContext(function($ctx1) {
  961. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  962. $1=true._and_((function(){
  963. return true;
  964. }));
  965. $ctx1.sendIdx["and:"]=1;
  966. self._assert_($1);
  967. $ctx1.sendIdx["assert:"]=1;
  968. $2=true._and_((function(){
  969. return false;
  970. }));
  971. $ctx1.sendIdx["and:"]=2;
  972. self._deny_($2);
  973. $ctx1.sendIdx["deny:"]=1;
  974. $3=false._and_((function(){
  975. return true;
  976. }));
  977. $ctx1.sendIdx["and:"]=3;
  978. self._deny_($3);
  979. $ctx1.sendIdx["deny:"]=2;
  980. $5=false._and_((function(){
  981. return false;
  982. }));
  983. $ctx1.sendIdx["and:"]=4;
  984. $4=self._deny_($5);
  985. $ctx1.sendIdx["deny:"]=3;
  986. $6=true._or_((function(){
  987. return true;
  988. }));
  989. $ctx1.sendIdx["or:"]=1;
  990. self._assert_($6);
  991. $ctx1.sendIdx["assert:"]=2;
  992. $7=true._or_((function(){
  993. return false;
  994. }));
  995. $ctx1.sendIdx["or:"]=2;
  996. self._assert_($7);
  997. $ctx1.sendIdx["assert:"]=3;
  998. $8=false._or_((function(){
  999. return true;
  1000. }));
  1001. $ctx1.sendIdx["or:"]=3;
  1002. self._assert_($8);
  1003. $ctx1.sendIdx["assert:"]=4;
  1004. $10=false._or_((function(){
  1005. return false;
  1006. }));
  1007. $ctx1.sendIdx["or:"]=4;
  1008. $9=self._deny_($10);
  1009. $ctx1.sendIdx["deny:"]=4;
  1010. $11=true._and_((function(){
  1011. return smalltalk.withContext(function($ctx2) {
  1012. return (1).__gt((0));
  1013. $ctx2.sendIdx[">"]=1;
  1014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  1015. }));
  1016. $ctx1.sendIdx["and:"]=5;
  1017. self._assert_($11);
  1018. $ctx1.sendIdx["assert:"]=5;
  1019. $13=(1).__gt((0));
  1020. $ctx1.sendIdx[">"]=2;
  1021. $12=_st($13)._and_((function(){
  1022. return false;
  1023. }));
  1024. $ctx1.sendIdx["and:"]=6;
  1025. self._deny_($12);
  1026. $ctx1.sendIdx["deny:"]=5;
  1027. $16=(1).__gt((0));
  1028. $ctx1.sendIdx[">"]=3;
  1029. $15=_st($16)._and_((function(){
  1030. return smalltalk.withContext(function($ctx2) {
  1031. return (1).__gt((2));
  1032. $ctx2.sendIdx[">"]=4;
  1033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  1034. }));
  1035. $14=self._deny_($15);
  1036. $17=false._or_((function(){
  1037. return smalltalk.withContext(function($ctx2) {
  1038. return (1).__gt((0));
  1039. $ctx2.sendIdx[">"]=5;
  1040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  1041. }));
  1042. $ctx1.sendIdx["or:"]=5;
  1043. self._assert_($17);
  1044. $ctx1.sendIdx["assert:"]=6;
  1045. $19=(1).__gt((0));
  1046. $ctx1.sendIdx[">"]=6;
  1047. $18=_st($19)._or_((function(){
  1048. return false;
  1049. }));
  1050. $ctx1.sendIdx["or:"]=6;
  1051. self._assert_($18);
  1052. $ctx1.sendIdx["assert:"]=7;
  1053. $22=(1).__gt((0));
  1054. $ctx1.sendIdx[">"]=7;
  1055. $21=_st($22)._or_((function(){
  1056. return smalltalk.withContext(function($ctx2) {
  1057. return (1).__gt((2));
  1058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  1059. }));
  1060. $20=self._assert_($21);
  1061. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)});
  1062. },
  1063. args: [],
  1064. 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 ])",
  1065. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  1066. referencedClasses: []
  1067. }),
  1068. globals.BooleanTest);
  1069. smalltalk.addMethod(
  1070. smalltalk.method({
  1071. selector: "testNonBooleanError",
  1072. protocol: 'tests',
  1073. fn: function (){
  1074. var self=this;
  1075. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1076. return smalltalk.withContext(function($ctx1) {
  1077. self._should_raise_((function(){
  1078. return smalltalk.withContext(function($ctx2) {
  1079. if(smalltalk.assert("")){
  1080. } else {
  1081. };
  1082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1083. }),$NonBooleanReceiver());
  1084. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)});
  1085. },
  1086. args: [],
  1087. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1088. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1089. referencedClasses: ["NonBooleanReceiver"]
  1090. }),
  1091. globals.BooleanTest);
  1092. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1093. smalltalk.addMethod(
  1094. smalltalk.method({
  1095. selector: "setUp",
  1096. protocol: 'running',
  1097. fn: function (){
  1098. var self=this;
  1099. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1100. return smalltalk.withContext(function($ctx1) {
  1101. self["@builder"]=_st($ClassBuilder())._new();
  1102. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)});
  1103. },
  1104. args: [],
  1105. source: "setUp\x0a\x09builder := ClassBuilder new",
  1106. messageSends: ["new"],
  1107. referencedClasses: ["ClassBuilder"]
  1108. }),
  1109. globals.ClassBuilderTest);
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "tearDown",
  1113. protocol: 'running',
  1114. fn: function (){
  1115. var self=this;
  1116. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1117. return smalltalk.withContext(function($ctx1) {
  1118. var $1,$receiver;
  1119. $1=self["@theClass"];
  1120. if(($receiver = $1) == null || $receiver.isNil){
  1121. $1;
  1122. } else {
  1123. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1124. self["@theClass"]=nil;
  1125. self["@theClass"];
  1126. };
  1127. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)});
  1128. },
  1129. args: [],
  1130. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1131. messageSends: ["ifNotNil:", "removeClass:"],
  1132. referencedClasses: ["Smalltalk"]
  1133. }),
  1134. globals.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassCopy",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. return smalltalk.withContext(function($ctx1) {
  1143. var $2,$1,$4,$3,$6,$5,$8,$7;
  1144. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1145. $2=_st(self["@theClass"])._superclass();
  1146. $ctx1.sendIdx["superclass"]=1;
  1147. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1148. $ctx1.sendIdx["=="]=1;
  1149. self._assert_($1);
  1150. $ctx1.sendIdx["assert:"]=1;
  1151. $4=_st(self["@theClass"])._instanceVariableNames();
  1152. $ctx1.sendIdx["instanceVariableNames"]=1;
  1153. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1154. $ctx1.sendIdx["=="]=2;
  1155. self._assert_($3);
  1156. $ctx1.sendIdx["assert:"]=2;
  1157. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1158. $ctx1.sendIdx["assert:equals:"]=1;
  1159. $6=_st(self["@theClass"])._package();
  1160. $ctx1.sendIdx["package"]=1;
  1161. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1162. self._assert_($5);
  1163. $8=_st(self["@theClass"])._methodDictionary();
  1164. $ctx1.sendIdx["methodDictionary"]=1;
  1165. $7=_st($8)._keys();
  1166. $ctx1.sendIdx["keys"]=1;
  1167. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1168. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)});
  1169. },
  1170. args: [],
  1171. 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",
  1172. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1173. referencedClasses: ["ObjectMock"]
  1174. }),
  1175. globals.ClassBuilderTest);
  1176. smalltalk.addMethod(
  1177. smalltalk.method({
  1178. selector: "testClassMigration",
  1179. protocol: 'tests',
  1180. fn: function (){
  1181. var self=this;
  1182. var instance,oldClass;
  1183. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1184. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1185. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1186. return smalltalk.withContext(function($ctx1) {
  1187. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1188. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1189. $2=_st($Smalltalk())._globals();
  1190. $ctx1.sendIdx["globals"]=1;
  1191. $1=_st($2)._at_("ObjectMock2");
  1192. $ctx1.sendIdx["at:"]=1;
  1193. instance=_st($1)._new();
  1194. $4=_st($Smalltalk())._globals();
  1195. $ctx1.sendIdx["globals"]=2;
  1196. $3=_st($4)._at_("ObjectMock2");
  1197. $ctx1.sendIdx["at:"]=2;
  1198. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1199. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1200. $ctx1.sendIdx["=="]=1;
  1201. self._deny_($5);
  1202. $ctx1.sendIdx["deny:"]=1;
  1203. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1204. $ctx1.sendIdx["=="]=2;
  1205. self._assert_($6);
  1206. $ctx1.sendIdx["assert:"]=1;
  1207. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1208. $ctx1.sendIdx["assert:"]=2;
  1209. $7=_st($ObjectMock2())._selectors();
  1210. $ctx1.sendIdx["selectors"]=1;
  1211. self._assert_equals_($7,_st(oldClass)._selectors());
  1212. $ctx1.sendIdx["assert:equals:"]=1;
  1213. $8=_st($ObjectMock2())._comment();
  1214. $ctx1.sendIdx["comment"]=1;
  1215. self._assert_equals_($8,_st(oldClass)._comment());
  1216. $ctx1.sendIdx["assert:equals:"]=2;
  1217. $9=_st(_st($ObjectMock2())._package())._name();
  1218. $ctx1.sendIdx["name"]=1;
  1219. self._assert_equals_($9,"Kernel-Tests");
  1220. $11=_st(instance)._class();
  1221. $ctx1.sendIdx["class"]=1;
  1222. $10=_st($11).__eq_eq($ObjectMock2());
  1223. self._deny_($10);
  1224. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1225. _st($Smalltalk())._removeClass_($ObjectMock2());
  1226. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)});
  1227. },
  1228. args: [],
  1229. 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",
  1230. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1231. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1232. }),
  1233. globals.ClassBuilderTest);
  1234. smalltalk.addMethod(
  1235. smalltalk.method({
  1236. selector: "testClassMigrationWithClassInstanceVariables",
  1237. protocol: 'tests',
  1238. fn: function (){
  1239. var self=this;
  1240. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1241. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1242. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1243. return smalltalk.withContext(function($ctx1) {
  1244. var $1;
  1245. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1246. $1=_st($ObjectMock2())._class();
  1247. $ctx1.sendIdx["class"]=1;
  1248. _st($1)._instanceVariableNames_("foo bar");
  1249. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1250. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1251. _st($Smalltalk())._removeClass_($ObjectMock2());
  1252. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)});
  1253. },
  1254. args: [],
  1255. 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",
  1256. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1257. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1258. }),
  1259. globals.ClassBuilderTest);
  1260. smalltalk.addMethod(
  1261. smalltalk.method({
  1262. selector: "testClassMigrationWithSubclasses",
  1263. protocol: 'tests',
  1264. fn: function (){
  1265. var self=this;
  1266. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1267. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1268. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1269. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1270. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1271. return smalltalk.withContext(function($ctx1) {
  1272. var $2,$1,$4,$3;
  1273. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1274. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1275. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1276. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1277. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1278. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1279. $2=_st($ObjectMock())._subclasses();
  1280. $ctx1.sendIdx["subclasses"]=1;
  1281. $1=_st($2)._includes_($ObjectMock2());
  1282. $ctx1.sendIdx["includes:"]=1;
  1283. self._assert_($1);
  1284. $ctx1.sendIdx["assert:"]=1;
  1285. $4=_st($ObjectMock2())._subclasses();
  1286. $ctx1.sendIdx["subclasses"]=2;
  1287. $3=_st($4)._includes_($ObjectMock3());
  1288. $ctx1.sendIdx["includes:"]=2;
  1289. self._assert_($3);
  1290. $ctx1.sendIdx["assert:"]=2;
  1291. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1292. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1293. return smalltalk.withContext(function($ctx2) {
  1294. return _st($Smalltalk())._removeClass_(each);
  1295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1296. }));
  1297. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)});
  1298. },
  1299. args: [],
  1300. 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 ]",
  1301. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1302. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1303. }),
  1304. globals.ClassBuilderTest);
  1305. smalltalk.addMethod(
  1306. smalltalk.method({
  1307. selector: "testInstanceVariableNames",
  1308. protocol: 'tests',
  1309. fn: function (){
  1310. var self=this;
  1311. return smalltalk.withContext(function($ctx1) {
  1312. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1313. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)});
  1314. },
  1315. args: [],
  1316. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1317. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1318. referencedClasses: []
  1319. }),
  1320. globals.ClassBuilderTest);
  1321. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1322. smalltalk.addMethod(
  1323. smalltalk.method({
  1324. selector: "assertSameContents:as:",
  1325. protocol: 'convenience',
  1326. fn: function (aCollection,anotherCollection){
  1327. var self=this;
  1328. return smalltalk.withContext(function($ctx1) {
  1329. var $2,$1,$4,$3;
  1330. $2=_st(aCollection)._size();
  1331. $ctx1.sendIdx["size"]=1;
  1332. $1=_st($2).__eq(_st(anotherCollection)._size());
  1333. $ctx1.sendIdx["="]=1;
  1334. self._assert_($1);
  1335. $ctx1.sendIdx["assert:"]=1;
  1336. _st(aCollection)._do_((function(each){
  1337. return smalltalk.withContext(function($ctx2) {
  1338. $4=_st(aCollection)._occurrencesOf_(each);
  1339. $ctx2.sendIdx["occurrencesOf:"]=1;
  1340. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1341. return self._assert_($3);
  1342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1343. }));
  1344. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)});
  1345. },
  1346. args: ["aCollection", "anotherCollection"],
  1347. 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)) ]",
  1348. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1349. referencedClasses: []
  1350. }),
  1351. globals.CollectionTest);
  1352. smalltalk.addMethod(
  1353. smalltalk.method({
  1354. selector: "collection",
  1355. protocol: 'fixture',
  1356. fn: function (){
  1357. var self=this;
  1358. return smalltalk.withContext(function($ctx1) {
  1359. self._subclassResponsibility();
  1360. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)});
  1361. },
  1362. args: [],
  1363. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1364. messageSends: ["subclassResponsibility"],
  1365. referencedClasses: []
  1366. }),
  1367. globals.CollectionTest);
  1368. smalltalk.addMethod(
  1369. smalltalk.method({
  1370. selector: "collectionClass",
  1371. protocol: 'fixture',
  1372. fn: function (){
  1373. var self=this;
  1374. return smalltalk.withContext(function($ctx1) {
  1375. var $1;
  1376. $1=_st(self._class())._collectionClass();
  1377. return $1;
  1378. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)});
  1379. },
  1380. args: [],
  1381. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1382. messageSends: ["collectionClass", "class"],
  1383. referencedClasses: []
  1384. }),
  1385. globals.CollectionTest);
  1386. smalltalk.addMethod(
  1387. smalltalk.method({
  1388. selector: "collectionOfPrintStrings",
  1389. protocol: 'fixture',
  1390. fn: function (){
  1391. var self=this;
  1392. return smalltalk.withContext(function($ctx1) {
  1393. self._subclassResponsibility();
  1394. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)});
  1395. },
  1396. args: [],
  1397. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1398. messageSends: ["subclassResponsibility"],
  1399. referencedClasses: []
  1400. }),
  1401. globals.CollectionTest);
  1402. smalltalk.addMethod(
  1403. smalltalk.method({
  1404. selector: "collectionSize",
  1405. protocol: 'fixture',
  1406. fn: function (){
  1407. var self=this;
  1408. return smalltalk.withContext(function($ctx1) {
  1409. self._subclassResponsibility();
  1410. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)});
  1411. },
  1412. args: [],
  1413. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1414. messageSends: ["subclassResponsibility"],
  1415. referencedClasses: []
  1416. }),
  1417. globals.CollectionTest);
  1418. smalltalk.addMethod(
  1419. smalltalk.method({
  1420. selector: "collectionWithDuplicates",
  1421. protocol: 'fixture',
  1422. fn: function (){
  1423. var self=this;
  1424. return smalltalk.withContext(function($ctx1) {
  1425. self._subclassResponsibility();
  1426. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)});
  1427. },
  1428. args: [],
  1429. 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",
  1430. messageSends: ["subclassResponsibility"],
  1431. referencedClasses: []
  1432. }),
  1433. globals.CollectionTest);
  1434. smalltalk.addMethod(
  1435. smalltalk.method({
  1436. selector: "collectionWithNewValue",
  1437. protocol: 'fixture',
  1438. fn: function (){
  1439. var self=this;
  1440. return smalltalk.withContext(function($ctx1) {
  1441. self._subclassResponsibility();
  1442. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)});
  1443. },
  1444. args: [],
  1445. 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",
  1446. messageSends: ["subclassResponsibility"],
  1447. referencedClasses: []
  1448. }),
  1449. globals.CollectionTest);
  1450. smalltalk.addMethod(
  1451. smalltalk.method({
  1452. selector: "isCollectionReadOnly",
  1453. protocol: 'testing',
  1454. fn: function (){
  1455. var self=this;
  1456. return false;
  1457. },
  1458. args: [],
  1459. source: "isCollectionReadOnly\x0a\x09^ false",
  1460. messageSends: [],
  1461. referencedClasses: []
  1462. }),
  1463. globals.CollectionTest);
  1464. smalltalk.addMethod(
  1465. smalltalk.method({
  1466. selector: "sampleNewValue",
  1467. protocol: 'fixture',
  1468. fn: function (){
  1469. var self=this;
  1470. return "N";
  1471. },
  1472. args: [],
  1473. 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'",
  1474. messageSends: [],
  1475. referencedClasses: []
  1476. }),
  1477. globals.CollectionTest);
  1478. smalltalk.addMethod(
  1479. smalltalk.method({
  1480. selector: "sampleNewValueAsCollection",
  1481. protocol: 'fixture',
  1482. fn: function (){
  1483. var self=this;
  1484. return smalltalk.withContext(function($ctx1) {
  1485. var $1;
  1486. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1487. return $1;
  1488. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)});
  1489. },
  1490. args: [],
  1491. 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",
  1492. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1493. referencedClasses: []
  1494. }),
  1495. globals.CollectionTest);
  1496. smalltalk.addMethod(
  1497. smalltalk.method({
  1498. selector: "testAddAll",
  1499. protocol: 'tests',
  1500. fn: function (){
  1501. var self=this;
  1502. return smalltalk.withContext(function($ctx1) {
  1503. 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;
  1504. $2=self._collection();
  1505. $ctx1.sendIdx["collection"]=1;
  1506. $3=$2;
  1507. $5=self._collectionClass();
  1508. $ctx1.sendIdx["collectionClass"]=1;
  1509. $4=_st($5)._new();
  1510. $ctx1.sendIdx["new"]=1;
  1511. _st($3)._addAll_($4);
  1512. $ctx1.sendIdx["addAll:"]=1;
  1513. $6=_st($2)._yourself();
  1514. $ctx1.sendIdx["yourself"]=1;
  1515. $1=$6;
  1516. $7=self._collection();
  1517. $ctx1.sendIdx["collection"]=2;
  1518. self._assert_equals_($1,$7);
  1519. $ctx1.sendIdx["assert:equals:"]=1;
  1520. $10=self._collectionClass();
  1521. $ctx1.sendIdx["collectionClass"]=2;
  1522. $9=_st($10)._new();
  1523. $ctx1.sendIdx["new"]=2;
  1524. $11=$9;
  1525. $12=self._collection();
  1526. $ctx1.sendIdx["collection"]=3;
  1527. _st($11)._addAll_($12);
  1528. $ctx1.sendIdx["addAll:"]=2;
  1529. $13=_st($9)._yourself();
  1530. $ctx1.sendIdx["yourself"]=2;
  1531. $8=$13;
  1532. $14=self._collection();
  1533. $ctx1.sendIdx["collection"]=4;
  1534. self._assert_equals_($8,$14);
  1535. $ctx1.sendIdx["assert:equals:"]=2;
  1536. $17=self._collectionClass();
  1537. $ctx1.sendIdx["collectionClass"]=3;
  1538. $16=_st($17)._new();
  1539. $ctx1.sendIdx["new"]=3;
  1540. $18=$16;
  1541. $20=self._collectionClass();
  1542. $ctx1.sendIdx["collectionClass"]=4;
  1543. $19=_st($20)._new();
  1544. $ctx1.sendIdx["new"]=4;
  1545. _st($18)._addAll_($19);
  1546. $ctx1.sendIdx["addAll:"]=3;
  1547. $21=_st($16)._yourself();
  1548. $ctx1.sendIdx["yourself"]=3;
  1549. $15=$21;
  1550. self._assert_equals_($15,_st(self._collectionClass())._new());
  1551. $ctx1.sendIdx["assert:equals:"]=3;
  1552. $23=self._collection();
  1553. $ctx1.sendIdx["collection"]=5;
  1554. $24=$23;
  1555. $25=self._sampleNewValueAsCollection();
  1556. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1557. _st($24)._addAll_($25);
  1558. $ctx1.sendIdx["addAll:"]=4;
  1559. $26=_st($23)._yourself();
  1560. $ctx1.sendIdx["yourself"]=4;
  1561. $22=$26;
  1562. $27=self._collectionWithNewValue();
  1563. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1564. self._assert_equals_($22,$27);
  1565. $28=self._sampleNewValueAsCollection();
  1566. _st($28)._addAll_(self._collection());
  1567. $29=_st($28)._yourself();
  1568. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1569. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)});
  1570. },
  1571. args: [],
  1572. 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",
  1573. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1574. referencedClasses: []
  1575. }),
  1576. globals.CollectionTest);
  1577. smalltalk.addMethod(
  1578. smalltalk.method({
  1579. selector: "testAllSatisfy",
  1580. protocol: 'tests',
  1581. fn: function (){
  1582. var self=this;
  1583. var collection,anyOne;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. var $1;
  1586. collection=self._collection();
  1587. anyOne=_st(collection)._anyOne();
  1588. $1=_st(collection)._allSatisfy_((function(each){
  1589. return smalltalk.withContext(function($ctx2) {
  1590. return _st(collection)._includes_(each);
  1591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1592. }));
  1593. $ctx1.sendIdx["allSatisfy:"]=1;
  1594. self._assert_($1);
  1595. self._deny_(_st(collection)._allSatisfy_((function(each){
  1596. return smalltalk.withContext(function($ctx2) {
  1597. return _st(each).__tild_eq(anyOne);
  1598. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1599. })));
  1600. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)});
  1601. },
  1602. args: [],
  1603. 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 ])",
  1604. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1605. referencedClasses: []
  1606. }),
  1607. globals.CollectionTest);
  1608. smalltalk.addMethod(
  1609. smalltalk.method({
  1610. selector: "testAnyOne",
  1611. protocol: 'tests',
  1612. fn: function (){
  1613. var self=this;
  1614. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1615. return smalltalk.withContext(function($ctx1) {
  1616. var $2,$1;
  1617. self._should_raise_((function(){
  1618. return smalltalk.withContext(function($ctx2) {
  1619. return _st(_st(self._collectionClass())._new())._anyOne();
  1620. $ctx2.sendIdx["anyOne"]=1;
  1621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1622. }),$Error());
  1623. $2=self._collection();
  1624. $ctx1.sendIdx["collection"]=1;
  1625. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1626. self._assert_($1);
  1627. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)});
  1628. },
  1629. args: [],
  1630. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1631. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1632. referencedClasses: ["Error"]
  1633. }),
  1634. globals.CollectionTest);
  1635. smalltalk.addMethod(
  1636. smalltalk.method({
  1637. selector: "testAnySatisfy",
  1638. protocol: 'tests',
  1639. fn: function (){
  1640. var self=this;
  1641. var anyOne;
  1642. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1643. return smalltalk.withContext(function($ctx1) {
  1644. var $1,$3,$2;
  1645. $1=self._collection();
  1646. $ctx1.sendIdx["collection"]=1;
  1647. anyOne=_st($1)._anyOne();
  1648. $3=self._collection();
  1649. $ctx1.sendIdx["collection"]=2;
  1650. $2=_st($3)._anySatisfy_((function(each){
  1651. return smalltalk.withContext(function($ctx2) {
  1652. return _st(each).__eq(anyOne);
  1653. $ctx2.sendIdx["="]=1;
  1654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1655. }));
  1656. $ctx1.sendIdx["anySatisfy:"]=1;
  1657. self._assert_($2);
  1658. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1659. return smalltalk.withContext(function($ctx2) {
  1660. return _st(each).__eq(_st($Object())._new());
  1661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1662. })));
  1663. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)});
  1664. },
  1665. args: [],
  1666. 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 ])",
  1667. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1668. referencedClasses: ["Object"]
  1669. }),
  1670. globals.CollectionTest);
  1671. smalltalk.addMethod(
  1672. smalltalk.method({
  1673. selector: "testAsArray",
  1674. protocol: 'tests',
  1675. fn: function (){
  1676. var self=this;
  1677. return smalltalk.withContext(function($ctx1) {
  1678. var $1;
  1679. $1=self._collection();
  1680. $ctx1.sendIdx["collection"]=1;
  1681. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1682. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)});
  1683. },
  1684. args: [],
  1685. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1686. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1687. referencedClasses: []
  1688. }),
  1689. globals.CollectionTest);
  1690. smalltalk.addMethod(
  1691. smalltalk.method({
  1692. selector: "testAsOrderedCollection",
  1693. protocol: 'tests',
  1694. fn: function (){
  1695. var self=this;
  1696. return smalltalk.withContext(function($ctx1) {
  1697. var $1;
  1698. $1=self._collection();
  1699. $ctx1.sendIdx["collection"]=1;
  1700. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1701. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)});
  1702. },
  1703. args: [],
  1704. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1705. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1706. referencedClasses: []
  1707. }),
  1708. globals.CollectionTest);
  1709. smalltalk.addMethod(
  1710. smalltalk.method({
  1711. selector: "testAsSet",
  1712. protocol: 'tests',
  1713. fn: function (){
  1714. var self=this;
  1715. var c,set;
  1716. return smalltalk.withContext(function($ctx1) {
  1717. c=self._collectionWithDuplicates();
  1718. set=_st(c)._asSet();
  1719. self._assert_equals_(_st(set)._size(),(5));
  1720. _st(c)._do_((function(each){
  1721. return smalltalk.withContext(function($ctx2) {
  1722. return self._assert_(_st(set)._includes_(each));
  1723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1724. }));
  1725. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)});
  1726. },
  1727. args: [],
  1728. 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) ]",
  1729. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1730. referencedClasses: []
  1731. }),
  1732. globals.CollectionTest);
  1733. smalltalk.addMethod(
  1734. smalltalk.method({
  1735. selector: "testCollect",
  1736. protocol: 'tests',
  1737. fn: function (){
  1738. var self=this;
  1739. return smalltalk.withContext(function($ctx1) {
  1740. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1741. $2=self._collection();
  1742. $ctx1.sendIdx["collection"]=1;
  1743. $1=_st($2)._collect_((function(each){
  1744. return each;
  1745. }));
  1746. $ctx1.sendIdx["collect:"]=1;
  1747. $3=self._collection();
  1748. $ctx1.sendIdx["collection"]=2;
  1749. self._assert_equals_($1,$3);
  1750. $ctx1.sendIdx["assert:equals:"]=1;
  1751. $5=self._collectionWithNewValue();
  1752. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1753. $4=_st($5)._collect_((function(each){
  1754. return each;
  1755. }));
  1756. $ctx1.sendIdx["collect:"]=2;
  1757. self._assert_equals_($4,self._collectionWithNewValue());
  1758. $ctx1.sendIdx["assert:equals:"]=2;
  1759. $8=self._collectionClass();
  1760. $ctx1.sendIdx["collectionClass"]=1;
  1761. $7=_st($8)._new();
  1762. $ctx1.sendIdx["new"]=1;
  1763. $6=_st($7)._collect_((function(each){
  1764. return smalltalk.withContext(function($ctx2) {
  1765. return _st(each)._printString();
  1766. $ctx2.sendIdx["printString"]=1;
  1767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1768. }));
  1769. $ctx1.sendIdx["collect:"]=3;
  1770. self._assert_equals_($6,_st(self._collectionClass())._new());
  1771. $ctx1.sendIdx["assert:equals:"]=3;
  1772. $11=self._collection();
  1773. $ctx1.sendIdx["collection"]=3;
  1774. $10=_st($11)._collect_((function(){
  1775. return smalltalk.withContext(function($ctx2) {
  1776. return self._sampleNewValue();
  1777. $ctx2.sendIdx["sampleNewValue"]=1;
  1778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  1779. }));
  1780. $ctx1.sendIdx["collect:"]=4;
  1781. $9=_st($10)._detect_((function(){
  1782. return true;
  1783. }));
  1784. self._assert_equals_($9,self._sampleNewValue());
  1785. $ctx1.sendIdx["assert:equals:"]=4;
  1786. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1787. return smalltalk.withContext(function($ctx2) {
  1788. return _st(each)._printString();
  1789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  1790. })),self._collectionOfPrintStrings());
  1791. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)});
  1792. },
  1793. args: [],
  1794. 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",
  1795. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1796. referencedClasses: []
  1797. }),
  1798. globals.CollectionTest);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "testComma",
  1802. protocol: 'tests',
  1803. fn: function (){
  1804. var self=this;
  1805. return smalltalk.withContext(function($ctx1) {
  1806. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1807. $2=self._collection();
  1808. $ctx1.sendIdx["collection"]=1;
  1809. $4=self._collectionClass();
  1810. $ctx1.sendIdx["collectionClass"]=1;
  1811. $3=_st($4)._new();
  1812. $ctx1.sendIdx["new"]=1;
  1813. $1=_st($2).__comma($3);
  1814. $ctx1.sendIdx[","]=1;
  1815. $5=self._collection();
  1816. $ctx1.sendIdx["collection"]=2;
  1817. self._assert_equals_($1,$5);
  1818. $ctx1.sendIdx["assert:equals:"]=1;
  1819. $8=self._collectionClass();
  1820. $ctx1.sendIdx["collectionClass"]=2;
  1821. $7=_st($8)._new();
  1822. $ctx1.sendIdx["new"]=2;
  1823. $9=self._collection();
  1824. $ctx1.sendIdx["collection"]=3;
  1825. $6=_st($7).__comma($9);
  1826. $ctx1.sendIdx[","]=2;
  1827. $10=self._collection();
  1828. $ctx1.sendIdx["collection"]=4;
  1829. self._assert_equals_($6,$10);
  1830. $ctx1.sendIdx["assert:equals:"]=2;
  1831. $13=self._collectionClass();
  1832. $ctx1.sendIdx["collectionClass"]=3;
  1833. $12=_st($13)._new();
  1834. $ctx1.sendIdx["new"]=3;
  1835. $15=self._collectionClass();
  1836. $ctx1.sendIdx["collectionClass"]=4;
  1837. $14=_st($15)._new();
  1838. $ctx1.sendIdx["new"]=4;
  1839. $11=_st($12).__comma($14);
  1840. $ctx1.sendIdx[","]=3;
  1841. self._assert_equals_($11,_st(self._collectionClass())._new());
  1842. $ctx1.sendIdx["assert:equals:"]=3;
  1843. $17=self._collection();
  1844. $ctx1.sendIdx["collection"]=5;
  1845. $18=self._sampleNewValueAsCollection();
  1846. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1847. $16=_st($17).__comma($18);
  1848. $ctx1.sendIdx[","]=4;
  1849. $19=self._collectionWithNewValue();
  1850. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1851. self._assert_equals_($16,$19);
  1852. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1853. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)});
  1854. },
  1855. args: [],
  1856. 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",
  1857. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1858. referencedClasses: []
  1859. }),
  1860. globals.CollectionTest);
  1861. smalltalk.addMethod(
  1862. smalltalk.method({
  1863. selector: "testDetect",
  1864. protocol: 'tests',
  1865. fn: function (){
  1866. var self=this;
  1867. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1868. return smalltalk.withContext(function($ctx1) {
  1869. var $1,$2,$3,$4,$6,$5,$7;
  1870. self._shouldnt_raise_((function(){
  1871. return smalltalk.withContext(function($ctx2) {
  1872. $1=self._collection();
  1873. $ctx2.sendIdx["collection"]=1;
  1874. return _st($1)._detect_((function(){
  1875. return true;
  1876. }));
  1877. $ctx2.sendIdx["detect:"]=1;
  1878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1879. }),$Error());
  1880. self._should_raise_((function(){
  1881. return smalltalk.withContext(function($ctx2) {
  1882. $2=self._collection();
  1883. $ctx2.sendIdx["collection"]=2;
  1884. return _st($2)._detect_((function(){
  1885. return false;
  1886. }));
  1887. $ctx2.sendIdx["detect:"]=2;
  1888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  1889. }),$Error());
  1890. $ctx1.sendIdx["should:raise:"]=1;
  1891. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1892. return true;
  1893. }));
  1894. $ctx1.sendIdx["detect:"]=3;
  1895. $4=self._sampleNewValue();
  1896. $ctx1.sendIdx["sampleNewValue"]=1;
  1897. self._assert_equals_($3,$4);
  1898. $ctx1.sendIdx["assert:equals:"]=1;
  1899. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1900. return smalltalk.withContext(function($ctx2) {
  1901. $6=self._sampleNewValue();
  1902. $ctx2.sendIdx["sampleNewValue"]=2;
  1903. return _st(each).__eq($6);
  1904. $ctx2.sendIdx["="]=1;
  1905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  1906. }));
  1907. $ctx1.sendIdx["detect:"]=4;
  1908. $7=self._sampleNewValue();
  1909. $ctx1.sendIdx["sampleNewValue"]=3;
  1910. self._assert_equals_($5,$7);
  1911. self._should_raise_((function(){
  1912. return smalltalk.withContext(function($ctx2) {
  1913. return _st(self._collection())._detect_((function(each){
  1914. return smalltalk.withContext(function($ctx3) {
  1915. return _st(each).__eq(self._sampleNewValue());
  1916. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  1917. }));
  1918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  1919. }),$Error());
  1920. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)});
  1921. },
  1922. args: [],
  1923. 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",
  1924. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1925. referencedClasses: ["Error"]
  1926. }),
  1927. globals.CollectionTest);
  1928. smalltalk.addMethod(
  1929. smalltalk.method({
  1930. selector: "testDetectIfNone",
  1931. protocol: 'tests',
  1932. fn: function (){
  1933. var self=this;
  1934. var sentinel;
  1935. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1936. return smalltalk.withContext(function($ctx1) {
  1937. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1938. sentinel=_st($Object())._new();
  1939. $3=self._collection();
  1940. $ctx1.sendIdx["collection"]=1;
  1941. $2=_st($3)._detect_ifNone_((function(){
  1942. return true;
  1943. }),(function(){
  1944. return sentinel;
  1945. }));
  1946. $ctx1.sendIdx["detect:ifNone:"]=1;
  1947. $1=_st($2).__tild_eq(sentinel);
  1948. self._assert_($1);
  1949. $5=self._collection();
  1950. $ctx1.sendIdx["collection"]=2;
  1951. $4=_st($5)._detect_ifNone_((function(){
  1952. return false;
  1953. }),(function(){
  1954. return sentinel;
  1955. }));
  1956. $ctx1.sendIdx["detect:ifNone:"]=2;
  1957. self._assert_equals_($4,sentinel);
  1958. $ctx1.sendIdx["assert:equals:"]=1;
  1959. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1960. return true;
  1961. }),(function(){
  1962. return sentinel;
  1963. }));
  1964. $ctx1.sendIdx["detect:ifNone:"]=3;
  1965. $7=self._sampleNewValue();
  1966. $ctx1.sendIdx["sampleNewValue"]=1;
  1967. self._assert_equals_($6,$7);
  1968. $ctx1.sendIdx["assert:equals:"]=2;
  1969. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1970. return smalltalk.withContext(function($ctx2) {
  1971. $9=self._sampleNewValue();
  1972. $ctx2.sendIdx["sampleNewValue"]=2;
  1973. return _st(each).__eq($9);
  1974. $ctx2.sendIdx["="]=1;
  1975. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  1976. }),(function(){
  1977. return sentinel;
  1978. }));
  1979. $ctx1.sendIdx["detect:ifNone:"]=4;
  1980. $10=self._sampleNewValue();
  1981. $ctx1.sendIdx["sampleNewValue"]=3;
  1982. self._assert_equals_($8,$10);
  1983. $ctx1.sendIdx["assert:equals:"]=3;
  1984. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1985. return smalltalk.withContext(function($ctx2) {
  1986. return _st(each).__eq(self._sampleNewValue());
  1987. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  1988. }),(function(){
  1989. return sentinel;
  1990. })),sentinel);
  1991. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)});
  1992. },
  1993. args: [],
  1994. 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",
  1995. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1996. referencedClasses: ["Object"]
  1997. }),
  1998. globals.CollectionTest);
  1999. smalltalk.addMethod(
  2000. smalltalk.method({
  2001. selector: "testDo",
  2002. protocol: 'tests',
  2003. fn: function (){
  2004. var self=this;
  2005. var newCollection;
  2006. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  2007. return smalltalk.withContext(function($ctx1) {
  2008. var $1,$2;
  2009. newCollection=_st($OrderedCollection())._new();
  2010. $ctx1.sendIdx["new"]=1;
  2011. $1=self._collection();
  2012. $ctx1.sendIdx["collection"]=1;
  2013. _st($1)._do_((function(each){
  2014. return smalltalk.withContext(function($ctx2) {
  2015. return _st(newCollection)._add_(each);
  2016. $ctx2.sendIdx["add:"]=1;
  2017. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2018. }));
  2019. $ctx1.sendIdx["do:"]=1;
  2020. self._assertSameContents_as_(self._collection(),newCollection);
  2021. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2022. newCollection=_st($OrderedCollection())._new();
  2023. $2=self._collectionWithDuplicates();
  2024. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  2025. _st($2)._do_((function(each){
  2026. return smalltalk.withContext(function($ctx2) {
  2027. return _st(newCollection)._add_(each);
  2028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2029. }));
  2030. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  2031. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)});
  2032. },
  2033. args: [],
  2034. 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",
  2035. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  2036. referencedClasses: ["OrderedCollection"]
  2037. }),
  2038. globals.CollectionTest);
  2039. smalltalk.addMethod(
  2040. smalltalk.method({
  2041. selector: "testIfEmptyFamily",
  2042. protocol: 'tests',
  2043. fn: function (){
  2044. var self=this;
  2045. return smalltalk.withContext(function($ctx1) {
  2046. 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;
  2047. $3=self._collectionClass();
  2048. $ctx1.sendIdx["collectionClass"]=1;
  2049. $2=_st($3)._new();
  2050. $ctx1.sendIdx["new"]=1;
  2051. $1=_st($2)._ifEmpty_((function(){
  2052. return (42);
  2053. }));
  2054. $ctx1.sendIdx["ifEmpty:"]=1;
  2055. self._assert_equals_($1,(42));
  2056. $ctx1.sendIdx["assert:equals:"]=1;
  2057. $5=self._collection();
  2058. $ctx1.sendIdx["collection"]=1;
  2059. $4=_st($5)._ifEmpty_((function(){
  2060. return (42);
  2061. }));
  2062. $6=self._collection();
  2063. $ctx1.sendIdx["collection"]=2;
  2064. self._assert_equals_($4,$6);
  2065. $ctx1.sendIdx["assert:equals:"]=2;
  2066. $9=self._collectionClass();
  2067. $ctx1.sendIdx["collectionClass"]=2;
  2068. $8=_st($9)._new();
  2069. $ctx1.sendIdx["new"]=2;
  2070. $7=_st($8)._ifNotEmpty_((function(){
  2071. return (42);
  2072. }));
  2073. $ctx1.sendIdx["ifNotEmpty:"]=1;
  2074. $11=self._collectionClass();
  2075. $ctx1.sendIdx["collectionClass"]=3;
  2076. $10=_st($11)._new();
  2077. $ctx1.sendIdx["new"]=3;
  2078. self._assert_equals_($7,$10);
  2079. $ctx1.sendIdx["assert:equals:"]=3;
  2080. $13=self._collection();
  2081. $ctx1.sendIdx["collection"]=3;
  2082. $12=_st($13)._ifNotEmpty_((function(){
  2083. return (42);
  2084. }));
  2085. $ctx1.sendIdx["ifNotEmpty:"]=2;
  2086. self._assert_equals_($12,(42));
  2087. $ctx1.sendIdx["assert:equals:"]=4;
  2088. $15=self._collection();
  2089. $ctx1.sendIdx["collection"]=4;
  2090. $14=_st($15)._ifNotEmpty_((function(col){
  2091. return col;
  2092. }));
  2093. $16=self._collection();
  2094. $ctx1.sendIdx["collection"]=5;
  2095. self._assert_equals_($14,$16);
  2096. $ctx1.sendIdx["assert:equals:"]=5;
  2097. $19=self._collectionClass();
  2098. $ctx1.sendIdx["collectionClass"]=4;
  2099. $18=_st($19)._new();
  2100. $ctx1.sendIdx["new"]=4;
  2101. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  2102. return (42);
  2103. }),(function(){
  2104. return (999);
  2105. }));
  2106. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  2107. self._assert_equals_($17,(42));
  2108. $ctx1.sendIdx["assert:equals:"]=6;
  2109. $21=self._collection();
  2110. $ctx1.sendIdx["collection"]=6;
  2111. $20=_st($21)._ifEmpty_ifNotEmpty_((function(){
  2112. return (42);
  2113. }),(function(){
  2114. return (999);
  2115. }));
  2116. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  2117. self._assert_equals_($20,(999));
  2118. $ctx1.sendIdx["assert:equals:"]=7;
  2119. $23=self._collection();
  2120. $ctx1.sendIdx["collection"]=7;
  2121. $22=_st($23)._ifEmpty_ifNotEmpty_((function(){
  2122. return (42);
  2123. }),(function(col){
  2124. return col;
  2125. }));
  2126. $24=self._collection();
  2127. $ctx1.sendIdx["collection"]=8;
  2128. self._assert_equals_($22,$24);
  2129. $ctx1.sendIdx["assert:equals:"]=8;
  2130. $25=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  2131. return (42);
  2132. }),(function(){
  2133. return (999);
  2134. }));
  2135. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  2136. self._assert_equals_($25,(999));
  2137. $ctx1.sendIdx["assert:equals:"]=9;
  2138. $27=self._collection();
  2139. $ctx1.sendIdx["collection"]=9;
  2140. $26=_st($27)._ifNotEmpty_ifEmpty_((function(){
  2141. return (42);
  2142. }),(function(){
  2143. return (999);
  2144. }));
  2145. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  2146. self._assert_equals_($26,(42));
  2147. $ctx1.sendIdx["assert:equals:"]=10;
  2148. $29=self._collection();
  2149. $ctx1.sendIdx["collection"]=10;
  2150. $28=_st($29)._ifNotEmpty_ifEmpty_((function(col){
  2151. return col;
  2152. }),(function(){
  2153. return (999);
  2154. }));
  2155. self._assert_equals_($28,self._collection());
  2156. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)});
  2157. },
  2158. args: [],
  2159. 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.",
  2160. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2161. referencedClasses: []
  2162. }),
  2163. globals.CollectionTest);
  2164. smalltalk.addMethod(
  2165. smalltalk.method({
  2166. selector: "testIsEmpty",
  2167. protocol: 'tests',
  2168. fn: function (){
  2169. var self=this;
  2170. return smalltalk.withContext(function($ctx1) {
  2171. var $1;
  2172. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2173. $ctx1.sendIdx["isEmpty"]=1;
  2174. self._assert_($1);
  2175. self._deny_(_st(self._collection())._isEmpty());
  2176. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)});
  2177. },
  2178. args: [],
  2179. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2180. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2181. referencedClasses: []
  2182. }),
  2183. globals.CollectionTest);
  2184. smalltalk.addMethod(
  2185. smalltalk.method({
  2186. selector: "testNoneSatisfy",
  2187. protocol: 'tests',
  2188. fn: function (){
  2189. var self=this;
  2190. var anyOne;
  2191. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2192. return smalltalk.withContext(function($ctx1) {
  2193. var $1,$3,$2;
  2194. $1=self._collection();
  2195. $ctx1.sendIdx["collection"]=1;
  2196. anyOne=_st($1)._anyOne();
  2197. $3=self._collection();
  2198. $ctx1.sendIdx["collection"]=2;
  2199. $2=_st($3)._noneSatisfy_((function(each){
  2200. return smalltalk.withContext(function($ctx2) {
  2201. return _st(each).__eq(anyOne);
  2202. $ctx2.sendIdx["="]=1;
  2203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2204. }));
  2205. $ctx1.sendIdx["noneSatisfy:"]=1;
  2206. self._deny_($2);
  2207. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2208. return smalltalk.withContext(function($ctx2) {
  2209. return _st(each).__eq(_st($Object())._new());
  2210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2211. })));
  2212. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)});
  2213. },
  2214. args: [],
  2215. 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 ])",
  2216. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2217. referencedClasses: ["Object"]
  2218. }),
  2219. globals.CollectionTest);
  2220. smalltalk.addMethod(
  2221. smalltalk.method({
  2222. selector: "testRemoveAll",
  2223. protocol: 'tests',
  2224. fn: function (){
  2225. var self=this;
  2226. return smalltalk.withContext(function($ctx1) {
  2227. var $1,$2;
  2228. $1=self._collection();
  2229. _st($1)._removeAll();
  2230. $2=_st($1)._yourself();
  2231. self._assert_equals_($2,_st(self._collectionClass())._new());
  2232. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)});
  2233. },
  2234. args: [],
  2235. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2236. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2237. referencedClasses: []
  2238. }),
  2239. globals.CollectionTest);
  2240. smalltalk.addMethod(
  2241. smalltalk.method({
  2242. selector: "testSelect",
  2243. protocol: 'tests',
  2244. fn: function (){
  2245. var self=this;
  2246. return smalltalk.withContext(function($ctx1) {
  2247. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2248. $2=self._collection();
  2249. $ctx1.sendIdx["collection"]=1;
  2250. $1=_st($2)._select_((function(){
  2251. return false;
  2252. }));
  2253. $ctx1.sendIdx["select:"]=1;
  2254. $4=self._collectionClass();
  2255. $ctx1.sendIdx["collectionClass"]=1;
  2256. $3=_st($4)._new();
  2257. $ctx1.sendIdx["new"]=1;
  2258. self._assert_equals_($1,$3);
  2259. $ctx1.sendIdx["assert:equals:"]=1;
  2260. $6=self._collection();
  2261. $ctx1.sendIdx["collection"]=2;
  2262. $5=_st($6)._select_((function(){
  2263. return true;
  2264. }));
  2265. $ctx1.sendIdx["select:"]=2;
  2266. $7=self._collection();
  2267. $ctx1.sendIdx["collection"]=3;
  2268. self._assert_equals_($5,$7);
  2269. $ctx1.sendIdx["assert:equals:"]=2;
  2270. $9=self._collectionWithNewValue();
  2271. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2272. $8=_st($9)._select_((function(each){
  2273. return smalltalk.withContext(function($ctx2) {
  2274. $10=self._sampleNewValue();
  2275. $ctx2.sendIdx["sampleNewValue"]=1;
  2276. return _st(each).__eq($10);
  2277. $ctx2.sendIdx["="]=1;
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  2279. }));
  2280. $ctx1.sendIdx["select:"]=3;
  2281. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2282. $ctx1.sendIdx["assert:equals:"]=3;
  2283. $12=self._collectionWithNewValue();
  2284. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2285. $11=_st($12)._select_((function(each){
  2286. return smalltalk.withContext(function($ctx2) {
  2287. $13=self._sampleNewValue();
  2288. $ctx2.sendIdx["sampleNewValue"]=2;
  2289. return _st(each).__tild_eq($13);
  2290. $ctx2.sendIdx["~="]=1;
  2291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  2292. }));
  2293. $ctx1.sendIdx["select:"]=4;
  2294. $14=self._collection();
  2295. $ctx1.sendIdx["collection"]=4;
  2296. self._assert_equals_($11,$14);
  2297. $ctx1.sendIdx["assert:equals:"]=4;
  2298. $16=self._collection();
  2299. $ctx1.sendIdx["collection"]=5;
  2300. $15=_st($16)._select_((function(each){
  2301. return smalltalk.withContext(function($ctx2) {
  2302. $17=self._sampleNewValue();
  2303. $ctx2.sendIdx["sampleNewValue"]=3;
  2304. return _st(each).__eq($17);
  2305. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  2306. }));
  2307. $ctx1.sendIdx["select:"]=5;
  2308. self._assert_equals_($15,_st(self._collectionClass())._new());
  2309. $ctx1.sendIdx["assert:equals:"]=5;
  2310. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2311. return smalltalk.withContext(function($ctx2) {
  2312. return _st(each).__tild_eq(self._sampleNewValue());
  2313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  2314. })),self._collection());
  2315. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)});
  2316. },
  2317. args: [],
  2318. 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",
  2319. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2320. referencedClasses: []
  2321. }),
  2322. globals.CollectionTest);
  2323. smalltalk.addMethod(
  2324. smalltalk.method({
  2325. selector: "testSize",
  2326. protocol: 'tests',
  2327. fn: function (){
  2328. var self=this;
  2329. return smalltalk.withContext(function($ctx1) {
  2330. var $1,$2;
  2331. $1=_st(_st(self._collectionClass())._new())._size();
  2332. $ctx1.sendIdx["size"]=1;
  2333. self._assert_equals_($1,(0));
  2334. $ctx1.sendIdx["assert:equals:"]=1;
  2335. $2=_st(self._sampleNewValueAsCollection())._size();
  2336. $ctx1.sendIdx["size"]=2;
  2337. self._assert_equals_($2,(1));
  2338. $ctx1.sendIdx["assert:equals:"]=2;
  2339. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2340. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)});
  2341. },
  2342. args: [],
  2343. 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",
  2344. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2345. referencedClasses: []
  2346. }),
  2347. globals.CollectionTest);
  2348. smalltalk.addMethod(
  2349. smalltalk.method({
  2350. selector: "collectionClass",
  2351. protocol: 'fixture',
  2352. fn: function (){
  2353. var self=this;
  2354. return nil;
  2355. },
  2356. args: [],
  2357. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2358. messageSends: [],
  2359. referencedClasses: []
  2360. }),
  2361. globals.CollectionTest.klass);
  2362. smalltalk.addMethod(
  2363. smalltalk.method({
  2364. selector: "isAbstract",
  2365. protocol: 'testing',
  2366. fn: function (){
  2367. var self=this;
  2368. return smalltalk.withContext(function($ctx1) {
  2369. var $1;
  2370. $1=_st(self._collectionClass())._isNil();
  2371. return $1;
  2372. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)});
  2373. },
  2374. args: [],
  2375. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2376. messageSends: ["isNil", "collectionClass"],
  2377. referencedClasses: []
  2378. }),
  2379. globals.CollectionTest.klass);
  2380. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2381. smalltalk.addMethod(
  2382. smalltalk.method({
  2383. selector: "collectionWithNewValue",
  2384. protocol: 'fixture',
  2385. fn: function (){
  2386. var self=this;
  2387. return smalltalk.withContext(function($ctx1) {
  2388. self._subclassResponsibility();
  2389. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)});
  2390. },
  2391. args: [],
  2392. 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",
  2393. messageSends: ["subclassResponsibility"],
  2394. referencedClasses: []
  2395. }),
  2396. globals.IndexableCollectionTest);
  2397. smalltalk.addMethod(
  2398. smalltalk.method({
  2399. selector: "sampleNewIndex",
  2400. protocol: 'fixture',
  2401. fn: function (){
  2402. var self=this;
  2403. return smalltalk.withContext(function($ctx1) {
  2404. self._subclassResponsibility();
  2405. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)});
  2406. },
  2407. args: [],
  2408. 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",
  2409. messageSends: ["subclassResponsibility"],
  2410. referencedClasses: []
  2411. }),
  2412. globals.IndexableCollectionTest);
  2413. smalltalk.addMethod(
  2414. smalltalk.method({
  2415. selector: "sampleNonIndexesDo:",
  2416. protocol: 'fixture',
  2417. fn: function (aBlock){
  2418. var self=this;
  2419. return smalltalk.withContext(function($ctx1) {
  2420. self._subclassResponsibility();
  2421. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)});
  2422. },
  2423. args: ["aBlock"],
  2424. 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",
  2425. messageSends: ["subclassResponsibility"],
  2426. referencedClasses: []
  2427. }),
  2428. globals.IndexableCollectionTest);
  2429. smalltalk.addMethod(
  2430. smalltalk.method({
  2431. selector: "samplesDo:",
  2432. protocol: 'fixture',
  2433. fn: function (aBlock){
  2434. var self=this;
  2435. return smalltalk.withContext(function($ctx1) {
  2436. self._subclassResponsibility();
  2437. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)});
  2438. },
  2439. args: ["aBlock"],
  2440. 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",
  2441. messageSends: ["subclassResponsibility"],
  2442. referencedClasses: []
  2443. }),
  2444. globals.IndexableCollectionTest);
  2445. smalltalk.addMethod(
  2446. smalltalk.method({
  2447. selector: "testAt",
  2448. protocol: 'tests',
  2449. fn: function (){
  2450. var self=this;
  2451. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2452. return smalltalk.withContext(function($ctx1) {
  2453. var $1;
  2454. self._nonIndexesDo_((function(each){
  2455. return smalltalk.withContext(function($ctx2) {
  2456. return self._should_raise_((function(){
  2457. return smalltalk.withContext(function($ctx3) {
  2458. $1=self._collection();
  2459. $ctx3.sendIdx["collection"]=1;
  2460. return _st($1)._at_(each);
  2461. $ctx3.sendIdx["at:"]=1;
  2462. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2463. }),$Error());
  2464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2465. }));
  2466. self._samplesDo_((function(index,value){
  2467. return smalltalk.withContext(function($ctx2) {
  2468. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2469. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  2470. }));
  2471. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)});
  2472. },
  2473. args: [],
  2474. 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 ]",
  2475. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2476. referencedClasses: ["Error"]
  2477. }),
  2478. globals.IndexableCollectionTest);
  2479. smalltalk.addMethod(
  2480. smalltalk.method({
  2481. selector: "testAtIfAbsent",
  2482. protocol: 'tests',
  2483. fn: function (){
  2484. var self=this;
  2485. return smalltalk.withContext(function($ctx1) {
  2486. var $2,$1,$3;
  2487. self._nonIndexesDo_((function(each){
  2488. return smalltalk.withContext(function($ctx2) {
  2489. $2=self._collection();
  2490. $ctx2.sendIdx["collection"]=1;
  2491. $1=_st($2)._at_ifAbsent_(each,(function(){
  2492. return smalltalk.withContext(function($ctx3) {
  2493. return self._sampleNewValue();
  2494. $ctx3.sendIdx["sampleNewValue"]=1;
  2495. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2496. }));
  2497. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2498. $3=self._sampleNewValue();
  2499. $ctx2.sendIdx["sampleNewValue"]=2;
  2500. return self._assert_equals_($1,$3);
  2501. $ctx2.sendIdx["assert:equals:"]=1;
  2502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2503. }));
  2504. self._samplesDo_((function(index,value){
  2505. return smalltalk.withContext(function($ctx2) {
  2506. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2507. return smalltalk.withContext(function($ctx3) {
  2508. return self._sampleNewValue();
  2509. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  2510. })),value);
  2511. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  2512. }));
  2513. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)});
  2514. },
  2515. args: [],
  2516. 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 ].",
  2517. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2518. referencedClasses: []
  2519. }),
  2520. globals.IndexableCollectionTest);
  2521. smalltalk.addMethod(
  2522. smalltalk.method({
  2523. selector: "testAtIfAbsentPut",
  2524. protocol: 'tests',
  2525. fn: function (){
  2526. var self=this;
  2527. var newCollection;
  2528. return smalltalk.withContext(function($ctx1) {
  2529. var $1;
  2530. newCollection=self._collection();
  2531. $ctx1.sendIdx["collection"]=1;
  2532. self._samplesDo_((function(index,value){
  2533. return smalltalk.withContext(function($ctx2) {
  2534. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2535. return smalltalk.withContext(function($ctx3) {
  2536. return self._sampleNewValue();
  2537. $ctx3.sendIdx["sampleNewValue"]=1;
  2538. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2539. }));
  2540. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2541. return self._assert_equals_($1,value);
  2542. $ctx2.sendIdx["assert:equals:"]=1;
  2543. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  2544. }));
  2545. self._assert_equals_(newCollection,self._collection());
  2546. $ctx1.sendIdx["assert:equals:"]=2;
  2547. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2548. return smalltalk.withContext(function($ctx2) {
  2549. return self._sampleNewValue();
  2550. $ctx2.sendIdx["sampleNewValue"]=2;
  2551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  2552. })),self._sampleNewValue());
  2553. $ctx1.sendIdx["assert:equals:"]=3;
  2554. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2555. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)});
  2556. },
  2557. args: [],
  2558. 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",
  2559. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2560. referencedClasses: []
  2561. }),
  2562. globals.IndexableCollectionTest);
  2563. smalltalk.addMethod(
  2564. smalltalk.method({
  2565. selector: "testAtIfPresent",
  2566. protocol: 'tests',
  2567. fn: function (){
  2568. var self=this;
  2569. var visited,sentinel;
  2570. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2571. return smalltalk.withContext(function($ctx1) {
  2572. var $2,$1,$4,$3;
  2573. sentinel=_st($Object())._new();
  2574. self._nonIndexesDo_((function(each){
  2575. return smalltalk.withContext(function($ctx2) {
  2576. visited=nil;
  2577. visited;
  2578. $2=self._collection();
  2579. $ctx2.sendIdx["collection"]=1;
  2580. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2581. visited=value1;
  2582. visited;
  2583. return sentinel;
  2584. }));
  2585. $ctx2.sendIdx["at:ifPresent:"]=1;
  2586. self._assert_equals_($1,nil);
  2587. $ctx2.sendIdx["assert:equals:"]=1;
  2588. return self._assert_(_st(visited)._isNil());
  2589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2590. }));
  2591. self._samplesDo_((function(index,value){
  2592. return smalltalk.withContext(function($ctx2) {
  2593. visited=nil;
  2594. visited;
  2595. $4=self._collection();
  2596. $ctx2.sendIdx["collection"]=2;
  2597. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2598. visited=value2;
  2599. visited;
  2600. return sentinel;
  2601. }));
  2602. self._assert_equals_($3,sentinel);
  2603. $ctx2.sendIdx["assert:equals:"]=2;
  2604. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2605. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  2606. }));
  2607. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)});
  2608. },
  2609. args: [],
  2610. 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) ]",
  2611. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2612. referencedClasses: ["Object"]
  2613. }),
  2614. globals.IndexableCollectionTest);
  2615. smalltalk.addMethod(
  2616. smalltalk.method({
  2617. selector: "testAtIfPresentIfAbsent",
  2618. protocol: 'tests',
  2619. fn: function (){
  2620. var self=this;
  2621. var visited,sentinel;
  2622. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2623. return smalltalk.withContext(function($ctx1) {
  2624. var $2,$1,$3,$5,$4;
  2625. sentinel=_st($Object())._new();
  2626. self._nonIndexesDo_((function(each){
  2627. return smalltalk.withContext(function($ctx2) {
  2628. visited=nil;
  2629. visited;
  2630. $2=self._collection();
  2631. $ctx2.sendIdx["collection"]=1;
  2632. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2633. visited=value1;
  2634. visited;
  2635. return sentinel;
  2636. }),(function(){
  2637. return smalltalk.withContext(function($ctx3) {
  2638. return self._sampleNewValue();
  2639. $ctx3.sendIdx["sampleNewValue"]=1;
  2640. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  2641. }));
  2642. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2643. $3=self._sampleNewValue();
  2644. $ctx2.sendIdx["sampleNewValue"]=2;
  2645. self._assert_equals_($1,$3);
  2646. $ctx2.sendIdx["assert:equals:"]=1;
  2647. return self._assert_(_st(visited)._isNil());
  2648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2649. }));
  2650. self._samplesDo_((function(index,value){
  2651. return smalltalk.withContext(function($ctx2) {
  2652. visited=nil;
  2653. visited;
  2654. $5=self._collection();
  2655. $ctx2.sendIdx["collection"]=2;
  2656. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2657. visited=value2;
  2658. visited;
  2659. return sentinel;
  2660. }),(function(){
  2661. return smalltalk.withContext(function($ctx3) {
  2662. return self._sampleNewValue();
  2663. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  2664. }));
  2665. self._assert_equals_($4,sentinel);
  2666. $ctx2.sendIdx["assert:equals:"]=2;
  2667. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2668. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  2669. }));
  2670. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)});
  2671. },
  2672. args: [],
  2673. 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) ]",
  2674. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2675. referencedClasses: ["Object"]
  2676. }),
  2677. globals.IndexableCollectionTest);
  2678. smalltalk.addMethod(
  2679. smalltalk.method({
  2680. selector: "testAtPut",
  2681. protocol: 'tests',
  2682. fn: function (){
  2683. var self=this;
  2684. var newCollection;
  2685. return smalltalk.withContext(function($ctx1) {
  2686. newCollection=self._collection();
  2687. $ctx1.sendIdx["collection"]=1;
  2688. self._samplesDo_((function(index,value){
  2689. return smalltalk.withContext(function($ctx2) {
  2690. return _st(newCollection)._at_put_(index,value);
  2691. $ctx2.sendIdx["at:put:"]=1;
  2692. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  2693. }));
  2694. self._assert_equals_(newCollection,self._collection());
  2695. $ctx1.sendIdx["assert:equals:"]=1;
  2696. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2697. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2698. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)});
  2699. },
  2700. args: [],
  2701. 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",
  2702. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2703. referencedClasses: []
  2704. }),
  2705. globals.IndexableCollectionTest);
  2706. smalltalk.addMethod(
  2707. smalltalk.method({
  2708. selector: "testEquality",
  2709. protocol: 'tests',
  2710. fn: function (){
  2711. var self=this;
  2712. return smalltalk.withContext(function($ctx1) {
  2713. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2714. $2=self._collectionClass();
  2715. $ctx1.sendIdx["collectionClass"]=1;
  2716. $1=_st($2)._new();
  2717. $ctx1.sendIdx["new"]=1;
  2718. $4=self._collectionClass();
  2719. $ctx1.sendIdx["collectionClass"]=2;
  2720. $3=_st($4)._new();
  2721. $ctx1.sendIdx["new"]=2;
  2722. self._assert_equals_($1,$3);
  2723. $ctx1.sendIdx["assert:equals:"]=1;
  2724. $5=self._collection();
  2725. $ctx1.sendIdx["collection"]=1;
  2726. $6=self._collection();
  2727. $ctx1.sendIdx["collection"]=2;
  2728. self._assert_equals_($5,$6);
  2729. $ctx1.sendIdx["assert:equals:"]=2;
  2730. $7=self._collectionWithNewValue();
  2731. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2732. self._assert_equals_($7,self._collectionWithNewValue());
  2733. $10=self._collectionClass();
  2734. $ctx1.sendIdx["collectionClass"]=3;
  2735. $9=_st($10)._new();
  2736. $ctx1.sendIdx["new"]=3;
  2737. $11=self._collection();
  2738. $ctx1.sendIdx["collection"]=3;
  2739. $8=_st($9).__eq($11);
  2740. $ctx1.sendIdx["="]=1;
  2741. self._deny_($8);
  2742. $ctx1.sendIdx["deny:"]=1;
  2743. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2744. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)});
  2745. },
  2746. args: [],
  2747. 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",
  2748. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2749. referencedClasses: []
  2750. }),
  2751. globals.IndexableCollectionTest);
  2752. smalltalk.addMethod(
  2753. smalltalk.method({
  2754. selector: "testIndexOf",
  2755. protocol: 'tests',
  2756. fn: function (){
  2757. var self=this;
  2758. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2759. return smalltalk.withContext(function($ctx1) {
  2760. var $1;
  2761. self._should_raise_((function(){
  2762. return smalltalk.withContext(function($ctx2) {
  2763. $1=self._collection();
  2764. $ctx2.sendIdx["collection"]=1;
  2765. return _st($1)._indexOf_(self._sampleNewValue());
  2766. $ctx2.sendIdx["indexOf:"]=1;
  2767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2768. }),$Error());
  2769. self._samplesDo_((function(index,value){
  2770. return smalltalk.withContext(function($ctx2) {
  2771. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2772. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  2773. }));
  2774. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)});
  2775. },
  2776. args: [],
  2777. 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 ]",
  2778. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2779. referencedClasses: ["Error"]
  2780. }),
  2781. globals.IndexableCollectionTest);
  2782. smalltalk.addMethod(
  2783. smalltalk.method({
  2784. selector: "testIndexOfWithNull",
  2785. protocol: 'tests',
  2786. fn: function (){
  2787. var self=this;
  2788. var jsNull;
  2789. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2790. return smalltalk.withContext(function($ctx1) {
  2791. var $1,$2;
  2792. jsNull=_st($JSON())._parse_("null");
  2793. self._samplesDo_((function(index,value){
  2794. return smalltalk.withContext(function($ctx2) {
  2795. $1=self._collection();
  2796. _st($1)._at_put_(index,jsNull);
  2797. $2=_st($1)._indexOf_(jsNull);
  2798. return self._assert_equals_($2,index);
  2799. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  2800. }));
  2801. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)});
  2802. },
  2803. args: [],
  2804. 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 ]",
  2805. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2806. referencedClasses: ["JSON"]
  2807. }),
  2808. globals.IndexableCollectionTest);
  2809. smalltalk.addMethod(
  2810. smalltalk.method({
  2811. selector: "testWithIndexDo",
  2812. protocol: 'tests',
  2813. fn: function (){
  2814. var self=this;
  2815. var collection;
  2816. return smalltalk.withContext(function($ctx1) {
  2817. collection=self._collection();
  2818. $ctx1.sendIdx["collection"]=1;
  2819. _st(self._collection())._withIndexDo_((function(each,index){
  2820. return smalltalk.withContext(function($ctx2) {
  2821. return self._assert_equals_(_st(collection)._at_(index),each);
  2822. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  2823. }));
  2824. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)});
  2825. },
  2826. args: [],
  2827. 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 ]",
  2828. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2829. referencedClasses: []
  2830. }),
  2831. globals.IndexableCollectionTest);
  2832. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2833. smalltalk.addMethod(
  2834. smalltalk.method({
  2835. selector: "collectionKeys",
  2836. protocol: 'fixture',
  2837. fn: function (){
  2838. var self=this;
  2839. return smalltalk.withContext(function($ctx1) {
  2840. self._subclassResponsibility();
  2841. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)});
  2842. },
  2843. args: [],
  2844. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2845. messageSends: ["subclassResponsibility"],
  2846. referencedClasses: []
  2847. }),
  2848. globals.AssociativeCollectionTest);
  2849. smalltalk.addMethod(
  2850. smalltalk.method({
  2851. selector: "collectionValues",
  2852. protocol: 'fixture',
  2853. fn: function (){
  2854. var self=this;
  2855. return smalltalk.withContext(function($ctx1) {
  2856. self._subclassResponsibility();
  2857. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)});
  2858. },
  2859. args: [],
  2860. source: "collectionValues\x0a\x09self subclassResponsibility",
  2861. messageSends: ["subclassResponsibility"],
  2862. referencedClasses: []
  2863. }),
  2864. globals.AssociativeCollectionTest);
  2865. smalltalk.addMethod(
  2866. smalltalk.method({
  2867. selector: "nonIndexesDo:",
  2868. protocol: 'fixture',
  2869. fn: function (aBlock){
  2870. var self=this;
  2871. return smalltalk.withContext(function($ctx1) {
  2872. _st(aBlock)._value_((5));
  2873. $ctx1.sendIdx["value:"]=1;
  2874. _st(aBlock)._value_("z");
  2875. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)});
  2876. },
  2877. args: ["aBlock"],
  2878. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2879. messageSends: ["value:"],
  2880. referencedClasses: []
  2881. }),
  2882. globals.AssociativeCollectionTest);
  2883. smalltalk.addMethod(
  2884. smalltalk.method({
  2885. selector: "sampleNewIndex",
  2886. protocol: 'fixture',
  2887. fn: function (){
  2888. var self=this;
  2889. return "new";
  2890. },
  2891. args: [],
  2892. source: "sampleNewIndex\x0a\x09^ 'new'",
  2893. messageSends: [],
  2894. referencedClasses: []
  2895. }),
  2896. globals.AssociativeCollectionTest);
  2897. smalltalk.addMethod(
  2898. smalltalk.method({
  2899. selector: "samplesDo:",
  2900. protocol: 'fixture',
  2901. fn: function (aBlock){
  2902. var self=this;
  2903. return smalltalk.withContext(function($ctx1) {
  2904. _st(aBlock)._value_value_("a",(2));
  2905. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)});
  2906. },
  2907. args: ["aBlock"],
  2908. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2909. messageSends: ["value:value:"],
  2910. referencedClasses: []
  2911. }),
  2912. globals.AssociativeCollectionTest);
  2913. smalltalk.addMethod(
  2914. smalltalk.method({
  2915. selector: "testAddAll",
  2916. protocol: 'tests',
  2917. fn: function (){
  2918. var self=this;
  2919. return smalltalk.withContext(function($ctx1) {
  2920. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2921. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2922. $ctx1.supercall = false;
  2923. $2=self._collection();
  2924. $ctx1.sendIdx["collection"]=1;
  2925. $3=$2;
  2926. $4=self._collection();
  2927. $ctx1.sendIdx["collection"]=2;
  2928. _st($3)._addAll_($4);
  2929. $ctx1.sendIdx["addAll:"]=1;
  2930. $5=_st($2)._yourself();
  2931. $ctx1.sendIdx["yourself"]=1;
  2932. $1=$5;
  2933. $6=self._collection();
  2934. $ctx1.sendIdx["collection"]=3;
  2935. self._assert_equals_($1,$6);
  2936. $ctx1.sendIdx["assert:equals:"]=1;
  2937. $8=self._collection();
  2938. $ctx1.sendIdx["collection"]=4;
  2939. $9=$8;
  2940. $10=self._collectionWithNewValue();
  2941. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2942. _st($9)._addAll_($10);
  2943. $ctx1.sendIdx["addAll:"]=2;
  2944. $11=_st($8)._yourself();
  2945. $ctx1.sendIdx["yourself"]=2;
  2946. $7=$11;
  2947. $12=self._collectionWithNewValue();
  2948. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2949. self._assert_equals_($7,$12);
  2950. $ctx1.sendIdx["assert:equals:"]=2;
  2951. $14=self._collectionWithNewValue();
  2952. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2953. _st($14)._addAll_(self._collection());
  2954. $15=_st($14)._yourself();
  2955. $13=$15;
  2956. self._assert_equals_($13,self._collectionWithNewValue());
  2957. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)});
  2958. },
  2959. args: [],
  2960. 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",
  2961. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2962. referencedClasses: []
  2963. }),
  2964. globals.AssociativeCollectionTest);
  2965. smalltalk.addMethod(
  2966. smalltalk.method({
  2967. selector: "testAsDictionary",
  2968. protocol: 'tests',
  2969. fn: function (){
  2970. var self=this;
  2971. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2972. return smalltalk.withContext(function($ctx1) {
  2973. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2974. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)});
  2975. },
  2976. args: [],
  2977. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2978. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2979. referencedClasses: ["Dictionary"]
  2980. }),
  2981. globals.AssociativeCollectionTest);
  2982. smalltalk.addMethod(
  2983. smalltalk.method({
  2984. selector: "testAsHashedCollection",
  2985. protocol: 'tests',
  2986. fn: function (){
  2987. var self=this;
  2988. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2989. return smalltalk.withContext(function($ctx1) {
  2990. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2991. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)});
  2992. },
  2993. args: [],
  2994. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2995. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2996. referencedClasses: ["HashedCollection"]
  2997. }),
  2998. globals.AssociativeCollectionTest);
  2999. smalltalk.addMethod(
  3000. smalltalk.method({
  3001. selector: "testComma",
  3002. protocol: 'tests',
  3003. fn: function (){
  3004. var self=this;
  3005. return smalltalk.withContext(function($ctx1) {
  3006. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  3007. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  3008. $ctx1.supercall = false;
  3009. $2=self._collection();
  3010. $ctx1.sendIdx["collection"]=1;
  3011. $3=self._collection();
  3012. $ctx1.sendIdx["collection"]=2;
  3013. $1=_st($2).__comma($3);
  3014. $ctx1.sendIdx[","]=1;
  3015. $4=self._collection();
  3016. $ctx1.sendIdx["collection"]=3;
  3017. self._assert_equals_($1,$4);
  3018. $ctx1.sendIdx["assert:equals:"]=1;
  3019. $6=self._collection();
  3020. $ctx1.sendIdx["collection"]=4;
  3021. $7=self._collectionWithNewValue();
  3022. $ctx1.sendIdx["collectionWithNewValue"]=1;
  3023. $5=_st($6).__comma($7);
  3024. $ctx1.sendIdx[","]=2;
  3025. $8=self._collectionWithNewValue();
  3026. $ctx1.sendIdx["collectionWithNewValue"]=2;
  3027. self._assert_equals_($5,$8);
  3028. $ctx1.sendIdx["assert:equals:"]=2;
  3029. $10=self._collectionWithNewValue();
  3030. $ctx1.sendIdx["collectionWithNewValue"]=3;
  3031. $9=_st($10).__comma(self._collection());
  3032. self._assert_equals_($9,self._collectionWithNewValue());
  3033. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)});
  3034. },
  3035. args: [],
  3036. 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",
  3037. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  3038. referencedClasses: []
  3039. }),
  3040. globals.AssociativeCollectionTest);
  3041. smalltalk.addMethod(
  3042. smalltalk.method({
  3043. selector: "testFrom",
  3044. protocol: 'tests',
  3045. fn: function (){
  3046. var self=this;
  3047. var associations;
  3048. return smalltalk.withContext(function($ctx1) {
  3049. var $1;
  3050. $1="a".__minus_gt((1));
  3051. $ctx1.sendIdx["->"]=1;
  3052. associations=[$1,"b".__minus_gt((2))];
  3053. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  3054. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)});
  3055. },
  3056. args: [],
  3057. 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 }.",
  3058. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  3059. referencedClasses: []
  3060. }),
  3061. globals.AssociativeCollectionTest);
  3062. smalltalk.addMethod(
  3063. smalltalk.method({
  3064. selector: "testKeys",
  3065. protocol: 'tests',
  3066. fn: function (){
  3067. var self=this;
  3068. return smalltalk.withContext(function($ctx1) {
  3069. var $2,$1,$3,$4;
  3070. $2=_st(_st(self._collectionClass())._new())._keys();
  3071. $ctx1.sendIdx["keys"]=1;
  3072. $1=_st($2)._isEmpty();
  3073. self._assert_($1);
  3074. $3=_st(self._collection())._keys();
  3075. $ctx1.sendIdx["keys"]=2;
  3076. $4=self._collectionKeys();
  3077. $ctx1.sendIdx["collectionKeys"]=1;
  3078. self._assertSameContents_as_($3,$4);
  3079. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3080. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  3081. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)});
  3082. },
  3083. args: [],
  3084. 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 }",
  3085. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  3086. referencedClasses: []
  3087. }),
  3088. globals.AssociativeCollectionTest);
  3089. smalltalk.addMethod(
  3090. smalltalk.method({
  3091. selector: "testNewFromPairs",
  3092. protocol: 'tests',
  3093. fn: function (){
  3094. var self=this;
  3095. var flattenedAssociations;
  3096. return smalltalk.withContext(function($ctx1) {
  3097. flattenedAssociations=["a",(1),"b",(2)];
  3098. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  3099. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)});
  3100. },
  3101. args: [],
  3102. 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 }.",
  3103. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  3104. referencedClasses: []
  3105. }),
  3106. globals.AssociativeCollectionTest);
  3107. smalltalk.addMethod(
  3108. smalltalk.method({
  3109. selector: "testPrintString",
  3110. protocol: 'tests',
  3111. fn: function (){
  3112. var self=this;
  3113. return smalltalk.withContext(function($ctx1) {
  3114. var $3,$2,$4,$1,$5;
  3115. $3=self._collectionClass();
  3116. $ctx1.sendIdx["collectionClass"]=1;
  3117. $2=_st($3)._new();
  3118. _st($2)._at_put_("firstname","James");
  3119. $ctx1.sendIdx["at:put:"]=1;
  3120. _st($2)._at_put_("lastname","Bond");
  3121. $4=_st($2)._printString();
  3122. $1=$4;
  3123. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3124. $ctx1.sendIdx[","]=1;
  3125. self._assert_equals_($1,$5);
  3126. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)});
  3127. },
  3128. args: [],
  3129. 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'')'",
  3130. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  3131. referencedClasses: []
  3132. }),
  3133. globals.AssociativeCollectionTest);
  3134. smalltalk.addMethod(
  3135. smalltalk.method({
  3136. selector: "testRemoveKey",
  3137. protocol: 'tests',
  3138. fn: function (){
  3139. var self=this;
  3140. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3141. return smalltalk.withContext(function($ctx1) {
  3142. var $1,$2,$3,$5,$6,$4,$7,$8;
  3143. self._nonIndexesDo_((function(each){
  3144. var collection;
  3145. return smalltalk.withContext(function($ctx2) {
  3146. collection=self._collection();
  3147. $ctx2.sendIdx["collection"]=1;
  3148. collection;
  3149. self._should_raise_((function(){
  3150. return smalltalk.withContext(function($ctx3) {
  3151. return _st(collection)._removeKey_(each);
  3152. $ctx3.sendIdx["removeKey:"]=1;
  3153. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3154. }),$Error());
  3155. $1=collection;
  3156. $2=self._collection();
  3157. $ctx2.sendIdx["collection"]=2;
  3158. return self._assert_equals_($1,$2);
  3159. $ctx2.sendIdx["assert:equals:"]=1;
  3160. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  3161. }));
  3162. self._samplesDo_((function(index,value){
  3163. var collection;
  3164. return smalltalk.withContext(function($ctx2) {
  3165. collection=self._collection();
  3166. $ctx2.sendIdx["collection"]=3;
  3167. collection;
  3168. $3=_st(collection)._removeKey_(index);
  3169. $ctx2.sendIdx["removeKey:"]=2;
  3170. self._assert_equals_($3,value);
  3171. $ctx2.sendIdx["assert:equals:"]=2;
  3172. $5=collection;
  3173. $6=self._collection();
  3174. $ctx2.sendIdx["collection"]=4;
  3175. $4=_st($5).__eq($6);
  3176. return self._deny_($4);
  3177. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  3178. }));
  3179. $7=self._collectionWithNewValue();
  3180. _st($7)._removeKey_(self._sampleNewIndex());
  3181. $8=_st($7)._yourself();
  3182. self._assert_equals_($8,self._collection());
  3183. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)});
  3184. },
  3185. args: [],
  3186. 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",
  3187. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  3188. referencedClasses: ["Error"]
  3189. }),
  3190. globals.AssociativeCollectionTest);
  3191. smalltalk.addMethod(
  3192. smalltalk.method({
  3193. selector: "testRemoveKeyIfAbsent",
  3194. protocol: 'tests',
  3195. fn: function (){
  3196. var self=this;
  3197. return smalltalk.withContext(function($ctx1) {
  3198. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  3199. self._nonIndexesDo_((function(each){
  3200. var collection;
  3201. return smalltalk.withContext(function($ctx2) {
  3202. collection=self._collection();
  3203. $ctx2.sendIdx["collection"]=1;
  3204. collection;
  3205. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  3206. return smalltalk.withContext(function($ctx3) {
  3207. return self._sampleNewValue();
  3208. $ctx3.sendIdx["sampleNewValue"]=1;
  3209. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3210. }));
  3211. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  3212. $2=self._sampleNewValue();
  3213. $ctx2.sendIdx["sampleNewValue"]=2;
  3214. self._assert_equals_($1,$2);
  3215. $ctx2.sendIdx["assert:equals:"]=1;
  3216. $3=collection;
  3217. $4=self._collection();
  3218. $ctx2.sendIdx["collection"]=2;
  3219. return self._assert_equals_($3,$4);
  3220. $ctx2.sendIdx["assert:equals:"]=2;
  3221. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  3222. }));
  3223. self._samplesDo_((function(index,value){
  3224. var collection;
  3225. return smalltalk.withContext(function($ctx2) {
  3226. collection=self._collection();
  3227. $ctx2.sendIdx["collection"]=3;
  3228. collection;
  3229. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3230. return smalltalk.withContext(function($ctx3) {
  3231. return self._sampleNewValue();
  3232. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  3233. }));
  3234. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3235. self._assert_equals_($5,value);
  3236. $ctx2.sendIdx["assert:equals:"]=3;
  3237. $7=collection;
  3238. $8=self._collection();
  3239. $ctx2.sendIdx["collection"]=4;
  3240. $6=_st($7).__eq($8);
  3241. return self._deny_($6);
  3242. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  3243. }));
  3244. $9=self._collectionWithNewValue();
  3245. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3246. return smalltalk.withContext(function($ctx2) {
  3247. return self._assert_(false);
  3248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  3249. }));
  3250. $10=_st($9)._yourself();
  3251. self._assert_equals_($10,self._collection());
  3252. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)});
  3253. },
  3254. args: [],
  3255. 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",
  3256. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3257. referencedClasses: []
  3258. }),
  3259. globals.AssociativeCollectionTest);
  3260. smalltalk.addMethod(
  3261. smalltalk.method({
  3262. selector: "testValues",
  3263. protocol: 'tests',
  3264. fn: function (){
  3265. var self=this;
  3266. return smalltalk.withContext(function($ctx1) {
  3267. var $2,$1,$3,$4;
  3268. $2=_st(_st(self._collectionClass())._new())._values();
  3269. $ctx1.sendIdx["values"]=1;
  3270. $1=_st($2)._isEmpty();
  3271. self._assert_($1);
  3272. $3=_st(self._collection())._values();
  3273. $ctx1.sendIdx["values"]=2;
  3274. $4=self._collectionValues();
  3275. $ctx1.sendIdx["collectionValues"]=1;
  3276. self._assertSameContents_as_($3,$4);
  3277. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3278. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3279. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)});
  3280. },
  3281. args: [],
  3282. 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 }",
  3283. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3284. referencedClasses: []
  3285. }),
  3286. globals.AssociativeCollectionTest);
  3287. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3288. smalltalk.addMethod(
  3289. smalltalk.method({
  3290. selector: "collection",
  3291. protocol: 'fixture',
  3292. fn: function (){
  3293. var self=this;
  3294. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3295. return smalltalk.withContext(function($ctx1) {
  3296. var $2,$3,$1;
  3297. $2=_st($Dictionary())._new();
  3298. _st($2)._at_put_((1),(1));
  3299. $ctx1.sendIdx["at:put:"]=1;
  3300. _st($2)._at_put_("a",(2));
  3301. $ctx1.sendIdx["at:put:"]=2;
  3302. _st($2)._at_put_(true,(3));
  3303. $ctx1.sendIdx["at:put:"]=3;
  3304. _st($2)._at_put_((1).__at((3)),(-4));
  3305. $3=_st($2)._yourself();
  3306. $1=$3;
  3307. return $1;
  3308. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)});
  3309. },
  3310. args: [],
  3311. 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",
  3312. messageSends: ["at:put:", "new", "@", "yourself"],
  3313. referencedClasses: ["Dictionary"]
  3314. }),
  3315. globals.DictionaryTest);
  3316. smalltalk.addMethod(
  3317. smalltalk.method({
  3318. selector: "collectionKeys",
  3319. protocol: 'fixture',
  3320. fn: function (){
  3321. var self=this;
  3322. return smalltalk.withContext(function($ctx1) {
  3323. var $1;
  3324. $1=[(1),"a",true,(1).__at((3))];
  3325. return $1;
  3326. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)});
  3327. },
  3328. args: [],
  3329. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3330. messageSends: ["@"],
  3331. referencedClasses: []
  3332. }),
  3333. globals.DictionaryTest);
  3334. smalltalk.addMethod(
  3335. smalltalk.method({
  3336. selector: "collectionOfPrintStrings",
  3337. protocol: 'fixture',
  3338. fn: function (){
  3339. var self=this;
  3340. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3341. return smalltalk.withContext(function($ctx1) {
  3342. var $2,$3,$1;
  3343. $2=_st($Dictionary())._new();
  3344. _st($2)._at_put_((1),"1");
  3345. $ctx1.sendIdx["at:put:"]=1;
  3346. _st($2)._at_put_("a","2");
  3347. $ctx1.sendIdx["at:put:"]=2;
  3348. _st($2)._at_put_(true,"3");
  3349. $ctx1.sendIdx["at:put:"]=3;
  3350. _st($2)._at_put_((1).__at((3)),"-4");
  3351. $3=_st($2)._yourself();
  3352. $1=$3;
  3353. return $1;
  3354. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)});
  3355. },
  3356. args: [],
  3357. 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",
  3358. messageSends: ["at:put:", "new", "@", "yourself"],
  3359. referencedClasses: ["Dictionary"]
  3360. }),
  3361. globals.DictionaryTest);
  3362. smalltalk.addMethod(
  3363. smalltalk.method({
  3364. selector: "collectionSize",
  3365. protocol: 'fixture',
  3366. fn: function (){
  3367. var self=this;
  3368. return (4);
  3369. },
  3370. args: [],
  3371. source: "collectionSize\x0a\x09^ 4",
  3372. messageSends: [],
  3373. referencedClasses: []
  3374. }),
  3375. globals.DictionaryTest);
  3376. smalltalk.addMethod(
  3377. smalltalk.method({
  3378. selector: "collectionValues",
  3379. protocol: 'fixture',
  3380. fn: function (){
  3381. var self=this;
  3382. var $1;
  3383. $1=[(1),(2),(3),(-4)];
  3384. return $1;
  3385. },
  3386. args: [],
  3387. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3388. messageSends: [],
  3389. referencedClasses: []
  3390. }),
  3391. globals.DictionaryTest);
  3392. smalltalk.addMethod(
  3393. smalltalk.method({
  3394. selector: "collectionWithDuplicates",
  3395. protocol: 'fixture',
  3396. fn: function (){
  3397. var self=this;
  3398. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3399. return smalltalk.withContext(function($ctx1) {
  3400. var $2,$3,$1;
  3401. $2=_st($Dictionary())._new();
  3402. _st($2)._at_put_((1),(1));
  3403. $ctx1.sendIdx["at:put:"]=1;
  3404. _st($2)._at_put_("a",(2));
  3405. $ctx1.sendIdx["at:put:"]=2;
  3406. _st($2)._at_put_(true,(3));
  3407. $ctx1.sendIdx["at:put:"]=3;
  3408. _st($2)._at_put_((4),(-4));
  3409. $ctx1.sendIdx["at:put:"]=4;
  3410. _st($2)._at_put_("b",(1));
  3411. $ctx1.sendIdx["at:put:"]=5;
  3412. _st($2)._at_put_((3),(3));
  3413. $ctx1.sendIdx["at:put:"]=6;
  3414. _st($2)._at_put_(false,(12));
  3415. $3=_st($2)._yourself();
  3416. $1=$3;
  3417. return $1;
  3418. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)});
  3419. },
  3420. args: [],
  3421. 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",
  3422. messageSends: ["at:put:", "new", "yourself"],
  3423. referencedClasses: ["Dictionary"]
  3424. }),
  3425. globals.DictionaryTest);
  3426. smalltalk.addMethod(
  3427. smalltalk.method({
  3428. selector: "collectionWithNewValue",
  3429. protocol: 'fixture',
  3430. fn: function (){
  3431. var self=this;
  3432. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3433. return smalltalk.withContext(function($ctx1) {
  3434. var $2,$3,$1;
  3435. $2=_st($Dictionary())._new();
  3436. _st($2)._at_put_((1),(1));
  3437. $ctx1.sendIdx["at:put:"]=1;
  3438. _st($2)._at_put_("a",(2));
  3439. $ctx1.sendIdx["at:put:"]=2;
  3440. _st($2)._at_put_(true,(3));
  3441. $ctx1.sendIdx["at:put:"]=3;
  3442. _st($2)._at_put_((1).__at((3)),(-4));
  3443. $ctx1.sendIdx["at:put:"]=4;
  3444. _st($2)._at_put_("new","N");
  3445. $3=_st($2)._yourself();
  3446. $1=$3;
  3447. return $1;
  3448. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)});
  3449. },
  3450. args: [],
  3451. 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",
  3452. messageSends: ["at:put:", "new", "@", "yourself"],
  3453. referencedClasses: ["Dictionary"]
  3454. }),
  3455. globals.DictionaryTest);
  3456. smalltalk.addMethod(
  3457. smalltalk.method({
  3458. selector: "sampleNewValueAsCollection",
  3459. protocol: 'fixture',
  3460. fn: function (){
  3461. var self=this;
  3462. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3463. return smalltalk.withContext(function($ctx1) {
  3464. var $2,$3,$1;
  3465. $2=_st($Dictionary())._new();
  3466. _st($2)._at_put_("new","N");
  3467. $3=_st($2)._yourself();
  3468. $1=$3;
  3469. return $1;
  3470. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)});
  3471. },
  3472. args: [],
  3473. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3474. messageSends: ["at:put:", "new", "yourself"],
  3475. referencedClasses: ["Dictionary"]
  3476. }),
  3477. globals.DictionaryTest);
  3478. smalltalk.addMethod(
  3479. smalltalk.method({
  3480. selector: "samplesDo:",
  3481. protocol: 'fixture',
  3482. fn: function (aBlock){
  3483. var self=this;
  3484. return smalltalk.withContext(function($ctx1) {
  3485. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3486. $ctx1.supercall = false;
  3487. _st(aBlock)._value_value_(true,(3));
  3488. $ctx1.sendIdx["value:value:"]=1;
  3489. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3490. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)});
  3491. },
  3492. args: ["aBlock"],
  3493. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3494. messageSends: ["samplesDo:", "value:value:", "@"],
  3495. referencedClasses: []
  3496. }),
  3497. globals.DictionaryTest);
  3498. smalltalk.addMethod(
  3499. smalltalk.method({
  3500. selector: "testAccessing",
  3501. protocol: 'tests',
  3502. fn: function (){
  3503. var self=this;
  3504. var d;
  3505. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3506. return smalltalk.withContext(function($ctx1) {
  3507. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3508. d=_st($Dictionary())._new();
  3509. _st(d)._at_put_("hello","world");
  3510. $ctx1.sendIdx["at:put:"]=1;
  3511. $1=_st(d)._at_("hello");
  3512. $ctx1.sendIdx["at:"]=1;
  3513. self._assert_equals_($1,"world");
  3514. $ctx1.sendIdx["assert:equals:"]=1;
  3515. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3516. return nil;
  3517. }));
  3518. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3519. self._assert_equals_($2,"world");
  3520. $ctx1.sendIdx["assert:equals:"]=2;
  3521. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3522. return nil;
  3523. }))).__eq("world"));
  3524. $ctx1.sendIdx["deny:"]=1;
  3525. $3=_st(d)._includesKey_("hello");
  3526. $ctx1.sendIdx["includesKey:"]=1;
  3527. self._assert_($3);
  3528. $ctx1.sendIdx["assert:"]=1;
  3529. $4=_st(d)._includesKey_("foo");
  3530. $ctx1.sendIdx["includesKey:"]=2;
  3531. self._deny_($4);
  3532. $ctx1.sendIdx["deny:"]=2;
  3533. _st(d)._at_put_((1),(2));
  3534. $ctx1.sendIdx["at:put:"]=2;
  3535. $5=_st(d)._at_((1));
  3536. $ctx1.sendIdx["at:"]=2;
  3537. self._assert_equals_($5,(2));
  3538. $ctx1.sendIdx["assert:equals:"]=3;
  3539. $6=d;
  3540. $7=(1).__at((3));
  3541. $ctx1.sendIdx["@"]=1;
  3542. _st($6)._at_put_($7,(3));
  3543. $9=d;
  3544. $10=(1).__at((3));
  3545. $ctx1.sendIdx["@"]=2;
  3546. $8=_st($9)._at_($10);
  3547. self._assert_equals_($8,(3));
  3548. $12=d;
  3549. $13=(1).__at((3));
  3550. $ctx1.sendIdx["@"]=3;
  3551. $11=_st($12)._includesKey_($13);
  3552. $ctx1.sendIdx["includesKey:"]=3;
  3553. self._assert_($11);
  3554. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3555. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)});
  3556. },
  3557. args: [],
  3558. 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)",
  3559. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3560. referencedClasses: ["Dictionary"]
  3561. }),
  3562. globals.DictionaryTest);
  3563. smalltalk.addMethod(
  3564. smalltalk.method({
  3565. selector: "testDynamicDictionaries",
  3566. protocol: 'tests',
  3567. fn: function (){
  3568. var self=this;
  3569. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3570. return smalltalk.withContext(function($ctx1) {
  3571. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3572. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)});
  3573. },
  3574. args: [],
  3575. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3576. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3577. referencedClasses: ["Dictionary"]
  3578. }),
  3579. globals.DictionaryTest);
  3580. smalltalk.addMethod(
  3581. smalltalk.method({
  3582. selector: "collectionClass",
  3583. protocol: 'fixture',
  3584. fn: function (){
  3585. var self=this;
  3586. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3587. return $Dictionary();
  3588. },
  3589. args: [],
  3590. source: "collectionClass\x0a\x09^ Dictionary",
  3591. messageSends: [],
  3592. referencedClasses: ["Dictionary"]
  3593. }),
  3594. globals.DictionaryTest.klass);
  3595. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3596. smalltalk.addMethod(
  3597. smalltalk.method({
  3598. selector: "collection",
  3599. protocol: 'fixture',
  3600. fn: function (){
  3601. var self=this;
  3602. var $1;
  3603. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3604. return $1;
  3605. },
  3606. args: [],
  3607. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3608. messageSends: [],
  3609. referencedClasses: []
  3610. }),
  3611. globals.HashedCollectionTest);
  3612. smalltalk.addMethod(
  3613. smalltalk.method({
  3614. selector: "collectionKeys",
  3615. protocol: 'fixture',
  3616. fn: function (){
  3617. var self=this;
  3618. var $1;
  3619. $1=["b","a","c","d"];
  3620. return $1;
  3621. },
  3622. args: [],
  3623. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3624. messageSends: [],
  3625. referencedClasses: []
  3626. }),
  3627. globals.HashedCollectionTest);
  3628. smalltalk.addMethod(
  3629. smalltalk.method({
  3630. selector: "collectionOfPrintStrings",
  3631. protocol: 'fixture',
  3632. fn: function (){
  3633. var self=this;
  3634. var $1;
  3635. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3636. return $1;
  3637. },
  3638. args: [],
  3639. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3640. messageSends: [],
  3641. referencedClasses: []
  3642. }),
  3643. globals.HashedCollectionTest);
  3644. smalltalk.addMethod(
  3645. smalltalk.method({
  3646. selector: "collectionSize",
  3647. protocol: 'fixture',
  3648. fn: function (){
  3649. var self=this;
  3650. return (4);
  3651. },
  3652. args: [],
  3653. source: "collectionSize\x0a\x09^ 4",
  3654. messageSends: [],
  3655. referencedClasses: []
  3656. }),
  3657. globals.HashedCollectionTest);
  3658. smalltalk.addMethod(
  3659. smalltalk.method({
  3660. selector: "collectionValues",
  3661. protocol: 'fixture',
  3662. fn: function (){
  3663. var self=this;
  3664. var $1;
  3665. $1=[(1),(2),(3),(-4)];
  3666. return $1;
  3667. },
  3668. args: [],
  3669. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3670. messageSends: [],
  3671. referencedClasses: []
  3672. }),
  3673. globals.HashedCollectionTest);
  3674. smalltalk.addMethod(
  3675. smalltalk.method({
  3676. selector: "collectionWithDuplicates",
  3677. protocol: 'fixture',
  3678. fn: function (){
  3679. var self=this;
  3680. var $1;
  3681. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3682. return $1;
  3683. },
  3684. args: [],
  3685. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3686. messageSends: [],
  3687. referencedClasses: []
  3688. }),
  3689. globals.HashedCollectionTest);
  3690. smalltalk.addMethod(
  3691. smalltalk.method({
  3692. selector: "collectionWithNewValue",
  3693. protocol: 'fixture',
  3694. fn: function (){
  3695. var self=this;
  3696. var $1;
  3697. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3698. return $1;
  3699. },
  3700. args: [],
  3701. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3702. messageSends: [],
  3703. referencedClasses: []
  3704. }),
  3705. globals.HashedCollectionTest);
  3706. smalltalk.addMethod(
  3707. smalltalk.method({
  3708. selector: "sampleNewValueAsCollection",
  3709. protocol: 'fixture',
  3710. fn: function (){
  3711. var self=this;
  3712. var $1;
  3713. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3714. return $1;
  3715. },
  3716. args: [],
  3717. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3718. messageSends: [],
  3719. referencedClasses: []
  3720. }),
  3721. globals.HashedCollectionTest);
  3722. smalltalk.addMethod(
  3723. smalltalk.method({
  3724. selector: "testDynamicDictionaries",
  3725. protocol: 'tests',
  3726. fn: function (){
  3727. var self=this;
  3728. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3729. return smalltalk.withContext(function($ctx1) {
  3730. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3731. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)});
  3732. },
  3733. args: [],
  3734. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3735. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3736. referencedClasses: ["HashedCollection"]
  3737. }),
  3738. globals.HashedCollectionTest);
  3739. smalltalk.addMethod(
  3740. smalltalk.method({
  3741. selector: "collectionClass",
  3742. protocol: 'fixture',
  3743. fn: function (){
  3744. var self=this;
  3745. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3746. return $HashedCollection();
  3747. },
  3748. args: [],
  3749. source: "collectionClass\x0a\x09^ HashedCollection",
  3750. messageSends: [],
  3751. referencedClasses: ["HashedCollection"]
  3752. }),
  3753. globals.HashedCollectionTest.klass);
  3754. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3755. smalltalk.addMethod(
  3756. smalltalk.method({
  3757. selector: "collectionFirst",
  3758. protocol: 'fixture',
  3759. fn: function (){
  3760. var self=this;
  3761. return smalltalk.withContext(function($ctx1) {
  3762. self._subclassResponsibility();
  3763. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)});
  3764. },
  3765. args: [],
  3766. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3767. messageSends: ["subclassResponsibility"],
  3768. referencedClasses: []
  3769. }),
  3770. globals.SequenceableCollectionTest);
  3771. smalltalk.addMethod(
  3772. smalltalk.method({
  3773. selector: "collectionFirstTwo",
  3774. protocol: 'fixture',
  3775. fn: function (){
  3776. var self=this;
  3777. return smalltalk.withContext(function($ctx1) {
  3778. self._subclassResponsibility();
  3779. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)});
  3780. },
  3781. args: [],
  3782. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3783. messageSends: ["subclassResponsibility"],
  3784. referencedClasses: []
  3785. }),
  3786. globals.SequenceableCollectionTest);
  3787. smalltalk.addMethod(
  3788. smalltalk.method({
  3789. selector: "collectionLast",
  3790. protocol: 'fixture',
  3791. fn: function (){
  3792. var self=this;
  3793. return smalltalk.withContext(function($ctx1) {
  3794. self._subclassResponsibility();
  3795. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)});
  3796. },
  3797. args: [],
  3798. source: "collectionLast\x0a\x09self subclassResponsibility",
  3799. messageSends: ["subclassResponsibility"],
  3800. referencedClasses: []
  3801. }),
  3802. globals.SequenceableCollectionTest);
  3803. smalltalk.addMethod(
  3804. smalltalk.method({
  3805. selector: "collectionLastTwo",
  3806. protocol: 'fixture',
  3807. fn: function (){
  3808. var self=this;
  3809. return smalltalk.withContext(function($ctx1) {
  3810. self._subclassResponsibility();
  3811. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)});
  3812. },
  3813. args: [],
  3814. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3815. messageSends: ["subclassResponsibility"],
  3816. referencedClasses: []
  3817. }),
  3818. globals.SequenceableCollectionTest);
  3819. smalltalk.addMethod(
  3820. smalltalk.method({
  3821. selector: "nonIndexesDo:",
  3822. protocol: 'fixture',
  3823. fn: function (aBlock){
  3824. var self=this;
  3825. return smalltalk.withContext(function($ctx1) {
  3826. _st(aBlock)._value_((0));
  3827. $ctx1.sendIdx["value:"]=1;
  3828. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3829. $ctx1.sendIdx["value:"]=2;
  3830. _st(aBlock)._value_("z");
  3831. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)});
  3832. },
  3833. args: ["aBlock"],
  3834. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3835. messageSends: ["value:", "+", "collectionSize"],
  3836. referencedClasses: []
  3837. }),
  3838. globals.SequenceableCollectionTest);
  3839. smalltalk.addMethod(
  3840. smalltalk.method({
  3841. selector: "samplesDo:",
  3842. protocol: 'fixture',
  3843. fn: function (aBlock){
  3844. var self=this;
  3845. return smalltalk.withContext(function($ctx1) {
  3846. _st(aBlock)._value_value_((1),self._collectionFirst());
  3847. $ctx1.sendIdx["value:value:"]=1;
  3848. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3849. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)});
  3850. },
  3851. args: ["aBlock"],
  3852. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3853. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3854. referencedClasses: []
  3855. }),
  3856. globals.SequenceableCollectionTest);
  3857. smalltalk.addMethod(
  3858. smalltalk.method({
  3859. selector: "testBeginsWith",
  3860. protocol: 'tests',
  3861. fn: function (){
  3862. var self=this;
  3863. return smalltalk.withContext(function($ctx1) {
  3864. var $2,$1,$4,$5,$3,$7,$6;
  3865. $2=self._collection();
  3866. $ctx1.sendIdx["collection"]=1;
  3867. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3868. $ctx1.sendIdx["beginsWith:"]=1;
  3869. self._assert_($1);
  3870. $ctx1.sendIdx["assert:"]=1;
  3871. $4=self._collection();
  3872. $ctx1.sendIdx["collection"]=2;
  3873. $5=self._collection();
  3874. $ctx1.sendIdx["collection"]=3;
  3875. $3=_st($4)._beginsWith_($5);
  3876. $ctx1.sendIdx["beginsWith:"]=2;
  3877. self._assert_($3);
  3878. $ctx1.sendIdx["assert:"]=2;
  3879. $7=self._collection();
  3880. $ctx1.sendIdx["collection"]=4;
  3881. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3882. $ctx1.sendIdx["beginsWith:"]=3;
  3883. self._assert_($6);
  3884. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3885. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)});
  3886. },
  3887. args: [],
  3888. 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)",
  3889. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3890. referencedClasses: []
  3891. }),
  3892. globals.SequenceableCollectionTest);
  3893. smalltalk.addMethod(
  3894. smalltalk.method({
  3895. selector: "testEndsWith",
  3896. protocol: 'tests',
  3897. fn: function (){
  3898. var self=this;
  3899. return smalltalk.withContext(function($ctx1) {
  3900. var $2,$1,$4,$5,$3,$7,$6;
  3901. $2=self._collection();
  3902. $ctx1.sendIdx["collection"]=1;
  3903. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3904. $ctx1.sendIdx["endsWith:"]=1;
  3905. self._assert_($1);
  3906. $ctx1.sendIdx["assert:"]=1;
  3907. $4=self._collection();
  3908. $ctx1.sendIdx["collection"]=2;
  3909. $5=self._collection();
  3910. $ctx1.sendIdx["collection"]=3;
  3911. $3=_st($4)._endsWith_($5);
  3912. $ctx1.sendIdx["endsWith:"]=2;
  3913. self._assert_($3);
  3914. $ctx1.sendIdx["assert:"]=2;
  3915. $7=self._collection();
  3916. $ctx1.sendIdx["collection"]=4;
  3917. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3918. $ctx1.sendIdx["endsWith:"]=3;
  3919. self._assert_($6);
  3920. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3921. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)});
  3922. },
  3923. args: [],
  3924. 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)",
  3925. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3926. referencedClasses: []
  3927. }),
  3928. globals.SequenceableCollectionTest);
  3929. smalltalk.addMethod(
  3930. smalltalk.method({
  3931. selector: "testFirst",
  3932. protocol: 'tests',
  3933. fn: function (){
  3934. var self=this;
  3935. return smalltalk.withContext(function($ctx1) {
  3936. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3937. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)});
  3938. },
  3939. args: [],
  3940. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3941. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3942. referencedClasses: []
  3943. }),
  3944. globals.SequenceableCollectionTest);
  3945. smalltalk.addMethod(
  3946. smalltalk.method({
  3947. selector: "testFirstN",
  3948. protocol: 'tests',
  3949. fn: function (){
  3950. var self=this;
  3951. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3952. return smalltalk.withContext(function($ctx1) {
  3953. var $2,$1,$4,$3,$6,$5,$7;
  3954. $2=self._collection();
  3955. $ctx1.sendIdx["collection"]=1;
  3956. $1=_st($2)._first_((2));
  3957. $ctx1.sendIdx["first:"]=1;
  3958. self._assert_equals_($1,self._collectionFirstTwo());
  3959. $ctx1.sendIdx["assert:equals:"]=1;
  3960. $4=self._collection();
  3961. $ctx1.sendIdx["collection"]=2;
  3962. $3=_st($4)._first_((0));
  3963. $ctx1.sendIdx["first:"]=2;
  3964. self._assert_equals_($3,_st(self._collectionClass())._new());
  3965. $ctx1.sendIdx["assert:equals:"]=2;
  3966. $6=self._collection();
  3967. $ctx1.sendIdx["collection"]=3;
  3968. $5=_st($6)._first_(self._collectionSize());
  3969. $ctx1.sendIdx["first:"]=3;
  3970. $7=self._collection();
  3971. $ctx1.sendIdx["collection"]=4;
  3972. self._assert_equals_($5,$7);
  3973. self._should_raise_((function(){
  3974. return smalltalk.withContext(function($ctx2) {
  3975. return _st(self._collection())._first_((33));
  3976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3977. }),$Error());
  3978. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)});
  3979. },
  3980. args: [],
  3981. 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",
  3982. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3983. referencedClasses: ["Error"]
  3984. }),
  3985. globals.SequenceableCollectionTest);
  3986. smalltalk.addMethod(
  3987. smalltalk.method({
  3988. selector: "testFourth",
  3989. protocol: 'tests',
  3990. fn: function (){
  3991. var self=this;
  3992. return smalltalk.withContext(function($ctx1) {
  3993. var $2,$1;
  3994. $2=self._collection();
  3995. $ctx1.sendIdx["collection"]=1;
  3996. $1=_st($2)._fourth();
  3997. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3998. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)});
  3999. },
  4000. args: [],
  4001. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  4002. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  4003. referencedClasses: []
  4004. }),
  4005. globals.SequenceableCollectionTest);
  4006. smalltalk.addMethod(
  4007. smalltalk.method({
  4008. selector: "testIndexOfStartingAt",
  4009. protocol: 'tests',
  4010. fn: function (){
  4011. var self=this;
  4012. var jsNull;
  4013. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  4014. return smalltalk.withContext(function($ctx1) {
  4015. var $2,$1,$4,$3;
  4016. jsNull=_st($JSON())._parse_("null");
  4017. self._samplesDo_((function(index,value){
  4018. return smalltalk.withContext(function($ctx2) {
  4019. $2=self._collection();
  4020. $ctx2.sendIdx["collection"]=1;
  4021. $1=_st($2)._indexOf_startingAt_(value,(1));
  4022. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  4023. self._assert_equals_($1,index);
  4024. $ctx2.sendIdx["assert:equals:"]=1;
  4025. $4=self._collection();
  4026. $ctx2.sendIdx["collection"]=2;
  4027. $3=_st($4)._indexOf_startingAt_(value,index);
  4028. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  4029. self._assert_equals_($3,index);
  4030. $ctx2.sendIdx["assert:equals:"]=2;
  4031. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  4032. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  4033. }));
  4034. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)});
  4035. },
  4036. args: [],
  4037. 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 ]",
  4038. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  4039. referencedClasses: ["JSON"]
  4040. }),
  4041. globals.SequenceableCollectionTest);
  4042. smalltalk.addMethod(
  4043. smalltalk.method({
  4044. selector: "testIndexOfStartingAtWithNull",
  4045. protocol: 'tests',
  4046. fn: function (){
  4047. var self=this;
  4048. var jsNull;
  4049. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  4050. return smalltalk.withContext(function($ctx1) {
  4051. var $1,$2;
  4052. jsNull=_st($JSON())._parse_("null");
  4053. self._samplesDo_((function(index,value){
  4054. var collection;
  4055. return smalltalk.withContext(function($ctx2) {
  4056. collection=self._collection();
  4057. collection;
  4058. _st(collection)._at_put_(index,jsNull);
  4059. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  4060. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  4061. self._assert_equals_($1,index);
  4062. $ctx2.sendIdx["assert:equals:"]=1;
  4063. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  4064. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  4065. self._assert_equals_($2,index);
  4066. $ctx2.sendIdx["assert:equals:"]=2;
  4067. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  4068. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  4069. }));
  4070. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)});
  4071. },
  4072. args: [],
  4073. 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 ]",
  4074. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  4075. referencedClasses: ["JSON"]
  4076. }),
  4077. globals.SequenceableCollectionTest);
  4078. smalltalk.addMethod(
  4079. smalltalk.method({
  4080. selector: "testLast",
  4081. protocol: 'tests',
  4082. fn: function (){
  4083. var self=this;
  4084. return smalltalk.withContext(function($ctx1) {
  4085. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  4086. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)});
  4087. },
  4088. args: [],
  4089. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  4090. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  4091. referencedClasses: []
  4092. }),
  4093. globals.SequenceableCollectionTest);
  4094. smalltalk.addMethod(
  4095. smalltalk.method({
  4096. selector: "testLastN",
  4097. protocol: 'tests',
  4098. fn: function (){
  4099. var self=this;
  4100. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4101. return smalltalk.withContext(function($ctx1) {
  4102. var $2,$1,$4,$3,$6,$5,$7;
  4103. $2=self._collection();
  4104. $ctx1.sendIdx["collection"]=1;
  4105. $1=_st($2)._last_((2));
  4106. $ctx1.sendIdx["last:"]=1;
  4107. self._assert_equals_($1,self._collectionLastTwo());
  4108. $ctx1.sendIdx["assert:equals:"]=1;
  4109. $4=self._collection();
  4110. $ctx1.sendIdx["collection"]=2;
  4111. $3=_st($4)._last_((0));
  4112. $ctx1.sendIdx["last:"]=2;
  4113. self._assert_equals_($3,_st(self._collectionClass())._new());
  4114. $ctx1.sendIdx["assert:equals:"]=2;
  4115. $6=self._collection();
  4116. $ctx1.sendIdx["collection"]=3;
  4117. $5=_st($6)._last_(self._collectionSize());
  4118. $ctx1.sendIdx["last:"]=3;
  4119. $7=self._collection();
  4120. $ctx1.sendIdx["collection"]=4;
  4121. self._assert_equals_($5,$7);
  4122. self._should_raise_((function(){
  4123. return smalltalk.withContext(function($ctx2) {
  4124. return _st(self._collection())._last_((33));
  4125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4126. }),$Error());
  4127. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)});
  4128. },
  4129. args: [],
  4130. 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",
  4131. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  4132. referencedClasses: ["Error"]
  4133. }),
  4134. globals.SequenceableCollectionTest);
  4135. smalltalk.addMethod(
  4136. smalltalk.method({
  4137. selector: "testSecond",
  4138. protocol: 'tests',
  4139. fn: function (){
  4140. var self=this;
  4141. return smalltalk.withContext(function($ctx1) {
  4142. var $2,$1;
  4143. $2=self._collection();
  4144. $ctx1.sendIdx["collection"]=1;
  4145. $1=_st($2)._second();
  4146. self._assert_equals_($1,_st(self._collection())._at_((2)));
  4147. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)});
  4148. },
  4149. args: [],
  4150. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  4151. messageSends: ["assert:equals:", "second", "collection", "at:"],
  4152. referencedClasses: []
  4153. }),
  4154. globals.SequenceableCollectionTest);
  4155. smalltalk.addMethod(
  4156. smalltalk.method({
  4157. selector: "testThird",
  4158. protocol: 'tests',
  4159. fn: function (){
  4160. var self=this;
  4161. return smalltalk.withContext(function($ctx1) {
  4162. var $2,$1;
  4163. $2=self._collection();
  4164. $ctx1.sendIdx["collection"]=1;
  4165. $1=_st($2)._third();
  4166. self._assert_equals_($1,_st(self._collection())._at_((3)));
  4167. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)});
  4168. },
  4169. args: [],
  4170. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  4171. messageSends: ["assert:equals:", "third", "collection", "at:"],
  4172. referencedClasses: []
  4173. }),
  4174. globals.SequenceableCollectionTest);
  4175. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4176. smalltalk.addMethod(
  4177. smalltalk.method({
  4178. selector: "collection",
  4179. protocol: 'fixture',
  4180. fn: function (){
  4181. var self=this;
  4182. var $1;
  4183. $1=[(1), (2), (3), (-4)];
  4184. return $1;
  4185. },
  4186. args: [],
  4187. source: "collection\x0a\x09^ #(1 2 3 -4)",
  4188. messageSends: [],
  4189. referencedClasses: []
  4190. }),
  4191. globals.ArrayTest);
  4192. smalltalk.addMethod(
  4193. smalltalk.method({
  4194. selector: "collectionFirst",
  4195. protocol: 'fixture',
  4196. fn: function (){
  4197. var self=this;
  4198. return (1);
  4199. },
  4200. args: [],
  4201. source: "collectionFirst\x0a\x09^ 1",
  4202. messageSends: [],
  4203. referencedClasses: []
  4204. }),
  4205. globals.ArrayTest);
  4206. smalltalk.addMethod(
  4207. smalltalk.method({
  4208. selector: "collectionFirstTwo",
  4209. protocol: 'fixture',
  4210. fn: function (){
  4211. var self=this;
  4212. var $1;
  4213. $1=[(1), (2)];
  4214. return $1;
  4215. },
  4216. args: [],
  4217. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4218. messageSends: [],
  4219. referencedClasses: []
  4220. }),
  4221. globals.ArrayTest);
  4222. smalltalk.addMethod(
  4223. smalltalk.method({
  4224. selector: "collectionLast",
  4225. protocol: 'fixture',
  4226. fn: function (){
  4227. var self=this;
  4228. return (-4);
  4229. },
  4230. args: [],
  4231. source: "collectionLast\x0a\x09^ -4",
  4232. messageSends: [],
  4233. referencedClasses: []
  4234. }),
  4235. globals.ArrayTest);
  4236. smalltalk.addMethod(
  4237. smalltalk.method({
  4238. selector: "collectionLastTwo",
  4239. protocol: 'fixture',
  4240. fn: function (){
  4241. var self=this;
  4242. var $1;
  4243. $1=[(3), (-4)];
  4244. return $1;
  4245. },
  4246. args: [],
  4247. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4248. messageSends: [],
  4249. referencedClasses: []
  4250. }),
  4251. globals.ArrayTest);
  4252. smalltalk.addMethod(
  4253. smalltalk.method({
  4254. selector: "collectionOfPrintStrings",
  4255. protocol: 'fixture',
  4256. fn: function (){
  4257. var self=this;
  4258. var $1;
  4259. $1=["1", "2", "3", "-4"];
  4260. return $1;
  4261. },
  4262. args: [],
  4263. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4264. messageSends: [],
  4265. referencedClasses: []
  4266. }),
  4267. globals.ArrayTest);
  4268. smalltalk.addMethod(
  4269. smalltalk.method({
  4270. selector: "collectionSize",
  4271. protocol: 'fixture',
  4272. fn: function (){
  4273. var self=this;
  4274. return (4);
  4275. },
  4276. args: [],
  4277. source: "collectionSize\x0a\x09^ 4",
  4278. messageSends: [],
  4279. referencedClasses: []
  4280. }),
  4281. globals.ArrayTest);
  4282. smalltalk.addMethod(
  4283. smalltalk.method({
  4284. selector: "collectionWithDuplicates",
  4285. protocol: 'fixture',
  4286. fn: function (){
  4287. var self=this;
  4288. var $1;
  4289. $1=["a", "b", "c", (1), (2), (1), "a"];
  4290. return $1;
  4291. },
  4292. args: [],
  4293. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4294. messageSends: [],
  4295. referencedClasses: []
  4296. }),
  4297. globals.ArrayTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "collectionWithNewValue",
  4301. protocol: 'fixture',
  4302. fn: function (){
  4303. var self=this;
  4304. var $1;
  4305. $1=[(1), (2), (3), (-4), "N"];
  4306. return $1;
  4307. },
  4308. args: [],
  4309. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4310. messageSends: [],
  4311. referencedClasses: []
  4312. }),
  4313. globals.ArrayTest);
  4314. smalltalk.addMethod(
  4315. smalltalk.method({
  4316. selector: "sampleNewIndex",
  4317. protocol: 'fixture',
  4318. fn: function (){
  4319. var self=this;
  4320. return (5);
  4321. },
  4322. args: [],
  4323. source: "sampleNewIndex\x0a\x09^ 5",
  4324. messageSends: [],
  4325. referencedClasses: []
  4326. }),
  4327. globals.ArrayTest);
  4328. smalltalk.addMethod(
  4329. smalltalk.method({
  4330. selector: "samplesDo:",
  4331. protocol: 'fixture',
  4332. fn: function (aBlock){
  4333. var self=this;
  4334. return smalltalk.withContext(function($ctx1) {
  4335. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4336. $ctx1.supercall = false;
  4337. _st(aBlock)._value_value_((3),(3));
  4338. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)});
  4339. },
  4340. args: ["aBlock"],
  4341. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4342. messageSends: ["samplesDo:", "value:value:"],
  4343. referencedClasses: []
  4344. }),
  4345. globals.ArrayTest);
  4346. smalltalk.addMethod(
  4347. smalltalk.method({
  4348. selector: "testAdd",
  4349. protocol: 'tests',
  4350. fn: function (){
  4351. var self=this;
  4352. var array;
  4353. return smalltalk.withContext(function($ctx1) {
  4354. array=self._collection();
  4355. _st(array)._add_((6));
  4356. self._assert_equals_(_st(array)._last(),(6));
  4357. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)});
  4358. },
  4359. args: [],
  4360. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4361. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4362. referencedClasses: []
  4363. }),
  4364. globals.ArrayTest);
  4365. smalltalk.addMethod(
  4366. smalltalk.method({
  4367. selector: "testAddFirst",
  4368. protocol: 'tests',
  4369. fn: function (){
  4370. var self=this;
  4371. return smalltalk.withContext(function($ctx1) {
  4372. var $1,$2;
  4373. $1=self._collection();
  4374. _st($1)._addFirst_((0));
  4375. $2=_st($1)._yourself();
  4376. self._assert_equals_(_st($2)._first(),(0));
  4377. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)});
  4378. },
  4379. args: [],
  4380. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4381. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4382. referencedClasses: []
  4383. }),
  4384. globals.ArrayTest);
  4385. smalltalk.addMethod(
  4386. smalltalk.method({
  4387. selector: "testPrintString",
  4388. protocol: 'tests',
  4389. fn: function (){
  4390. var self=this;
  4391. var array;
  4392. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4393. return smalltalk.withContext(function($ctx1) {
  4394. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4395. array=_st($Array())._new();
  4396. $1=_st(array)._printString();
  4397. $ctx1.sendIdx["printString"]=1;
  4398. self._assert_equals_($1,"an Array ()");
  4399. $ctx1.sendIdx["assert:equals:"]=1;
  4400. $2=array;
  4401. _st($2)._add_((1));
  4402. $ctx1.sendIdx["add:"]=1;
  4403. $3=_st($2)._add_((3));
  4404. $ctx1.sendIdx["add:"]=2;
  4405. $4=_st(array)._printString();
  4406. $ctx1.sendIdx["printString"]=2;
  4407. self._assert_equals_($4,"an Array (1 3)");
  4408. $ctx1.sendIdx["assert:equals:"]=2;
  4409. _st(array)._add_("foo");
  4410. $5=_st(array)._printString();
  4411. $ctx1.sendIdx["printString"]=3;
  4412. self._assert_equals_($5,"an Array (1 3 'foo')");
  4413. $ctx1.sendIdx["assert:equals:"]=3;
  4414. $6=array;
  4415. _st($6)._remove_((1));
  4416. $ctx1.sendIdx["remove:"]=1;
  4417. $7=_st($6)._remove_((3));
  4418. $8=_st(array)._printString();
  4419. $ctx1.sendIdx["printString"]=4;
  4420. self._assert_equals_($8,"an Array ('foo')");
  4421. $ctx1.sendIdx["assert:equals:"]=4;
  4422. _st(array)._addLast_((3));
  4423. $ctx1.sendIdx["addLast:"]=1;
  4424. $9=_st(array)._printString();
  4425. $ctx1.sendIdx["printString"]=5;
  4426. self._assert_equals_($9,"an Array ('foo' 3)");
  4427. $ctx1.sendIdx["assert:equals:"]=5;
  4428. _st(array)._addLast_((3));
  4429. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4430. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)});
  4431. },
  4432. args: [],
  4433. 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)'.",
  4434. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4435. referencedClasses: ["Array"]
  4436. }),
  4437. globals.ArrayTest);
  4438. smalltalk.addMethod(
  4439. smalltalk.method({
  4440. selector: "testRemove",
  4441. protocol: 'tests',
  4442. fn: function (){
  4443. var self=this;
  4444. var array;
  4445. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4446. return smalltalk.withContext(function($ctx1) {
  4447. array=[(1), (2), (3), (4), (5)];
  4448. _st(array)._remove_((3));
  4449. $ctx1.sendIdx["remove:"]=1;
  4450. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4451. self._should_raise_((function(){
  4452. return smalltalk.withContext(function($ctx2) {
  4453. return _st(array)._remove_((3));
  4454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4455. }),$Error());
  4456. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)});
  4457. },
  4458. args: [],
  4459. 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",
  4460. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4461. referencedClasses: ["Error"]
  4462. }),
  4463. globals.ArrayTest);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "testRemoveFromTo",
  4467. protocol: 'tests',
  4468. fn: function (){
  4469. var self=this;
  4470. return smalltalk.withContext(function($ctx1) {
  4471. var $1,$2;
  4472. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4473. $ctx1.sendIdx["removeFrom:to:"]=1;
  4474. self._assert_equals_($1,[(4)]);
  4475. $ctx1.sendIdx["assert:equals:"]=1;
  4476. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4477. $ctx1.sendIdx["removeFrom:to:"]=2;
  4478. self._assert_equals_($2,[(1), (4)]);
  4479. $ctx1.sendIdx["assert:equals:"]=2;
  4480. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4481. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)});
  4482. },
  4483. args: [],
  4484. 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)",
  4485. messageSends: ["assert:equals:", "removeFrom:to:"],
  4486. referencedClasses: []
  4487. }),
  4488. globals.ArrayTest);
  4489. smalltalk.addMethod(
  4490. smalltalk.method({
  4491. selector: "testRemoveIndex",
  4492. protocol: 'tests',
  4493. fn: function (){
  4494. var self=this;
  4495. return smalltalk.withContext(function($ctx1) {
  4496. var $1,$2;
  4497. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4498. $ctx1.sendIdx["removeIndex:"]=1;
  4499. self._assert_equals_($1,[(1), (3), (4)]);
  4500. $ctx1.sendIdx["assert:equals:"]=1;
  4501. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4502. $ctx1.sendIdx["removeIndex:"]=2;
  4503. self._assert_equals_($2,[(2), (3), (4)]);
  4504. $ctx1.sendIdx["assert:equals:"]=2;
  4505. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4506. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)});
  4507. },
  4508. args: [],
  4509. 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: #()",
  4510. messageSends: ["assert:equals:", "removeIndex:"],
  4511. referencedClasses: []
  4512. }),
  4513. globals.ArrayTest);
  4514. smalltalk.addMethod(
  4515. smalltalk.method({
  4516. selector: "testRemoveLast",
  4517. protocol: 'tests',
  4518. fn: function (){
  4519. var self=this;
  4520. var array;
  4521. return smalltalk.withContext(function($ctx1) {
  4522. array=[(1), (2)];
  4523. _st(array)._removeLast();
  4524. self._assert_equals_(_st(array)._last(),(1));
  4525. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)});
  4526. },
  4527. args: [],
  4528. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4529. messageSends: ["removeLast", "assert:equals:", "last"],
  4530. referencedClasses: []
  4531. }),
  4532. globals.ArrayTest);
  4533. smalltalk.addMethod(
  4534. smalltalk.method({
  4535. selector: "testReversed",
  4536. protocol: 'tests',
  4537. fn: function (){
  4538. var self=this;
  4539. var array;
  4540. return smalltalk.withContext(function($ctx1) {
  4541. array=[(5), (4), (3), (2), (1)];
  4542. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4543. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)});
  4544. },
  4545. args: [],
  4546. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4547. messageSends: ["assert:equals:", "reversed"],
  4548. referencedClasses: []
  4549. }),
  4550. globals.ArrayTest);
  4551. smalltalk.addMethod(
  4552. smalltalk.method({
  4553. selector: "testSort",
  4554. protocol: 'tests',
  4555. fn: function (){
  4556. var self=this;
  4557. var array;
  4558. return smalltalk.withContext(function($ctx1) {
  4559. array=[(10), (1), (5)];
  4560. _st(array)._sort();
  4561. self._assert_equals_(array,[(1), (5), (10)]);
  4562. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)});
  4563. },
  4564. args: [],
  4565. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4566. messageSends: ["sort", "assert:equals:"],
  4567. referencedClasses: []
  4568. }),
  4569. globals.ArrayTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "collectionClass",
  4573. protocol: 'fixture',
  4574. fn: function (){
  4575. var self=this;
  4576. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4577. return $Array();
  4578. },
  4579. args: [],
  4580. source: "collectionClass\x0a\x09^ Array",
  4581. messageSends: [],
  4582. referencedClasses: ["Array"]
  4583. }),
  4584. globals.ArrayTest.klass);
  4585. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4586. smalltalk.addMethod(
  4587. smalltalk.method({
  4588. selector: "collection",
  4589. protocol: 'fixture',
  4590. fn: function (){
  4591. var self=this;
  4592. return "helLo";
  4593. },
  4594. args: [],
  4595. source: "collection\x0a\x09^ 'helLo'",
  4596. messageSends: [],
  4597. referencedClasses: []
  4598. }),
  4599. globals.StringTest);
  4600. smalltalk.addMethod(
  4601. smalltalk.method({
  4602. selector: "collectionFirst",
  4603. protocol: 'fixture',
  4604. fn: function (){
  4605. var self=this;
  4606. return "h";
  4607. },
  4608. args: [],
  4609. source: "collectionFirst\x0a\x09^ 'h'",
  4610. messageSends: [],
  4611. referencedClasses: []
  4612. }),
  4613. globals.StringTest);
  4614. smalltalk.addMethod(
  4615. smalltalk.method({
  4616. selector: "collectionFirstTwo",
  4617. protocol: 'fixture',
  4618. fn: function (){
  4619. var self=this;
  4620. return "he";
  4621. },
  4622. args: [],
  4623. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4624. messageSends: [],
  4625. referencedClasses: []
  4626. }),
  4627. globals.StringTest);
  4628. smalltalk.addMethod(
  4629. smalltalk.method({
  4630. selector: "collectionLast",
  4631. protocol: 'fixture',
  4632. fn: function (){
  4633. var self=this;
  4634. return "o";
  4635. },
  4636. args: [],
  4637. source: "collectionLast\x0a\x09^ 'o'",
  4638. messageSends: [],
  4639. referencedClasses: []
  4640. }),
  4641. globals.StringTest);
  4642. smalltalk.addMethod(
  4643. smalltalk.method({
  4644. selector: "collectionLastTwo",
  4645. protocol: 'fixture',
  4646. fn: function (){
  4647. var self=this;
  4648. return "Lo";
  4649. },
  4650. args: [],
  4651. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4652. messageSends: [],
  4653. referencedClasses: []
  4654. }),
  4655. globals.StringTest);
  4656. smalltalk.addMethod(
  4657. smalltalk.method({
  4658. selector: "collectionOfPrintStrings",
  4659. protocol: 'fixture',
  4660. fn: function (){
  4661. var self=this;
  4662. return "'h''e''l''L''o'";
  4663. },
  4664. args: [],
  4665. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4666. messageSends: [],
  4667. referencedClasses: []
  4668. }),
  4669. globals.StringTest);
  4670. smalltalk.addMethod(
  4671. smalltalk.method({
  4672. selector: "collectionSize",
  4673. protocol: 'fixture',
  4674. fn: function (){
  4675. var self=this;
  4676. return (5);
  4677. },
  4678. args: [],
  4679. source: "collectionSize\x0a\x09^ 5",
  4680. messageSends: [],
  4681. referencedClasses: []
  4682. }),
  4683. globals.StringTest);
  4684. smalltalk.addMethod(
  4685. smalltalk.method({
  4686. selector: "collectionWithDuplicates",
  4687. protocol: 'fixture',
  4688. fn: function (){
  4689. var self=this;
  4690. return "abbaerte";
  4691. },
  4692. args: [],
  4693. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4694. messageSends: [],
  4695. referencedClasses: []
  4696. }),
  4697. globals.StringTest);
  4698. smalltalk.addMethod(
  4699. smalltalk.method({
  4700. selector: "collectionWithNewValue",
  4701. protocol: 'fixture',
  4702. fn: function (){
  4703. var self=this;
  4704. return "helLoN";
  4705. },
  4706. args: [],
  4707. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4708. messageSends: [],
  4709. referencedClasses: []
  4710. }),
  4711. globals.StringTest);
  4712. smalltalk.addMethod(
  4713. smalltalk.method({
  4714. selector: "sampleNewValueAsCollection",
  4715. protocol: 'fixture',
  4716. fn: function (){
  4717. var self=this;
  4718. return "N";
  4719. },
  4720. args: [],
  4721. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4722. messageSends: [],
  4723. referencedClasses: []
  4724. }),
  4725. globals.StringTest);
  4726. smalltalk.addMethod(
  4727. smalltalk.method({
  4728. selector: "samplesDo:",
  4729. protocol: 'fixture',
  4730. fn: function (aBlock){
  4731. var self=this;
  4732. return smalltalk.withContext(function($ctx1) {
  4733. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4734. $ctx1.supercall = false;
  4735. _st(aBlock)._value_value_((3),"l");
  4736. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)});
  4737. },
  4738. args: ["aBlock"],
  4739. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4740. messageSends: ["samplesDo:", "value:value:"],
  4741. referencedClasses: []
  4742. }),
  4743. globals.StringTest);
  4744. smalltalk.addMethod(
  4745. smalltalk.method({
  4746. selector: "testAddAll",
  4747. protocol: 'tests',
  4748. fn: function (){
  4749. var self=this;
  4750. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4751. return smalltalk.withContext(function($ctx1) {
  4752. var $1;
  4753. self._should_raise_((function(){
  4754. return smalltalk.withContext(function($ctx2) {
  4755. $1=self._collection();
  4756. $ctx2.sendIdx["collection"]=1;
  4757. return _st($1)._addAll_(self._collection());
  4758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4759. }),$Error());
  4760. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)});
  4761. },
  4762. args: [],
  4763. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4764. messageSends: ["should:raise:", "addAll:", "collection"],
  4765. referencedClasses: ["Error"]
  4766. }),
  4767. globals.StringTest);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "testAddRemove",
  4771. protocol: 'tests',
  4772. fn: function (){
  4773. var self=this;
  4774. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4775. return smalltalk.withContext(function($ctx1) {
  4776. self._should_raise_((function(){
  4777. return smalltalk.withContext(function($ctx2) {
  4778. return "hello"._add_("a");
  4779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4780. }),$Error());
  4781. $ctx1.sendIdx["should:raise:"]=1;
  4782. self._should_raise_((function(){
  4783. return smalltalk.withContext(function($ctx2) {
  4784. return "hello"._remove_("h");
  4785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4786. }),$Error());
  4787. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)});
  4788. },
  4789. args: [],
  4790. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4791. messageSends: ["should:raise:", "add:", "remove:"],
  4792. referencedClasses: ["Error"]
  4793. }),
  4794. globals.StringTest);
  4795. smalltalk.addMethod(
  4796. smalltalk.method({
  4797. selector: "testAsArray",
  4798. protocol: 'tests',
  4799. fn: function (){
  4800. var self=this;
  4801. return smalltalk.withContext(function($ctx1) {
  4802. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4803. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)});
  4804. },
  4805. args: [],
  4806. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4807. messageSends: ["assert:equals:", "asArray"],
  4808. referencedClasses: []
  4809. }),
  4810. globals.StringTest);
  4811. smalltalk.addMethod(
  4812. smalltalk.method({
  4813. selector: "testAsLowerCase",
  4814. protocol: 'tests',
  4815. fn: function (){
  4816. var self=this;
  4817. return smalltalk.withContext(function($ctx1) {
  4818. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4819. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)});
  4820. },
  4821. args: [],
  4822. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4823. messageSends: ["assert:equals:", "asLowercase"],
  4824. referencedClasses: []
  4825. }),
  4826. globals.StringTest);
  4827. smalltalk.addMethod(
  4828. smalltalk.method({
  4829. selector: "testAsNumber",
  4830. protocol: 'tests',
  4831. fn: function (){
  4832. var self=this;
  4833. return smalltalk.withContext(function($ctx1) {
  4834. var $1,$2;
  4835. $1="3"._asNumber();
  4836. $ctx1.sendIdx["asNumber"]=1;
  4837. self._assert_equals_($1,(3));
  4838. $ctx1.sendIdx["assert:equals:"]=1;
  4839. $2="-3"._asNumber();
  4840. $ctx1.sendIdx["asNumber"]=2;
  4841. self._assert_equals_($2,(-3));
  4842. $ctx1.sendIdx["assert:equals:"]=2;
  4843. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4844. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)});
  4845. },
  4846. args: [],
  4847. 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.",
  4848. messageSends: ["assert:equals:", "asNumber"],
  4849. referencedClasses: []
  4850. }),
  4851. globals.StringTest);
  4852. smalltalk.addMethod(
  4853. smalltalk.method({
  4854. selector: "testAsUpperCase",
  4855. protocol: 'tests',
  4856. fn: function (){
  4857. var self=this;
  4858. return smalltalk.withContext(function($ctx1) {
  4859. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4860. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)});
  4861. },
  4862. args: [],
  4863. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4864. messageSends: ["assert:equals:", "asUppercase"],
  4865. referencedClasses: []
  4866. }),
  4867. globals.StringTest);
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "testAsciiValue",
  4871. protocol: 'tests',
  4872. fn: function (){
  4873. var self=this;
  4874. var characterA,characterU;
  4875. return smalltalk.withContext(function($ctx1) {
  4876. var $1;
  4877. characterA="A";
  4878. characterU="U";
  4879. $1=_st(characterA)._asciiValue();
  4880. $ctx1.sendIdx["asciiValue"]=1;
  4881. self._assert_equals_($1,(65));
  4882. $ctx1.sendIdx["assert:equals:"]=1;
  4883. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4884. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)});
  4885. },
  4886. args: [],
  4887. 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",
  4888. messageSends: ["assert:equals:", "asciiValue"],
  4889. referencedClasses: []
  4890. }),
  4891. globals.StringTest);
  4892. smalltalk.addMethod(
  4893. smalltalk.method({
  4894. selector: "testAtIfAbsentPut",
  4895. protocol: 'tests',
  4896. fn: function (){
  4897. var self=this;
  4898. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4899. return smalltalk.withContext(function($ctx1) {
  4900. self._should_raise_((function(){
  4901. return smalltalk.withContext(function($ctx2) {
  4902. return "hello"._at_ifAbsentPut_((6),(function(){
  4903. return "a";
  4904. }));
  4905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4906. }),$Error());
  4907. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)});
  4908. },
  4909. args: [],
  4910. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4911. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4912. referencedClasses: ["Error"]
  4913. }),
  4914. globals.StringTest);
  4915. smalltalk.addMethod(
  4916. smalltalk.method({
  4917. selector: "testAtPut",
  4918. protocol: 'tests',
  4919. fn: function (){
  4920. var self=this;
  4921. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4922. return smalltalk.withContext(function($ctx1) {
  4923. self._should_raise_((function(){
  4924. return smalltalk.withContext(function($ctx2) {
  4925. return "hello"._at_put_((1),"a");
  4926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4927. }),$Error());
  4928. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)});
  4929. },
  4930. args: [],
  4931. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4932. messageSends: ["should:raise:", "at:put:"],
  4933. referencedClasses: ["Error"]
  4934. }),
  4935. globals.StringTest);
  4936. smalltalk.addMethod(
  4937. smalltalk.method({
  4938. selector: "testCapitalized",
  4939. protocol: 'tests',
  4940. fn: function (){
  4941. var self=this;
  4942. return smalltalk.withContext(function($ctx1) {
  4943. var $1,$2,$3;
  4944. $1="test"._capitalized();
  4945. $ctx1.sendIdx["capitalized"]=1;
  4946. self._assert_equals_($1,"Test");
  4947. $ctx1.sendIdx["assert:equals:"]=1;
  4948. $2="Test"._capitalized();
  4949. $ctx1.sendIdx["capitalized"]=2;
  4950. self._assert_equals_($2,"Test");
  4951. $ctx1.sendIdx["assert:equals:"]=2;
  4952. self._assert_equals_(""._capitalized(),"");
  4953. $ctx1.sendIdx["assert:equals:"]=3;
  4954. $3="Test"._isCapitalized();
  4955. $ctx1.sendIdx["isCapitalized"]=1;
  4956. self._assert_equals_($3,true);
  4957. $ctx1.sendIdx["assert:equals:"]=4;
  4958. self._assert_equals_("test"._isCapitalized(),false);
  4959. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)});
  4960. },
  4961. args: [],
  4962. 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.",
  4963. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4964. referencedClasses: []
  4965. }),
  4966. globals.StringTest);
  4967. smalltalk.addMethod(
  4968. smalltalk.method({
  4969. selector: "testCharCodeAt",
  4970. protocol: 'tests',
  4971. fn: function (){
  4972. var self=this;
  4973. return smalltalk.withContext(function($ctx1) {
  4974. var $1,$2,$3,$4,$5;
  4975. $1="jackie"._charCodeAt_((1));
  4976. $ctx1.sendIdx["charCodeAt:"]=1;
  4977. self._assert_equals_($1,(106));
  4978. $ctx1.sendIdx["assert:equals:"]=1;
  4979. $2="jackie"._charCodeAt_((2));
  4980. $ctx1.sendIdx["charCodeAt:"]=2;
  4981. self._assert_equals_($2,(97));
  4982. $ctx1.sendIdx["assert:equals:"]=2;
  4983. $3="jackie"._charCodeAt_((3));
  4984. $ctx1.sendIdx["charCodeAt:"]=3;
  4985. self._assert_equals_($3,(99));
  4986. $ctx1.sendIdx["assert:equals:"]=3;
  4987. $4="jackie"._charCodeAt_((4));
  4988. $ctx1.sendIdx["charCodeAt:"]=4;
  4989. self._assert_equals_($4,(107));
  4990. $ctx1.sendIdx["assert:equals:"]=4;
  4991. $5="jackie"._charCodeAt_((5));
  4992. $ctx1.sendIdx["charCodeAt:"]=5;
  4993. self._assert_equals_($5,(105));
  4994. $ctx1.sendIdx["assert:equals:"]=5;
  4995. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4996. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)});
  4997. },
  4998. args: [],
  4999. 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",
  5000. messageSends: ["assert:equals:", "charCodeAt:"],
  5001. referencedClasses: []
  5002. }),
  5003. globals.StringTest);
  5004. smalltalk.addMethod(
  5005. smalltalk.method({
  5006. selector: "testCopyFromTo",
  5007. protocol: 'tests',
  5008. fn: function (){
  5009. var self=this;
  5010. return smalltalk.withContext(function($ctx1) {
  5011. var $1;
  5012. $1="jackie"._copyFrom_to_((1),(3));
  5013. $ctx1.sendIdx["copyFrom:to:"]=1;
  5014. self._assert_equals_($1,"jac");
  5015. $ctx1.sendIdx["assert:equals:"]=1;
  5016. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  5017. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)});
  5018. },
  5019. args: [],
  5020. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  5021. messageSends: ["assert:equals:", "copyFrom:to:"],
  5022. referencedClasses: []
  5023. }),
  5024. globals.StringTest);
  5025. smalltalk.addMethod(
  5026. smalltalk.method({
  5027. selector: "testCopyWithoutAll",
  5028. protocol: 'tests',
  5029. fn: function (){
  5030. var self=this;
  5031. return smalltalk.withContext(function($ctx1) {
  5032. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  5033. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)});
  5034. },
  5035. args: [],
  5036. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  5037. messageSends: ["assert:equals:", "copyWithoutAll:"],
  5038. referencedClasses: []
  5039. }),
  5040. globals.StringTest);
  5041. smalltalk.addMethod(
  5042. smalltalk.method({
  5043. selector: "testEquality",
  5044. protocol: 'tests',
  5045. fn: function (){
  5046. var self=this;
  5047. return smalltalk.withContext(function($ctx1) {
  5048. var $1,$2,$3;
  5049. self._assert_equals_("hello","hello");
  5050. $ctx1.sendIdx["assert:equals:"]=1;
  5051. $1="hello".__eq("world");
  5052. $ctx1.sendIdx["="]=1;
  5053. self._deny_($1);
  5054. $ctx1.sendIdx["deny:"]=1;
  5055. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  5056. })));
  5057. $ctx1.sendIdx["="]=2;
  5058. self._deny_($2);
  5059. $ctx1.sendIdx["deny:"]=2;
  5060. $3="hello"._yourself();
  5061. $ctx1.sendIdx["yourself"]=1;
  5062. self._assert_equals_("hello",$3);
  5063. $ctx1.sendIdx["assert:equals:"]=2;
  5064. self._assert_equals_("hello"._yourself(),"hello");
  5065. self._deny_("".__eq((0)));
  5066. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)});
  5067. },
  5068. args: [],
  5069. 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",
  5070. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  5071. referencedClasses: []
  5072. }),
  5073. globals.StringTest);
  5074. smalltalk.addMethod(
  5075. smalltalk.method({
  5076. selector: "testIdentity",
  5077. protocol: 'tests',
  5078. fn: function (){
  5079. var self=this;
  5080. return smalltalk.withContext(function($ctx1) {
  5081. var $1,$2,$4,$3,$5;
  5082. $1="hello".__eq_eq("hello");
  5083. $ctx1.sendIdx["=="]=1;
  5084. self._assert_($1);
  5085. $ctx1.sendIdx["assert:"]=1;
  5086. $2="hello".__eq_eq("world");
  5087. $ctx1.sendIdx["=="]=2;
  5088. self._deny_($2);
  5089. $ctx1.sendIdx["deny:"]=1;
  5090. $4="hello"._yourself();
  5091. $ctx1.sendIdx["yourself"]=1;
  5092. $3="hello".__eq_eq($4);
  5093. $ctx1.sendIdx["=="]=3;
  5094. self._assert_($3);
  5095. $ctx1.sendIdx["assert:"]=2;
  5096. $5=_st("hello"._yourself()).__eq_eq("hello");
  5097. $ctx1.sendIdx["=="]=4;
  5098. self._assert_($5);
  5099. self._deny_("".__eq_eq((0)));
  5100. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)});
  5101. },
  5102. args: [],
  5103. 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",
  5104. messageSends: ["assert:", "==", "deny:", "yourself"],
  5105. referencedClasses: []
  5106. }),
  5107. globals.StringTest);
  5108. smalltalk.addMethod(
  5109. smalltalk.method({
  5110. selector: "testIdentityHash",
  5111. protocol: 'tests',
  5112. fn: function (){
  5113. var self=this;
  5114. return smalltalk.withContext(function($ctx1) {
  5115. var $1,$2,$4,$3;
  5116. $1="foo"._identityHash();
  5117. $ctx1.sendIdx["identityHash"]=1;
  5118. $2="foo"._identityHash();
  5119. $ctx1.sendIdx["identityHash"]=2;
  5120. self._assert_equals_($1,$2);
  5121. $4="foo"._identityHash();
  5122. $ctx1.sendIdx["identityHash"]=3;
  5123. $3=_st($4).__eq("bar"._identityHash());
  5124. self._deny_($3);
  5125. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)});
  5126. },
  5127. args: [],
  5128. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  5129. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  5130. referencedClasses: []
  5131. }),
  5132. globals.StringTest);
  5133. smalltalk.addMethod(
  5134. smalltalk.method({
  5135. selector: "testIncludesSubString",
  5136. protocol: 'tests',
  5137. fn: function (){
  5138. var self=this;
  5139. return smalltalk.withContext(function($ctx1) {
  5140. var $1;
  5141. $1="amber"._includesSubString_("ber");
  5142. $ctx1.sendIdx["includesSubString:"]=1;
  5143. self._assert_($1);
  5144. self._deny_("amber"._includesSubString_("zork"));
  5145. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)});
  5146. },
  5147. args: [],
  5148. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  5149. messageSends: ["assert:", "includesSubString:", "deny:"],
  5150. referencedClasses: []
  5151. }),
  5152. globals.StringTest);
  5153. smalltalk.addMethod(
  5154. smalltalk.method({
  5155. selector: "testIndexOfStartingAtWithNull",
  5156. protocol: 'tests',
  5157. fn: function (){
  5158. var self=this;
  5159. return self
  5160. },
  5161. args: [],
  5162. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  5163. messageSends: [],
  5164. referencedClasses: []
  5165. }),
  5166. globals.StringTest);
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "testIndexOfWithNull",
  5170. protocol: 'tests',
  5171. fn: function (){
  5172. var self=this;
  5173. return self
  5174. },
  5175. args: [],
  5176. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  5177. messageSends: [],
  5178. referencedClasses: []
  5179. }),
  5180. globals.StringTest);
  5181. smalltalk.addMethod(
  5182. smalltalk.method({
  5183. selector: "testIsVowel",
  5184. protocol: 'tests',
  5185. fn: function (){
  5186. var self=this;
  5187. var vowel,consonant;
  5188. return smalltalk.withContext(function($ctx1) {
  5189. var $1;
  5190. vowel="u";
  5191. consonant="z";
  5192. $1=_st(vowel)._isVowel();
  5193. $ctx1.sendIdx["isVowel"]=1;
  5194. self._assert_equals_($1,true);
  5195. $ctx1.sendIdx["assert:equals:"]=1;
  5196. self._assert_equals_(_st(consonant)._isVowel(),false);
  5197. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)});
  5198. },
  5199. args: [],
  5200. 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",
  5201. messageSends: ["assert:equals:", "isVowel"],
  5202. referencedClasses: []
  5203. }),
  5204. globals.StringTest);
  5205. smalltalk.addMethod(
  5206. smalltalk.method({
  5207. selector: "testJoin",
  5208. protocol: 'tests',
  5209. fn: function (){
  5210. var self=this;
  5211. return smalltalk.withContext(function($ctx1) {
  5212. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  5213. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)});
  5214. },
  5215. args: [],
  5216. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  5217. messageSends: ["assert:equals:", "join:"],
  5218. referencedClasses: []
  5219. }),
  5220. globals.StringTest);
  5221. smalltalk.addMethod(
  5222. smalltalk.method({
  5223. selector: "testRemoveAll",
  5224. protocol: 'tests',
  5225. fn: function (){
  5226. var self=this;
  5227. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5228. return smalltalk.withContext(function($ctx1) {
  5229. self._should_raise_((function(){
  5230. return smalltalk.withContext(function($ctx2) {
  5231. return _st(self._collection())._removeAll();
  5232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5233. }),$Error());
  5234. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)});
  5235. },
  5236. args: [],
  5237. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  5238. messageSends: ["should:raise:", "removeAll", "collection"],
  5239. referencedClasses: ["Error"]
  5240. }),
  5241. globals.StringTest);
  5242. smalltalk.addMethod(
  5243. smalltalk.method({
  5244. selector: "testReversed",
  5245. protocol: 'tests',
  5246. fn: function (){
  5247. var self=this;
  5248. return smalltalk.withContext(function($ctx1) {
  5249. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5250. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)});
  5251. },
  5252. args: [],
  5253. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5254. messageSends: ["assert:equals:", "reversed"],
  5255. referencedClasses: []
  5256. }),
  5257. globals.StringTest);
  5258. smalltalk.addMethod(
  5259. smalltalk.method({
  5260. selector: "testStreamContents",
  5261. protocol: 'tests',
  5262. fn: function (){
  5263. var self=this;
  5264. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5265. return smalltalk.withContext(function($ctx1) {
  5266. var $1;
  5267. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5268. return smalltalk.withContext(function($ctx2) {
  5269. _st(aStream)._nextPutAll_("hello");
  5270. $ctx2.sendIdx["nextPutAll:"]=1;
  5271. _st(aStream)._space();
  5272. $1=_st(aStream)._nextPutAll_("world");
  5273. return $1;
  5274. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  5275. })),"hello world");
  5276. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)});
  5277. },
  5278. args: [],
  5279. 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'",
  5280. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5281. referencedClasses: ["String"]
  5282. }),
  5283. globals.StringTest);
  5284. smalltalk.addMethod(
  5285. smalltalk.method({
  5286. selector: "testSubStrings",
  5287. protocol: 'tests',
  5288. fn: function (){
  5289. var self=this;
  5290. return smalltalk.withContext(function($ctx1) {
  5291. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5292. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)});
  5293. },
  5294. args: [],
  5295. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5296. messageSends: ["assert:equals:", "subStrings:"],
  5297. referencedClasses: []
  5298. }),
  5299. globals.StringTest);
  5300. smalltalk.addMethod(
  5301. smalltalk.method({
  5302. selector: "testTrim",
  5303. protocol: 'tests',
  5304. fn: function (){
  5305. var self=this;
  5306. return smalltalk.withContext(function($ctx1) {
  5307. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5308. $ctx1.sendIdx["assert:equals:"]=1;
  5309. self._assert_equals_("jackie "._trimRight(),"jackie");
  5310. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)});
  5311. },
  5312. args: [],
  5313. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5314. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5315. referencedClasses: []
  5316. }),
  5317. globals.StringTest);
  5318. smalltalk.addMethod(
  5319. smalltalk.method({
  5320. selector: "testValue",
  5321. protocol: 'tests',
  5322. fn: function (){
  5323. var self=this;
  5324. return smalltalk.withContext(function($ctx1) {
  5325. self._assert_equals_("asString"._value_((1)),"1");
  5326. $ctx1.sendIdx["assert:equals:"]=1;
  5327. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5328. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)});
  5329. },
  5330. args: [],
  5331. 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')",
  5332. messageSends: ["assert:equals:", "value:", "collect:"],
  5333. referencedClasses: []
  5334. }),
  5335. globals.StringTest);
  5336. smalltalk.addMethod(
  5337. smalltalk.method({
  5338. selector: "collectionClass",
  5339. protocol: 'fixture',
  5340. fn: function (){
  5341. var self=this;
  5342. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5343. return $String();
  5344. },
  5345. args: [],
  5346. source: "collectionClass\x0a\x09^ String",
  5347. messageSends: [],
  5348. referencedClasses: ["String"]
  5349. }),
  5350. globals.StringTest.klass);
  5351. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5352. smalltalk.addMethod(
  5353. smalltalk.method({
  5354. selector: "collection",
  5355. protocol: 'fixture',
  5356. fn: function (){
  5357. var self=this;
  5358. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5359. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5360. return smalltalk.withContext(function($ctx1) {
  5361. var $2,$3,$1;
  5362. $2=_st($Set())._new();
  5363. _st($2)._add_($Smalltalk());
  5364. $ctx1.sendIdx["add:"]=1;
  5365. _st($2)._add_(nil);
  5366. $ctx1.sendIdx["add:"]=2;
  5367. _st($2)._add_((3).__at((3)));
  5368. $ctx1.sendIdx["add:"]=3;
  5369. _st($2)._add_(false);
  5370. $3=_st($2)._yourself();
  5371. $1=$3;
  5372. return $1;
  5373. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)});
  5374. },
  5375. args: [],
  5376. 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",
  5377. messageSends: ["add:", "new", "@", "yourself"],
  5378. referencedClasses: ["Set", "Smalltalk"]
  5379. }),
  5380. globals.SetTest);
  5381. smalltalk.addMethod(
  5382. smalltalk.method({
  5383. selector: "collectionOfPrintStrings",
  5384. protocol: 'fixture',
  5385. fn: function (){
  5386. var self=this;
  5387. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5388. return smalltalk.withContext(function($ctx1) {
  5389. var $2,$3,$1;
  5390. $2=_st($Set())._new();
  5391. _st($2)._add_("a SmalltalkImage");
  5392. $ctx1.sendIdx["add:"]=1;
  5393. _st($2)._add_("nil");
  5394. $ctx1.sendIdx["add:"]=2;
  5395. _st($2)._add_("3@3");
  5396. $ctx1.sendIdx["add:"]=3;
  5397. _st($2)._add_("false");
  5398. $3=_st($2)._yourself();
  5399. $1=$3;
  5400. return $1;
  5401. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)});
  5402. },
  5403. args: [],
  5404. 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",
  5405. messageSends: ["add:", "new", "yourself"],
  5406. referencedClasses: ["Set"]
  5407. }),
  5408. globals.SetTest);
  5409. smalltalk.addMethod(
  5410. smalltalk.method({
  5411. selector: "collectionSize",
  5412. protocol: 'fixture',
  5413. fn: function (){
  5414. var self=this;
  5415. return (4);
  5416. },
  5417. args: [],
  5418. source: "collectionSize\x0a\x09^ 4",
  5419. messageSends: [],
  5420. referencedClasses: []
  5421. }),
  5422. globals.SetTest);
  5423. smalltalk.addMethod(
  5424. smalltalk.method({
  5425. selector: "collectionWithDuplicates",
  5426. protocol: 'fixture',
  5427. fn: function (){
  5428. var self=this;
  5429. return smalltalk.withContext(function($ctx1) {
  5430. var $2,$3,$1;
  5431. $2=self._collection();
  5432. _st($2)._add_((0));
  5433. $3=_st($2)._yourself();
  5434. $1=$3;
  5435. return $1;
  5436. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)});
  5437. },
  5438. args: [],
  5439. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5440. messageSends: ["add:", "collection", "yourself"],
  5441. referencedClasses: []
  5442. }),
  5443. globals.SetTest);
  5444. smalltalk.addMethod(
  5445. smalltalk.method({
  5446. selector: "collectionWithNewValue",
  5447. protocol: 'fixture',
  5448. fn: function (){
  5449. var self=this;
  5450. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5451. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5452. return smalltalk.withContext(function($ctx1) {
  5453. var $2,$3,$1;
  5454. $2=_st($Set())._new();
  5455. _st($2)._add_($Smalltalk());
  5456. $ctx1.sendIdx["add:"]=1;
  5457. _st($2)._add_(nil);
  5458. $ctx1.sendIdx["add:"]=2;
  5459. _st($2)._add_((3).__at((3)));
  5460. $ctx1.sendIdx["add:"]=3;
  5461. _st($2)._add_("N");
  5462. $ctx1.sendIdx["add:"]=4;
  5463. _st($2)._add_(false);
  5464. $3=_st($2)._yourself();
  5465. $1=$3;
  5466. return $1;
  5467. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)});
  5468. },
  5469. args: [],
  5470. 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",
  5471. messageSends: ["add:", "new", "@", "yourself"],
  5472. referencedClasses: ["Set", "Smalltalk"]
  5473. }),
  5474. globals.SetTest);
  5475. smalltalk.addMethod(
  5476. smalltalk.method({
  5477. selector: "testAddAll",
  5478. protocol: 'tests',
  5479. fn: function (){
  5480. var self=this;
  5481. return smalltalk.withContext(function($ctx1) {
  5482. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5483. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5484. $ctx1.supercall = false;
  5485. $2=self._collection();
  5486. $ctx1.sendIdx["collection"]=1;
  5487. $3=$2;
  5488. $4=self._collection();
  5489. $ctx1.sendIdx["collection"]=2;
  5490. _st($3)._addAll_($4);
  5491. $ctx1.sendIdx["addAll:"]=1;
  5492. $5=_st($2)._yourself();
  5493. $ctx1.sendIdx["yourself"]=1;
  5494. $1=$5;
  5495. $6=self._collection();
  5496. $ctx1.sendIdx["collection"]=3;
  5497. self._assert_equals_($1,$6);
  5498. $ctx1.sendIdx["assert:equals:"]=1;
  5499. $8=self._collection();
  5500. $ctx1.sendIdx["collection"]=4;
  5501. $9=$8;
  5502. $10=self._collectionWithNewValue();
  5503. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5504. _st($9)._addAll_($10);
  5505. $ctx1.sendIdx["addAll:"]=2;
  5506. $11=_st($8)._yourself();
  5507. $ctx1.sendIdx["yourself"]=2;
  5508. $7=$11;
  5509. $12=self._collectionWithNewValue();
  5510. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5511. self._assert_equals_($7,$12);
  5512. $ctx1.sendIdx["assert:equals:"]=2;
  5513. $14=self._collectionWithNewValue();
  5514. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5515. _st($14)._addAll_(self._collection());
  5516. $15=_st($14)._yourself();
  5517. $13=$15;
  5518. self._assert_equals_($13,self._collectionWithNewValue());
  5519. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)});
  5520. },
  5521. args: [],
  5522. 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",
  5523. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5524. referencedClasses: []
  5525. }),
  5526. globals.SetTest);
  5527. smalltalk.addMethod(
  5528. smalltalk.method({
  5529. selector: "testAddRemove",
  5530. protocol: 'tests',
  5531. fn: function (){
  5532. var self=this;
  5533. var set;
  5534. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5535. return smalltalk.withContext(function($ctx1) {
  5536. var $1,$2;
  5537. set=_st($Set())._new();
  5538. self._assert_(_st(set)._isEmpty());
  5539. $ctx1.sendIdx["assert:"]=1;
  5540. _st(set)._add_((3));
  5541. $ctx1.sendIdx["add:"]=1;
  5542. $1=_st(set)._includes_((3));
  5543. $ctx1.sendIdx["includes:"]=1;
  5544. self._assert_($1);
  5545. $ctx1.sendIdx["assert:"]=2;
  5546. _st(set)._add_((5));
  5547. $2=_st(set)._includes_((5));
  5548. $ctx1.sendIdx["includes:"]=2;
  5549. self._assert_($2);
  5550. _st(set)._remove_((3));
  5551. self._deny_(_st(set)._includes_((3)));
  5552. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)});
  5553. },
  5554. args: [],
  5555. 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)",
  5556. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5557. referencedClasses: ["Set"]
  5558. }),
  5559. globals.SetTest);
  5560. smalltalk.addMethod(
  5561. smalltalk.method({
  5562. selector: "testAt",
  5563. protocol: 'tests',
  5564. fn: function (){
  5565. var self=this;
  5566. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5567. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5568. return smalltalk.withContext(function($ctx1) {
  5569. self._should_raise_((function(){
  5570. return smalltalk.withContext(function($ctx2) {
  5571. return _st(_st($Set())._new())._at_put_((1),(2));
  5572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5573. }),$Error());
  5574. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)});
  5575. },
  5576. args: [],
  5577. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5578. messageSends: ["should:raise:", "at:put:", "new"],
  5579. referencedClasses: ["Set", "Error"]
  5580. }),
  5581. globals.SetTest);
  5582. smalltalk.addMethod(
  5583. smalltalk.method({
  5584. selector: "testCollect",
  5585. protocol: 'tests',
  5586. fn: function (){
  5587. var self=this;
  5588. return smalltalk.withContext(function($ctx1) {
  5589. var $2,$1;
  5590. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5591. $ctx1.supercall = false;
  5592. $2=[(5), (6), (8)]._asSet();
  5593. $ctx1.sendIdx["asSet"]=1;
  5594. $1=_st($2)._collect_((function(x){
  5595. return smalltalk.withContext(function($ctx2) {
  5596. return _st(x).__backslash_backslash((3));
  5597. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  5598. }));
  5599. self._assert_equals_($1,[(0), (2)]._asSet());
  5600. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)});
  5601. },
  5602. args: [],
  5603. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5604. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5605. referencedClasses: []
  5606. }),
  5607. globals.SetTest);
  5608. smalltalk.addMethod(
  5609. smalltalk.method({
  5610. selector: "testComma",
  5611. protocol: 'tests',
  5612. fn: function (){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) {
  5615. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5616. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5617. $ctx1.supercall = false;
  5618. $2=self._collection();
  5619. $ctx1.sendIdx["collection"]=1;
  5620. $3=self._collection();
  5621. $ctx1.sendIdx["collection"]=2;
  5622. $1=_st($2).__comma($3);
  5623. $ctx1.sendIdx[","]=1;
  5624. $4=self._collection();
  5625. $ctx1.sendIdx["collection"]=3;
  5626. self._assert_equals_($1,$4);
  5627. $ctx1.sendIdx["assert:equals:"]=1;
  5628. $6=self._collection();
  5629. $ctx1.sendIdx["collection"]=4;
  5630. $7=self._collectionWithNewValue();
  5631. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5632. $5=_st($6).__comma($7);
  5633. $ctx1.sendIdx[","]=2;
  5634. $8=self._collectionWithNewValue();
  5635. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5636. self._assert_equals_($5,$8);
  5637. $ctx1.sendIdx["assert:equals:"]=2;
  5638. $10=self._collectionWithNewValue();
  5639. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5640. $9=_st($10).__comma(self._collection());
  5641. self._assert_equals_($9,self._collectionWithNewValue());
  5642. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)});
  5643. },
  5644. args: [],
  5645. 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",
  5646. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5647. referencedClasses: []
  5648. }),
  5649. globals.SetTest);
  5650. smalltalk.addMethod(
  5651. smalltalk.method({
  5652. selector: "testComparing",
  5653. protocol: 'tests',
  5654. fn: function (){
  5655. var self=this;
  5656. return smalltalk.withContext(function($ctx1) {
  5657. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5658. $1=[(0), (2)]._asSet();
  5659. $ctx1.sendIdx["asSet"]=1;
  5660. $2=[(0), (2)]._asSet();
  5661. $ctx1.sendIdx["asSet"]=2;
  5662. self._assert_equals_($1,$2);
  5663. $ctx1.sendIdx["assert:equals:"]=1;
  5664. $3=[(2), (0)]._asSet();
  5665. $ctx1.sendIdx["asSet"]=3;
  5666. $4=[(0), (2)]._asSet();
  5667. $ctx1.sendIdx["asSet"]=4;
  5668. self._assert_equals_($3,$4);
  5669. $6=[(0), (2), (3)]._asSet();
  5670. $ctx1.sendIdx["asSet"]=5;
  5671. $7=[(0), (2)]._asSet();
  5672. $ctx1.sendIdx["asSet"]=6;
  5673. $5=_st($6).__eq($7);
  5674. $ctx1.sendIdx["="]=1;
  5675. self._deny_($5);
  5676. $ctx1.sendIdx["deny:"]=1;
  5677. $9=[(1), (2)]._asSet();
  5678. $ctx1.sendIdx["asSet"]=7;
  5679. $8=_st($9).__eq([(0), (2)]._asSet());
  5680. self._deny_($8);
  5681. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)});
  5682. },
  5683. args: [],
  5684. 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",
  5685. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5686. referencedClasses: []
  5687. }),
  5688. globals.SetTest);
  5689. smalltalk.addMethod(
  5690. smalltalk.method({
  5691. selector: "testPrintString",
  5692. protocol: 'tests',
  5693. fn: function (){
  5694. var self=this;
  5695. var set;
  5696. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5697. return smalltalk.withContext(function($ctx1) {
  5698. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5699. set=_st($Set())._new();
  5700. $1=_st(set)._printString();
  5701. $ctx1.sendIdx["printString"]=1;
  5702. self._assert_equals_($1,"a Set ()");
  5703. $ctx1.sendIdx["assert:equals:"]=1;
  5704. $2=set;
  5705. _st($2)._add_((1));
  5706. $ctx1.sendIdx["add:"]=1;
  5707. $3=_st($2)._add_((3));
  5708. $ctx1.sendIdx["add:"]=2;
  5709. $4=_st(set)._printString();
  5710. $ctx1.sendIdx["printString"]=2;
  5711. self._assert_equals_($4,"a Set (1 3)");
  5712. $ctx1.sendIdx["assert:equals:"]=2;
  5713. _st(set)._add_("foo");
  5714. $ctx1.sendIdx["add:"]=3;
  5715. $5=_st(set)._printString();
  5716. $ctx1.sendIdx["printString"]=3;
  5717. self._assert_equals_($5,"a Set (1 3 'foo')");
  5718. $ctx1.sendIdx["assert:equals:"]=3;
  5719. $6=set;
  5720. _st($6)._remove_((1));
  5721. $ctx1.sendIdx["remove:"]=1;
  5722. $7=_st($6)._remove_((3));
  5723. $8=_st(set)._printString();
  5724. $ctx1.sendIdx["printString"]=4;
  5725. self._assert_equals_($8,"a Set ('foo')");
  5726. $ctx1.sendIdx["assert:equals:"]=4;
  5727. _st(set)._add_((3));
  5728. $ctx1.sendIdx["add:"]=4;
  5729. $9=_st(set)._printString();
  5730. $ctx1.sendIdx["printString"]=5;
  5731. self._assert_equals_($9,"a Set (3 'foo')");
  5732. $ctx1.sendIdx["assert:equals:"]=5;
  5733. _st(set)._add_((3));
  5734. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5735. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)});
  5736. },
  5737. args: [],
  5738. 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'')'",
  5739. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5740. referencedClasses: ["Set"]
  5741. }),
  5742. globals.SetTest);
  5743. smalltalk.addMethod(
  5744. smalltalk.method({
  5745. selector: "testUnboxedObjects",
  5746. protocol: 'tests',
  5747. fn: function (){
  5748. var self=this;
  5749. return smalltalk.withContext(function($ctx1) {
  5750. var $4,$3,$2,$1;
  5751. $4="foo"._yourself();
  5752. $ctx1.sendIdx["yourself"]=1;
  5753. $3=[$4,"foo"._yourself()];
  5754. $2=_st($3)._asSet();
  5755. $1=_st($2)._asArray();
  5756. self._assert_equals_($1,["foo"]);
  5757. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)});
  5758. },
  5759. args: [],
  5760. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5761. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5762. referencedClasses: []
  5763. }),
  5764. globals.SetTest);
  5765. smalltalk.addMethod(
  5766. smalltalk.method({
  5767. selector: "testUnicity",
  5768. protocol: 'tests',
  5769. fn: function (){
  5770. var self=this;
  5771. var set;
  5772. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5773. return smalltalk.withContext(function($ctx1) {
  5774. var $1;
  5775. set=_st($Set())._new();
  5776. _st(set)._add_((21));
  5777. $ctx1.sendIdx["add:"]=1;
  5778. _st(set)._add_("hello");
  5779. $ctx1.sendIdx["add:"]=2;
  5780. _st(set)._add_((21));
  5781. $ctx1.sendIdx["add:"]=3;
  5782. $1=_st(set)._size();
  5783. $ctx1.sendIdx["size"]=1;
  5784. self._assert_equals_($1,(2));
  5785. $ctx1.sendIdx["assert:equals:"]=1;
  5786. _st(set)._add_("hello");
  5787. self._assert_equals_(_st(set)._size(),(2));
  5788. $ctx1.sendIdx["assert:equals:"]=2;
  5789. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5790. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)});
  5791. },
  5792. args: [],
  5793. 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')",
  5794. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5795. referencedClasses: ["Set"]
  5796. }),
  5797. globals.SetTest);
  5798. smalltalk.addMethod(
  5799. smalltalk.method({
  5800. selector: "collectionClass",
  5801. protocol: 'fixture',
  5802. fn: function (){
  5803. var self=this;
  5804. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5805. return $Set();
  5806. },
  5807. args: [],
  5808. source: "collectionClass\x0a\x09^ Set",
  5809. messageSends: [],
  5810. referencedClasses: ["Set"]
  5811. }),
  5812. globals.SetTest.klass);
  5813. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5814. smalltalk.addMethod(
  5815. smalltalk.method({
  5816. selector: "testShow",
  5817. protocol: 'tests',
  5818. fn: function (){
  5819. var self=this;
  5820. var originalTranscript;
  5821. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5822. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5823. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5824. return smalltalk.withContext(function($ctx1) {
  5825. originalTranscript=_st($Transcript())._current();
  5826. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5827. $ctx1.sendIdx["register:"]=1;
  5828. self._shouldnt_raise_((function(){
  5829. return smalltalk.withContext(function($ctx2) {
  5830. return _st($Transcript())._show_("Hello console!");
  5831. $ctx2.sendIdx["show:"]=1;
  5832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5833. }),$Error());
  5834. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5835. self._shouldnt_raise_((function(){
  5836. return smalltalk.withContext(function($ctx2) {
  5837. return _st($Transcript())._show_(console);
  5838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5839. }),$Error());
  5840. _st($Transcript())._register_(originalTranscript);
  5841. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)});
  5842. },
  5843. args: [],
  5844. 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.",
  5845. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5846. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5847. }),
  5848. globals.ConsoleTranscriptTest);
  5849. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5850. smalltalk.addMethod(
  5851. smalltalk.method({
  5852. selector: "jsNull",
  5853. protocol: 'accessing',
  5854. fn: function (){
  5855. var self=this;
  5856. return smalltalk.withContext(function($ctx1) {
  5857. return null;
  5858. return self}, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)});
  5859. },
  5860. args: [],
  5861. source: "jsNull\x0a\x09<return null>",
  5862. messageSends: [],
  5863. referencedClasses: []
  5864. }),
  5865. globals.JSObjectProxyTest);
  5866. smalltalk.addMethod(
  5867. smalltalk.method({
  5868. selector: "jsObject",
  5869. protocol: 'accessing',
  5870. fn: function (){
  5871. var self=this;
  5872. return smalltalk.withContext(function($ctx1) {
  5873. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5874. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)});
  5875. },
  5876. args: [],
  5877. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5878. messageSends: [],
  5879. referencedClasses: []
  5880. }),
  5881. globals.JSObjectProxyTest);
  5882. smalltalk.addMethod(
  5883. smalltalk.method({
  5884. selector: "jsUndefined",
  5885. protocol: 'accessing',
  5886. fn: function (){
  5887. var self=this;
  5888. return smalltalk.withContext(function($ctx1) {
  5889. return;
  5890. return self}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)});
  5891. },
  5892. args: [],
  5893. source: "jsUndefined\x0a\x09<return>",
  5894. messageSends: [],
  5895. referencedClasses: []
  5896. }),
  5897. globals.JSObjectProxyTest);
  5898. smalltalk.addMethod(
  5899. smalltalk.method({
  5900. selector: "testAtIfAbsent",
  5901. protocol: 'tests',
  5902. fn: function (){
  5903. var self=this;
  5904. var testObject;
  5905. return smalltalk.withContext(function($ctx1) {
  5906. var $1,$2,$3;
  5907. testObject=self._jsObject();
  5908. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5909. return "Property does not exist";
  5910. }));
  5911. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5912. self._assert_equals_($1,"Property does not exist");
  5913. $ctx1.sendIdx["assert:equals:"]=1;
  5914. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5915. return "Property does not exist";
  5916. }));
  5917. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5918. self._assert_equals_($2,nil);
  5919. $ctx1.sendIdx["assert:equals:"]=2;
  5920. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5921. return "Property does not exist";
  5922. }));
  5923. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5924. self._assert_equals_($3,(1));
  5925. $ctx1.sendIdx["assert:equals:"]=3;
  5926. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5927. return "Property does not exist";
  5928. })),nil);
  5929. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)});
  5930. },
  5931. args: [],
  5932. 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.",
  5933. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5934. referencedClasses: []
  5935. }),
  5936. globals.JSObjectProxyTest);
  5937. smalltalk.addMethod(
  5938. smalltalk.method({
  5939. selector: "testAtIfPresent",
  5940. protocol: 'tests',
  5941. fn: function (){
  5942. var self=this;
  5943. var testObject;
  5944. return smalltalk.withContext(function($ctx1) {
  5945. var $2,$1,$4,$3,$6,$5;
  5946. testObject=self._jsObject();
  5947. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5948. return smalltalk.withContext(function($ctx2) {
  5949. $2=_st(x)._asString();
  5950. $ctx2.sendIdx["asString"]=1;
  5951. return "hello ".__comma($2);
  5952. $ctx2.sendIdx[","]=1;
  5953. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  5954. }));
  5955. $ctx1.sendIdx["at:ifPresent:"]=1;
  5956. self._assert_equals_($1,nil);
  5957. $ctx1.sendIdx["assert:equals:"]=1;
  5958. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5959. return smalltalk.withContext(function($ctx2) {
  5960. $4=_st(x)._asString();
  5961. $ctx2.sendIdx["asString"]=2;
  5962. return "hello ".__comma($4);
  5963. $ctx2.sendIdx[","]=2;
  5964. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  5965. }));
  5966. $ctx1.sendIdx["at:ifPresent:"]=2;
  5967. self._assert_equals_($3,"hello nil");
  5968. $ctx1.sendIdx["assert:equals:"]=2;
  5969. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5970. return smalltalk.withContext(function($ctx2) {
  5971. $6=_st(x)._asString();
  5972. $ctx2.sendIdx["asString"]=3;
  5973. return "hello ".__comma($6);
  5974. $ctx2.sendIdx[","]=3;
  5975. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  5976. }));
  5977. $ctx1.sendIdx["at:ifPresent:"]=3;
  5978. self._assert_equals_($5,"hello 1");
  5979. $ctx1.sendIdx["assert:equals:"]=3;
  5980. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5981. return smalltalk.withContext(function($ctx2) {
  5982. return "hello ".__comma(_st(x)._asString());
  5983. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  5984. })),"hello nil");
  5985. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)});
  5986. },
  5987. args: [],
  5988. 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'.",
  5989. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5990. referencedClasses: []
  5991. }),
  5992. globals.JSObjectProxyTest);
  5993. smalltalk.addMethod(
  5994. smalltalk.method({
  5995. selector: "testAtIfPresentIfAbsent",
  5996. protocol: 'tests',
  5997. fn: function (){
  5998. var self=this;
  5999. var testObject;
  6000. return smalltalk.withContext(function($ctx1) {
  6001. var $2,$1,$4,$3,$6,$5;
  6002. testObject=self._jsObject();
  6003. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  6004. return smalltalk.withContext(function($ctx2) {
  6005. $2=_st(x)._asString();
  6006. $ctx2.sendIdx["asString"]=1;
  6007. return "hello ".__comma($2);
  6008. $ctx2.sendIdx[","]=1;
  6009. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  6010. }),(function(){
  6011. return "not present";
  6012. }));
  6013. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  6014. self._assert_equals_($1,"not present");
  6015. $ctx1.sendIdx["assert:equals:"]=1;
  6016. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  6017. return smalltalk.withContext(function($ctx2) {
  6018. $4=_st(x)._asString();
  6019. $ctx2.sendIdx["asString"]=2;
  6020. return "hello ".__comma($4);
  6021. $ctx2.sendIdx[","]=2;
  6022. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  6023. }),(function(){
  6024. return "not present";
  6025. }));
  6026. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  6027. self._assert_equals_($3,"hello nil");
  6028. $ctx1.sendIdx["assert:equals:"]=2;
  6029. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  6030. return smalltalk.withContext(function($ctx2) {
  6031. $6=_st(x)._asString();
  6032. $ctx2.sendIdx["asString"]=3;
  6033. return "hello ".__comma($6);
  6034. $ctx2.sendIdx[","]=3;
  6035. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  6036. }),(function(){
  6037. return "not present";
  6038. }));
  6039. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  6040. self._assert_equals_($5,"hello 1");
  6041. $ctx1.sendIdx["assert:equals:"]=3;
  6042. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  6043. return smalltalk.withContext(function($ctx2) {
  6044. return "hello ".__comma(_st(x)._asString());
  6045. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  6046. }),(function(){
  6047. return "not present";
  6048. })),"hello nil");
  6049. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)});
  6050. },
  6051. args: [],
  6052. 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'.",
  6053. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  6054. referencedClasses: []
  6055. }),
  6056. globals.JSObjectProxyTest);
  6057. smalltalk.addMethod(
  6058. smalltalk.method({
  6059. selector: "testAtPut",
  6060. protocol: 'tests',
  6061. fn: function (){
  6062. var self=this;
  6063. var testObject;
  6064. return smalltalk.withContext(function($ctx1) {
  6065. var $2,$1;
  6066. testObject=self._jsObject();
  6067. $2=_st(testObject)._at_("abc");
  6068. $ctx1.sendIdx["at:"]=1;
  6069. $1=_st($2).__tild_eq("xyz");
  6070. self._assert_($1);
  6071. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  6072. $ctx1.sendIdx["assert:equals:"]=1;
  6073. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  6074. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)});
  6075. },
  6076. args: [],
  6077. 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'",
  6078. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  6079. referencedClasses: []
  6080. }),
  6081. globals.JSObjectProxyTest);
  6082. smalltalk.addMethod(
  6083. smalltalk.method({
  6084. selector: "testComparison",
  6085. protocol: 'tests',
  6086. fn: function (){
  6087. var self=this;
  6088. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6089. return smalltalk.withContext(function($ctx1) {
  6090. var $1,$2;
  6091. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  6092. $1=_st(console).__eq(console);
  6093. $ctx1.sendIdx["="]=1;
  6094. self._assert_($1);
  6095. $2=_st(console).__eq(_st($Object())._new());
  6096. $ctx1.sendIdx["="]=2;
  6097. self._deny_($2);
  6098. $ctx1.sendIdx["deny:"]=1;
  6099. self._deny_(_st(console).__eq(self._jsObject()));
  6100. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)});
  6101. },
  6102. args: [],
  6103. 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",
  6104. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  6105. referencedClasses: ["Object"]
  6106. }),
  6107. globals.JSObjectProxyTest);
  6108. smalltalk.addMethod(
  6109. smalltalk.method({
  6110. selector: "testDNU",
  6111. protocol: 'tests',
  6112. fn: function (){
  6113. var self=this;
  6114. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6115. return smalltalk.withContext(function($ctx1) {
  6116. self._should_raise_((function(){
  6117. return smalltalk.withContext(function($ctx2) {
  6118. return _st(self._jsObject())._foo();
  6119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6120. }),$MessageNotUnderstood());
  6121. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)});
  6122. },
  6123. args: [],
  6124. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  6125. messageSends: ["should:raise:", "foo", "jsObject"],
  6126. referencedClasses: ["MessageNotUnderstood"]
  6127. }),
  6128. globals.JSObjectProxyTest);
  6129. smalltalk.addMethod(
  6130. smalltalk.method({
  6131. selector: "testDNURegression1057",
  6132. protocol: 'tests',
  6133. fn: function (){
  6134. var self=this;
  6135. var jsObject;
  6136. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6137. return smalltalk.withContext(function($ctx1) {
  6138. var $1;
  6139. jsObject=[];
  6140. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  6141. $ctx1.sendIdx["basicAt:put:"]=1;
  6142. _st(jsObject)._basicAt_put_("foo",(3));
  6143. self._shouldnt_raise_((function(){
  6144. return smalltalk.withContext(function($ctx2) {
  6145. return _st(jsObject)._foo();
  6146. $ctx2.sendIdx["foo"]=1;
  6147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6148. }),$Error());
  6149. $ctx1.sendIdx["shouldnt:raise:"]=1;
  6150. $1=_st(jsObject)._foo();
  6151. $ctx1.sendIdx["foo"]=2;
  6152. self._assert_equals_($1,(3));
  6153. $ctx1.sendIdx["assert:equals:"]=1;
  6154. self._shouldnt_raise_((function(){
  6155. return smalltalk.withContext(function($ctx2) {
  6156. return _st(jsObject)._foo_((4));
  6157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6158. }),$Error());
  6159. self._assert_equals_(_st(jsObject)._foo(),(4));
  6160. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},globals.JSObjectProxyTest)});
  6161. },
  6162. args: [],
  6163. 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",
  6164. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"],
  6165. referencedClasses: ["Error"]
  6166. }),
  6167. globals.JSObjectProxyTest);
  6168. smalltalk.addMethod(
  6169. smalltalk.method({
  6170. selector: "testDNURegression1059",
  6171. protocol: 'tests',
  6172. fn: function (){
  6173. var self=this;
  6174. var jsObject;
  6175. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6176. return smalltalk.withContext(function($ctx1) {
  6177. jsObject=[];
  6178. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  6179. $ctx1.sendIdx["basicAt:put:"]=1;
  6180. _st(jsObject)._basicAt_put_("x",(3));
  6181. $ctx1.sendIdx["basicAt:put:"]=2;
  6182. _st(jsObject)._basicAt_put_("x:",(function(){
  6183. return smalltalk.withContext(function($ctx2) {
  6184. return self._error();
  6185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6186. }));
  6187. self._shouldnt_raise_((function(){
  6188. return smalltalk.withContext(function($ctx2) {
  6189. return _st(jsObject)._x_((4));
  6190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6191. }),$Error());
  6192. self._assert_equals_(_st(jsObject)._x(),(4));
  6193. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},globals.JSObjectProxyTest)});
  6194. },
  6195. args: [],
  6196. 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",
  6197. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"],
  6198. referencedClasses: ["Error"]
  6199. }),
  6200. globals.JSObjectProxyTest);
  6201. smalltalk.addMethod(
  6202. smalltalk.method({
  6203. selector: "testDNURegression1062",
  6204. protocol: 'tests',
  6205. fn: function (){
  6206. var self=this;
  6207. var jsObject,stored;
  6208. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6209. return smalltalk.withContext(function($ctx1) {
  6210. jsObject=[];
  6211. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  6212. $ctx1.sendIdx["basicAt:put:"]=1;
  6213. _st(jsObject)._basicAt_put_("x",(function(v){
  6214. stored=v;
  6215. return stored;
  6216. }));
  6217. self._shouldnt_raise_((function(){
  6218. return smalltalk.withContext(function($ctx2) {
  6219. return _st(jsObject)._x_((4));
  6220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6221. }),$Error());
  6222. self._assert_equals_(stored,(4));
  6223. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},globals.JSObjectProxyTest)});
  6224. },
  6225. args: [],
  6226. 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",
  6227. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"],
  6228. referencedClasses: ["Error"]
  6229. }),
  6230. globals.JSObjectProxyTest);
  6231. smalltalk.addMethod(
  6232. smalltalk.method({
  6233. selector: "testMessageSend",
  6234. protocol: 'tests',
  6235. fn: function (){
  6236. var self=this;
  6237. return smalltalk.withContext(function($ctx1) {
  6238. var $2,$1,$4,$3;
  6239. $2=self._jsObject();
  6240. $ctx1.sendIdx["jsObject"]=1;
  6241. $1=_st($2)._a();
  6242. self._assert_equals_($1,(1));
  6243. $ctx1.sendIdx["assert:equals:"]=1;
  6244. $4=self._jsObject();
  6245. $ctx1.sendIdx["jsObject"]=2;
  6246. $3=_st($4)._b();
  6247. self._assert_equals_($3,(2));
  6248. $ctx1.sendIdx["assert:equals:"]=2;
  6249. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  6250. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)});
  6251. },
  6252. args: [],
  6253. 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",
  6254. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  6255. referencedClasses: []
  6256. }),
  6257. globals.JSObjectProxyTest);
  6258. smalltalk.addMethod(
  6259. smalltalk.method({
  6260. selector: "testMethodWithArguments",
  6261. protocol: 'tests',
  6262. fn: function (){
  6263. var self=this;
  6264. return smalltalk.withContext(function($ctx1) {
  6265. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  6266. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)});
  6267. },
  6268. args: [],
  6269. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  6270. messageSends: ["assert:equals:", "c:", "jsObject"],
  6271. referencedClasses: []
  6272. }),
  6273. globals.JSObjectProxyTest);
  6274. smalltalk.addMethod(
  6275. smalltalk.method({
  6276. selector: "testPrinting",
  6277. protocol: 'tests',
  6278. fn: function (){
  6279. var self=this;
  6280. return smalltalk.withContext(function($ctx1) {
  6281. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  6282. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)});
  6283. },
  6284. args: [],
  6285. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  6286. messageSends: ["assert:equals:", "printString", "jsObject"],
  6287. referencedClasses: []
  6288. }),
  6289. globals.JSObjectProxyTest);
  6290. smalltalk.addMethod(
  6291. smalltalk.method({
  6292. selector: "testPropertyThatReturnsEmptyString",
  6293. protocol: 'tests',
  6294. fn: function (){
  6295. var self=this;
  6296. var object;
  6297. return smalltalk.withContext(function($ctx1) {
  6298. var $1;
  6299. object=self._jsObject();
  6300. $1=_st(object)._d();
  6301. $ctx1.sendIdx["d"]=1;
  6302. self._assert_equals_($1,"");
  6303. $ctx1.sendIdx["assert:equals:"]=1;
  6304. _st(object)._d_("hello");
  6305. self._assert_equals_(_st(object)._d(),"hello");
  6306. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)});
  6307. },
  6308. args: [],
  6309. 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'",
  6310. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  6311. referencedClasses: []
  6312. }),
  6313. globals.JSObjectProxyTest);
  6314. smalltalk.addMethod(
  6315. smalltalk.method({
  6316. selector: "testPropertyThatReturnsUndefined",
  6317. protocol: 'tests',
  6318. fn: function (){
  6319. var self=this;
  6320. var object;
  6321. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6322. return smalltalk.withContext(function($ctx1) {
  6323. object=self._jsObject();
  6324. self._shouldnt_raise_((function(){
  6325. return smalltalk.withContext(function($ctx2) {
  6326. return _st(object)._e();
  6327. $ctx2.sendIdx["e"]=1;
  6328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6329. }),$MessageNotUnderstood());
  6330. self._assert_(_st(_st(object)._e())._isNil());
  6331. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)});
  6332. },
  6333. args: [],
  6334. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  6335. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  6336. referencedClasses: ["MessageNotUnderstood"]
  6337. }),
  6338. globals.JSObjectProxyTest);
  6339. smalltalk.addMethod(
  6340. smalltalk.method({
  6341. selector: "testSetPropertyWithFalsyValue",
  6342. protocol: 'tests',
  6343. fn: function (){
  6344. var self=this;
  6345. var jsObject;
  6346. return smalltalk.withContext(function($ctx1) {
  6347. var $1,$2,$3,$4,$5;
  6348. jsObject=self._jsObject();
  6349. $1=_st(jsObject)._a();
  6350. $ctx1.sendIdx["a"]=1;
  6351. self._assert_equals_($1,(1));
  6352. $ctx1.sendIdx["assert:equals:"]=1;
  6353. _st(jsObject)._a_(self._jsNull());
  6354. $ctx1.sendIdx["a:"]=1;
  6355. $2=_st(jsObject)._a();
  6356. $ctx1.sendIdx["a"]=2;
  6357. self._assert_equals_($2,nil);
  6358. $ctx1.sendIdx["assert:equals:"]=2;
  6359. _st(jsObject)._a_((0));
  6360. $ctx1.sendIdx["a:"]=2;
  6361. $3=_st(jsObject)._a();
  6362. $ctx1.sendIdx["a"]=3;
  6363. self._assert_equals_($3,(0));
  6364. $ctx1.sendIdx["assert:equals:"]=3;
  6365. _st(jsObject)._a_(self._jsUndefined());
  6366. $ctx1.sendIdx["a:"]=3;
  6367. $4=_st(jsObject)._a();
  6368. $ctx1.sendIdx["a"]=4;
  6369. self._assert_equals_($4,nil);
  6370. $ctx1.sendIdx["assert:equals:"]=4;
  6371. _st(jsObject)._a_("");
  6372. $ctx1.sendIdx["a:"]=4;
  6373. $5=_st(jsObject)._a();
  6374. $ctx1.sendIdx["a"]=5;
  6375. self._assert_equals_($5,"");
  6376. $ctx1.sendIdx["assert:equals:"]=5;
  6377. _st(jsObject)._a_(false);
  6378. self._assert_equals_(_st(jsObject)._a(),false);
  6379. return self}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)});
  6380. },
  6381. args: [],
  6382. 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",
  6383. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"],
  6384. referencedClasses: []
  6385. }),
  6386. globals.JSObjectProxyTest);
  6387. smalltalk.addMethod(
  6388. smalltalk.method({
  6389. selector: "testValue",
  6390. protocol: 'tests',
  6391. fn: function (){
  6392. var self=this;
  6393. var testObject;
  6394. return smalltalk.withContext(function($ctx1) {
  6395. testObject=self._jsObject();
  6396. _st(testObject)._at_put_("value","aValue");
  6397. self._assert_equals_(_st(testObject)._value(),"aValue");
  6398. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)});
  6399. },
  6400. args: [],
  6401. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  6402. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  6403. referencedClasses: []
  6404. }),
  6405. globals.JSObjectProxyTest);
  6406. smalltalk.addMethod(
  6407. smalltalk.method({
  6408. selector: "testYourself",
  6409. protocol: 'tests',
  6410. fn: function (){
  6411. var self=this;
  6412. var object;
  6413. return smalltalk.withContext(function($ctx1) {
  6414. var $1,$2;
  6415. $1=self._jsObject();
  6416. _st($1)._d_("test");
  6417. $2=_st($1)._yourself();
  6418. object=$2;
  6419. self._assert_equals_(_st(object)._d(),"test");
  6420. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)});
  6421. },
  6422. args: [],
  6423. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  6424. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  6425. referencedClasses: []
  6426. }),
  6427. globals.JSObjectProxyTest);
  6428. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  6429. smalltalk.addMethod(
  6430. smalltalk.method({
  6431. selector: "testCatchingException",
  6432. protocol: 'tests',
  6433. fn: function (){
  6434. var self=this;
  6435. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6436. return smalltalk.withContext(function($ctx1) {
  6437. _st((function(){
  6438. return smalltalk.withContext(function($ctx2) {
  6439. return self._throwException();
  6440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6441. }))._on_do_($Error(),(function(error){
  6442. return smalltalk.withContext(function($ctx2) {
  6443. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  6444. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  6445. }));
  6446. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)});
  6447. },
  6448. args: [],
  6449. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  6450. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  6451. referencedClasses: ["Error"]
  6452. }),
  6453. globals.JavaScriptExceptionTest);
  6454. smalltalk.addMethod(
  6455. smalltalk.method({
  6456. selector: "testRaisingException",
  6457. protocol: 'tests',
  6458. fn: function (){
  6459. var self=this;
  6460. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6461. return smalltalk.withContext(function($ctx1) {
  6462. self._should_raise_((function(){
  6463. return smalltalk.withContext(function($ctx2) {
  6464. return self._throwException();
  6465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6466. }),$JavaScriptException());
  6467. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)});
  6468. },
  6469. args: [],
  6470. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  6471. messageSends: ["should:raise:", "throwException"],
  6472. referencedClasses: ["JavaScriptException"]
  6473. }),
  6474. globals.JavaScriptExceptionTest);
  6475. smalltalk.addMethod(
  6476. smalltalk.method({
  6477. selector: "throwException",
  6478. protocol: 'helpers',
  6479. fn: function (){
  6480. var self=this;
  6481. return smalltalk.withContext(function($ctx1) {
  6482. throw 'test';
  6483. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)});
  6484. },
  6485. args: [],
  6486. source: "throwException\x0a\x09<throw 'test'>",
  6487. messageSends: [],
  6488. referencedClasses: []
  6489. }),
  6490. globals.JavaScriptExceptionTest);
  6491. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  6492. smalltalk.addMethod(
  6493. smalltalk.method({
  6494. selector: "testValue",
  6495. protocol: 'tests',
  6496. fn: function (){
  6497. var self=this;
  6498. var messageSend;
  6499. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6500. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6501. return smalltalk.withContext(function($ctx1) {
  6502. var $1,$2;
  6503. $1=_st($MessageSend())._new();
  6504. $ctx1.sendIdx["new"]=1;
  6505. _st($1)._receiver_(_st($Object())._new());
  6506. _st($1)._selector_("asString");
  6507. $2=_st($1)._yourself();
  6508. messageSend=$2;
  6509. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6510. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)});
  6511. },
  6512. args: [],
  6513. 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'",
  6514. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6515. referencedClasses: ["MessageSend", "Object"]
  6516. }),
  6517. globals.MessageSendTest);
  6518. smalltalk.addMethod(
  6519. smalltalk.method({
  6520. selector: "testValueWithArguments",
  6521. protocol: 'tests',
  6522. fn: function (){
  6523. var self=this;
  6524. var messageSend;
  6525. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6526. return smalltalk.withContext(function($ctx1) {
  6527. var $1,$2;
  6528. $1=_st($MessageSend())._new();
  6529. _st($1)._receiver_((2));
  6530. _st($1)._selector_("+");
  6531. $2=_st($1)._yourself();
  6532. messageSend=$2;
  6533. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6534. $ctx1.sendIdx["assert:equals:"]=1;
  6535. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6536. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)});
  6537. },
  6538. args: [],
  6539. 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",
  6540. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6541. referencedClasses: ["MessageSend"]
  6542. }),
  6543. globals.MessageSendTest);
  6544. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6545. smalltalk.addMethod(
  6546. smalltalk.method({
  6547. selector: "codeGeneratorClass",
  6548. protocol: 'accessing',
  6549. fn: function (){
  6550. var self=this;
  6551. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6552. return $CodeGenerator();
  6553. },
  6554. args: [],
  6555. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6556. messageSends: [],
  6557. referencedClasses: ["CodeGenerator"]
  6558. }),
  6559. globals.MethodInheritanceTest);
  6560. smalltalk.addMethod(
  6561. smalltalk.method({
  6562. selector: "compiler",
  6563. protocol: 'factory',
  6564. fn: function (){
  6565. var self=this;
  6566. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6567. return smalltalk.withContext(function($ctx1) {
  6568. var $2,$3,$1;
  6569. $2=_st($Compiler())._new();
  6570. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6571. $3=_st($2)._yourself();
  6572. $1=$3;
  6573. return $1;
  6574. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)});
  6575. },
  6576. args: [],
  6577. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6578. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6579. referencedClasses: ["Compiler"]
  6580. }),
  6581. globals.MethodInheritanceTest);
  6582. smalltalk.addMethod(
  6583. smalltalk.method({
  6584. selector: "deinstallBottom",
  6585. protocol: 'testing',
  6586. fn: function (){
  6587. var self=this;
  6588. return smalltalk.withContext(function($ctx1) {
  6589. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6590. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)});
  6591. },
  6592. args: [],
  6593. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6594. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6595. referencedClasses: []
  6596. }),
  6597. globals.MethodInheritanceTest);
  6598. smalltalk.addMethod(
  6599. smalltalk.method({
  6600. selector: "deinstallMiddle",
  6601. protocol: 'testing',
  6602. fn: function (){
  6603. var self=this;
  6604. return smalltalk.withContext(function($ctx1) {
  6605. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6606. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)});
  6607. },
  6608. args: [],
  6609. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6610. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6611. referencedClasses: []
  6612. }),
  6613. globals.MethodInheritanceTest);
  6614. smalltalk.addMethod(
  6615. smalltalk.method({
  6616. selector: "deinstallTop",
  6617. protocol: 'testing',
  6618. fn: function (){
  6619. var self=this;
  6620. return smalltalk.withContext(function($ctx1) {
  6621. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6622. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)});
  6623. },
  6624. args: [],
  6625. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6626. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6627. referencedClasses: []
  6628. }),
  6629. globals.MethodInheritanceTest);
  6630. smalltalk.addMethod(
  6631. smalltalk.method({
  6632. selector: "installBottom:",
  6633. protocol: 'testing',
  6634. fn: function (aString){
  6635. var self=this;
  6636. return smalltalk.withContext(function($ctx1) {
  6637. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6638. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)});
  6639. },
  6640. args: ["aString"],
  6641. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6642. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6643. referencedClasses: []
  6644. }),
  6645. globals.MethodInheritanceTest);
  6646. smalltalk.addMethod(
  6647. smalltalk.method({
  6648. selector: "installMiddle:",
  6649. protocol: 'testing',
  6650. fn: function (aString){
  6651. var self=this;
  6652. return smalltalk.withContext(function($ctx1) {
  6653. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6654. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)});
  6655. },
  6656. args: ["aString"],
  6657. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6658. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6659. referencedClasses: []
  6660. }),
  6661. globals.MethodInheritanceTest);
  6662. smalltalk.addMethod(
  6663. smalltalk.method({
  6664. selector: "installTop:",
  6665. protocol: 'testing',
  6666. fn: function (aString){
  6667. var self=this;
  6668. return smalltalk.withContext(function($ctx1) {
  6669. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6670. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)});
  6671. },
  6672. args: ["aString"],
  6673. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6674. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6675. referencedClasses: []
  6676. }),
  6677. globals.MethodInheritanceTest);
  6678. smalltalk.addMethod(
  6679. smalltalk.method({
  6680. selector: "setUp",
  6681. protocol: 'initialization',
  6682. fn: function (){
  6683. var self=this;
  6684. return smalltalk.withContext(function($ctx1) {
  6685. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6686. $ctx1.sendIdx["new"]=1;
  6687. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6688. $ctx1.sendIdx["new"]=2;
  6689. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6690. self["@method"]=nil;
  6691. self["@performBlock"]=(function(){
  6692. return smalltalk.withContext(function($ctx2) {
  6693. return self._error_("performBlock not initialized");
  6694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6695. });
  6696. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)});
  6697. },
  6698. args: [],
  6699. 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' ]",
  6700. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6701. referencedClasses: []
  6702. }),
  6703. globals.MethodInheritanceTest);
  6704. smalltalk.addMethod(
  6705. smalltalk.method({
  6706. selector: "shouldMNU",
  6707. protocol: 'testing',
  6708. fn: function (){
  6709. var self=this;
  6710. return smalltalk.withContext(function($ctx1) {
  6711. self._shouldMNUTop();
  6712. self._shouldMNUMiddle();
  6713. self._shouldMNUBottom();
  6714. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)});
  6715. },
  6716. args: [],
  6717. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6718. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6719. referencedClasses: []
  6720. }),
  6721. globals.MethodInheritanceTest);
  6722. smalltalk.addMethod(
  6723. smalltalk.method({
  6724. selector: "shouldMNUBottom",
  6725. protocol: 'testing',
  6726. fn: function (){
  6727. var self=this;
  6728. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6729. return smalltalk.withContext(function($ctx1) {
  6730. self._should_raise_((function(){
  6731. return smalltalk.withContext(function($ctx2) {
  6732. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6734. }),$MessageNotUnderstood());
  6735. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)});
  6736. },
  6737. args: [],
  6738. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6739. messageSends: ["should:raise:", "value:"],
  6740. referencedClasses: ["MessageNotUnderstood"]
  6741. }),
  6742. globals.MethodInheritanceTest);
  6743. smalltalk.addMethod(
  6744. smalltalk.method({
  6745. selector: "shouldMNUMiddle",
  6746. protocol: 'testing',
  6747. fn: function (){
  6748. var self=this;
  6749. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6750. return smalltalk.withContext(function($ctx1) {
  6751. self._should_raise_((function(){
  6752. return smalltalk.withContext(function($ctx2) {
  6753. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6755. }),$MessageNotUnderstood());
  6756. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)});
  6757. },
  6758. args: [],
  6759. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6760. messageSends: ["should:raise:", "value:"],
  6761. referencedClasses: ["MessageNotUnderstood"]
  6762. }),
  6763. globals.MethodInheritanceTest);
  6764. smalltalk.addMethod(
  6765. smalltalk.method({
  6766. selector: "shouldMNUTop",
  6767. protocol: 'testing',
  6768. fn: function (){
  6769. var self=this;
  6770. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6771. return smalltalk.withContext(function($ctx1) {
  6772. self._should_raise_((function(){
  6773. return smalltalk.withContext(function($ctx2) {
  6774. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6776. }),$MessageNotUnderstood());
  6777. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)});
  6778. },
  6779. args: [],
  6780. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6781. messageSends: ["should:raise:", "value:"],
  6782. referencedClasses: ["MessageNotUnderstood"]
  6783. }),
  6784. globals.MethodInheritanceTest);
  6785. smalltalk.addMethod(
  6786. smalltalk.method({
  6787. selector: "shouldReturn:",
  6788. protocol: 'testing',
  6789. fn: function (anObject){
  6790. var self=this;
  6791. var result;
  6792. return smalltalk.withContext(function($ctx1) {
  6793. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6794. $ctx1.sendIdx["value:"]=1;
  6795. self._assert_equals_(["top",anObject],["top",result]);
  6796. $ctx1.sendIdx["assert:equals:"]=1;
  6797. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6798. $ctx1.sendIdx["value:"]=2;
  6799. self._assert_equals_(["middle",anObject],["middle",result]);
  6800. $ctx1.sendIdx["assert:equals:"]=2;
  6801. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6802. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6803. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)});
  6804. },
  6805. args: ["anObject"],
  6806. 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 }",
  6807. messageSends: ["value:", "assert:equals:"],
  6808. referencedClasses: []
  6809. }),
  6810. globals.MethodInheritanceTest);
  6811. smalltalk.addMethod(
  6812. smalltalk.method({
  6813. selector: "shouldReturn:and:and:",
  6814. protocol: 'testing',
  6815. fn: function (anObject,anObject2,anObject3){
  6816. var self=this;
  6817. var result;
  6818. return smalltalk.withContext(function($ctx1) {
  6819. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6820. $ctx1.sendIdx["value:"]=1;
  6821. self._assert_equals_(["top",anObject],["top",result]);
  6822. $ctx1.sendIdx["assert:equals:"]=1;
  6823. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6824. $ctx1.sendIdx["value:"]=2;
  6825. self._assert_equals_(["middle",anObject2],["middle",result]);
  6826. $ctx1.sendIdx["assert:equals:"]=2;
  6827. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6828. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6829. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)});
  6830. },
  6831. args: ["anObject", "anObject2", "anObject3"],
  6832. 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 }",
  6833. messageSends: ["value:", "assert:equals:"],
  6834. referencedClasses: []
  6835. }),
  6836. globals.MethodInheritanceTest);
  6837. smalltalk.addMethod(
  6838. smalltalk.method({
  6839. selector: "targetClassBottom",
  6840. protocol: 'accessing',
  6841. fn: function (){
  6842. var self=this;
  6843. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6844. return $JavaScriptException();
  6845. },
  6846. args: [],
  6847. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6848. messageSends: [],
  6849. referencedClasses: ["JavaScriptException"]
  6850. }),
  6851. globals.MethodInheritanceTest);
  6852. smalltalk.addMethod(
  6853. smalltalk.method({
  6854. selector: "targetClassMiddle",
  6855. protocol: 'accessing',
  6856. fn: function (){
  6857. var self=this;
  6858. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6859. return $Error();
  6860. },
  6861. args: [],
  6862. source: "targetClassMiddle\x0a\x09^ Error",
  6863. messageSends: [],
  6864. referencedClasses: ["Error"]
  6865. }),
  6866. globals.MethodInheritanceTest);
  6867. smalltalk.addMethod(
  6868. smalltalk.method({
  6869. selector: "targetClassTop",
  6870. protocol: 'accessing',
  6871. fn: function (){
  6872. var self=this;
  6873. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6874. return $Object();
  6875. },
  6876. args: [],
  6877. source: "targetClassTop\x0a\x09^ Object",
  6878. messageSends: [],
  6879. referencedClasses: ["Object"]
  6880. }),
  6881. globals.MethodInheritanceTest);
  6882. smalltalk.addMethod(
  6883. smalltalk.method({
  6884. selector: "tearDown",
  6885. protocol: 'initialization',
  6886. fn: function (){
  6887. var self=this;
  6888. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6889. return smalltalk.withContext(function($ctx1) {
  6890. _st((function(){
  6891. return smalltalk.withContext(function($ctx2) {
  6892. return self._deinstallTop();
  6893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6894. }))._on_do_($Error(),(function(){
  6895. }));
  6896. $ctx1.sendIdx["on:do:"]=1;
  6897. _st((function(){
  6898. return smalltalk.withContext(function($ctx2) {
  6899. return self._deinstallMiddle();
  6900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6901. }))._on_do_($Error(),(function(){
  6902. }));
  6903. $ctx1.sendIdx["on:do:"]=2;
  6904. _st((function(){
  6905. return smalltalk.withContext(function($ctx2) {
  6906. return self._deinstallBottom();
  6907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  6908. }))._on_do_($Error(),(function(){
  6909. }));
  6910. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)});
  6911. },
  6912. args: [],
  6913. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6914. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6915. referencedClasses: ["Error"]
  6916. }),
  6917. globals.MethodInheritanceTest);
  6918. smalltalk.addMethod(
  6919. smalltalk.method({
  6920. selector: "testMNU11",
  6921. protocol: 'tests',
  6922. fn: function (){
  6923. var self=this;
  6924. return smalltalk.withContext(function($ctx1) {
  6925. self["@performBlock"]=(function(x){
  6926. return smalltalk.withContext(function($ctx2) {
  6927. return _st(x)._foo();
  6928. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  6929. });
  6930. self._shouldMNU();
  6931. $ctx1.sendIdx["shouldMNU"]=1;
  6932. self._installTop_("foo ^ false");
  6933. $ctx1.sendIdx["installTop:"]=1;
  6934. self._installTop_("foo ^ true");
  6935. self._deinstallTop();
  6936. self._shouldMNU();
  6937. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)});
  6938. },
  6939. args: [],
  6940. 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",
  6941. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6942. referencedClasses: []
  6943. }),
  6944. globals.MethodInheritanceTest);
  6945. smalltalk.addMethod(
  6946. smalltalk.method({
  6947. selector: "testMNU22",
  6948. protocol: 'tests',
  6949. fn: function (){
  6950. var self=this;
  6951. return smalltalk.withContext(function($ctx1) {
  6952. self["@performBlock"]=(function(x){
  6953. return smalltalk.withContext(function($ctx2) {
  6954. return _st(x)._foo();
  6955. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  6956. });
  6957. self._shouldMNU();
  6958. $ctx1.sendIdx["shouldMNU"]=1;
  6959. self._installMiddle_("foo ^ false");
  6960. $ctx1.sendIdx["installMiddle:"]=1;
  6961. self._installMiddle_("foo ^ true");
  6962. self._deinstallMiddle();
  6963. self._shouldMNU();
  6964. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)});
  6965. },
  6966. args: [],
  6967. 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",
  6968. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6969. referencedClasses: []
  6970. }),
  6971. globals.MethodInheritanceTest);
  6972. smalltalk.addMethod(
  6973. smalltalk.method({
  6974. selector: "testReturns1",
  6975. protocol: 'tests',
  6976. fn: function (){
  6977. var self=this;
  6978. return smalltalk.withContext(function($ctx1) {
  6979. self["@performBlock"]=(function(x){
  6980. return smalltalk.withContext(function($ctx2) {
  6981. return _st(x)._foo();
  6982. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  6983. });
  6984. self._installTop_("foo ^ false");
  6985. $ctx1.sendIdx["installTop:"]=1;
  6986. self._shouldReturn_(false);
  6987. $ctx1.sendIdx["shouldReturn:"]=1;
  6988. self._installTop_("foo ^ true");
  6989. self._shouldReturn_(true);
  6990. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)});
  6991. },
  6992. args: [],
  6993. 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",
  6994. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6995. referencedClasses: []
  6996. }),
  6997. globals.MethodInheritanceTest);
  6998. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6999. smalltalk.addMethod(
  7000. smalltalk.method({
  7001. selector: "testAbs",
  7002. protocol: 'tests',
  7003. fn: function (){
  7004. var self=this;
  7005. return smalltalk.withContext(function($ctx1) {
  7006. var $1;
  7007. $1=(4)._abs();
  7008. $ctx1.sendIdx["abs"]=1;
  7009. self._assert_equals_($1,(4));
  7010. $ctx1.sendIdx["assert:equals:"]=1;
  7011. self._assert_equals_((-4)._abs(),(4));
  7012. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)});
  7013. },
  7014. args: [],
  7015. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  7016. messageSends: ["assert:equals:", "abs"],
  7017. referencedClasses: []
  7018. }),
  7019. globals.NumberTest);
  7020. smalltalk.addMethod(
  7021. smalltalk.method({
  7022. selector: "testArithmetic",
  7023. protocol: 'tests',
  7024. fn: function (){
  7025. var self=this;
  7026. return smalltalk.withContext(function($ctx1) {
  7027. var $1,$2,$3,$5,$4;
  7028. $1=(1.5).__plus((1));
  7029. $ctx1.sendIdx["+"]=1;
  7030. self._assert_equals_($1,(2.5));
  7031. $ctx1.sendIdx["assert:equals:"]=1;
  7032. $2=(2).__minus((1));
  7033. $ctx1.sendIdx["-"]=1;
  7034. self._assert_equals_($2,(1));
  7035. $ctx1.sendIdx["assert:equals:"]=2;
  7036. self._assert_equals_((-2).__minus((1)),(-3));
  7037. $ctx1.sendIdx["assert:equals:"]=3;
  7038. self._assert_equals_((12).__slash((2)),(6));
  7039. $ctx1.sendIdx["assert:equals:"]=4;
  7040. $3=(3).__star((4));
  7041. $ctx1.sendIdx["*"]=1;
  7042. self._assert_equals_($3,(12));
  7043. $ctx1.sendIdx["assert:equals:"]=5;
  7044. self._assert_equals_((7).__slash_slash((2)),(3));
  7045. $ctx1.sendIdx["assert:equals:"]=6;
  7046. self._assert_equals_((7).__backslash_backslash((2)),(1));
  7047. $ctx1.sendIdx["assert:equals:"]=7;
  7048. $5=(1).__plus((2));
  7049. $ctx1.sendIdx["+"]=2;
  7050. $4=_st($5).__star((3));
  7051. $ctx1.sendIdx["*"]=2;
  7052. self._assert_equals_($4,(9));
  7053. $ctx1.sendIdx["assert:equals:"]=8;
  7054. self._assert_equals_((1).__plus((2).__star((3))),(7));
  7055. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)});
  7056. },
  7057. args: [],
  7058. 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",
  7059. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  7060. referencedClasses: []
  7061. }),
  7062. globals.NumberTest);
  7063. smalltalk.addMethod(
  7064. smalltalk.method({
  7065. selector: "testAsNumber",
  7066. protocol: 'tests',
  7067. fn: function (){
  7068. var self=this;
  7069. return smalltalk.withContext(function($ctx1) {
  7070. self._assert_equals_((3)._asNumber(),(3));
  7071. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)});
  7072. },
  7073. args: [],
  7074. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  7075. messageSends: ["assert:equals:", "asNumber"],
  7076. referencedClasses: []
  7077. }),
  7078. globals.NumberTest);
  7079. smalltalk.addMethod(
  7080. smalltalk.method({
  7081. selector: "testCeiling",
  7082. protocol: 'tests',
  7083. fn: function (){
  7084. var self=this;
  7085. return smalltalk.withContext(function($ctx1) {
  7086. var $1,$2;
  7087. $1=(1.2)._ceiling();
  7088. $ctx1.sendIdx["ceiling"]=1;
  7089. self._assert_equals_($1,(2));
  7090. $ctx1.sendIdx["assert:equals:"]=1;
  7091. $2=(-1.2)._ceiling();
  7092. $ctx1.sendIdx["ceiling"]=2;
  7093. self._assert_equals_($2,(-1));
  7094. $ctx1.sendIdx["assert:equals:"]=2;
  7095. self._assert_equals_((1)._ceiling(),(1));
  7096. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)});
  7097. },
  7098. args: [],
  7099. 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.",
  7100. messageSends: ["assert:equals:", "ceiling"],
  7101. referencedClasses: []
  7102. }),
  7103. globals.NumberTest);
  7104. smalltalk.addMethod(
  7105. smalltalk.method({
  7106. selector: "testComparison",
  7107. protocol: 'tests',
  7108. fn: function (){
  7109. var self=this;
  7110. return smalltalk.withContext(function($ctx1) {
  7111. var $1,$2,$3,$4;
  7112. $1=(3).__gt((2));
  7113. $ctx1.sendIdx[">"]=1;
  7114. self._assert_($1);
  7115. $ctx1.sendIdx["assert:"]=1;
  7116. $2=(2).__lt((3));
  7117. $ctx1.sendIdx["<"]=1;
  7118. self._assert_($2);
  7119. $ctx1.sendIdx["assert:"]=2;
  7120. self._deny_((3).__lt((2)));
  7121. $ctx1.sendIdx["deny:"]=1;
  7122. self._deny_((2).__gt((3)));
  7123. $3=(3).__gt_eq((3));
  7124. $ctx1.sendIdx[">="]=1;
  7125. self._assert_($3);
  7126. $ctx1.sendIdx["assert:"]=3;
  7127. self._assert_((3.1).__gt_eq((3)));
  7128. $ctx1.sendIdx["assert:"]=4;
  7129. $4=(3).__lt_eq((3));
  7130. $ctx1.sendIdx["<="]=1;
  7131. self._assert_($4);
  7132. $ctx1.sendIdx["assert:"]=5;
  7133. self._assert_((3).__lt_eq((3.1)));
  7134. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)});
  7135. },
  7136. args: [],
  7137. 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",
  7138. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  7139. referencedClasses: []
  7140. }),
  7141. globals.NumberTest);
  7142. smalltalk.addMethod(
  7143. smalltalk.method({
  7144. selector: "testCopying",
  7145. protocol: 'tests',
  7146. fn: function (){
  7147. var self=this;
  7148. return smalltalk.withContext(function($ctx1) {
  7149. var $1;
  7150. $1=_st((1)._copy()).__eq_eq((1));
  7151. $ctx1.sendIdx["=="]=1;
  7152. self._assert_($1);
  7153. $ctx1.sendIdx["assert:"]=1;
  7154. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  7155. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)});
  7156. },
  7157. args: [],
  7158. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  7159. messageSends: ["assert:", "==", "copy", "deepCopy"],
  7160. referencedClasses: []
  7161. }),
  7162. globals.NumberTest);
  7163. smalltalk.addMethod(
  7164. smalltalk.method({
  7165. selector: "testEquality",
  7166. protocol: 'tests',
  7167. fn: function (){
  7168. var self=this;
  7169. return smalltalk.withContext(function($ctx1) {
  7170. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  7171. $1=(1).__eq((1));
  7172. $ctx1.sendIdx["="]=1;
  7173. self._assert_($1);
  7174. $ctx1.sendIdx["assert:"]=1;
  7175. $2=(0).__eq((0));
  7176. $ctx1.sendIdx["="]=2;
  7177. self._assert_($2);
  7178. $ctx1.sendIdx["assert:"]=2;
  7179. $3=(1).__eq((0));
  7180. $ctx1.sendIdx["="]=3;
  7181. self._deny_($3);
  7182. $ctx1.sendIdx["deny:"]=1;
  7183. $5=(1)._yourself();
  7184. $ctx1.sendIdx["yourself"]=1;
  7185. $4=_st($5).__eq((1));
  7186. $ctx1.sendIdx["="]=4;
  7187. self._assert_($4);
  7188. $ctx1.sendIdx["assert:"]=3;
  7189. $7=(1)._yourself();
  7190. $ctx1.sendIdx["yourself"]=2;
  7191. $6=(1).__eq($7);
  7192. $ctx1.sendIdx["="]=5;
  7193. self._assert_($6);
  7194. $ctx1.sendIdx["assert:"]=4;
  7195. $9=(1)._yourself();
  7196. $ctx1.sendIdx["yourself"]=3;
  7197. $8=_st($9).__eq((1)._yourself());
  7198. $ctx1.sendIdx["="]=6;
  7199. self._assert_($8);
  7200. $10=(0).__eq(false);
  7201. $ctx1.sendIdx["="]=7;
  7202. self._deny_($10);
  7203. $ctx1.sendIdx["deny:"]=2;
  7204. $11=false.__eq((0));
  7205. $ctx1.sendIdx["="]=8;
  7206. self._deny_($11);
  7207. $ctx1.sendIdx["deny:"]=3;
  7208. $12="".__eq((0));
  7209. $ctx1.sendIdx["="]=9;
  7210. self._deny_($12);
  7211. $ctx1.sendIdx["deny:"]=4;
  7212. self._deny_((0).__eq(""));
  7213. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)});
  7214. },
  7215. args: [],
  7216. 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 = ''",
  7217. messageSends: ["assert:", "=", "deny:", "yourself"],
  7218. referencedClasses: []
  7219. }),
  7220. globals.NumberTest);
  7221. smalltalk.addMethod(
  7222. smalltalk.method({
  7223. selector: "testFloor",
  7224. protocol: 'tests',
  7225. fn: function (){
  7226. var self=this;
  7227. return smalltalk.withContext(function($ctx1) {
  7228. var $1,$2;
  7229. $1=(1.2)._floor();
  7230. $ctx1.sendIdx["floor"]=1;
  7231. self._assert_equals_($1,(1));
  7232. $ctx1.sendIdx["assert:equals:"]=1;
  7233. $2=(-1.2)._floor();
  7234. $ctx1.sendIdx["floor"]=2;
  7235. self._assert_equals_($2,(-2));
  7236. $ctx1.sendIdx["assert:equals:"]=2;
  7237. self._assert_equals_((1)._floor(),(1));
  7238. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)});
  7239. },
  7240. args: [],
  7241. 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.",
  7242. messageSends: ["assert:equals:", "floor"],
  7243. referencedClasses: []
  7244. }),
  7245. globals.NumberTest);
  7246. smalltalk.addMethod(
  7247. smalltalk.method({
  7248. selector: "testHexNumbers",
  7249. protocol: 'tests',
  7250. fn: function (){
  7251. var self=this;
  7252. return smalltalk.withContext(function($ctx1) {
  7253. var $1,$2,$3,$4,$5;
  7254. self._assert_equals_((9),(9));
  7255. $ctx1.sendIdx["assert:equals:"]=1;
  7256. $1=(10)._truncated();
  7257. $ctx1.sendIdx["truncated"]=1;
  7258. self._assert_equals_($1,(10));
  7259. $ctx1.sendIdx["assert:equals:"]=2;
  7260. $2=(11)._truncated();
  7261. $ctx1.sendIdx["truncated"]=2;
  7262. self._assert_equals_($2,(11));
  7263. $ctx1.sendIdx["assert:equals:"]=3;
  7264. $3=(12)._truncated();
  7265. $ctx1.sendIdx["truncated"]=3;
  7266. self._assert_equals_($3,(12));
  7267. $ctx1.sendIdx["assert:equals:"]=4;
  7268. $4=(13)._truncated();
  7269. $ctx1.sendIdx["truncated"]=4;
  7270. self._assert_equals_($4,(13));
  7271. $ctx1.sendIdx["assert:equals:"]=5;
  7272. $5=(14)._truncated();
  7273. $ctx1.sendIdx["truncated"]=5;
  7274. self._assert_equals_($5,(14));
  7275. $ctx1.sendIdx["assert:equals:"]=6;
  7276. self._assert_equals_((15)._truncated(),(15));
  7277. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)});
  7278. },
  7279. args: [],
  7280. 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",
  7281. messageSends: ["assert:equals:", "truncated"],
  7282. referencedClasses: []
  7283. }),
  7284. globals.NumberTest);
  7285. smalltalk.addMethod(
  7286. smalltalk.method({
  7287. selector: "testIdentity",
  7288. protocol: 'tests',
  7289. fn: function (){
  7290. var self=this;
  7291. return smalltalk.withContext(function($ctx1) {
  7292. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  7293. $1=(1).__eq_eq((1));
  7294. $ctx1.sendIdx["=="]=1;
  7295. self._assert_($1);
  7296. $ctx1.sendIdx["assert:"]=1;
  7297. $2=(0).__eq_eq((0));
  7298. $ctx1.sendIdx["=="]=2;
  7299. self._assert_($2);
  7300. $ctx1.sendIdx["assert:"]=2;
  7301. $3=(1).__eq_eq((0));
  7302. $ctx1.sendIdx["=="]=3;
  7303. self._deny_($3);
  7304. $ctx1.sendIdx["deny:"]=1;
  7305. $5=(1)._yourself();
  7306. $ctx1.sendIdx["yourself"]=1;
  7307. $4=_st($5).__eq_eq((1));
  7308. $ctx1.sendIdx["=="]=4;
  7309. self._assert_($4);
  7310. $ctx1.sendIdx["assert:"]=3;
  7311. $7=(1)._yourself();
  7312. $ctx1.sendIdx["yourself"]=2;
  7313. $6=(1).__eq_eq($7);
  7314. $ctx1.sendIdx["=="]=5;
  7315. self._assert_($6);
  7316. $ctx1.sendIdx["assert:"]=4;
  7317. $9=(1)._yourself();
  7318. $ctx1.sendIdx["yourself"]=3;
  7319. $8=_st($9).__eq_eq((1)._yourself());
  7320. $ctx1.sendIdx["=="]=6;
  7321. self._assert_($8);
  7322. self._deny_((1).__eq_eq((2)));
  7323. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)});
  7324. },
  7325. args: [],
  7326. 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",
  7327. messageSends: ["assert:", "==", "deny:", "yourself"],
  7328. referencedClasses: []
  7329. }),
  7330. globals.NumberTest);
  7331. smalltalk.addMethod(
  7332. smalltalk.method({
  7333. selector: "testInvalidHexNumbers",
  7334. protocol: 'tests',
  7335. fn: function (){
  7336. var self=this;
  7337. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7338. return smalltalk.withContext(function($ctx1) {
  7339. self._should_raise_((function(){
  7340. return smalltalk.withContext(function($ctx2) {
  7341. return (16)._rG();
  7342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7343. }),$MessageNotUnderstood());
  7344. $ctx1.sendIdx["should:raise:"]=1;
  7345. self._should_raise_((function(){
  7346. return smalltalk.withContext(function($ctx2) {
  7347. return (16)._rg();
  7348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7349. }),$MessageNotUnderstood());
  7350. $ctx1.sendIdx["should:raise:"]=2;
  7351. self._should_raise_((function(){
  7352. return smalltalk.withContext(function($ctx2) {
  7353. return (16)._rH();
  7354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  7355. }),$MessageNotUnderstood());
  7356. $ctx1.sendIdx["should:raise:"]=3;
  7357. self._should_raise_((function(){
  7358. return smalltalk.withContext(function($ctx2) {
  7359. return (16)._rh();
  7360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  7361. }),$MessageNotUnderstood());
  7362. $ctx1.sendIdx["should:raise:"]=4;
  7363. self._should_raise_((function(){
  7364. return smalltalk.withContext(function($ctx2) {
  7365. return (16)._rI();
  7366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  7367. }),$MessageNotUnderstood());
  7368. $ctx1.sendIdx["should:raise:"]=5;
  7369. self._should_raise_((function(){
  7370. return smalltalk.withContext(function($ctx2) {
  7371. return (16)._ri();
  7372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  7373. }),$MessageNotUnderstood());
  7374. $ctx1.sendIdx["should:raise:"]=6;
  7375. self._should_raise_((function(){
  7376. return smalltalk.withContext(function($ctx2) {
  7377. return (16)._rJ();
  7378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  7379. }),$MessageNotUnderstood());
  7380. $ctx1.sendIdx["should:raise:"]=7;
  7381. self._should_raise_((function(){
  7382. return smalltalk.withContext(function($ctx2) {
  7383. return (16)._rj();
  7384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  7385. }),$MessageNotUnderstood());
  7386. $ctx1.sendIdx["should:raise:"]=8;
  7387. self._should_raise_((function(){
  7388. return smalltalk.withContext(function($ctx2) {
  7389. return (16)._rK();
  7390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  7391. }),$MessageNotUnderstood());
  7392. $ctx1.sendIdx["should:raise:"]=9;
  7393. self._should_raise_((function(){
  7394. return smalltalk.withContext(function($ctx2) {
  7395. return (16)._rk();
  7396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  7397. }),$MessageNotUnderstood());
  7398. $ctx1.sendIdx["should:raise:"]=10;
  7399. self._should_raise_((function(){
  7400. return smalltalk.withContext(function($ctx2) {
  7401. return (16)._rL();
  7402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  7403. }),$MessageNotUnderstood());
  7404. $ctx1.sendIdx["should:raise:"]=11;
  7405. self._should_raise_((function(){
  7406. return smalltalk.withContext(function($ctx2) {
  7407. return (16)._rl();
  7408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  7409. }),$MessageNotUnderstood());
  7410. $ctx1.sendIdx["should:raise:"]=12;
  7411. self._should_raise_((function(){
  7412. return smalltalk.withContext(function($ctx2) {
  7413. return (16)._rM();
  7414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  7415. }),$MessageNotUnderstood());
  7416. $ctx1.sendIdx["should:raise:"]=13;
  7417. self._should_raise_((function(){
  7418. return smalltalk.withContext(function($ctx2) {
  7419. return (16)._rm();
  7420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  7421. }),$MessageNotUnderstood());
  7422. $ctx1.sendIdx["should:raise:"]=14;
  7423. self._should_raise_((function(){
  7424. return smalltalk.withContext(function($ctx2) {
  7425. return (16)._rN();
  7426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  7427. }),$MessageNotUnderstood());
  7428. $ctx1.sendIdx["should:raise:"]=15;
  7429. self._should_raise_((function(){
  7430. return smalltalk.withContext(function($ctx2) {
  7431. return (16)._rn();
  7432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  7433. }),$MessageNotUnderstood());
  7434. $ctx1.sendIdx["should:raise:"]=16;
  7435. self._should_raise_((function(){
  7436. return smalltalk.withContext(function($ctx2) {
  7437. return (16)._rO();
  7438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  7439. }),$MessageNotUnderstood());
  7440. $ctx1.sendIdx["should:raise:"]=17;
  7441. self._should_raise_((function(){
  7442. return smalltalk.withContext(function($ctx2) {
  7443. return (16)._ro();
  7444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  7445. }),$MessageNotUnderstood());
  7446. $ctx1.sendIdx["should:raise:"]=18;
  7447. self._should_raise_((function(){
  7448. return smalltalk.withContext(function($ctx2) {
  7449. return (16)._rP();
  7450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  7451. }),$MessageNotUnderstood());
  7452. $ctx1.sendIdx["should:raise:"]=19;
  7453. self._should_raise_((function(){
  7454. return smalltalk.withContext(function($ctx2) {
  7455. return (16)._rp();
  7456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  7457. }),$MessageNotUnderstood());
  7458. $ctx1.sendIdx["should:raise:"]=20;
  7459. self._should_raise_((function(){
  7460. return smalltalk.withContext(function($ctx2) {
  7461. return (16)._rQ();
  7462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  7463. }),$MessageNotUnderstood());
  7464. $ctx1.sendIdx["should:raise:"]=21;
  7465. self._should_raise_((function(){
  7466. return smalltalk.withContext(function($ctx2) {
  7467. return (16)._rq();
  7468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  7469. }),$MessageNotUnderstood());
  7470. $ctx1.sendIdx["should:raise:"]=22;
  7471. self._should_raise_((function(){
  7472. return smalltalk.withContext(function($ctx2) {
  7473. return (16)._rR();
  7474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  7475. }),$MessageNotUnderstood());
  7476. $ctx1.sendIdx["should:raise:"]=23;
  7477. self._should_raise_((function(){
  7478. return smalltalk.withContext(function($ctx2) {
  7479. return (16)._rr();
  7480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  7481. }),$MessageNotUnderstood());
  7482. $ctx1.sendIdx["should:raise:"]=24;
  7483. self._should_raise_((function(){
  7484. return smalltalk.withContext(function($ctx2) {
  7485. return (16)._rS();
  7486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  7487. }),$MessageNotUnderstood());
  7488. $ctx1.sendIdx["should:raise:"]=25;
  7489. self._should_raise_((function(){
  7490. return smalltalk.withContext(function($ctx2) {
  7491. return (16)._rs();
  7492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  7493. }),$MessageNotUnderstood());
  7494. $ctx1.sendIdx["should:raise:"]=26;
  7495. self._should_raise_((function(){
  7496. return smalltalk.withContext(function($ctx2) {
  7497. return (16)._rT();
  7498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  7499. }),$MessageNotUnderstood());
  7500. $ctx1.sendIdx["should:raise:"]=27;
  7501. self._should_raise_((function(){
  7502. return smalltalk.withContext(function($ctx2) {
  7503. return (16)._rt();
  7504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  7505. }),$MessageNotUnderstood());
  7506. $ctx1.sendIdx["should:raise:"]=28;
  7507. self._should_raise_((function(){
  7508. return smalltalk.withContext(function($ctx2) {
  7509. return (16)._rU();
  7510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  7511. }),$MessageNotUnderstood());
  7512. $ctx1.sendIdx["should:raise:"]=29;
  7513. self._should_raise_((function(){
  7514. return smalltalk.withContext(function($ctx2) {
  7515. return (16)._ru();
  7516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  7517. }),$MessageNotUnderstood());
  7518. $ctx1.sendIdx["should:raise:"]=30;
  7519. self._should_raise_((function(){
  7520. return smalltalk.withContext(function($ctx2) {
  7521. return (16)._rV();
  7522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  7523. }),$MessageNotUnderstood());
  7524. $ctx1.sendIdx["should:raise:"]=31;
  7525. self._should_raise_((function(){
  7526. return smalltalk.withContext(function($ctx2) {
  7527. return (16)._rv();
  7528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  7529. }),$MessageNotUnderstood());
  7530. $ctx1.sendIdx["should:raise:"]=32;
  7531. self._should_raise_((function(){
  7532. return smalltalk.withContext(function($ctx2) {
  7533. return (16)._rW();
  7534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  7535. }),$MessageNotUnderstood());
  7536. $ctx1.sendIdx["should:raise:"]=33;
  7537. self._should_raise_((function(){
  7538. return smalltalk.withContext(function($ctx2) {
  7539. return (16)._rw();
  7540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  7541. }),$MessageNotUnderstood());
  7542. $ctx1.sendIdx["should:raise:"]=34;
  7543. self._should_raise_((function(){
  7544. return smalltalk.withContext(function($ctx2) {
  7545. return (16)._rX();
  7546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  7547. }),$MessageNotUnderstood());
  7548. $ctx1.sendIdx["should:raise:"]=35;
  7549. self._should_raise_((function(){
  7550. return smalltalk.withContext(function($ctx2) {
  7551. return (16)._rx();
  7552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  7553. }),$MessageNotUnderstood());
  7554. $ctx1.sendIdx["should:raise:"]=36;
  7555. self._should_raise_((function(){
  7556. return smalltalk.withContext(function($ctx2) {
  7557. return (16)._rY();
  7558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  7559. }),$MessageNotUnderstood());
  7560. $ctx1.sendIdx["should:raise:"]=37;
  7561. self._should_raise_((function(){
  7562. return smalltalk.withContext(function($ctx2) {
  7563. return (16)._ry();
  7564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  7565. }),$MessageNotUnderstood());
  7566. $ctx1.sendIdx["should:raise:"]=38;
  7567. self._should_raise_((function(){
  7568. return smalltalk.withContext(function($ctx2) {
  7569. return (16)._rZ();
  7570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  7571. }),$MessageNotUnderstood());
  7572. $ctx1.sendIdx["should:raise:"]=39;
  7573. self._should_raise_((function(){
  7574. return smalltalk.withContext(function($ctx2) {
  7575. return (16)._rz();
  7576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  7577. }),$MessageNotUnderstood());
  7578. $ctx1.sendIdx["should:raise:"]=40;
  7579. self._should_raise_((function(){
  7580. return smalltalk.withContext(function($ctx2) {
  7581. return (11259375)._Z();
  7582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  7583. }),$MessageNotUnderstood());
  7584. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)});
  7585. },
  7586. args: [],
  7587. 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.",
  7588. 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"],
  7589. referencedClasses: ["MessageNotUnderstood"]
  7590. }),
  7591. globals.NumberTest);
  7592. smalltalk.addMethod(
  7593. smalltalk.method({
  7594. selector: "testLog",
  7595. protocol: 'tests',
  7596. fn: function (){
  7597. var self=this;
  7598. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7599. return smalltalk.withContext(function($ctx1) {
  7600. self._assert_equals_((10000)._log(),(4));
  7601. $ctx1.sendIdx["assert:equals:"]=1;
  7602. self._assert_equals_((512)._log_((2)),(9));
  7603. $ctx1.sendIdx["assert:equals:"]=2;
  7604. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7605. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)});
  7606. },
  7607. args: [],
  7608. 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.",
  7609. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7610. referencedClasses: ["Number"]
  7611. }),
  7612. globals.NumberTest);
  7613. smalltalk.addMethod(
  7614. smalltalk.method({
  7615. selector: "testMinMax",
  7616. protocol: 'tests',
  7617. fn: function (){
  7618. var self=this;
  7619. return smalltalk.withContext(function($ctx1) {
  7620. self._assert_equals_((2)._max_((5)),(5));
  7621. $ctx1.sendIdx["assert:equals:"]=1;
  7622. self._assert_equals_((2)._min_((5)),(2));
  7623. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)});
  7624. },
  7625. args: [],
  7626. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7627. messageSends: ["assert:equals:", "max:", "min:"],
  7628. referencedClasses: []
  7629. }),
  7630. globals.NumberTest);
  7631. smalltalk.addMethod(
  7632. smalltalk.method({
  7633. selector: "testNegated",
  7634. protocol: 'tests',
  7635. fn: function (){
  7636. var self=this;
  7637. return smalltalk.withContext(function($ctx1) {
  7638. var $1;
  7639. $1=(3)._negated();
  7640. $ctx1.sendIdx["negated"]=1;
  7641. self._assert_equals_($1,(-3));
  7642. $ctx1.sendIdx["assert:equals:"]=1;
  7643. self._assert_equals_((-3)._negated(),(3));
  7644. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)});
  7645. },
  7646. args: [],
  7647. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7648. messageSends: ["assert:equals:", "negated"],
  7649. referencedClasses: []
  7650. }),
  7651. globals.NumberTest);
  7652. smalltalk.addMethod(
  7653. smalltalk.method({
  7654. selector: "testPrintShowingDecimalPlaces",
  7655. protocol: 'tests',
  7656. fn: function (){
  7657. var self=this;
  7658. return smalltalk.withContext(function($ctx1) {
  7659. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7660. $1=(23)._printShowingDecimalPlaces_((2));
  7661. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7662. self._assert_equals_($1,"23.00");
  7663. $ctx1.sendIdx["assert:equals:"]=1;
  7664. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7665. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7666. self._assert_equals_($2,"23.57");
  7667. $ctx1.sendIdx["assert:equals:"]=2;
  7668. $4=(234.567)._negated();
  7669. $ctx1.sendIdx["negated"]=1;
  7670. $3=_st($4)._printShowingDecimalPlaces_((5));
  7671. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7672. self._assert_equals_($3,"-234.56700");
  7673. $ctx1.sendIdx["assert:equals:"]=3;
  7674. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7675. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7676. self._assert_equals_($5,"23");
  7677. $ctx1.sendIdx["assert:equals:"]=4;
  7678. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7679. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7680. self._assert_equals_($6,"24");
  7681. $ctx1.sendIdx["assert:equals:"]=5;
  7682. $8=(23.4567)._negated();
  7683. $ctx1.sendIdx["negated"]=2;
  7684. $7=_st($8)._printShowingDecimalPlaces_((0));
  7685. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7686. self._assert_equals_($7,"-23");
  7687. $ctx1.sendIdx["assert:equals:"]=6;
  7688. $10=(23.5567)._negated();
  7689. $ctx1.sendIdx["negated"]=3;
  7690. $9=_st($10)._printShowingDecimalPlaces_((0));
  7691. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7692. self._assert_equals_($9,"-24");
  7693. $ctx1.sendIdx["assert:equals:"]=7;
  7694. $11=(100000000)._printShowingDecimalPlaces_((1));
  7695. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7696. self._assert_equals_($11,"100000000.0");
  7697. $ctx1.sendIdx["assert:equals:"]=8;
  7698. $12=(0.98)._printShowingDecimalPlaces_((5));
  7699. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7700. self._assert_equals_($12,"0.98000");
  7701. $ctx1.sendIdx["assert:equals:"]=9;
  7702. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7703. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7704. self._assert_equals_($13,"-0.98");
  7705. $ctx1.sendIdx["assert:equals:"]=10;
  7706. $14=(2.567)._printShowingDecimalPlaces_((2));
  7707. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7708. self._assert_equals_($14,"2.57");
  7709. $ctx1.sendIdx["assert:equals:"]=11;
  7710. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7711. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7712. self._assert_equals_($15,"-2.57");
  7713. $ctx1.sendIdx["assert:equals:"]=12;
  7714. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7715. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)});
  7716. },
  7717. args: [],
  7718. 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'.",
  7719. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7720. referencedClasses: []
  7721. }),
  7722. globals.NumberTest);
  7723. smalltalk.addMethod(
  7724. smalltalk.method({
  7725. selector: "testRaisedTo",
  7726. protocol: 'tests',
  7727. fn: function (){
  7728. var self=this;
  7729. return smalltalk.withContext(function($ctx1) {
  7730. var $1,$2,$3;
  7731. $1=(2)._raisedTo_((4));
  7732. $ctx1.sendIdx["raisedTo:"]=1;
  7733. self._assert_equals_($1,(16));
  7734. $ctx1.sendIdx["assert:equals:"]=1;
  7735. $2=(2)._raisedTo_((0));
  7736. $ctx1.sendIdx["raisedTo:"]=2;
  7737. self._assert_equals_($2,(1));
  7738. $ctx1.sendIdx["assert:equals:"]=2;
  7739. $3=(2)._raisedTo_((-3));
  7740. $ctx1.sendIdx["raisedTo:"]=3;
  7741. self._assert_equals_($3,(0.125));
  7742. $ctx1.sendIdx["assert:equals:"]=3;
  7743. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7744. $ctx1.sendIdx["assert:equals:"]=4;
  7745. self._assert_equals_((2).__star_star((4)),(16));
  7746. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)});
  7747. },
  7748. args: [],
  7749. 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.",
  7750. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7751. referencedClasses: []
  7752. }),
  7753. globals.NumberTest);
  7754. smalltalk.addMethod(
  7755. smalltalk.method({
  7756. selector: "testRounded",
  7757. protocol: 'tests',
  7758. fn: function (){
  7759. var self=this;
  7760. return smalltalk.withContext(function($ctx1) {
  7761. var $1,$2;
  7762. $1=(3)._rounded();
  7763. $ctx1.sendIdx["rounded"]=1;
  7764. self._assert_equals_($1,(3));
  7765. $ctx1.sendIdx["assert:equals:"]=1;
  7766. $2=(3.212)._rounded();
  7767. $ctx1.sendIdx["rounded"]=2;
  7768. self._assert_equals_($2,(3));
  7769. $ctx1.sendIdx["assert:equals:"]=2;
  7770. self._assert_equals_((3.51)._rounded(),(4));
  7771. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)});
  7772. },
  7773. args: [],
  7774. 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",
  7775. messageSends: ["assert:equals:", "rounded"],
  7776. referencedClasses: []
  7777. }),
  7778. globals.NumberTest);
  7779. smalltalk.addMethod(
  7780. smalltalk.method({
  7781. selector: "testSign",
  7782. protocol: 'tests',
  7783. fn: function (){
  7784. var self=this;
  7785. return smalltalk.withContext(function($ctx1) {
  7786. var $1,$2;
  7787. $1=(5)._sign();
  7788. $ctx1.sendIdx["sign"]=1;
  7789. self._assert_equals_($1,(1));
  7790. $ctx1.sendIdx["assert:equals:"]=1;
  7791. $2=(0)._sign();
  7792. $ctx1.sendIdx["sign"]=2;
  7793. self._assert_equals_($2,(0));
  7794. $ctx1.sendIdx["assert:equals:"]=2;
  7795. self._assert_equals_((-1.4)._sign(),(-1));
  7796. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)});
  7797. },
  7798. args: [],
  7799. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7800. messageSends: ["assert:equals:", "sign"],
  7801. referencedClasses: []
  7802. }),
  7803. globals.NumberTest);
  7804. smalltalk.addMethod(
  7805. smalltalk.method({
  7806. selector: "testSqrt",
  7807. protocol: 'tests',
  7808. fn: function (){
  7809. var self=this;
  7810. return smalltalk.withContext(function($ctx1) {
  7811. var $1;
  7812. $1=(4)._sqrt();
  7813. $ctx1.sendIdx["sqrt"]=1;
  7814. self._assert_equals_($1,(2));
  7815. $ctx1.sendIdx["assert:equals:"]=1;
  7816. self._assert_equals_((16)._sqrt(),(4));
  7817. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)});
  7818. },
  7819. args: [],
  7820. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7821. messageSends: ["assert:equals:", "sqrt"],
  7822. referencedClasses: []
  7823. }),
  7824. globals.NumberTest);
  7825. smalltalk.addMethod(
  7826. smalltalk.method({
  7827. selector: "testSquared",
  7828. protocol: 'tests',
  7829. fn: function (){
  7830. var self=this;
  7831. return smalltalk.withContext(function($ctx1) {
  7832. self._assert_equals_((4)._squared(),(16));
  7833. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)});
  7834. },
  7835. args: [],
  7836. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7837. messageSends: ["assert:equals:", "squared"],
  7838. referencedClasses: []
  7839. }),
  7840. globals.NumberTest);
  7841. smalltalk.addMethod(
  7842. smalltalk.method({
  7843. selector: "testTimesRepeat",
  7844. protocol: 'tests',
  7845. fn: function (){
  7846. var self=this;
  7847. var i;
  7848. return smalltalk.withContext(function($ctx1) {
  7849. i=(0);
  7850. (0)._timesRepeat_((function(){
  7851. return smalltalk.withContext(function($ctx2) {
  7852. i=_st(i).__plus((1));
  7853. $ctx2.sendIdx["+"]=1;
  7854. return i;
  7855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7856. }));
  7857. $ctx1.sendIdx["timesRepeat:"]=1;
  7858. self._assert_equals_(i,(0));
  7859. $ctx1.sendIdx["assert:equals:"]=1;
  7860. (5)._timesRepeat_((function(){
  7861. return smalltalk.withContext(function($ctx2) {
  7862. i=_st(i).__plus((1));
  7863. return i;
  7864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7865. }));
  7866. self._assert_equals_(i,(5));
  7867. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)});
  7868. },
  7869. args: [],
  7870. 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",
  7871. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7872. referencedClasses: []
  7873. }),
  7874. globals.NumberTest);
  7875. smalltalk.addMethod(
  7876. smalltalk.method({
  7877. selector: "testTo",
  7878. protocol: 'tests',
  7879. fn: function (){
  7880. var self=this;
  7881. return smalltalk.withContext(function($ctx1) {
  7882. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7883. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)});
  7884. },
  7885. args: [],
  7886. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7887. messageSends: ["assert:equals:", "to:"],
  7888. referencedClasses: []
  7889. }),
  7890. globals.NumberTest);
  7891. smalltalk.addMethod(
  7892. smalltalk.method({
  7893. selector: "testToBy",
  7894. protocol: 'tests',
  7895. fn: function (){
  7896. var self=this;
  7897. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7898. return smalltalk.withContext(function($ctx1) {
  7899. var $1;
  7900. $1=(0)._to_by_((6),(2));
  7901. $ctx1.sendIdx["to:by:"]=1;
  7902. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7903. self._should_raise_((function(){
  7904. return smalltalk.withContext(function($ctx2) {
  7905. return (1)._to_by_((4),(0));
  7906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7907. }),$Error());
  7908. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)});
  7909. },
  7910. args: [],
  7911. 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",
  7912. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7913. referencedClasses: ["Error"]
  7914. }),
  7915. globals.NumberTest);
  7916. smalltalk.addMethod(
  7917. smalltalk.method({
  7918. selector: "testTrigonometry",
  7919. protocol: 'tests',
  7920. fn: function (){
  7921. var self=this;
  7922. return smalltalk.withContext(function($ctx1) {
  7923. self._assert_equals_((0)._cos(),(1));
  7924. $ctx1.sendIdx["assert:equals:"]=1;
  7925. self._assert_equals_((0)._sin(),(0));
  7926. $ctx1.sendIdx["assert:equals:"]=2;
  7927. self._assert_equals_((0)._tan(),(0));
  7928. $ctx1.sendIdx["assert:equals:"]=3;
  7929. self._assert_equals_((1)._arcCos(),(0));
  7930. $ctx1.sendIdx["assert:equals:"]=4;
  7931. self._assert_equals_((0)._arcSin(),(0));
  7932. $ctx1.sendIdx["assert:equals:"]=5;
  7933. self._assert_equals_((0)._arcTan(),(0));
  7934. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)});
  7935. },
  7936. args: [],
  7937. 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.",
  7938. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7939. referencedClasses: []
  7940. }),
  7941. globals.NumberTest);
  7942. smalltalk.addMethod(
  7943. smalltalk.method({
  7944. selector: "testTruncated",
  7945. protocol: 'tests',
  7946. fn: function (){
  7947. var self=this;
  7948. return smalltalk.withContext(function($ctx1) {
  7949. var $1,$2;
  7950. $1=(3)._truncated();
  7951. $ctx1.sendIdx["truncated"]=1;
  7952. self._assert_equals_($1,(3));
  7953. $ctx1.sendIdx["assert:equals:"]=1;
  7954. $2=(3.212)._truncated();
  7955. $ctx1.sendIdx["truncated"]=2;
  7956. self._assert_equals_($2,(3));
  7957. $ctx1.sendIdx["assert:equals:"]=2;
  7958. self._assert_equals_((3.51)._truncated(),(3));
  7959. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)});
  7960. },
  7961. args: [],
  7962. 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",
  7963. messageSends: ["assert:equals:", "truncated"],
  7964. referencedClasses: []
  7965. }),
  7966. globals.NumberTest);
  7967. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7968. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7969. smalltalk.addMethod(
  7970. smalltalk.method({
  7971. selector: "foo",
  7972. protocol: 'not yet classified',
  7973. fn: function (){
  7974. var self=this;
  7975. var $1;
  7976. $1=self["@foo"];
  7977. return $1;
  7978. },
  7979. args: [],
  7980. source: "foo\x0a\x09^ foo",
  7981. messageSends: [],
  7982. referencedClasses: []
  7983. }),
  7984. globals.ObjectMock);
  7985. smalltalk.addMethod(
  7986. smalltalk.method({
  7987. selector: "foo:",
  7988. protocol: 'not yet classified',
  7989. fn: function (anObject){
  7990. var self=this;
  7991. self["@foo"]=anObject;
  7992. return self
  7993. },
  7994. args: ["anObject"],
  7995. source: "foo: anObject\x0a\x09foo := anObject",
  7996. messageSends: [],
  7997. referencedClasses: []
  7998. }),
  7999. globals.ObjectMock);
  8000. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  8001. smalltalk.addMethod(
  8002. smalltalk.method({
  8003. selector: "notDefined",
  8004. protocol: 'tests',
  8005. fn: function (){
  8006. var self=this;
  8007. return smalltalk.withContext(function($ctx1) {
  8008. return void 0;;
  8009. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)});
  8010. },
  8011. args: [],
  8012. source: "notDefined\x0a\x09<return void 0;>",
  8013. messageSends: [],
  8014. referencedClasses: []
  8015. }),
  8016. globals.ObjectTest);
  8017. smalltalk.addMethod(
  8018. smalltalk.method({
  8019. selector: "testBasicAccess",
  8020. protocol: 'tests',
  8021. fn: function (){
  8022. var self=this;
  8023. var o;
  8024. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8025. return smalltalk.withContext(function($ctx1) {
  8026. var $1;
  8027. o=_st($Object())._new();
  8028. _st(o)._basicAt_put_("a",(1));
  8029. $1=_st(o)._basicAt_("a");
  8030. $ctx1.sendIdx["basicAt:"]=1;
  8031. self._assert_equals_($1,(1));
  8032. $ctx1.sendIdx["assert:equals:"]=1;
  8033. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  8034. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)});
  8035. },
  8036. args: [],
  8037. 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",
  8038. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  8039. referencedClasses: ["Object"]
  8040. }),
  8041. globals.ObjectTest);
  8042. smalltalk.addMethod(
  8043. smalltalk.method({
  8044. selector: "testBasicPerform",
  8045. protocol: 'tests',
  8046. fn: function (){
  8047. var self=this;
  8048. var o;
  8049. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8050. return smalltalk.withContext(function($ctx1) {
  8051. o=_st($Object())._new();
  8052. _st(o)._basicAt_put_("func",(function(){
  8053. return "hello";
  8054. }));
  8055. $ctx1.sendIdx["basicAt:put:"]=1;
  8056. _st(o)._basicAt_put_("func2",(function(a){
  8057. return smalltalk.withContext(function($ctx2) {
  8058. return _st(a).__plus((1));
  8059. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  8060. }));
  8061. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  8062. $ctx1.sendIdx["assert:equals:"]=1;
  8063. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  8064. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)});
  8065. },
  8066. args: [],
  8067. 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",
  8068. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  8069. referencedClasses: ["Object"]
  8070. }),
  8071. globals.ObjectTest);
  8072. smalltalk.addMethod(
  8073. smalltalk.method({
  8074. selector: "testDNU",
  8075. protocol: 'tests',
  8076. fn: function (){
  8077. var self=this;
  8078. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8079. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  8080. return smalltalk.withContext(function($ctx1) {
  8081. self._should_raise_((function(){
  8082. return smalltalk.withContext(function($ctx2) {
  8083. return _st(_st($Object())._new())._foo();
  8084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8085. }),$MessageNotUnderstood());
  8086. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)});
  8087. },
  8088. args: [],
  8089. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  8090. messageSends: ["should:raise:", "foo", "new"],
  8091. referencedClasses: ["Object", "MessageNotUnderstood"]
  8092. }),
  8093. globals.ObjectTest);
  8094. smalltalk.addMethod(
  8095. smalltalk.method({
  8096. selector: "testEquality",
  8097. protocol: 'tests',
  8098. fn: function (){
  8099. var self=this;
  8100. var o;
  8101. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8102. return smalltalk.withContext(function($ctx1) {
  8103. var $1,$2,$4,$3;
  8104. o=_st($Object())._new();
  8105. $ctx1.sendIdx["new"]=1;
  8106. $1=_st(o).__eq(_st($Object())._new());
  8107. $ctx1.sendIdx["="]=1;
  8108. self._deny_($1);
  8109. $2=_st(o).__eq(o);
  8110. $ctx1.sendIdx["="]=2;
  8111. self._assert_($2);
  8112. $ctx1.sendIdx["assert:"]=1;
  8113. $4=_st(o)._yourself();
  8114. $ctx1.sendIdx["yourself"]=1;
  8115. $3=_st($4).__eq(o);
  8116. $ctx1.sendIdx["="]=3;
  8117. self._assert_($3);
  8118. $ctx1.sendIdx["assert:"]=2;
  8119. self._assert_(_st(o).__eq(_st(o)._yourself()));
  8120. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)});
  8121. },
  8122. args: [],
  8123. 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)",
  8124. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  8125. referencedClasses: ["Object"]
  8126. }),
  8127. globals.ObjectTest);
  8128. smalltalk.addMethod(
  8129. smalltalk.method({
  8130. selector: "testHalt",
  8131. protocol: 'tests',
  8132. fn: function (){
  8133. var self=this;
  8134. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8135. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8136. return smalltalk.withContext(function($ctx1) {
  8137. self._should_raise_((function(){
  8138. return smalltalk.withContext(function($ctx2) {
  8139. return _st(_st($Object())._new())._halt();
  8140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8141. }),$Error());
  8142. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)});
  8143. },
  8144. args: [],
  8145. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  8146. messageSends: ["should:raise:", "halt", "new"],
  8147. referencedClasses: ["Object", "Error"]
  8148. }),
  8149. globals.ObjectTest);
  8150. smalltalk.addMethod(
  8151. smalltalk.method({
  8152. selector: "testIdentity",
  8153. protocol: 'tests',
  8154. fn: function (){
  8155. var self=this;
  8156. var o;
  8157. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8158. return smalltalk.withContext(function($ctx1) {
  8159. var $1,$2,$4,$3;
  8160. o=_st($Object())._new();
  8161. $ctx1.sendIdx["new"]=1;
  8162. $1=_st(o).__eq_eq(_st($Object())._new());
  8163. $ctx1.sendIdx["=="]=1;
  8164. self._deny_($1);
  8165. $2=_st(o).__eq_eq(o);
  8166. $ctx1.sendIdx["=="]=2;
  8167. self._assert_($2);
  8168. $ctx1.sendIdx["assert:"]=1;
  8169. $4=_st(o)._yourself();
  8170. $ctx1.sendIdx["yourself"]=1;
  8171. $3=_st($4).__eq_eq(o);
  8172. $ctx1.sendIdx["=="]=3;
  8173. self._assert_($3);
  8174. $ctx1.sendIdx["assert:"]=2;
  8175. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  8176. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)});
  8177. },
  8178. args: [],
  8179. 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",
  8180. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  8181. referencedClasses: ["Object"]
  8182. }),
  8183. globals.ObjectTest);
  8184. smalltalk.addMethod(
  8185. smalltalk.method({
  8186. selector: "testIfNil",
  8187. protocol: 'tests',
  8188. fn: function (){
  8189. var self=this;
  8190. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8191. return smalltalk.withContext(function($ctx1) {
  8192. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  8193. $2=_st($Object())._new();
  8194. $ctx1.sendIdx["new"]=1;
  8195. $1=_st($2)._isNil();
  8196. self._deny_($1);
  8197. $ctx1.sendIdx["deny:"]=1;
  8198. $5=_st($Object())._new();
  8199. $ctx1.sendIdx["new"]=2;
  8200. if(($receiver = $5) == null || $receiver.isNil){
  8201. $4=true;
  8202. } else {
  8203. $4=$5;
  8204. };
  8205. $3=_st($4).__eq(true);
  8206. self._deny_($3);
  8207. $7=_st($Object())._new();
  8208. $ctx1.sendIdx["new"]=3;
  8209. if(($receiver = $7) == null || $receiver.isNil){
  8210. $6=$7;
  8211. } else {
  8212. $6=true;
  8213. };
  8214. self._assert_equals_($6,true);
  8215. $ctx1.sendIdx["assert:equals:"]=1;
  8216. $9=_st($Object())._new();
  8217. $ctx1.sendIdx["new"]=4;
  8218. if(($receiver = $9) == null || $receiver.isNil){
  8219. $8=false;
  8220. } else {
  8221. $8=true;
  8222. };
  8223. self._assert_equals_($8,true);
  8224. $ctx1.sendIdx["assert:equals:"]=2;
  8225. $11=_st($Object())._new();
  8226. if(($receiver = $11) == null || $receiver.isNil){
  8227. $10=false;
  8228. } else {
  8229. $10=true;
  8230. };
  8231. self._assert_equals_($10,true);
  8232. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)});
  8233. },
  8234. args: [],
  8235. 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",
  8236. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8237. referencedClasses: ["Object"]
  8238. }),
  8239. globals.ObjectTest);
  8240. smalltalk.addMethod(
  8241. smalltalk.method({
  8242. selector: "testInstVars",
  8243. protocol: 'tests',
  8244. fn: function (){
  8245. var self=this;
  8246. var o;
  8247. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  8248. return smalltalk.withContext(function($ctx1) {
  8249. var $1,$2;
  8250. o=_st($ObjectMock())._new();
  8251. $1=_st(o)._instVarAt_("foo");
  8252. $ctx1.sendIdx["instVarAt:"]=1;
  8253. self._assert_equals_($1,nil);
  8254. $ctx1.sendIdx["assert:equals:"]=1;
  8255. _st(o)._instVarAt_put_("foo",(1));
  8256. $2=_st(o)._instVarAt_("foo");
  8257. $ctx1.sendIdx["instVarAt:"]=2;
  8258. self._assert_equals_($2,(1));
  8259. $ctx1.sendIdx["assert:equals:"]=2;
  8260. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  8261. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)});
  8262. },
  8263. args: [],
  8264. 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",
  8265. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  8266. referencedClasses: ["ObjectMock"]
  8267. }),
  8268. globals.ObjectTest);
  8269. smalltalk.addMethod(
  8270. smalltalk.method({
  8271. selector: "testNilUndefined",
  8272. protocol: 'tests',
  8273. fn: function (){
  8274. var self=this;
  8275. return smalltalk.withContext(function($ctx1) {
  8276. self._assert_equals_(self._notDefined(),nil);
  8277. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)});
  8278. },
  8279. args: [],
  8280. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  8281. messageSends: ["assert:equals:", "notDefined"],
  8282. referencedClasses: []
  8283. }),
  8284. globals.ObjectTest);
  8285. smalltalk.addMethod(
  8286. smalltalk.method({
  8287. selector: "testYourself",
  8288. protocol: 'tests',
  8289. fn: function (){
  8290. var self=this;
  8291. var o;
  8292. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  8293. return smalltalk.withContext(function($ctx1) {
  8294. o=_st($ObjectMock())._new();
  8295. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  8296. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)});
  8297. },
  8298. args: [],
  8299. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  8300. messageSends: ["new", "assert:", "==", "yourself"],
  8301. referencedClasses: ["ObjectMock"]
  8302. }),
  8303. globals.ObjectTest);
  8304. smalltalk.addMethod(
  8305. smalltalk.method({
  8306. selector: "testidentityHash",
  8307. protocol: 'tests',
  8308. fn: function (){
  8309. var self=this;
  8310. var o1,o2;
  8311. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8312. return smalltalk.withContext(function($ctx1) {
  8313. var $2,$3,$1,$5,$4;
  8314. o1=_st($Object())._new();
  8315. $ctx1.sendIdx["new"]=1;
  8316. o2=_st($Object())._new();
  8317. $2=_st(o1)._identityHash();
  8318. $ctx1.sendIdx["identityHash"]=1;
  8319. $3=_st(o1)._identityHash();
  8320. $ctx1.sendIdx["identityHash"]=2;
  8321. $1=_st($2).__eq_eq($3);
  8322. $ctx1.sendIdx["=="]=1;
  8323. self._assert_($1);
  8324. $5=_st(o1)._identityHash();
  8325. $ctx1.sendIdx["identityHash"]=3;
  8326. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  8327. self._deny_($4);
  8328. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)});
  8329. },
  8330. args: [],
  8331. 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",
  8332. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  8333. referencedClasses: ["Object"]
  8334. }),
  8335. globals.ObjectTest);
  8336. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  8337. smalltalk.addMethod(
  8338. smalltalk.method({
  8339. selector: "testAccessing",
  8340. protocol: 'tests',
  8341. fn: function (){
  8342. var self=this;
  8343. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8344. return smalltalk.withContext(function($ctx1) {
  8345. var $2,$1,$3,$6,$5,$4;
  8346. $2=_st($Point())._x_y_((3),(4));
  8347. $ctx1.sendIdx["x:y:"]=1;
  8348. $1=_st($2)._x();
  8349. $ctx1.sendIdx["x"]=1;
  8350. self._assert_equals_($1,(3));
  8351. $ctx1.sendIdx["assert:equals:"]=1;
  8352. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  8353. $ctx1.sendIdx["y"]=1;
  8354. self._assert_equals_($3,(4));
  8355. $ctx1.sendIdx["assert:equals:"]=2;
  8356. $6=_st($Point())._new();
  8357. $ctx1.sendIdx["new"]=1;
  8358. $5=_st($6)._x_((3));
  8359. $4=_st($5)._x();
  8360. self._assert_equals_($4,(3));
  8361. $ctx1.sendIdx["assert:equals:"]=3;
  8362. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  8363. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)});
  8364. },
  8365. args: [],
  8366. 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",
  8367. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  8368. referencedClasses: ["Point"]
  8369. }),
  8370. globals.PointTest);
  8371. smalltalk.addMethod(
  8372. smalltalk.method({
  8373. selector: "testArithmetic",
  8374. protocol: 'tests',
  8375. fn: function (){
  8376. var self=this;
  8377. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8378. return smalltalk.withContext(function($ctx1) {
  8379. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  8380. $2=(3).__at((4));
  8381. $ctx1.sendIdx["@"]=1;
  8382. $3=(3).__at((4));
  8383. $ctx1.sendIdx["@"]=2;
  8384. $1=_st($2).__star($3);
  8385. $4=_st($Point())._x_y_((9),(16));
  8386. $ctx1.sendIdx["x:y:"]=1;
  8387. self._assert_equals_($1,$4);
  8388. $ctx1.sendIdx["assert:equals:"]=1;
  8389. $6=(3).__at((4));
  8390. $ctx1.sendIdx["@"]=3;
  8391. $7=(3).__at((4));
  8392. $ctx1.sendIdx["@"]=4;
  8393. $5=_st($6).__plus($7);
  8394. $8=_st($Point())._x_y_((6),(8));
  8395. $ctx1.sendIdx["x:y:"]=2;
  8396. self._assert_equals_($5,$8);
  8397. $ctx1.sendIdx["assert:equals:"]=2;
  8398. $10=(3).__at((4));
  8399. $ctx1.sendIdx["@"]=5;
  8400. $11=(3).__at((4));
  8401. $ctx1.sendIdx["@"]=6;
  8402. $9=_st($10).__minus($11);
  8403. $12=_st($Point())._x_y_((0),(0));
  8404. $ctx1.sendIdx["x:y:"]=3;
  8405. self._assert_equals_($9,$12);
  8406. $ctx1.sendIdx["assert:equals:"]=3;
  8407. $14=(6).__at((8));
  8408. $ctx1.sendIdx["@"]=7;
  8409. $13=_st($14).__slash((3).__at((4)));
  8410. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  8411. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)});
  8412. },
  8413. args: [],
  8414. 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)",
  8415. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  8416. referencedClasses: ["Point"]
  8417. }),
  8418. globals.PointTest);
  8419. smalltalk.addMethod(
  8420. smalltalk.method({
  8421. selector: "testAt",
  8422. protocol: 'tests',
  8423. fn: function (){
  8424. var self=this;
  8425. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8426. return smalltalk.withContext(function($ctx1) {
  8427. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  8428. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)});
  8429. },
  8430. args: [],
  8431. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  8432. messageSends: ["assert:equals:", "@", "x:y:"],
  8433. referencedClasses: ["Point"]
  8434. }),
  8435. globals.PointTest);
  8436. smalltalk.addMethod(
  8437. smalltalk.method({
  8438. selector: "testComparison",
  8439. protocol: 'tests',
  8440. fn: function (){
  8441. var self=this;
  8442. return smalltalk.withContext(function($ctx1) {
  8443. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  8444. $2=(3).__at((4));
  8445. $ctx1.sendIdx["@"]=1;
  8446. $3=(4).__at((5));
  8447. $ctx1.sendIdx["@"]=2;
  8448. $1=_st($2).__lt($3);
  8449. $ctx1.sendIdx["<"]=1;
  8450. self._assert_($1);
  8451. $ctx1.sendIdx["assert:"]=1;
  8452. $5=(3).__at((4));
  8453. $ctx1.sendIdx["@"]=3;
  8454. $6=(4).__at((4));
  8455. $ctx1.sendIdx["@"]=4;
  8456. $4=_st($5).__lt($6);
  8457. self._deny_($4);
  8458. $ctx1.sendIdx["deny:"]=1;
  8459. $8=(4).__at((5));
  8460. $ctx1.sendIdx["@"]=5;
  8461. $9=(4).__at((5));
  8462. $ctx1.sendIdx["@"]=6;
  8463. $7=_st($8).__lt_eq($9);
  8464. $ctx1.sendIdx["<="]=1;
  8465. self._assert_($7);
  8466. $ctx1.sendIdx["assert:"]=2;
  8467. $11=(4).__at((5));
  8468. $ctx1.sendIdx["@"]=7;
  8469. $12=(3).__at((5));
  8470. $ctx1.sendIdx["@"]=8;
  8471. $10=_st($11).__lt_eq($12);
  8472. self._deny_($10);
  8473. $ctx1.sendIdx["deny:"]=2;
  8474. $14=(5).__at((6));
  8475. $ctx1.sendIdx["@"]=9;
  8476. $15=(4).__at((5));
  8477. $ctx1.sendIdx["@"]=10;
  8478. $13=_st($14).__gt($15);
  8479. $ctx1.sendIdx[">"]=1;
  8480. self._assert_($13);
  8481. $ctx1.sendIdx["assert:"]=3;
  8482. $17=(5).__at((6));
  8483. $ctx1.sendIdx["@"]=11;
  8484. $18=(6).__at((6));
  8485. $ctx1.sendIdx["@"]=12;
  8486. $16=_st($17).__gt($18);
  8487. self._deny_($16);
  8488. $ctx1.sendIdx["deny:"]=3;
  8489. $20=(4).__at((5));
  8490. $ctx1.sendIdx["@"]=13;
  8491. $21=(4).__at((5));
  8492. $ctx1.sendIdx["@"]=14;
  8493. $19=_st($20).__gt_eq($21);
  8494. $ctx1.sendIdx[">="]=1;
  8495. self._assert_($19);
  8496. $23=(4).__at((5));
  8497. $ctx1.sendIdx["@"]=15;
  8498. $22=_st($23).__gt_eq((5).__at((5)));
  8499. self._deny_($22);
  8500. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)});
  8501. },
  8502. args: [],
  8503. 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)",
  8504. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  8505. referencedClasses: []
  8506. }),
  8507. globals.PointTest);
  8508. smalltalk.addMethod(
  8509. smalltalk.method({
  8510. selector: "testEgality",
  8511. protocol: 'tests',
  8512. fn: function (){
  8513. var self=this;
  8514. return smalltalk.withContext(function($ctx1) {
  8515. var $2,$3,$1,$5,$4;
  8516. $2=(3).__at((4));
  8517. $ctx1.sendIdx["@"]=1;
  8518. $3=(3).__at((4));
  8519. $ctx1.sendIdx["@"]=2;
  8520. $1=_st($2).__eq($3);
  8521. $ctx1.sendIdx["="]=1;
  8522. self._assert_($1);
  8523. $5=(3).__at((5));
  8524. $ctx1.sendIdx["@"]=3;
  8525. $4=_st($5).__eq((3).__at((6)));
  8526. self._deny_($4);
  8527. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)});
  8528. },
  8529. args: [],
  8530. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  8531. messageSends: ["assert:", "=", "@", "deny:"],
  8532. referencedClasses: []
  8533. }),
  8534. globals.PointTest);
  8535. smalltalk.addMethod(
  8536. smalltalk.method({
  8537. selector: "testNew",
  8538. protocol: 'tests',
  8539. fn: function (){
  8540. var self=this;
  8541. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8542. return smalltalk.withContext(function($ctx1) {
  8543. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  8544. $3=_st($Point())._new();
  8545. $ctx1.sendIdx["new"]=1;
  8546. $2=_st($3)._x_((3));
  8547. $ctx1.sendIdx["x:"]=1;
  8548. $1=_st($2)._y();
  8549. $ctx1.sendIdx["y"]=1;
  8550. self._assert_equals_($1,nil);
  8551. $ctx1.sendIdx["assert:equals:"]=1;
  8552. $7=_st($Point())._new();
  8553. $ctx1.sendIdx["new"]=2;
  8554. $6=_st($7)._x_((3));
  8555. $5=_st($6)._x();
  8556. $ctx1.sendIdx["x"]=1;
  8557. $4=_st($5).__eq((0));
  8558. $ctx1.sendIdx["="]=1;
  8559. self._deny_($4);
  8560. $ctx1.sendIdx["deny:"]=1;
  8561. $10=_st($Point())._new();
  8562. $ctx1.sendIdx["new"]=3;
  8563. $9=_st($10)._y_((4));
  8564. $ctx1.sendIdx["y:"]=1;
  8565. $8=_st($9)._x();
  8566. self._assert_equals_($8,nil);
  8567. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  8568. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)});
  8569. },
  8570. args: [],
  8571. 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",
  8572. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  8573. referencedClasses: ["Point"]
  8574. }),
  8575. globals.PointTest);
  8576. smalltalk.addMethod(
  8577. smalltalk.method({
  8578. selector: "testTranslateBy",
  8579. protocol: 'tests',
  8580. fn: function (){
  8581. var self=this;
  8582. return smalltalk.withContext(function($ctx1) {
  8583. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  8584. $2=(3).__at((3));
  8585. $ctx1.sendIdx["@"]=1;
  8586. $3=(0).__at((1));
  8587. $ctx1.sendIdx["@"]=2;
  8588. $1=_st($2)._translateBy_($3);
  8589. $ctx1.sendIdx["translateBy:"]=1;
  8590. $4=(3).__at((4));
  8591. $ctx1.sendIdx["@"]=3;
  8592. self._assert_equals_($1,$4);
  8593. $ctx1.sendIdx["assert:equals:"]=1;
  8594. $6=(3).__at((3));
  8595. $ctx1.sendIdx["@"]=4;
  8596. $8=(1)._negated();
  8597. $ctx1.sendIdx["negated"]=1;
  8598. $7=(0).__at($8);
  8599. $ctx1.sendIdx["@"]=5;
  8600. $5=_st($6)._translateBy_($7);
  8601. $ctx1.sendIdx["translateBy:"]=2;
  8602. $9=(3).__at((2));
  8603. $ctx1.sendIdx["@"]=6;
  8604. self._assert_equals_($5,$9);
  8605. $ctx1.sendIdx["assert:equals:"]=2;
  8606. $11=(3).__at((3));
  8607. $ctx1.sendIdx["@"]=7;
  8608. $12=(2).__at((3));
  8609. $ctx1.sendIdx["@"]=8;
  8610. $10=_st($11)._translateBy_($12);
  8611. $ctx1.sendIdx["translateBy:"]=3;
  8612. $13=(5).__at((6));
  8613. $ctx1.sendIdx["@"]=9;
  8614. self._assert_equals_($10,$13);
  8615. $ctx1.sendIdx["assert:equals:"]=3;
  8616. $15=(3).__at((3));
  8617. $ctx1.sendIdx["@"]=10;
  8618. $16=_st((3)._negated()).__at((0));
  8619. $ctx1.sendIdx["@"]=11;
  8620. $14=_st($15)._translateBy_($16);
  8621. self._assert_equals_($14,(0).__at((3)));
  8622. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)});
  8623. },
  8624. args: [],
  8625. 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.",
  8626. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  8627. referencedClasses: []
  8628. }),
  8629. globals.PointTest);
  8630. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  8631. smalltalk.addMethod(
  8632. smalltalk.method({
  8633. selector: "testNextIfAbsent",
  8634. protocol: 'tests',
  8635. fn: function (){
  8636. var self=this;
  8637. var queue;
  8638. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8639. return smalltalk.withContext(function($ctx1) {
  8640. var $2,$1;
  8641. queue=_st($Queue())._new();
  8642. _st(queue)._nextPut_("index1");
  8643. $2=_st(queue)._nextIfAbsent_("empty");
  8644. $ctx1.sendIdx["nextIfAbsent:"]=1;
  8645. $1=_st($2).__eq("index1");
  8646. $ctx1.sendIdx["="]=1;
  8647. self._assert_($1);
  8648. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  8649. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)});
  8650. },
  8651. args: [],
  8652. 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'",
  8653. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  8654. referencedClasses: ["Queue"]
  8655. }),
  8656. globals.QueueTest);
  8657. smalltalk.addMethod(
  8658. smalltalk.method({
  8659. selector: "testQueueNext",
  8660. protocol: 'tests',
  8661. fn: function (){
  8662. var self=this;
  8663. var queue;
  8664. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8665. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8666. return smalltalk.withContext(function($ctx1) {
  8667. var $1,$2,$4,$3,$6,$5;
  8668. queue=_st($Queue())._new();
  8669. $1=queue;
  8670. _st($1)._nextPut_("index1");
  8671. $ctx1.sendIdx["nextPut:"]=1;
  8672. $2=_st($1)._nextPut_("index2");
  8673. $4=_st(queue)._next();
  8674. $ctx1.sendIdx["next"]=1;
  8675. $3=_st($4).__eq("index1");
  8676. $ctx1.sendIdx["="]=1;
  8677. self._assert_($3);
  8678. $6=_st(queue)._next();
  8679. $ctx1.sendIdx["next"]=2;
  8680. $5=_st($6).__eq("index");
  8681. self._deny_($5);
  8682. self._should_raise_((function(){
  8683. return smalltalk.withContext(function($ctx2) {
  8684. return _st(queue)._next();
  8685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8686. }),$Error());
  8687. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)});
  8688. },
  8689. args: [],
  8690. 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",
  8691. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8692. referencedClasses: ["Queue", "Error"]
  8693. }),
  8694. globals.QueueTest);
  8695. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8696. smalltalk.addMethod(
  8697. smalltalk.method({
  8698. selector: "testAtRandomNumber",
  8699. protocol: 'tests',
  8700. fn: function (){
  8701. var self=this;
  8702. var val;
  8703. return smalltalk.withContext(function($ctx1) {
  8704. (100)._timesRepeat_((function(){
  8705. return smalltalk.withContext(function($ctx2) {
  8706. val=(10)._atRandom();
  8707. val;
  8708. self._assert_(_st(val).__gt((0)));
  8709. $ctx2.sendIdx["assert:"]=1;
  8710. return self._assert_(_st(val).__lt((11)));
  8711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8712. }));
  8713. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)});
  8714. },
  8715. args: [],
  8716. 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]",
  8717. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8718. referencedClasses: []
  8719. }),
  8720. globals.RandomTest);
  8721. smalltalk.addMethod(
  8722. smalltalk.method({
  8723. selector: "testAtRandomSequenceableCollection",
  8724. protocol: 'tests',
  8725. fn: function (){
  8726. var self=this;
  8727. var val;
  8728. return smalltalk.withContext(function($ctx1) {
  8729. var $3,$4,$2,$1;
  8730. (100)._timesRepeat_((function(){
  8731. return smalltalk.withContext(function($ctx2) {
  8732. val="abc"._atRandom();
  8733. val;
  8734. $3=_st(val).__eq("a");
  8735. $ctx2.sendIdx["="]=1;
  8736. $4=_st(val).__eq("b");
  8737. $ctx2.sendIdx["="]=2;
  8738. $2=_st($3).__or($4);
  8739. $1=_st($2).__or(_st(val).__eq("c"));
  8740. $ctx2.sendIdx["|"]=1;
  8741. return self._assert_($1);
  8742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8743. }));
  8744. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)});
  8745. },
  8746. args: [],
  8747. 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].",
  8748. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8749. referencedClasses: []
  8750. }),
  8751. globals.RandomTest);
  8752. smalltalk.addMethod(
  8753. smalltalk.method({
  8754. selector: "textNext",
  8755. protocol: 'tests',
  8756. fn: function (){
  8757. var self=this;
  8758. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8759. return smalltalk.withContext(function($ctx1) {
  8760. var $1;
  8761. (10000)._timesRepeat_((function(){
  8762. var current,next;
  8763. return smalltalk.withContext(function($ctx2) {
  8764. next=_st(_st($Random())._new())._next();
  8765. next;
  8766. self._assert_(_st(next).__gt_eq((0)));
  8767. $ctx2.sendIdx["assert:"]=1;
  8768. self._assert_(_st(next).__lt((1)));
  8769. $1=_st(current).__eq(next);
  8770. $ctx2.sendIdx["="]=1;
  8771. self._deny_($1);
  8772. return _st(next).__eq(current);
  8773. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  8774. }));
  8775. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)});
  8776. },
  8777. args: [],
  8778. 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 ]",
  8779. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8780. referencedClasses: ["Random"]
  8781. }),
  8782. globals.RandomTest);
  8783. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8784. smalltalk.addMethod(
  8785. smalltalk.method({
  8786. selector: "collectionClass",
  8787. protocol: 'accessing',
  8788. fn: function (){
  8789. var self=this;
  8790. return smalltalk.withContext(function($ctx1) {
  8791. var $1;
  8792. $1=_st(self._class())._collectionClass();
  8793. return $1;
  8794. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)});
  8795. },
  8796. args: [],
  8797. source: "collectionClass\x0a\x09^ self class collectionClass",
  8798. messageSends: ["collectionClass", "class"],
  8799. referencedClasses: []
  8800. }),
  8801. globals.StreamTest);
  8802. smalltalk.addMethod(
  8803. smalltalk.method({
  8804. selector: "newCollection",
  8805. protocol: 'accessing',
  8806. fn: function (){
  8807. var self=this;
  8808. return smalltalk.withContext(function($ctx1) {
  8809. var $1;
  8810. $1=_st(self._collectionClass())._new();
  8811. return $1;
  8812. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)});
  8813. },
  8814. args: [],
  8815. source: "newCollection\x0a\x09^ self collectionClass new",
  8816. messageSends: ["new", "collectionClass"],
  8817. referencedClasses: []
  8818. }),
  8819. globals.StreamTest);
  8820. smalltalk.addMethod(
  8821. smalltalk.method({
  8822. selector: "newStream",
  8823. protocol: 'accessing',
  8824. fn: function (){
  8825. var self=this;
  8826. return smalltalk.withContext(function($ctx1) {
  8827. var $1;
  8828. $1=_st(_st(self._collectionClass())._new())._stream();
  8829. return $1;
  8830. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)});
  8831. },
  8832. args: [],
  8833. source: "newStream\x0a\x09^ self collectionClass new stream",
  8834. messageSends: ["stream", "new", "collectionClass"],
  8835. referencedClasses: []
  8836. }),
  8837. globals.StreamTest);
  8838. smalltalk.addMethod(
  8839. smalltalk.method({
  8840. selector: "testAtStartAtEnd",
  8841. protocol: 'tests',
  8842. fn: function (){
  8843. var self=this;
  8844. var stream;
  8845. return smalltalk.withContext(function($ctx1) {
  8846. var $1,$2,$3,$4;
  8847. stream=self._newStream();
  8848. $1=_st(stream)._atStart();
  8849. $ctx1.sendIdx["atStart"]=1;
  8850. self._assert_($1);
  8851. $ctx1.sendIdx["assert:"]=1;
  8852. $2=_st(stream)._atEnd();
  8853. $ctx1.sendIdx["atEnd"]=1;
  8854. self._assert_($2);
  8855. $ctx1.sendIdx["assert:"]=2;
  8856. _st(stream)._nextPutAll_(self._newCollection());
  8857. $3=_st(stream)._atEnd();
  8858. $ctx1.sendIdx["atEnd"]=2;
  8859. self._assert_($3);
  8860. $4=_st(stream)._atStart();
  8861. $ctx1.sendIdx["atStart"]=2;
  8862. self._deny_($4);
  8863. $ctx1.sendIdx["deny:"]=1;
  8864. _st(stream)._position_((1));
  8865. self._deny_(_st(stream)._atEnd());
  8866. $ctx1.sendIdx["deny:"]=2;
  8867. self._deny_(_st(stream)._atStart());
  8868. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)});
  8869. },
  8870. args: [],
  8871. 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",
  8872. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8873. referencedClasses: []
  8874. }),
  8875. globals.StreamTest);
  8876. smalltalk.addMethod(
  8877. smalltalk.method({
  8878. selector: "testContents",
  8879. protocol: 'tests',
  8880. fn: function (){
  8881. var self=this;
  8882. var stream;
  8883. return smalltalk.withContext(function($ctx1) {
  8884. var $1,$2;
  8885. stream=self._newStream();
  8886. $1=stream;
  8887. $2=self._newCollection();
  8888. $ctx1.sendIdx["newCollection"]=1;
  8889. _st($1)._nextPutAll_($2);
  8890. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8891. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)});
  8892. },
  8893. args: [],
  8894. 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",
  8895. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8896. referencedClasses: []
  8897. }),
  8898. globals.StreamTest);
  8899. smalltalk.addMethod(
  8900. smalltalk.method({
  8901. selector: "testIsEmpty",
  8902. protocol: 'tests',
  8903. fn: function (){
  8904. var self=this;
  8905. var stream;
  8906. return smalltalk.withContext(function($ctx1) {
  8907. var $1;
  8908. stream=self._newStream();
  8909. $1=_st(stream)._isEmpty();
  8910. $ctx1.sendIdx["isEmpty"]=1;
  8911. self._assert_($1);
  8912. _st(stream)._nextPutAll_(self._newCollection());
  8913. self._deny_(_st(stream)._isEmpty());
  8914. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)});
  8915. },
  8916. args: [],
  8917. 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",
  8918. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8919. referencedClasses: []
  8920. }),
  8921. globals.StreamTest);
  8922. smalltalk.addMethod(
  8923. smalltalk.method({
  8924. selector: "testPosition",
  8925. protocol: 'tests',
  8926. fn: function (){
  8927. var self=this;
  8928. var collection,stream;
  8929. return smalltalk.withContext(function($ctx1) {
  8930. var $1,$2,$3;
  8931. collection=self._newCollection();
  8932. stream=self._newStream();
  8933. _st(stream)._nextPutAll_(collection);
  8934. $1=_st(stream)._position();
  8935. $ctx1.sendIdx["position"]=1;
  8936. self._assert_equals_($1,_st(collection)._size());
  8937. $ctx1.sendIdx["assert:equals:"]=1;
  8938. _st(stream)._position_((0));
  8939. $2=_st(stream)._position();
  8940. $ctx1.sendIdx["position"]=2;
  8941. self._assert_equals_($2,(0));
  8942. $ctx1.sendIdx["assert:equals:"]=2;
  8943. _st(stream)._next();
  8944. $ctx1.sendIdx["next"]=1;
  8945. $3=_st(stream)._position();
  8946. $ctx1.sendIdx["position"]=3;
  8947. self._assert_equals_($3,(1));
  8948. $ctx1.sendIdx["assert:equals:"]=3;
  8949. _st(stream)._next();
  8950. self._assert_equals_(_st(stream)._position(),(2));
  8951. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)});
  8952. },
  8953. args: [],
  8954. 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",
  8955. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8956. referencedClasses: []
  8957. }),
  8958. globals.StreamTest);
  8959. smalltalk.addMethod(
  8960. smalltalk.method({
  8961. selector: "testReading",
  8962. protocol: 'tests',
  8963. fn: function (){
  8964. var self=this;
  8965. var stream,collection;
  8966. return smalltalk.withContext(function($ctx1) {
  8967. var $1,$2,$3;
  8968. collection=self._newCollection();
  8969. stream=self._newStream();
  8970. $1=stream;
  8971. _st($1)._nextPutAll_(collection);
  8972. $2=_st($1)._position_((0));
  8973. _st(collection)._do_((function(each){
  8974. return smalltalk.withContext(function($ctx2) {
  8975. $3=_st(stream)._next();
  8976. $ctx2.sendIdx["next"]=1;
  8977. return self._assert_equals_($3,each);
  8978. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8979. }));
  8980. self._assert_(_st(_st(stream)._next())._isNil());
  8981. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)});
  8982. },
  8983. args: [],
  8984. 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",
  8985. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8986. referencedClasses: []
  8987. }),
  8988. globals.StreamTest);
  8989. smalltalk.addMethod(
  8990. smalltalk.method({
  8991. selector: "testStreamContents",
  8992. protocol: 'tests',
  8993. fn: function (){
  8994. var self=this;
  8995. return self
  8996. },
  8997. args: [],
  8998. source: "testStreamContents",
  8999. messageSends: [],
  9000. referencedClasses: []
  9001. }),
  9002. globals.StreamTest);
  9003. smalltalk.addMethod(
  9004. smalltalk.method({
  9005. selector: "testWrite",
  9006. protocol: 'tests',
  9007. fn: function (){
  9008. var self=this;
  9009. var stream,collection;
  9010. return smalltalk.withContext(function($ctx1) {
  9011. collection=self._newCollection();
  9012. stream=self._newStream();
  9013. _st(collection)._do_((function(each){
  9014. return smalltalk.withContext(function($ctx2) {
  9015. return _st(stream).__lt_lt(each);
  9016. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9017. }));
  9018. self._assert_equals_(_st(stream)._contents(),collection);
  9019. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)});
  9020. },
  9021. args: [],
  9022. 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",
  9023. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  9024. referencedClasses: []
  9025. }),
  9026. globals.StreamTest);
  9027. smalltalk.addMethod(
  9028. smalltalk.method({
  9029. selector: "testWriting",
  9030. protocol: 'tests',
  9031. fn: function (){
  9032. var self=this;
  9033. var stream,collection;
  9034. return smalltalk.withContext(function($ctx1) {
  9035. var $1;
  9036. collection=self._newCollection();
  9037. stream=self._newStream();
  9038. $ctx1.sendIdx["newStream"]=1;
  9039. _st(collection)._do_((function(each){
  9040. return smalltalk.withContext(function($ctx2) {
  9041. return _st(stream)._nextPut_(each);
  9042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9043. }));
  9044. $1=_st(stream)._contents();
  9045. $ctx1.sendIdx["contents"]=1;
  9046. self._assert_equals_($1,collection);
  9047. $ctx1.sendIdx["assert:equals:"]=1;
  9048. stream=self._newStream();
  9049. _st(stream)._nextPutAll_(collection);
  9050. self._assert_equals_(_st(stream)._contents(),collection);
  9051. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)});
  9052. },
  9053. args: [],
  9054. 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",
  9055. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  9056. referencedClasses: []
  9057. }),
  9058. globals.StreamTest);
  9059. smalltalk.addMethod(
  9060. smalltalk.method({
  9061. selector: "collectionClass",
  9062. protocol: 'accessing',
  9063. fn: function (){
  9064. var self=this;
  9065. return nil;
  9066. },
  9067. args: [],
  9068. source: "collectionClass\x0a\x09^ nil",
  9069. messageSends: [],
  9070. referencedClasses: []
  9071. }),
  9072. globals.StreamTest.klass);
  9073. smalltalk.addMethod(
  9074. smalltalk.method({
  9075. selector: "isAbstract",
  9076. protocol: 'testing',
  9077. fn: function (){
  9078. var self=this;
  9079. return smalltalk.withContext(function($ctx1) {
  9080. var $1;
  9081. $1=_st(self._collectionClass())._isNil();
  9082. return $1;
  9083. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)});
  9084. },
  9085. args: [],
  9086. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  9087. messageSends: ["isNil", "collectionClass"],
  9088. referencedClasses: []
  9089. }),
  9090. globals.StreamTest.klass);
  9091. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  9092. smalltalk.addMethod(
  9093. smalltalk.method({
  9094. selector: "newCollection",
  9095. protocol: 'accessing',
  9096. fn: function (){
  9097. var self=this;
  9098. return smalltalk.withContext(function($ctx1) {
  9099. var $1;
  9100. $1=[true,(1),(3).__at((4)),"foo"];
  9101. return $1;
  9102. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)});
  9103. },
  9104. args: [],
  9105. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  9106. messageSends: ["@"],
  9107. referencedClasses: []
  9108. }),
  9109. globals.ArrayStreamTest);
  9110. smalltalk.addMethod(
  9111. smalltalk.method({
  9112. selector: "collectionClass",
  9113. protocol: 'accessing',
  9114. fn: function (){
  9115. var self=this;
  9116. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  9117. return $Array();
  9118. },
  9119. args: [],
  9120. source: "collectionClass\x0a\x09^ Array",
  9121. messageSends: [],
  9122. referencedClasses: ["Array"]
  9123. }),
  9124. globals.ArrayStreamTest.klass);
  9125. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  9126. smalltalk.addMethod(
  9127. smalltalk.method({
  9128. selector: "newCollection",
  9129. protocol: 'accessing',
  9130. fn: function (){
  9131. var self=this;
  9132. return "hello world";
  9133. },
  9134. args: [],
  9135. source: "newCollection\x0a\x09^ 'hello world'",
  9136. messageSends: [],
  9137. referencedClasses: []
  9138. }),
  9139. globals.StringStreamTest);
  9140. smalltalk.addMethod(
  9141. smalltalk.method({
  9142. selector: "collectionClass",
  9143. protocol: 'accessing',
  9144. fn: function (){
  9145. var self=this;
  9146. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  9147. return $String();
  9148. },
  9149. args: [],
  9150. source: "collectionClass\x0a\x09^ String",
  9151. messageSends: [],
  9152. referencedClasses: ["String"]
  9153. }),
  9154. globals.StringStreamTest.klass);
  9155. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  9156. smalltalk.addMethod(
  9157. smalltalk.method({
  9158. selector: "testCopying",
  9159. protocol: 'tests',
  9160. fn: function (){
  9161. var self=this;
  9162. return smalltalk.withContext(function($ctx1) {
  9163. self._assert_equals_(nil._copy(),nil);
  9164. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)});
  9165. },
  9166. args: [],
  9167. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  9168. messageSends: ["assert:equals:", "copy"],
  9169. referencedClasses: []
  9170. }),
  9171. globals.UndefinedTest);
  9172. smalltalk.addMethod(
  9173. smalltalk.method({
  9174. selector: "testDeepCopy",
  9175. protocol: 'tests',
  9176. fn: function (){
  9177. var self=this;
  9178. return smalltalk.withContext(function($ctx1) {
  9179. self._assert_(_st(nil._deepCopy()).__eq(nil));
  9180. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)});
  9181. },
  9182. args: [],
  9183. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  9184. messageSends: ["assert:", "=", "deepCopy"],
  9185. referencedClasses: []
  9186. }),
  9187. globals.UndefinedTest);
  9188. smalltalk.addMethod(
  9189. smalltalk.method({
  9190. selector: "testIfNil",
  9191. protocol: 'tests',
  9192. fn: function (){
  9193. var self=this;
  9194. return smalltalk.withContext(function($ctx1) {
  9195. var $1,$3,$2,$4,$6,$5,$receiver;
  9196. if(($receiver = nil) == null || $receiver.isNil){
  9197. $1=true;
  9198. } else {
  9199. $1=nil;
  9200. };
  9201. self._assert_equals_($1,true);
  9202. $ctx1.sendIdx["assert:equals:"]=1;
  9203. if(($receiver = nil) == null || $receiver.isNil){
  9204. $3=nil;
  9205. } else {
  9206. $3=true;
  9207. };
  9208. $2=_st($3).__eq(true);
  9209. $ctx1.sendIdx["="]=1;
  9210. self._deny_($2);
  9211. $ctx1.sendIdx["deny:"]=1;
  9212. if(($receiver = nil) == null || $receiver.isNil){
  9213. $4=true;
  9214. } else {
  9215. $4=false;
  9216. };
  9217. self._assert_equals_($4,true);
  9218. if(($receiver = nil) == null || $receiver.isNil){
  9219. $6=false;
  9220. } else {
  9221. $6=true;
  9222. };
  9223. $5=_st($6).__eq(true);
  9224. self._deny_($5);
  9225. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)});
  9226. },
  9227. args: [],
  9228. 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",
  9229. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  9230. referencedClasses: []
  9231. }),
  9232. globals.UndefinedTest);
  9233. smalltalk.addMethod(
  9234. smalltalk.method({
  9235. selector: "testIsNil",
  9236. protocol: 'tests',
  9237. fn: function (){
  9238. var self=this;
  9239. return smalltalk.withContext(function($ctx1) {
  9240. self._assert_(nil._isNil());
  9241. self._deny_(nil._notNil());
  9242. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)});
  9243. },
  9244. args: [],
  9245. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  9246. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  9247. referencedClasses: []
  9248. }),
  9249. globals.UndefinedTest);
  9250. });