Kernel-Tests.js 328 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testAddExtensionMethod",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var method;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1,$4,$3,$2;
  14. $1=self._class();
  15. $ctx1.sendIdx["class"]=1;
  16. method=_st($1)._compile_protocol_("doNothing","**not-a-package");
  17. $4=self._class();
  18. $ctx1.sendIdx["class"]=2;
  19. $3=_st($4)._package();
  20. $2=_st($3)._isDirty();
  21. self._deny_($2);
  22. _st(self._class())._removeCompiledMethod_(method);
  23. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method},globals.AnnouncementSubscriptionTest)})},
  24. args: [],
  25. source: "testAddExtensionMethod\x0a\x09| method |\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09self class removeCompiledMethod: method.",
  26. messageSends: ["compile:protocol:", "class", "deny:", "isDirty", "package", "removeCompiledMethod:"],
  27. referencedClasses: []
  28. }),
  29. globals.AnnouncementSubscriptionTest);
  30. smalltalk.addMethod(
  31. smalltalk.method({
  32. selector: "testHandlesAnnouncement",
  33. protocol: 'tests',
  34. fn: function (){
  35. var self=this;
  36. var subscription,announcementClass1,announcementClass2,classBuilder;
  37. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  38. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  39. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  40. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  41. return smalltalk.withContext(function($ctx1) {
  42. var $1,$2;
  43. classBuilder=_st($ClassBuilder())._new();
  44. $ctx1.sendIdx["new"]=1;
  45. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  46. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  47. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  48. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  49. self._assert_equals_($1,true);
  50. $ctx1.sendIdx["assert:equals:"]=1;
  51. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  52. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  53. self._assert_equals_($2,true);
  54. $ctx1.sendIdx["assert:equals:"]=2;
  55. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  56. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  57. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  58. args: [],
  59. 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.",
  60. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  61. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  62. }),
  63. globals.AnnouncementSubscriptionTest);
  64. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  65. smalltalk.addMethod(
  66. smalltalk.method({
  67. selector: "testOnDo",
  68. protocol: 'tests',
  69. fn: function (){
  70. var self=this;
  71. var counter,announcer;
  72. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  73. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  74. return smalltalk.withContext(function($ctx1) {
  75. var $1,$2;
  76. counter=(0);
  77. announcer=_st($Announcer())._new();
  78. $ctx1.sendIdx["new"]=1;
  79. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  80. return smalltalk.withContext(function($ctx2) {
  81. counter=_st(counter).__plus((1));
  82. return counter;
  83. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  84. $1=announcer;
  85. $2=_st($SystemAnnouncement())._new();
  86. $ctx1.sendIdx["new"]=2;
  87. _st($1)._announce_($2);
  88. $ctx1.sendIdx["announce:"]=1;
  89. self._assert_equals_(counter,(1));
  90. $ctx1.sendIdx["assert:equals:"]=1;
  91. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  92. self._assert_equals_(counter,(2));
  93. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  94. args: [],
  95. 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.",
  96. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  97. referencedClasses: ["Announcer", "SystemAnnouncement"]
  98. }),
  99. globals.AnnouncerTest);
  100. smalltalk.addMethod(
  101. smalltalk.method({
  102. selector: "testOnDoFor",
  103. protocol: 'tests',
  104. fn: function (){
  105. var self=this;
  106. var counter,announcer;
  107. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  108. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  109. return smalltalk.withContext(function($ctx1) {
  110. var $1,$2,$3,$4;
  111. counter=(0);
  112. announcer=_st($Announcer())._new();
  113. $ctx1.sendIdx["new"]=1;
  114. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  115. return smalltalk.withContext(function($ctx2) {
  116. counter=_st(counter).__plus((1));
  117. return counter;
  118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  119. $1=announcer;
  120. $2=_st($SystemAnnouncement())._new();
  121. $ctx1.sendIdx["new"]=2;
  122. _st($1)._announce_($2);
  123. $ctx1.sendIdx["announce:"]=1;
  124. self._assert_equals_(counter,(1));
  125. $ctx1.sendIdx["assert:equals:"]=1;
  126. $3=announcer;
  127. $4=_st($SystemAnnouncement())._new();
  128. $ctx1.sendIdx["new"]=3;
  129. _st($3)._announce_($4);
  130. $ctx1.sendIdx["announce:"]=2;
  131. self._assert_equals_(counter,(2));
  132. $ctx1.sendIdx["assert:equals:"]=2;
  133. _st(announcer)._unsubscribe_(self);
  134. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  135. self._assert_equals_(counter,(2));
  136. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  137. args: [],
  138. 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.",
  139. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  140. referencedClasses: ["Announcer", "SystemAnnouncement"]
  141. }),
  142. globals.AnnouncerTest);
  143. smalltalk.addMethod(
  144. smalltalk.method({
  145. selector: "testOnDoOnce",
  146. protocol: 'tests',
  147. fn: function (){
  148. var self=this;
  149. var counter,announcer;
  150. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  151. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  152. return smalltalk.withContext(function($ctx1) {
  153. var $1,$2;
  154. counter=(0);
  155. announcer=_st($Announcer())._new();
  156. $ctx1.sendIdx["new"]=1;
  157. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  158. return smalltalk.withContext(function($ctx2) {
  159. counter=_st(counter).__plus((1));
  160. return counter;
  161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  162. $1=announcer;
  163. $2=_st($SystemAnnouncement())._new();
  164. $ctx1.sendIdx["new"]=2;
  165. _st($1)._announce_($2);
  166. $ctx1.sendIdx["announce:"]=1;
  167. self._assert_equals_(counter,(1));
  168. $ctx1.sendIdx["assert:equals:"]=1;
  169. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  170. self._assert_equals_(counter,(1));
  171. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  172. args: [],
  173. 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.",
  174. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  175. referencedClasses: ["Announcer", "SystemAnnouncement"]
  176. }),
  177. globals.AnnouncerTest);
  178. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  179. smalltalk.addMethod(
  180. smalltalk.method({
  181. selector: "testCanClearInterval",
  182. protocol: 'tests',
  183. fn: function (){
  184. var self=this;
  185. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  186. return smalltalk.withContext(function($ctx1) {
  187. self._shouldnt_raise_((function(){
  188. return smalltalk.withContext(function($ctx2) {
  189. return _st(_st((function(){
  190. return smalltalk.withContext(function($ctx3) {
  191. return _st(_st($Error())._new())._signal();
  192. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  194. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  195. args: [],
  196. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  197. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  198. referencedClasses: ["Error"]
  199. }),
  200. globals.BlockClosureTest);
  201. smalltalk.addMethod(
  202. smalltalk.method({
  203. selector: "testCanClearTimeout",
  204. protocol: 'tests',
  205. fn: function (){
  206. var self=this;
  207. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  208. return smalltalk.withContext(function($ctx1) {
  209. self._shouldnt_raise_((function(){
  210. return smalltalk.withContext(function($ctx2) {
  211. return _st(_st((function(){
  212. return smalltalk.withContext(function($ctx3) {
  213. return _st(_st($Error())._new())._signal();
  214. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  216. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  217. args: [],
  218. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  219. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  220. referencedClasses: ["Error"]
  221. }),
  222. globals.BlockClosureTest);
  223. smalltalk.addMethod(
  224. smalltalk.method({
  225. selector: "testCompiledSource",
  226. protocol: 'tests',
  227. fn: function (){
  228. var self=this;
  229. return smalltalk.withContext(function($ctx1) {
  230. self._assert_(_st(_st((function(){
  231. return smalltalk.withContext(function($ctx2) {
  232. return (1).__plus((1));
  233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  234. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  235. args: [],
  236. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  237. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  238. referencedClasses: []
  239. }),
  240. globals.BlockClosureTest);
  241. smalltalk.addMethod(
  242. smalltalk.method({
  243. selector: "testCurrySelf",
  244. protocol: 'tests',
  245. fn: function (){
  246. var self=this;
  247. var curriedMethod,array;
  248. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  249. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  250. return smalltalk.withContext(function($ctx1) {
  251. curriedMethod=_st(_st((function(selfarg,x){
  252. return smalltalk.withContext(function($ctx2) {
  253. return _st(selfarg)._at_(x);
  254. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  255. array=[(3), (1), (4)];
  256. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  257. _st((function(){
  258. return smalltalk.withContext(function($ctx2) {
  259. return self._assert_equals_(_st(array)._foo_((2)),(1));
  260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  261. return smalltalk.withContext(function($ctx2) {
  262. return _st($Array())._removeCompiledMethod_(curriedMethod);
  263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  264. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  265. args: [],
  266. 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 ]",
  267. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  268. referencedClasses: ["ClassBuilder", "Array"]
  269. }),
  270. globals.BlockClosureTest);
  271. smalltalk.addMethod(
  272. smalltalk.method({
  273. selector: "testEnsure",
  274. protocol: 'tests',
  275. fn: function (){
  276. var self=this;
  277. return smalltalk.withContext(function($ctx1) {
  278. self._assert_equals_(_st((function(){
  279. return (3);
  280. }))._ensure_((function(){
  281. return (4);
  282. })),(3));
  283. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  284. args: [],
  285. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  286. messageSends: ["assert:equals:", "ensure:"],
  287. referencedClasses: []
  288. }),
  289. globals.BlockClosureTest);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "testEnsureRaises",
  293. protocol: 'tests',
  294. fn: function (){
  295. var self=this;
  296. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  297. return smalltalk.withContext(function($ctx1) {
  298. self._should_raise_((function(){
  299. return smalltalk.withContext(function($ctx2) {
  300. return _st((function(){
  301. return smalltalk.withContext(function($ctx3) {
  302. return _st(_st($Error())._new())._signal();
  303. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  304. return true;
  305. }));
  306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  307. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  308. args: [],
  309. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  310. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  311. referencedClasses: ["Error"]
  312. }),
  313. globals.BlockClosureTest);
  314. smalltalk.addMethod(
  315. smalltalk.method({
  316. selector: "testExceptionSemantics",
  317. protocol: 'tests',
  318. fn: function (){
  319. var self=this;
  320. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  321. return smalltalk.withContext(function($ctx1) {
  322. self._timeout_((100));
  323. _st(self._async_((function(){
  324. return smalltalk.withContext(function($ctx2) {
  325. return _st((function(){
  326. return smalltalk.withContext(function($ctx3) {
  327. self._assert_(true);
  328. _st($Error())._signal();
  329. self._deny_(true);
  330. return self._finished();
  331. $ctx3.sendIdx["finished"]=1;
  332. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  333. return smalltalk.withContext(function($ctx3) {
  334. return self._finished();
  335. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  337. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  338. args: [],
  339. 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",
  340. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  341. referencedClasses: ["Error"]
  342. }),
  343. globals.BlockClosureTest);
  344. smalltalk.addMethod(
  345. smalltalk.method({
  346. selector: "testNewWithValues",
  347. protocol: 'tests',
  348. fn: function (){
  349. var self=this;
  350. return smalltalk.withContext(function($ctx1) {
  351. function TestConstructor(arg1, arg2, arg3) {}
  352. TestConstructor.prototype.name = 'theTestPrototype';
  353. var wrappedConstructor = _st(TestConstructor);
  354. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  355. self._assert_(result instanceof TestConstructor);
  356. self._assert_equals_(result.name, 'theTestPrototype');
  357. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  358. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  359. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  360. args: [],
  361. 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>",
  362. messageSends: [],
  363. referencedClasses: []
  364. }),
  365. globals.BlockClosureTest);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "testNumArgs",
  369. protocol: 'tests',
  370. fn: function (){
  371. var self=this;
  372. return smalltalk.withContext(function($ctx1) {
  373. var $1;
  374. $1=_st((function(){
  375. }))._numArgs();
  376. $ctx1.sendIdx["numArgs"]=1;
  377. self._assert_equals_($1,(0));
  378. $ctx1.sendIdx["assert:equals:"]=1;
  379. self._assert_equals_(_st((function(a,b){
  380. }))._numArgs(),(2));
  381. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  382. args: [],
  383. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  384. messageSends: ["assert:equals:", "numArgs"],
  385. referencedClasses: []
  386. }),
  387. globals.BlockClosureTest);
  388. smalltalk.addMethod(
  389. smalltalk.method({
  390. selector: "testOnDo",
  391. protocol: 'tests',
  392. fn: function (){
  393. var self=this;
  394. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  395. return smalltalk.withContext(function($ctx1) {
  396. self._assert_(_st((function(){
  397. return smalltalk.withContext(function($ctx2) {
  398. return _st(_st($Error())._new())._signal();
  399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  400. return true;
  401. })));
  402. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  403. args: [],
  404. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  405. messageSends: ["assert:", "on:do:", "signal", "new"],
  406. referencedClasses: ["Error"]
  407. }),
  408. globals.BlockClosureTest);
  409. smalltalk.addMethod(
  410. smalltalk.method({
  411. selector: "testValue",
  412. protocol: 'tests',
  413. fn: function (){
  414. var self=this;
  415. return smalltalk.withContext(function($ctx1) {
  416. var $1;
  417. $1=_st((function(){
  418. return smalltalk.withContext(function($ctx2) {
  419. return (1).__plus((1));
  420. $ctx2.sendIdx["+"]=1;
  421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  422. $ctx1.sendIdx["value"]=1;
  423. self._assert_equals_($1,(2));
  424. $ctx1.sendIdx["assert:equals:"]=1;
  425. self._assert_equals_(_st((function(x){
  426. return smalltalk.withContext(function($ctx2) {
  427. return _st(x).__plus((1));
  428. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  429. $ctx1.sendIdx["assert:equals:"]=2;
  430. self._assert_equals_(_st((function(x,y){
  431. return smalltalk.withContext(function($ctx2) {
  432. return _st(x).__star(y);
  433. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  434. $ctx1.sendIdx["assert:equals:"]=3;
  435. self._assert_equals_(_st((function(a,b,c){
  436. return (1);
  437. }))._value(),(1));
  438. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  439. args: [],
  440. 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",
  441. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  442. referencedClasses: []
  443. }),
  444. globals.BlockClosureTest);
  445. smalltalk.addMethod(
  446. smalltalk.method({
  447. selector: "testValueWithPossibleArguments",
  448. protocol: 'tests',
  449. fn: function (){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) {
  452. var $1,$2;
  453. $1=_st((function(){
  454. return (1);
  455. }))._valueWithPossibleArguments_([(3), (4)]);
  456. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  457. self._assert_equals_($1,(1));
  458. $ctx1.sendIdx["assert:equals:"]=1;
  459. $2=_st((function(a){
  460. return smalltalk.withContext(function($ctx2) {
  461. return _st(a).__plus((4));
  462. $ctx2.sendIdx["+"]=1;
  463. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  464. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  465. self._assert_equals_($2,(7));
  466. $ctx1.sendIdx["assert:equals:"]=2;
  467. self._assert_equals_(_st((function(a,b){
  468. return smalltalk.withContext(function($ctx2) {
  469. return _st(a).__plus(b);
  470. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  471. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  472. args: [],
  473. 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.",
  474. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  475. referencedClasses: []
  476. }),
  477. globals.BlockClosureTest);
  478. smalltalk.addMethod(
  479. smalltalk.method({
  480. selector: "testWhileFalse",
  481. protocol: 'tests',
  482. fn: function (){
  483. var self=this;
  484. var i;
  485. return smalltalk.withContext(function($ctx1) {
  486. i=(0);
  487. _st((function(){
  488. return smalltalk.withContext(function($ctx2) {
  489. return _st(i).__gt((5));
  490. $ctx2.sendIdx[">"]=1;
  491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  492. return smalltalk.withContext(function($ctx2) {
  493. i=_st(i).__plus((1));
  494. $ctx2.sendIdx["+"]=1;
  495. return i;
  496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  497. self._assert_equals_(i,(6));
  498. $ctx1.sendIdx["assert:equals:"]=1;
  499. i=(0);
  500. _st((function(){
  501. return smalltalk.withContext(function($ctx2) {
  502. i=_st(i).__plus((1));
  503. i;
  504. return _st(i).__gt((5));
  505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  506. self._assert_equals_(i,(6));
  507. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  508. args: [],
  509. 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",
  510. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  511. referencedClasses: []
  512. }),
  513. globals.BlockClosureTest);
  514. smalltalk.addMethod(
  515. smalltalk.method({
  516. selector: "testWhileTrue",
  517. protocol: 'tests',
  518. fn: function (){
  519. var self=this;
  520. var i;
  521. return smalltalk.withContext(function($ctx1) {
  522. i=(0);
  523. _st((function(){
  524. return smalltalk.withContext(function($ctx2) {
  525. return _st(i).__lt((5));
  526. $ctx2.sendIdx["<"]=1;
  527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  528. return smalltalk.withContext(function($ctx2) {
  529. i=_st(i).__plus((1));
  530. $ctx2.sendIdx["+"]=1;
  531. return i;
  532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  533. self._assert_equals_(i,(5));
  534. $ctx1.sendIdx["assert:equals:"]=1;
  535. i=(0);
  536. _st((function(){
  537. return smalltalk.withContext(function($ctx2) {
  538. i=_st(i).__plus((1));
  539. i;
  540. return _st(i).__lt((5));
  541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  542. self._assert_equals_(i,(5));
  543. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  544. args: [],
  545. 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",
  546. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  547. referencedClasses: []
  548. }),
  549. globals.BlockClosureTest);
  550. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  551. smalltalk.addMethod(
  552. smalltalk.method({
  553. selector: "testEquality",
  554. protocol: 'tests',
  555. fn: function (){
  556. var self=this;
  557. return smalltalk.withContext(function($ctx1) {
  558. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  559. $1=(0).__eq(false);
  560. $ctx1.sendIdx["="]=1;
  561. self._deny_($1);
  562. $ctx1.sendIdx["deny:"]=1;
  563. $2=false.__eq((0));
  564. $ctx1.sendIdx["="]=2;
  565. self._deny_($2);
  566. $ctx1.sendIdx["deny:"]=2;
  567. $3="".__eq(false);
  568. $ctx1.sendIdx["="]=3;
  569. self._deny_($3);
  570. $ctx1.sendIdx["deny:"]=3;
  571. $4=false.__eq("");
  572. $ctx1.sendIdx["="]=4;
  573. self._deny_($4);
  574. $ctx1.sendIdx["deny:"]=4;
  575. $5=true.__eq(true);
  576. $ctx1.sendIdx["="]=5;
  577. self._assert_($5);
  578. $ctx1.sendIdx["assert:"]=1;
  579. $6=false.__eq(true);
  580. $ctx1.sendIdx["="]=6;
  581. self._deny_($6);
  582. $ctx1.sendIdx["deny:"]=5;
  583. $7=true.__eq(false);
  584. $ctx1.sendIdx["="]=7;
  585. self._deny_($7);
  586. $8=false.__eq(false);
  587. $ctx1.sendIdx["="]=8;
  588. self._assert_($8);
  589. $ctx1.sendIdx["assert:"]=2;
  590. $10=true._yourself();
  591. $ctx1.sendIdx["yourself"]=1;
  592. $9=_st($10).__eq(true);
  593. $ctx1.sendIdx["="]=9;
  594. self._assert_($9);
  595. $ctx1.sendIdx["assert:"]=3;
  596. $12=true._yourself();
  597. $ctx1.sendIdx["yourself"]=2;
  598. $11=_st($12).__eq(true._yourself());
  599. self._assert_($11);
  600. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  601. args: [],
  602. 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)",
  603. messageSends: ["deny:", "=", "assert:", "yourself"],
  604. referencedClasses: []
  605. }),
  606. globals.BooleanTest);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "testIdentity",
  610. protocol: 'tests',
  611. fn: function (){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) {
  614. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  615. $1=(0).__eq_eq(false);
  616. $ctx1.sendIdx["=="]=1;
  617. self._deny_($1);
  618. $ctx1.sendIdx["deny:"]=1;
  619. $2=false.__eq_eq((0));
  620. $ctx1.sendIdx["=="]=2;
  621. self._deny_($2);
  622. $ctx1.sendIdx["deny:"]=2;
  623. $3="".__eq_eq(false);
  624. $ctx1.sendIdx["=="]=3;
  625. self._deny_($3);
  626. $ctx1.sendIdx["deny:"]=3;
  627. $4=false.__eq_eq("");
  628. $ctx1.sendIdx["=="]=4;
  629. self._deny_($4);
  630. $ctx1.sendIdx["deny:"]=4;
  631. $5=true.__eq_eq(true);
  632. $ctx1.sendIdx["=="]=5;
  633. self._assert_($5);
  634. $ctx1.sendIdx["assert:"]=1;
  635. $6=false.__eq_eq(true);
  636. $ctx1.sendIdx["=="]=6;
  637. self._deny_($6);
  638. $ctx1.sendIdx["deny:"]=5;
  639. $7=true.__eq_eq(false);
  640. $ctx1.sendIdx["=="]=7;
  641. self._deny_($7);
  642. $8=false.__eq_eq(false);
  643. $ctx1.sendIdx["=="]=8;
  644. self._assert_($8);
  645. $ctx1.sendIdx["assert:"]=2;
  646. $10=true._yourself();
  647. $ctx1.sendIdx["yourself"]=1;
  648. $9=_st($10).__eq_eq(true);
  649. $ctx1.sendIdx["=="]=9;
  650. self._assert_($9);
  651. $ctx1.sendIdx["assert:"]=3;
  652. $12=true._yourself();
  653. $ctx1.sendIdx["yourself"]=2;
  654. $11=_st($12).__eq_eq(true._yourself());
  655. self._assert_($11);
  656. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  657. args: [],
  658. 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",
  659. messageSends: ["deny:", "==", "assert:", "yourself"],
  660. referencedClasses: []
  661. }),
  662. globals.BooleanTest);
  663. smalltalk.addMethod(
  664. smalltalk.method({
  665. selector: "testIfTrueIfFalse",
  666. protocol: 'tests',
  667. fn: function (){
  668. var self=this;
  669. return smalltalk.withContext(function($ctx1) {
  670. var $1,$2,$3,$4,$5,$6,$7,$8;
  671. if(smalltalk.assert(true)){
  672. $1="alternative block";
  673. };
  674. self._assert_equals_($1,"alternative block");
  675. $ctx1.sendIdx["assert:equals:"]=1;
  676. if(! smalltalk.assert(true)){
  677. $2="alternative block";
  678. };
  679. self._assert_equals_($2,nil);
  680. $ctx1.sendIdx["assert:equals:"]=2;
  681. if(smalltalk.assert(false)){
  682. $3="alternative block";
  683. };
  684. self._assert_equals_($3,nil);
  685. $ctx1.sendIdx["assert:equals:"]=3;
  686. if(! smalltalk.assert(false)){
  687. $4="alternative block";
  688. };
  689. self._assert_equals_($4,"alternative block");
  690. $ctx1.sendIdx["assert:equals:"]=4;
  691. if(smalltalk.assert(false)){
  692. $5="alternative block";
  693. } else {
  694. $5="alternative block2";
  695. };
  696. self._assert_equals_($5,"alternative block2");
  697. $ctx1.sendIdx["assert:equals:"]=5;
  698. if(smalltalk.assert(false)){
  699. $6="alternative block2";
  700. } else {
  701. $6="alternative block";
  702. };
  703. self._assert_equals_($6,"alternative block");
  704. $ctx1.sendIdx["assert:equals:"]=6;
  705. if(smalltalk.assert(true)){
  706. $7="alternative block";
  707. } else {
  708. $7="alternative block2";
  709. };
  710. self._assert_equals_($7,"alternative block");
  711. $ctx1.sendIdx["assert:equals:"]=7;
  712. if(smalltalk.assert(true)){
  713. $8="alternative block2";
  714. } else {
  715. $8="alternative block";
  716. };
  717. self._assert_equals_($8,"alternative block2");
  718. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  719. args: [],
  720. 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'.",
  721. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  722. referencedClasses: []
  723. }),
  724. globals.BooleanTest);
  725. smalltalk.addMethod(
  726. smalltalk.method({
  727. selector: "testIfTrueIfFalseWithBoxing",
  728. protocol: 'tests',
  729. fn: function (){
  730. var self=this;
  731. return smalltalk.withContext(function($ctx1) {
  732. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  733. $2=true._yourself();
  734. $ctx1.sendIdx["yourself"]=1;
  735. if(smalltalk.assert($2)){
  736. $1="alternative block";
  737. };
  738. self._assert_equals_($1,"alternative block");
  739. $ctx1.sendIdx["assert:equals:"]=1;
  740. $4=true._yourself();
  741. $ctx1.sendIdx["yourself"]=2;
  742. if(! smalltalk.assert($4)){
  743. $3="alternative block";
  744. };
  745. self._assert_equals_($3,nil);
  746. $ctx1.sendIdx["assert:equals:"]=2;
  747. $6=false._yourself();
  748. $ctx1.sendIdx["yourself"]=3;
  749. if(smalltalk.assert($6)){
  750. $5="alternative block";
  751. };
  752. self._assert_equals_($5,nil);
  753. $ctx1.sendIdx["assert:equals:"]=3;
  754. $8=false._yourself();
  755. $ctx1.sendIdx["yourself"]=4;
  756. if(! smalltalk.assert($8)){
  757. $7="alternative block";
  758. };
  759. self._assert_equals_($7,"alternative block");
  760. $ctx1.sendIdx["assert:equals:"]=4;
  761. $10=false._yourself();
  762. $ctx1.sendIdx["yourself"]=5;
  763. if(smalltalk.assert($10)){
  764. $9="alternative block";
  765. } else {
  766. $9="alternative block2";
  767. };
  768. self._assert_equals_($9,"alternative block2");
  769. $ctx1.sendIdx["assert:equals:"]=5;
  770. $12=false._yourself();
  771. $ctx1.sendIdx["yourself"]=6;
  772. if(smalltalk.assert($12)){
  773. $11="alternative block2";
  774. } else {
  775. $11="alternative block";
  776. };
  777. self._assert_equals_($11,"alternative block");
  778. $ctx1.sendIdx["assert:equals:"]=6;
  779. $14=true._yourself();
  780. $ctx1.sendIdx["yourself"]=7;
  781. if(smalltalk.assert($14)){
  782. $13="alternative block";
  783. } else {
  784. $13="alternative block2";
  785. };
  786. self._assert_equals_($13,"alternative block");
  787. $ctx1.sendIdx["assert:equals:"]=7;
  788. $16=true._yourself();
  789. if(smalltalk.assert($16)){
  790. $15="alternative block2";
  791. } else {
  792. $15="alternative block";
  793. };
  794. self._assert_equals_($15,"alternative block2");
  795. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  796. args: [],
  797. 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'.",
  798. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  799. referencedClasses: []
  800. }),
  801. globals.BooleanTest);
  802. smalltalk.addMethod(
  803. smalltalk.method({
  804. selector: "testLogic",
  805. protocol: 'tests',
  806. fn: function (){
  807. var self=this;
  808. return smalltalk.withContext(function($ctx1) {
  809. 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;
  810. $1=true.__and(true);
  811. $ctx1.sendIdx["&"]=1;
  812. self._assert_($1);
  813. $ctx1.sendIdx["assert:"]=1;
  814. $2=true.__and(false);
  815. $ctx1.sendIdx["&"]=2;
  816. self._deny_($2);
  817. $ctx1.sendIdx["deny:"]=1;
  818. $3=false.__and(true);
  819. $ctx1.sendIdx["&"]=3;
  820. self._deny_($3);
  821. $ctx1.sendIdx["deny:"]=2;
  822. $5=false.__and(false);
  823. $ctx1.sendIdx["&"]=4;
  824. $4=self._deny_($5);
  825. $ctx1.sendIdx["deny:"]=3;
  826. $6=true.__or(true);
  827. $ctx1.sendIdx["|"]=1;
  828. self._assert_($6);
  829. $ctx1.sendIdx["assert:"]=2;
  830. $7=true.__or(false);
  831. $ctx1.sendIdx["|"]=2;
  832. self._assert_($7);
  833. $ctx1.sendIdx["assert:"]=3;
  834. $8=false.__or(true);
  835. $ctx1.sendIdx["|"]=3;
  836. self._assert_($8);
  837. $ctx1.sendIdx["assert:"]=4;
  838. $10=false.__or(false);
  839. $ctx1.sendIdx["|"]=4;
  840. $9=self._deny_($10);
  841. $ctx1.sendIdx["deny:"]=4;
  842. $12=(1).__gt((0));
  843. $ctx1.sendIdx[">"]=1;
  844. $11=true.__and($12);
  845. $ctx1.sendIdx["&"]=5;
  846. self._assert_($11);
  847. $ctx1.sendIdx["assert:"]=5;
  848. $14=(1).__gt((0));
  849. $ctx1.sendIdx[">"]=2;
  850. $13=_st($14).__and(false);
  851. $ctx1.sendIdx["&"]=6;
  852. self._deny_($13);
  853. $ctx1.sendIdx["deny:"]=5;
  854. $17=(1).__gt((0));
  855. $ctx1.sendIdx[">"]=3;
  856. $18=(1).__gt((2));
  857. $ctx1.sendIdx[">"]=4;
  858. $16=_st($17).__and($18);
  859. $15=self._deny_($16);
  860. $20=(1).__gt((0));
  861. $ctx1.sendIdx[">"]=5;
  862. $19=false.__or($20);
  863. $ctx1.sendIdx["|"]=5;
  864. self._assert_($19);
  865. $ctx1.sendIdx["assert:"]=6;
  866. $22=(1).__gt((0));
  867. $ctx1.sendIdx[">"]=6;
  868. $21=_st($22).__or(false);
  869. $ctx1.sendIdx["|"]=6;
  870. self._assert_($21);
  871. $ctx1.sendIdx["assert:"]=7;
  872. $25=(1).__gt((0));
  873. $ctx1.sendIdx[">"]=7;
  874. $24=_st($25).__or((1).__gt((2)));
  875. $23=self._assert_($24);
  876. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  877. args: [],
  878. 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))",
  879. messageSends: ["assert:", "&", "deny:", "|", ">"],
  880. referencedClasses: []
  881. }),
  882. globals.BooleanTest);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "testLogicKeywords",
  886. protocol: 'tests',
  887. fn: function (){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  891. $1=true._and_((function(){
  892. return true;
  893. }));
  894. $ctx1.sendIdx["and:"]=1;
  895. self._assert_($1);
  896. $ctx1.sendIdx["assert:"]=1;
  897. $2=true._and_((function(){
  898. return false;
  899. }));
  900. $ctx1.sendIdx["and:"]=2;
  901. self._deny_($2);
  902. $ctx1.sendIdx["deny:"]=1;
  903. $3=false._and_((function(){
  904. return true;
  905. }));
  906. $ctx1.sendIdx["and:"]=3;
  907. self._deny_($3);
  908. $ctx1.sendIdx["deny:"]=2;
  909. $5=false._and_((function(){
  910. return false;
  911. }));
  912. $ctx1.sendIdx["and:"]=4;
  913. $4=self._deny_($5);
  914. $ctx1.sendIdx["deny:"]=3;
  915. $6=true._or_((function(){
  916. return true;
  917. }));
  918. $ctx1.sendIdx["or:"]=1;
  919. self._assert_($6);
  920. $ctx1.sendIdx["assert:"]=2;
  921. $7=true._or_((function(){
  922. return false;
  923. }));
  924. $ctx1.sendIdx["or:"]=2;
  925. self._assert_($7);
  926. $ctx1.sendIdx["assert:"]=3;
  927. $8=false._or_((function(){
  928. return true;
  929. }));
  930. $ctx1.sendIdx["or:"]=3;
  931. self._assert_($8);
  932. $ctx1.sendIdx["assert:"]=4;
  933. $10=false._or_((function(){
  934. return false;
  935. }));
  936. $ctx1.sendIdx["or:"]=4;
  937. $9=self._deny_($10);
  938. $ctx1.sendIdx["deny:"]=4;
  939. $11=true._and_((function(){
  940. return smalltalk.withContext(function($ctx2) {
  941. return (1).__gt((0));
  942. $ctx2.sendIdx[">"]=1;
  943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  944. $ctx1.sendIdx["and:"]=5;
  945. self._assert_($11);
  946. $ctx1.sendIdx["assert:"]=5;
  947. $13=(1).__gt((0));
  948. $ctx1.sendIdx[">"]=2;
  949. $12=_st($13)._and_((function(){
  950. return false;
  951. }));
  952. $ctx1.sendIdx["and:"]=6;
  953. self._deny_($12);
  954. $ctx1.sendIdx["deny:"]=5;
  955. $16=(1).__gt((0));
  956. $ctx1.sendIdx[">"]=3;
  957. $15=_st($16)._and_((function(){
  958. return smalltalk.withContext(function($ctx2) {
  959. return (1).__gt((2));
  960. $ctx2.sendIdx[">"]=4;
  961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  962. $14=self._deny_($15);
  963. $17=false._or_((function(){
  964. return smalltalk.withContext(function($ctx2) {
  965. return (1).__gt((0));
  966. $ctx2.sendIdx[">"]=5;
  967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  968. $ctx1.sendIdx["or:"]=5;
  969. self._assert_($17);
  970. $ctx1.sendIdx["assert:"]=6;
  971. $19=(1).__gt((0));
  972. $ctx1.sendIdx[">"]=6;
  973. $18=_st($19)._or_((function(){
  974. return false;
  975. }));
  976. $ctx1.sendIdx["or:"]=6;
  977. self._assert_($18);
  978. $ctx1.sendIdx["assert:"]=7;
  979. $22=(1).__gt((0));
  980. $ctx1.sendIdx[">"]=7;
  981. $21=_st($22)._or_((function(){
  982. return smalltalk.withContext(function($ctx2) {
  983. return (1).__gt((2));
  984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  985. $20=self._assert_($21);
  986. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  987. args: [],
  988. 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 ])",
  989. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  990. referencedClasses: []
  991. }),
  992. globals.BooleanTest);
  993. smalltalk.addMethod(
  994. smalltalk.method({
  995. selector: "testNonBooleanError",
  996. protocol: 'tests',
  997. fn: function (){
  998. var self=this;
  999. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1000. return smalltalk.withContext(function($ctx1) {
  1001. self._should_raise_((function(){
  1002. return smalltalk.withContext(function($ctx2) {
  1003. if(smalltalk.assert("")){
  1004. } else {
  1005. };
  1006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  1007. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  1008. args: [],
  1009. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1010. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1011. referencedClasses: ["NonBooleanReceiver"]
  1012. }),
  1013. globals.BooleanTest);
  1014. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1015. smalltalk.addMethod(
  1016. smalltalk.method({
  1017. selector: "setUp",
  1018. protocol: 'running',
  1019. fn: function (){
  1020. var self=this;
  1021. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1022. return smalltalk.withContext(function($ctx1) {
  1023. self["@builder"]=_st($ClassBuilder())._new();
  1024. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1025. args: [],
  1026. source: "setUp\x0a\x09builder := ClassBuilder new",
  1027. messageSends: ["new"],
  1028. referencedClasses: ["ClassBuilder"]
  1029. }),
  1030. globals.ClassBuilderTest);
  1031. smalltalk.addMethod(
  1032. smalltalk.method({
  1033. selector: "tearDown",
  1034. protocol: 'running',
  1035. fn: function (){
  1036. var self=this;
  1037. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1038. return smalltalk.withContext(function($ctx1) {
  1039. var $1,$receiver;
  1040. $1=self["@theClass"];
  1041. if(($receiver = $1) == null || $receiver.isNil){
  1042. $1;
  1043. } else {
  1044. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1045. self["@theClass"]=nil;
  1046. self["@theClass"];
  1047. };
  1048. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1049. args: [],
  1050. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1051. messageSends: ["ifNotNil:", "removeClass:"],
  1052. referencedClasses: ["Smalltalk"]
  1053. }),
  1054. globals.ClassBuilderTest);
  1055. smalltalk.addMethod(
  1056. smalltalk.method({
  1057. selector: "testClassCopy",
  1058. protocol: 'tests',
  1059. fn: function (){
  1060. var self=this;
  1061. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1062. return smalltalk.withContext(function($ctx1) {
  1063. var $2,$1,$4,$3,$6,$5,$8,$7;
  1064. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1065. $2=_st(self["@theClass"])._superclass();
  1066. $ctx1.sendIdx["superclass"]=1;
  1067. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1068. $ctx1.sendIdx["=="]=1;
  1069. self._assert_($1);
  1070. $ctx1.sendIdx["assert:"]=1;
  1071. $4=_st(self["@theClass"])._instanceVariableNames();
  1072. $ctx1.sendIdx["instanceVariableNames"]=1;
  1073. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($3);
  1076. $ctx1.sendIdx["assert:"]=2;
  1077. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1078. $ctx1.sendIdx["assert:equals:"]=1;
  1079. $6=_st(self["@theClass"])._package();
  1080. $ctx1.sendIdx["package"]=1;
  1081. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1082. self._assert_($5);
  1083. $8=_st(self["@theClass"])._methodDictionary();
  1084. $ctx1.sendIdx["methodDictionary"]=1;
  1085. $7=_st($8)._keys();
  1086. $ctx1.sendIdx["keys"]=1;
  1087. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1088. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1089. args: [],
  1090. 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",
  1091. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1092. referencedClasses: ["ObjectMock"]
  1093. }),
  1094. globals.ClassBuilderTest);
  1095. smalltalk.addMethod(
  1096. smalltalk.method({
  1097. selector: "testClassMigration",
  1098. protocol: 'tests',
  1099. fn: function (){
  1100. var self=this;
  1101. var instance,oldClass;
  1102. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1103. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1104. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1105. return smalltalk.withContext(function($ctx1) {
  1106. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1107. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1108. $2=_st($Smalltalk())._globals();
  1109. $ctx1.sendIdx["globals"]=1;
  1110. $1=_st($2)._at_("ObjectMock2");
  1111. $ctx1.sendIdx["at:"]=1;
  1112. instance=_st($1)._new();
  1113. $4=_st($Smalltalk())._globals();
  1114. $ctx1.sendIdx["globals"]=2;
  1115. $3=_st($4)._at_("ObjectMock2");
  1116. $ctx1.sendIdx["at:"]=2;
  1117. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1118. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1119. $ctx1.sendIdx["=="]=1;
  1120. self._deny_($5);
  1121. $ctx1.sendIdx["deny:"]=1;
  1122. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1123. $ctx1.sendIdx["=="]=2;
  1124. self._assert_($6);
  1125. $ctx1.sendIdx["assert:"]=1;
  1126. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1127. $ctx1.sendIdx["assert:"]=2;
  1128. $7=_st($ObjectMock2())._selectors();
  1129. $ctx1.sendIdx["selectors"]=1;
  1130. self._assert_equals_($7,_st(oldClass)._selectors());
  1131. $ctx1.sendIdx["assert:equals:"]=1;
  1132. $8=_st($ObjectMock2())._comment();
  1133. $ctx1.sendIdx["comment"]=1;
  1134. self._assert_equals_($8,_st(oldClass)._comment());
  1135. $ctx1.sendIdx["assert:equals:"]=2;
  1136. $9=_st(_st($ObjectMock2())._package())._name();
  1137. $ctx1.sendIdx["name"]=1;
  1138. self._assert_equals_($9,"Kernel-Tests");
  1139. $11=_st(instance)._class();
  1140. $ctx1.sendIdx["class"]=1;
  1141. $10=_st($11).__eq_eq($ObjectMock2());
  1142. self._deny_($10);
  1143. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1144. _st($Smalltalk())._removeClass_($ObjectMock2());
  1145. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1146. args: [],
  1147. 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",
  1148. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1149. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1150. }),
  1151. globals.ClassBuilderTest);
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "testClassMigrationWithClassInstanceVariables",
  1155. protocol: 'tests',
  1156. fn: function (){
  1157. var self=this;
  1158. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1159. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1160. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1161. return smalltalk.withContext(function($ctx1) {
  1162. var $1;
  1163. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1164. $1=_st($ObjectMock2())._class();
  1165. $ctx1.sendIdx["class"]=1;
  1166. _st($1)._instanceVariableNames_("foo bar");
  1167. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1168. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1169. _st($Smalltalk())._removeClass_($ObjectMock2());
  1170. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1171. args: [],
  1172. 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",
  1173. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1174. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1175. }),
  1176. globals.ClassBuilderTest);
  1177. smalltalk.addMethod(
  1178. smalltalk.method({
  1179. selector: "testClassMigrationWithSubclasses",
  1180. protocol: 'tests',
  1181. fn: function (){
  1182. var self=this;
  1183. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1184. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1185. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1186. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1187. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1188. return smalltalk.withContext(function($ctx1) {
  1189. var $2,$1,$4,$3;
  1190. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1191. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1192. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1193. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1194. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1195. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1196. $2=_st($ObjectMock())._subclasses();
  1197. $ctx1.sendIdx["subclasses"]=1;
  1198. $1=_st($2)._includes_($ObjectMock2());
  1199. $ctx1.sendIdx["includes:"]=1;
  1200. self._assert_($1);
  1201. $ctx1.sendIdx["assert:"]=1;
  1202. $4=_st($ObjectMock2())._subclasses();
  1203. $ctx1.sendIdx["subclasses"]=2;
  1204. $3=_st($4)._includes_($ObjectMock3());
  1205. $ctx1.sendIdx["includes:"]=2;
  1206. self._assert_($3);
  1207. $ctx1.sendIdx["assert:"]=2;
  1208. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1209. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1210. return smalltalk.withContext(function($ctx2) {
  1211. return _st($Smalltalk())._removeClass_(each);
  1212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1213. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1214. args: [],
  1215. 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 ]",
  1216. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1217. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1218. }),
  1219. globals.ClassBuilderTest);
  1220. smalltalk.addMethod(
  1221. smalltalk.method({
  1222. selector: "testInstanceVariableNames",
  1223. protocol: 'tests',
  1224. fn: function (){
  1225. var self=this;
  1226. return smalltalk.withContext(function($ctx1) {
  1227. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1228. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1229. args: [],
  1230. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1231. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1232. referencedClasses: []
  1233. }),
  1234. globals.ClassBuilderTest);
  1235. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1236. smalltalk.addMethod(
  1237. smalltalk.method({
  1238. selector: "assertSameContents:as:",
  1239. protocol: 'convenience',
  1240. fn: function (aCollection,anotherCollection){
  1241. var self=this;
  1242. return smalltalk.withContext(function($ctx1) {
  1243. var $2,$1,$4,$3;
  1244. $2=_st(aCollection)._size();
  1245. $ctx1.sendIdx["size"]=1;
  1246. $1=_st($2).__eq(_st(anotherCollection)._size());
  1247. $ctx1.sendIdx["="]=1;
  1248. self._assert_($1);
  1249. $ctx1.sendIdx["assert:"]=1;
  1250. _st(aCollection)._do_((function(each){
  1251. return smalltalk.withContext(function($ctx2) {
  1252. $4=_st(aCollection)._occurrencesOf_(each);
  1253. $ctx2.sendIdx["occurrencesOf:"]=1;
  1254. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1255. return self._assert_($3);
  1256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1257. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1258. args: ["aCollection", "anotherCollection"],
  1259. 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)) ]",
  1260. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1261. referencedClasses: []
  1262. }),
  1263. globals.CollectionTest);
  1264. smalltalk.addMethod(
  1265. smalltalk.method({
  1266. selector: "collection",
  1267. protocol: 'fixture',
  1268. fn: function (){
  1269. var self=this;
  1270. return smalltalk.withContext(function($ctx1) {
  1271. self._subclassResponsibility();
  1272. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1273. args: [],
  1274. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1275. messageSends: ["subclassResponsibility"],
  1276. referencedClasses: []
  1277. }),
  1278. globals.CollectionTest);
  1279. smalltalk.addMethod(
  1280. smalltalk.method({
  1281. selector: "collectionClass",
  1282. protocol: 'fixture',
  1283. fn: function (){
  1284. var self=this;
  1285. return smalltalk.withContext(function($ctx1) {
  1286. var $1;
  1287. $1=_st(self._class())._collectionClass();
  1288. return $1;
  1289. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1290. args: [],
  1291. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1292. messageSends: ["collectionClass", "class"],
  1293. referencedClasses: []
  1294. }),
  1295. globals.CollectionTest);
  1296. smalltalk.addMethod(
  1297. smalltalk.method({
  1298. selector: "collectionOfPrintStrings",
  1299. protocol: 'fixture',
  1300. fn: function (){
  1301. var self=this;
  1302. return smalltalk.withContext(function($ctx1) {
  1303. self._subclassResponsibility();
  1304. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1305. args: [],
  1306. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1307. messageSends: ["subclassResponsibility"],
  1308. referencedClasses: []
  1309. }),
  1310. globals.CollectionTest);
  1311. smalltalk.addMethod(
  1312. smalltalk.method({
  1313. selector: "collectionSize",
  1314. protocol: 'fixture',
  1315. fn: function (){
  1316. var self=this;
  1317. return smalltalk.withContext(function($ctx1) {
  1318. self._subclassResponsibility();
  1319. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1320. args: [],
  1321. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1322. messageSends: ["subclassResponsibility"],
  1323. referencedClasses: []
  1324. }),
  1325. globals.CollectionTest);
  1326. smalltalk.addMethod(
  1327. smalltalk.method({
  1328. selector: "collectionWithDuplicates",
  1329. protocol: 'fixture',
  1330. fn: function (){
  1331. var self=this;
  1332. return smalltalk.withContext(function($ctx1) {
  1333. self._subclassResponsibility();
  1334. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1335. args: [],
  1336. 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",
  1337. messageSends: ["subclassResponsibility"],
  1338. referencedClasses: []
  1339. }),
  1340. globals.CollectionTest);
  1341. smalltalk.addMethod(
  1342. smalltalk.method({
  1343. selector: "collectionWithNewValue",
  1344. protocol: 'fixture',
  1345. fn: function (){
  1346. var self=this;
  1347. return smalltalk.withContext(function($ctx1) {
  1348. self._subclassResponsibility();
  1349. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1350. args: [],
  1351. 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",
  1352. messageSends: ["subclassResponsibility"],
  1353. referencedClasses: []
  1354. }),
  1355. globals.CollectionTest);
  1356. smalltalk.addMethod(
  1357. smalltalk.method({
  1358. selector: "isCollectionReadOnly",
  1359. protocol: 'testing',
  1360. fn: function (){
  1361. var self=this;
  1362. return false;
  1363. },
  1364. args: [],
  1365. source: "isCollectionReadOnly\x0a\x09^ false",
  1366. messageSends: [],
  1367. referencedClasses: []
  1368. }),
  1369. globals.CollectionTest);
  1370. smalltalk.addMethod(
  1371. smalltalk.method({
  1372. selector: "sampleNewValue",
  1373. protocol: 'fixture',
  1374. fn: function (){
  1375. var self=this;
  1376. return "N";
  1377. },
  1378. args: [],
  1379. 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'",
  1380. messageSends: [],
  1381. referencedClasses: []
  1382. }),
  1383. globals.CollectionTest);
  1384. smalltalk.addMethod(
  1385. smalltalk.method({
  1386. selector: "sampleNewValueAsCollection",
  1387. protocol: 'fixture',
  1388. fn: function (){
  1389. var self=this;
  1390. return smalltalk.withContext(function($ctx1) {
  1391. var $1;
  1392. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1393. return $1;
  1394. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1395. args: [],
  1396. 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",
  1397. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1398. referencedClasses: []
  1399. }),
  1400. globals.CollectionTest);
  1401. smalltalk.addMethod(
  1402. smalltalk.method({
  1403. selector: "testAddAll",
  1404. protocol: 'tests',
  1405. fn: function (){
  1406. var self=this;
  1407. return smalltalk.withContext(function($ctx1) {
  1408. 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;
  1409. $2=self._collection();
  1410. $ctx1.sendIdx["collection"]=1;
  1411. $3=$2;
  1412. $5=self._collectionClass();
  1413. $ctx1.sendIdx["collectionClass"]=1;
  1414. $4=_st($5)._new();
  1415. $ctx1.sendIdx["new"]=1;
  1416. _st($3)._addAll_($4);
  1417. $ctx1.sendIdx["addAll:"]=1;
  1418. $6=_st($2)._yourself();
  1419. $ctx1.sendIdx["yourself"]=1;
  1420. $1=$6;
  1421. $7=self._collection();
  1422. $ctx1.sendIdx["collection"]=2;
  1423. self._assert_equals_($1,$7);
  1424. $ctx1.sendIdx["assert:equals:"]=1;
  1425. $10=self._collectionClass();
  1426. $ctx1.sendIdx["collectionClass"]=2;
  1427. $9=_st($10)._new();
  1428. $ctx1.sendIdx["new"]=2;
  1429. $11=$9;
  1430. $12=self._collection();
  1431. $ctx1.sendIdx["collection"]=3;
  1432. _st($11)._addAll_($12);
  1433. $ctx1.sendIdx["addAll:"]=2;
  1434. $13=_st($9)._yourself();
  1435. $ctx1.sendIdx["yourself"]=2;
  1436. $8=$13;
  1437. $14=self._collection();
  1438. $ctx1.sendIdx["collection"]=4;
  1439. self._assert_equals_($8,$14);
  1440. $ctx1.sendIdx["assert:equals:"]=2;
  1441. $17=self._collectionClass();
  1442. $ctx1.sendIdx["collectionClass"]=3;
  1443. $16=_st($17)._new();
  1444. $ctx1.sendIdx["new"]=3;
  1445. $18=$16;
  1446. $20=self._collectionClass();
  1447. $ctx1.sendIdx["collectionClass"]=4;
  1448. $19=_st($20)._new();
  1449. $ctx1.sendIdx["new"]=4;
  1450. _st($18)._addAll_($19);
  1451. $ctx1.sendIdx["addAll:"]=3;
  1452. $21=_st($16)._yourself();
  1453. $ctx1.sendIdx["yourself"]=3;
  1454. $15=$21;
  1455. self._assert_equals_($15,_st(self._collectionClass())._new());
  1456. $ctx1.sendIdx["assert:equals:"]=3;
  1457. $23=self._collection();
  1458. $ctx1.sendIdx["collection"]=5;
  1459. $24=$23;
  1460. $25=self._sampleNewValueAsCollection();
  1461. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1462. _st($24)._addAll_($25);
  1463. $ctx1.sendIdx["addAll:"]=4;
  1464. $26=_st($23)._yourself();
  1465. $ctx1.sendIdx["yourself"]=4;
  1466. $22=$26;
  1467. $27=self._collectionWithNewValue();
  1468. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1469. self._assert_equals_($22,$27);
  1470. $28=self._sampleNewValueAsCollection();
  1471. _st($28)._addAll_(self._collection());
  1472. $29=_st($28)._yourself();
  1473. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1474. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1475. args: [],
  1476. 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",
  1477. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1478. referencedClasses: []
  1479. }),
  1480. globals.CollectionTest);
  1481. smalltalk.addMethod(
  1482. smalltalk.method({
  1483. selector: "testAllSatisfy",
  1484. protocol: 'tests',
  1485. fn: function (){
  1486. var self=this;
  1487. var collection,anyOne;
  1488. return smalltalk.withContext(function($ctx1) {
  1489. var $1;
  1490. collection=self._collection();
  1491. anyOne=_st(collection)._anyOne();
  1492. $1=_st(collection)._allSatisfy_((function(each){
  1493. return smalltalk.withContext(function($ctx2) {
  1494. return _st(collection)._includes_(each);
  1495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1496. $ctx1.sendIdx["allSatisfy:"]=1;
  1497. self._assert_($1);
  1498. self._deny_(_st(collection)._allSatisfy_((function(each){
  1499. return smalltalk.withContext(function($ctx2) {
  1500. return _st(each).__tild_eq(anyOne);
  1501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1502. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1503. args: [],
  1504. 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 ])",
  1505. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1506. referencedClasses: []
  1507. }),
  1508. globals.CollectionTest);
  1509. smalltalk.addMethod(
  1510. smalltalk.method({
  1511. selector: "testAnyOne",
  1512. protocol: 'tests',
  1513. fn: function (){
  1514. var self=this;
  1515. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1516. return smalltalk.withContext(function($ctx1) {
  1517. var $2,$1;
  1518. self._should_raise_((function(){
  1519. return smalltalk.withContext(function($ctx2) {
  1520. return _st(_st(self._collectionClass())._new())._anyOne();
  1521. $ctx2.sendIdx["anyOne"]=1;
  1522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1523. $2=self._collection();
  1524. $ctx1.sendIdx["collection"]=1;
  1525. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1526. self._assert_($1);
  1527. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1528. args: [],
  1529. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1530. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1531. referencedClasses: ["Error"]
  1532. }),
  1533. globals.CollectionTest);
  1534. smalltalk.addMethod(
  1535. smalltalk.method({
  1536. selector: "testAnySatisfy",
  1537. protocol: 'tests',
  1538. fn: function (){
  1539. var self=this;
  1540. var anyOne;
  1541. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1542. return smalltalk.withContext(function($ctx1) {
  1543. var $1,$3,$2;
  1544. $1=self._collection();
  1545. $ctx1.sendIdx["collection"]=1;
  1546. anyOne=_st($1)._anyOne();
  1547. $3=self._collection();
  1548. $ctx1.sendIdx["collection"]=2;
  1549. $2=_st($3)._anySatisfy_((function(each){
  1550. return smalltalk.withContext(function($ctx2) {
  1551. return _st(each).__eq(anyOne);
  1552. $ctx2.sendIdx["="]=1;
  1553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1554. $ctx1.sendIdx["anySatisfy:"]=1;
  1555. self._assert_($2);
  1556. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1557. return smalltalk.withContext(function($ctx2) {
  1558. return _st(each).__eq(_st($Object())._new());
  1559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1560. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1561. args: [],
  1562. 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 ])",
  1563. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1564. referencedClasses: ["Object"]
  1565. }),
  1566. globals.CollectionTest);
  1567. smalltalk.addMethod(
  1568. smalltalk.method({
  1569. selector: "testAsArray",
  1570. protocol: 'tests',
  1571. fn: function (){
  1572. var self=this;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. var $1;
  1575. $1=self._collection();
  1576. $ctx1.sendIdx["collection"]=1;
  1577. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1578. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1579. args: [],
  1580. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1581. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1582. referencedClasses: []
  1583. }),
  1584. globals.CollectionTest);
  1585. smalltalk.addMethod(
  1586. smalltalk.method({
  1587. selector: "testAsOrderedCollection",
  1588. protocol: 'tests',
  1589. fn: function (){
  1590. var self=this;
  1591. return smalltalk.withContext(function($ctx1) {
  1592. var $1;
  1593. $1=self._collection();
  1594. $ctx1.sendIdx["collection"]=1;
  1595. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1596. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1597. args: [],
  1598. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1599. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1600. referencedClasses: []
  1601. }),
  1602. globals.CollectionTest);
  1603. smalltalk.addMethod(
  1604. smalltalk.method({
  1605. selector: "testAsSet",
  1606. protocol: 'tests',
  1607. fn: function (){
  1608. var self=this;
  1609. var c,set;
  1610. return smalltalk.withContext(function($ctx1) {
  1611. c=self._collectionWithDuplicates();
  1612. set=_st(c)._asSet();
  1613. self._assert_equals_(_st(set)._size(),(5));
  1614. _st(c)._do_((function(each){
  1615. return smalltalk.withContext(function($ctx2) {
  1616. return self._assert_(_st(set)._includes_(each));
  1617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1618. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1619. args: [],
  1620. 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) ]",
  1621. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1622. referencedClasses: []
  1623. }),
  1624. globals.CollectionTest);
  1625. smalltalk.addMethod(
  1626. smalltalk.method({
  1627. selector: "testCollect",
  1628. protocol: 'tests',
  1629. fn: function (){
  1630. var self=this;
  1631. return smalltalk.withContext(function($ctx1) {
  1632. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1633. $2=self._collection();
  1634. $ctx1.sendIdx["collection"]=1;
  1635. $1=_st($2)._collect_((function(each){
  1636. return each;
  1637. }));
  1638. $ctx1.sendIdx["collect:"]=1;
  1639. $3=self._collection();
  1640. $ctx1.sendIdx["collection"]=2;
  1641. self._assert_equals_($1,$3);
  1642. $ctx1.sendIdx["assert:equals:"]=1;
  1643. $5=self._collectionWithNewValue();
  1644. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1645. $4=_st($5)._collect_((function(each){
  1646. return each;
  1647. }));
  1648. $ctx1.sendIdx["collect:"]=2;
  1649. self._assert_equals_($4,self._collectionWithNewValue());
  1650. $ctx1.sendIdx["assert:equals:"]=2;
  1651. $8=self._collectionClass();
  1652. $ctx1.sendIdx["collectionClass"]=1;
  1653. $7=_st($8)._new();
  1654. $ctx1.sendIdx["new"]=1;
  1655. $6=_st($7)._collect_((function(each){
  1656. return smalltalk.withContext(function($ctx2) {
  1657. return _st(each)._printString();
  1658. $ctx2.sendIdx["printString"]=1;
  1659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1660. $ctx1.sendIdx["collect:"]=3;
  1661. self._assert_equals_($6,_st(self._collectionClass())._new());
  1662. $ctx1.sendIdx["assert:equals:"]=3;
  1663. $11=self._collection();
  1664. $ctx1.sendIdx["collection"]=3;
  1665. $10=_st($11)._collect_((function(){
  1666. return smalltalk.withContext(function($ctx2) {
  1667. return self._sampleNewValue();
  1668. $ctx2.sendIdx["sampleNewValue"]=1;
  1669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1670. $ctx1.sendIdx["collect:"]=4;
  1671. $9=_st($10)._detect_((function(){
  1672. return true;
  1673. }));
  1674. self._assert_equals_($9,self._sampleNewValue());
  1675. $ctx1.sendIdx["assert:equals:"]=4;
  1676. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1677. return smalltalk.withContext(function($ctx2) {
  1678. return _st(each)._printString();
  1679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1680. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1681. args: [],
  1682. 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",
  1683. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1684. referencedClasses: []
  1685. }),
  1686. globals.CollectionTest);
  1687. smalltalk.addMethod(
  1688. smalltalk.method({
  1689. selector: "testComma",
  1690. protocol: 'tests',
  1691. fn: function (){
  1692. var self=this;
  1693. return smalltalk.withContext(function($ctx1) {
  1694. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1695. $2=self._collection();
  1696. $ctx1.sendIdx["collection"]=1;
  1697. $4=self._collectionClass();
  1698. $ctx1.sendIdx["collectionClass"]=1;
  1699. $3=_st($4)._new();
  1700. $ctx1.sendIdx["new"]=1;
  1701. $1=_st($2).__comma($3);
  1702. $ctx1.sendIdx[","]=1;
  1703. $5=self._collection();
  1704. $ctx1.sendIdx["collection"]=2;
  1705. self._assert_equals_($1,$5);
  1706. $ctx1.sendIdx["assert:equals:"]=1;
  1707. $8=self._collectionClass();
  1708. $ctx1.sendIdx["collectionClass"]=2;
  1709. $7=_st($8)._new();
  1710. $ctx1.sendIdx["new"]=2;
  1711. $9=self._collection();
  1712. $ctx1.sendIdx["collection"]=3;
  1713. $6=_st($7).__comma($9);
  1714. $ctx1.sendIdx[","]=2;
  1715. $10=self._collection();
  1716. $ctx1.sendIdx["collection"]=4;
  1717. self._assert_equals_($6,$10);
  1718. $ctx1.sendIdx["assert:equals:"]=2;
  1719. $13=self._collectionClass();
  1720. $ctx1.sendIdx["collectionClass"]=3;
  1721. $12=_st($13)._new();
  1722. $ctx1.sendIdx["new"]=3;
  1723. $15=self._collectionClass();
  1724. $ctx1.sendIdx["collectionClass"]=4;
  1725. $14=_st($15)._new();
  1726. $ctx1.sendIdx["new"]=4;
  1727. $11=_st($12).__comma($14);
  1728. $ctx1.sendIdx[","]=3;
  1729. self._assert_equals_($11,_st(self._collectionClass())._new());
  1730. $ctx1.sendIdx["assert:equals:"]=3;
  1731. $17=self._collection();
  1732. $ctx1.sendIdx["collection"]=5;
  1733. $18=self._sampleNewValueAsCollection();
  1734. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1735. $16=_st($17).__comma($18);
  1736. $ctx1.sendIdx[","]=4;
  1737. $19=self._collectionWithNewValue();
  1738. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1739. self._assert_equals_($16,$19);
  1740. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1741. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1742. args: [],
  1743. 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",
  1744. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1745. referencedClasses: []
  1746. }),
  1747. globals.CollectionTest);
  1748. smalltalk.addMethod(
  1749. smalltalk.method({
  1750. selector: "testDetect",
  1751. protocol: 'tests',
  1752. fn: function (){
  1753. var self=this;
  1754. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1755. return smalltalk.withContext(function($ctx1) {
  1756. var $1,$2,$3,$4,$6,$5,$7;
  1757. self._shouldnt_raise_((function(){
  1758. return smalltalk.withContext(function($ctx2) {
  1759. $1=self._collection();
  1760. $ctx2.sendIdx["collection"]=1;
  1761. return _st($1)._detect_((function(){
  1762. return true;
  1763. }));
  1764. $ctx2.sendIdx["detect:"]=1;
  1765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1766. self._should_raise_((function(){
  1767. return smalltalk.withContext(function($ctx2) {
  1768. $2=self._collection();
  1769. $ctx2.sendIdx["collection"]=2;
  1770. return _st($2)._detect_((function(){
  1771. return false;
  1772. }));
  1773. $ctx2.sendIdx["detect:"]=2;
  1774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1775. $ctx1.sendIdx["should:raise:"]=1;
  1776. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1777. return true;
  1778. }));
  1779. $ctx1.sendIdx["detect:"]=3;
  1780. $4=self._sampleNewValue();
  1781. $ctx1.sendIdx["sampleNewValue"]=1;
  1782. self._assert_equals_($3,$4);
  1783. $ctx1.sendIdx["assert:equals:"]=1;
  1784. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1785. return smalltalk.withContext(function($ctx2) {
  1786. $6=self._sampleNewValue();
  1787. $ctx2.sendIdx["sampleNewValue"]=2;
  1788. return _st(each).__eq($6);
  1789. $ctx2.sendIdx["="]=1;
  1790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1791. $ctx1.sendIdx["detect:"]=4;
  1792. $7=self._sampleNewValue();
  1793. $ctx1.sendIdx["sampleNewValue"]=3;
  1794. self._assert_equals_($5,$7);
  1795. self._should_raise_((function(){
  1796. return smalltalk.withContext(function($ctx2) {
  1797. return _st(self._collection())._detect_((function(each){
  1798. return smalltalk.withContext(function($ctx3) {
  1799. return _st(each).__eq(self._sampleNewValue());
  1800. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1802. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1803. args: [],
  1804. 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",
  1805. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1806. referencedClasses: ["Error"]
  1807. }),
  1808. globals.CollectionTest);
  1809. smalltalk.addMethod(
  1810. smalltalk.method({
  1811. selector: "testDetectIfNone",
  1812. protocol: 'tests',
  1813. fn: function (){
  1814. var self=this;
  1815. var sentinel;
  1816. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1817. return smalltalk.withContext(function($ctx1) {
  1818. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1819. sentinel=_st($Object())._new();
  1820. $3=self._collection();
  1821. $ctx1.sendIdx["collection"]=1;
  1822. $2=_st($3)._detect_ifNone_((function(){
  1823. return true;
  1824. }),(function(){
  1825. return sentinel;
  1826. }));
  1827. $ctx1.sendIdx["detect:ifNone:"]=1;
  1828. $1=_st($2).__tild_eq(sentinel);
  1829. self._assert_($1);
  1830. $5=self._collection();
  1831. $ctx1.sendIdx["collection"]=2;
  1832. $4=_st($5)._detect_ifNone_((function(){
  1833. return false;
  1834. }),(function(){
  1835. return sentinel;
  1836. }));
  1837. $ctx1.sendIdx["detect:ifNone:"]=2;
  1838. self._assert_equals_($4,sentinel);
  1839. $ctx1.sendIdx["assert:equals:"]=1;
  1840. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1841. return true;
  1842. }),(function(){
  1843. return sentinel;
  1844. }));
  1845. $ctx1.sendIdx["detect:ifNone:"]=3;
  1846. $7=self._sampleNewValue();
  1847. $ctx1.sendIdx["sampleNewValue"]=1;
  1848. self._assert_equals_($6,$7);
  1849. $ctx1.sendIdx["assert:equals:"]=2;
  1850. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1851. return smalltalk.withContext(function($ctx2) {
  1852. $9=self._sampleNewValue();
  1853. $ctx2.sendIdx["sampleNewValue"]=2;
  1854. return _st(each).__eq($9);
  1855. $ctx2.sendIdx["="]=1;
  1856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1857. return sentinel;
  1858. }));
  1859. $ctx1.sendIdx["detect:ifNone:"]=4;
  1860. $10=self._sampleNewValue();
  1861. $ctx1.sendIdx["sampleNewValue"]=3;
  1862. self._assert_equals_($8,$10);
  1863. $ctx1.sendIdx["assert:equals:"]=3;
  1864. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1865. return smalltalk.withContext(function($ctx2) {
  1866. return _st(each).__eq(self._sampleNewValue());
  1867. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1868. return sentinel;
  1869. })),sentinel);
  1870. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1871. args: [],
  1872. 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",
  1873. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1874. referencedClasses: ["Object"]
  1875. }),
  1876. globals.CollectionTest);
  1877. smalltalk.addMethod(
  1878. smalltalk.method({
  1879. selector: "testDo",
  1880. protocol: 'tests',
  1881. fn: function (){
  1882. var self=this;
  1883. var newCollection;
  1884. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1885. return smalltalk.withContext(function($ctx1) {
  1886. var $1,$2;
  1887. newCollection=_st($OrderedCollection())._new();
  1888. $ctx1.sendIdx["new"]=1;
  1889. $1=self._collection();
  1890. $ctx1.sendIdx["collection"]=1;
  1891. _st($1)._do_((function(each){
  1892. return smalltalk.withContext(function($ctx2) {
  1893. return _st(newCollection)._add_(each);
  1894. $ctx2.sendIdx["add:"]=1;
  1895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1896. $ctx1.sendIdx["do:"]=1;
  1897. self._assertSameContents_as_(self._collection(),newCollection);
  1898. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1899. newCollection=_st($OrderedCollection())._new();
  1900. $2=self._collectionWithDuplicates();
  1901. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1902. _st($2)._do_((function(each){
  1903. return smalltalk.withContext(function($ctx2) {
  1904. return _st(newCollection)._add_(each);
  1905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1906. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1907. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1908. args: [],
  1909. 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",
  1910. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1911. referencedClasses: ["OrderedCollection"]
  1912. }),
  1913. globals.CollectionTest);
  1914. smalltalk.addMethod(
  1915. smalltalk.method({
  1916. selector: "testIfEmptyFamily",
  1917. protocol: 'tests',
  1918. fn: function (){
  1919. var self=this;
  1920. return smalltalk.withContext(function($ctx1) {
  1921. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1922. $3=self._collectionClass();
  1923. $ctx1.sendIdx["collectionClass"]=1;
  1924. $2=_st($3)._new();
  1925. $ctx1.sendIdx["new"]=1;
  1926. $1=_st($2)._ifEmpty_((function(){
  1927. return (42);
  1928. }));
  1929. $ctx1.sendIdx["ifEmpty:"]=1;
  1930. self._assert_equals_($1,(42));
  1931. $ctx1.sendIdx["assert:equals:"]=1;
  1932. $5=self._collection();
  1933. $ctx1.sendIdx["collection"]=1;
  1934. $4=_st($5)._ifEmpty_((function(){
  1935. return (42);
  1936. }));
  1937. $6=self._collection();
  1938. $ctx1.sendIdx["collection"]=2;
  1939. self._assert_equals_($4,$6);
  1940. $ctx1.sendIdx["assert:equals:"]=2;
  1941. $9=self._collectionClass();
  1942. $ctx1.sendIdx["collectionClass"]=2;
  1943. $8=_st($9)._new();
  1944. $ctx1.sendIdx["new"]=2;
  1945. $7=_st($8)._ifNotEmpty_((function(){
  1946. return (42);
  1947. }));
  1948. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1949. $11=self._collectionClass();
  1950. $ctx1.sendIdx["collectionClass"]=3;
  1951. $10=_st($11)._new();
  1952. $ctx1.sendIdx["new"]=3;
  1953. self._assert_equals_($7,$10);
  1954. $ctx1.sendIdx["assert:equals:"]=3;
  1955. $13=self._collection();
  1956. $ctx1.sendIdx["collection"]=3;
  1957. $12=_st($13)._ifNotEmpty_((function(){
  1958. return (42);
  1959. }));
  1960. self._assert_equals_($12,(42));
  1961. $ctx1.sendIdx["assert:equals:"]=4;
  1962. $16=self._collectionClass();
  1963. $ctx1.sendIdx["collectionClass"]=4;
  1964. $15=_st($16)._new();
  1965. $ctx1.sendIdx["new"]=4;
  1966. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1967. return (42);
  1968. }),(function(){
  1969. return (999);
  1970. }));
  1971. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1972. self._assert_equals_($14,(42));
  1973. $ctx1.sendIdx["assert:equals:"]=5;
  1974. $18=self._collection();
  1975. $ctx1.sendIdx["collection"]=4;
  1976. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1977. return (42);
  1978. }),(function(){
  1979. return (999);
  1980. }));
  1981. self._assert_equals_($17,(999));
  1982. $ctx1.sendIdx["assert:equals:"]=6;
  1983. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1984. return (42);
  1985. }),(function(){
  1986. return (999);
  1987. }));
  1988. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1989. self._assert_equals_($19,(999));
  1990. $ctx1.sendIdx["assert:equals:"]=7;
  1991. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1992. return (42);
  1993. }),(function(){
  1994. return (999);
  1995. })),(42));
  1996. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1997. args: [],
  1998. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1999. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2000. referencedClasses: []
  2001. }),
  2002. globals.CollectionTest);
  2003. smalltalk.addMethod(
  2004. smalltalk.method({
  2005. selector: "testIsEmpty",
  2006. protocol: 'tests',
  2007. fn: function (){
  2008. var self=this;
  2009. return smalltalk.withContext(function($ctx1) {
  2010. var $1;
  2011. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2012. $ctx1.sendIdx["isEmpty"]=1;
  2013. self._assert_($1);
  2014. self._deny_(_st(self._collection())._isEmpty());
  2015. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  2016. args: [],
  2017. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2018. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2019. referencedClasses: []
  2020. }),
  2021. globals.CollectionTest);
  2022. smalltalk.addMethod(
  2023. smalltalk.method({
  2024. selector: "testNoneSatisfy",
  2025. protocol: 'tests',
  2026. fn: function (){
  2027. var self=this;
  2028. var anyOne;
  2029. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2030. return smalltalk.withContext(function($ctx1) {
  2031. var $1,$3,$2;
  2032. $1=self._collection();
  2033. $ctx1.sendIdx["collection"]=1;
  2034. anyOne=_st($1)._anyOne();
  2035. $3=self._collection();
  2036. $ctx1.sendIdx["collection"]=2;
  2037. $2=_st($3)._noneSatisfy_((function(each){
  2038. return smalltalk.withContext(function($ctx2) {
  2039. return _st(each).__eq(anyOne);
  2040. $ctx2.sendIdx["="]=1;
  2041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2042. $ctx1.sendIdx["noneSatisfy:"]=1;
  2043. self._deny_($2);
  2044. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2045. return smalltalk.withContext(function($ctx2) {
  2046. return _st(each).__eq(_st($Object())._new());
  2047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2048. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2049. args: [],
  2050. 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 ])",
  2051. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2052. referencedClasses: ["Object"]
  2053. }),
  2054. globals.CollectionTest);
  2055. smalltalk.addMethod(
  2056. smalltalk.method({
  2057. selector: "testRemoveAll",
  2058. protocol: 'tests',
  2059. fn: function (){
  2060. var self=this;
  2061. return smalltalk.withContext(function($ctx1) {
  2062. var $1,$2;
  2063. $1=self._collection();
  2064. _st($1)._removeAll();
  2065. $2=_st($1)._yourself();
  2066. self._assert_equals_($2,_st(self._collectionClass())._new());
  2067. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2068. args: [],
  2069. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2070. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2071. referencedClasses: []
  2072. }),
  2073. globals.CollectionTest);
  2074. smalltalk.addMethod(
  2075. smalltalk.method({
  2076. selector: "testSelect",
  2077. protocol: 'tests',
  2078. fn: function (){
  2079. var self=this;
  2080. return smalltalk.withContext(function($ctx1) {
  2081. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2082. $2=self._collection();
  2083. $ctx1.sendIdx["collection"]=1;
  2084. $1=_st($2)._select_((function(){
  2085. return false;
  2086. }));
  2087. $ctx1.sendIdx["select:"]=1;
  2088. $4=self._collectionClass();
  2089. $ctx1.sendIdx["collectionClass"]=1;
  2090. $3=_st($4)._new();
  2091. $ctx1.sendIdx["new"]=1;
  2092. self._assert_equals_($1,$3);
  2093. $ctx1.sendIdx["assert:equals:"]=1;
  2094. $6=self._collection();
  2095. $ctx1.sendIdx["collection"]=2;
  2096. $5=_st($6)._select_((function(){
  2097. return true;
  2098. }));
  2099. $ctx1.sendIdx["select:"]=2;
  2100. $7=self._collection();
  2101. $ctx1.sendIdx["collection"]=3;
  2102. self._assert_equals_($5,$7);
  2103. $ctx1.sendIdx["assert:equals:"]=2;
  2104. $9=self._collectionWithNewValue();
  2105. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2106. $8=_st($9)._select_((function(each){
  2107. return smalltalk.withContext(function($ctx2) {
  2108. $10=self._sampleNewValue();
  2109. $ctx2.sendIdx["sampleNewValue"]=1;
  2110. return _st(each).__eq($10);
  2111. $ctx2.sendIdx["="]=1;
  2112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2113. $ctx1.sendIdx["select:"]=3;
  2114. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2115. $ctx1.sendIdx["assert:equals:"]=3;
  2116. $12=self._collectionWithNewValue();
  2117. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2118. $11=_st($12)._select_((function(each){
  2119. return smalltalk.withContext(function($ctx2) {
  2120. $13=self._sampleNewValue();
  2121. $ctx2.sendIdx["sampleNewValue"]=2;
  2122. return _st(each).__tild_eq($13);
  2123. $ctx2.sendIdx["~="]=1;
  2124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2125. $ctx1.sendIdx["select:"]=4;
  2126. $14=self._collection();
  2127. $ctx1.sendIdx["collection"]=4;
  2128. self._assert_equals_($11,$14);
  2129. $ctx1.sendIdx["assert:equals:"]=4;
  2130. $16=self._collection();
  2131. $ctx1.sendIdx["collection"]=5;
  2132. $15=_st($16)._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. $17=self._sampleNewValue();
  2135. $ctx2.sendIdx["sampleNewValue"]=3;
  2136. return _st(each).__eq($17);
  2137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2138. $ctx1.sendIdx["select:"]=5;
  2139. self._assert_equals_($15,_st(self._collectionClass())._new());
  2140. $ctx1.sendIdx["assert:equals:"]=5;
  2141. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2142. return smalltalk.withContext(function($ctx2) {
  2143. return _st(each).__tild_eq(self._sampleNewValue());
  2144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2145. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2146. args: [],
  2147. 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",
  2148. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2149. referencedClasses: []
  2150. }),
  2151. globals.CollectionTest);
  2152. smalltalk.addMethod(
  2153. smalltalk.method({
  2154. selector: "testSize",
  2155. protocol: 'tests',
  2156. fn: function (){
  2157. var self=this;
  2158. return smalltalk.withContext(function($ctx1) {
  2159. var $1,$2;
  2160. $1=_st(_st(self._collectionClass())._new())._size();
  2161. $ctx1.sendIdx["size"]=1;
  2162. self._assert_equals_($1,(0));
  2163. $ctx1.sendIdx["assert:equals:"]=1;
  2164. $2=_st(self._sampleNewValueAsCollection())._size();
  2165. $ctx1.sendIdx["size"]=2;
  2166. self._assert_equals_($2,(1));
  2167. $ctx1.sendIdx["assert:equals:"]=2;
  2168. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2169. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2170. args: [],
  2171. 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",
  2172. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2173. referencedClasses: []
  2174. }),
  2175. globals.CollectionTest);
  2176. smalltalk.addMethod(
  2177. smalltalk.method({
  2178. selector: "collectionClass",
  2179. protocol: 'fixture',
  2180. fn: function (){
  2181. var self=this;
  2182. return nil;
  2183. },
  2184. args: [],
  2185. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2186. messageSends: [],
  2187. referencedClasses: []
  2188. }),
  2189. globals.CollectionTest.klass);
  2190. smalltalk.addMethod(
  2191. smalltalk.method({
  2192. selector: "isAbstract",
  2193. protocol: 'testing',
  2194. fn: function (){
  2195. var self=this;
  2196. return smalltalk.withContext(function($ctx1) {
  2197. var $1;
  2198. $1=_st(self._collectionClass())._isNil();
  2199. return $1;
  2200. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2201. args: [],
  2202. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2203. messageSends: ["isNil", "collectionClass"],
  2204. referencedClasses: []
  2205. }),
  2206. globals.CollectionTest.klass);
  2207. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2208. smalltalk.addMethod(
  2209. smalltalk.method({
  2210. selector: "collectionWithNewValue",
  2211. protocol: 'fixture',
  2212. fn: function (){
  2213. var self=this;
  2214. return smalltalk.withContext(function($ctx1) {
  2215. self._subclassResponsibility();
  2216. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2217. args: [],
  2218. 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",
  2219. messageSends: ["subclassResponsibility"],
  2220. referencedClasses: []
  2221. }),
  2222. globals.IndexableCollectionTest);
  2223. smalltalk.addMethod(
  2224. smalltalk.method({
  2225. selector: "sampleNewIndex",
  2226. protocol: 'fixture',
  2227. fn: function (){
  2228. var self=this;
  2229. return smalltalk.withContext(function($ctx1) {
  2230. self._subclassResponsibility();
  2231. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2232. args: [],
  2233. 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",
  2234. messageSends: ["subclassResponsibility"],
  2235. referencedClasses: []
  2236. }),
  2237. globals.IndexableCollectionTest);
  2238. smalltalk.addMethod(
  2239. smalltalk.method({
  2240. selector: "sampleNonIndexesDo:",
  2241. protocol: 'fixture',
  2242. fn: function (aBlock){
  2243. var self=this;
  2244. return smalltalk.withContext(function($ctx1) {
  2245. self._subclassResponsibility();
  2246. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2247. args: ["aBlock"],
  2248. 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",
  2249. messageSends: ["subclassResponsibility"],
  2250. referencedClasses: []
  2251. }),
  2252. globals.IndexableCollectionTest);
  2253. smalltalk.addMethod(
  2254. smalltalk.method({
  2255. selector: "samplesDo:",
  2256. protocol: 'fixture',
  2257. fn: function (aBlock){
  2258. var self=this;
  2259. return smalltalk.withContext(function($ctx1) {
  2260. self._subclassResponsibility();
  2261. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2262. args: ["aBlock"],
  2263. 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",
  2264. messageSends: ["subclassResponsibility"],
  2265. referencedClasses: []
  2266. }),
  2267. globals.IndexableCollectionTest);
  2268. smalltalk.addMethod(
  2269. smalltalk.method({
  2270. selector: "testAt",
  2271. protocol: 'tests',
  2272. fn: function (){
  2273. var self=this;
  2274. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2275. return smalltalk.withContext(function($ctx1) {
  2276. var $1;
  2277. self._nonIndexesDo_((function(each){
  2278. return smalltalk.withContext(function($ctx2) {
  2279. return self._should_raise_((function(){
  2280. return smalltalk.withContext(function($ctx3) {
  2281. $1=self._collection();
  2282. $ctx3.sendIdx["collection"]=1;
  2283. return _st($1)._at_(each);
  2284. $ctx3.sendIdx["at:"]=1;
  2285. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2287. self._samplesDo_((function(index,value){
  2288. return smalltalk.withContext(function($ctx2) {
  2289. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2290. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2291. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2292. args: [],
  2293. 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 ]",
  2294. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2295. referencedClasses: ["Error"]
  2296. }),
  2297. globals.IndexableCollectionTest);
  2298. smalltalk.addMethod(
  2299. smalltalk.method({
  2300. selector: "testAtIfAbsent",
  2301. protocol: 'tests',
  2302. fn: function (){
  2303. var self=this;
  2304. return smalltalk.withContext(function($ctx1) {
  2305. var $2,$1,$3;
  2306. self._nonIndexesDo_((function(each){
  2307. return smalltalk.withContext(function($ctx2) {
  2308. $2=self._collection();
  2309. $ctx2.sendIdx["collection"]=1;
  2310. $1=_st($2)._at_ifAbsent_(each,(function(){
  2311. return smalltalk.withContext(function($ctx3) {
  2312. return self._sampleNewValue();
  2313. $ctx3.sendIdx["sampleNewValue"]=1;
  2314. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2315. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2316. $3=self._sampleNewValue();
  2317. $ctx2.sendIdx["sampleNewValue"]=2;
  2318. return self._assert_equals_($1,$3);
  2319. $ctx2.sendIdx["assert:equals:"]=1;
  2320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2321. self._samplesDo_((function(index,value){
  2322. return smalltalk.withContext(function($ctx2) {
  2323. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2324. return smalltalk.withContext(function($ctx3) {
  2325. return self._sampleNewValue();
  2326. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2327. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2328. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2329. args: [],
  2330. 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 ].",
  2331. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2332. referencedClasses: []
  2333. }),
  2334. globals.IndexableCollectionTest);
  2335. smalltalk.addMethod(
  2336. smalltalk.method({
  2337. selector: "testAtIfAbsentPut",
  2338. protocol: 'tests',
  2339. fn: function (){
  2340. var self=this;
  2341. var newCollection;
  2342. return smalltalk.withContext(function($ctx1) {
  2343. var $1;
  2344. newCollection=self._collection();
  2345. $ctx1.sendIdx["collection"]=1;
  2346. self._samplesDo_((function(index,value){
  2347. return smalltalk.withContext(function($ctx2) {
  2348. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2349. return smalltalk.withContext(function($ctx3) {
  2350. return self._sampleNewValue();
  2351. $ctx3.sendIdx["sampleNewValue"]=1;
  2352. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2353. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2354. return self._assert_equals_($1,value);
  2355. $ctx2.sendIdx["assert:equals:"]=1;
  2356. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2357. self._assert_equals_(newCollection,self._collection());
  2358. $ctx1.sendIdx["assert:equals:"]=2;
  2359. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2360. return smalltalk.withContext(function($ctx2) {
  2361. return self._sampleNewValue();
  2362. $ctx2.sendIdx["sampleNewValue"]=2;
  2363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2364. $ctx1.sendIdx["assert:equals:"]=3;
  2365. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2366. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2367. args: [],
  2368. 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",
  2369. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2370. referencedClasses: []
  2371. }),
  2372. globals.IndexableCollectionTest);
  2373. smalltalk.addMethod(
  2374. smalltalk.method({
  2375. selector: "testAtIfPresent",
  2376. protocol: 'tests',
  2377. fn: function (){
  2378. var self=this;
  2379. var visited,sentinel;
  2380. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2381. return smalltalk.withContext(function($ctx1) {
  2382. var $2,$1,$4,$3;
  2383. sentinel=_st($Object())._new();
  2384. self._nonIndexesDo_((function(each){
  2385. return smalltalk.withContext(function($ctx2) {
  2386. visited=nil;
  2387. visited;
  2388. $2=self._collection();
  2389. $ctx2.sendIdx["collection"]=1;
  2390. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2391. visited=value1;
  2392. visited;
  2393. return sentinel;
  2394. }));
  2395. $ctx2.sendIdx["at:ifPresent:"]=1;
  2396. self._assert_equals_($1,nil);
  2397. $ctx2.sendIdx["assert:equals:"]=1;
  2398. return self._assert_(_st(visited)._isNil());
  2399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2400. self._samplesDo_((function(index,value){
  2401. return smalltalk.withContext(function($ctx2) {
  2402. visited=nil;
  2403. visited;
  2404. $4=self._collection();
  2405. $ctx2.sendIdx["collection"]=2;
  2406. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2407. visited=value2;
  2408. visited;
  2409. return sentinel;
  2410. }));
  2411. self._assert_equals_($3,sentinel);
  2412. $ctx2.sendIdx["assert:equals:"]=2;
  2413. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2414. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2415. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2416. args: [],
  2417. 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) ]",
  2418. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2419. referencedClasses: ["Object"]
  2420. }),
  2421. globals.IndexableCollectionTest);
  2422. smalltalk.addMethod(
  2423. smalltalk.method({
  2424. selector: "testAtIfPresentIfAbsent",
  2425. protocol: 'tests',
  2426. fn: function (){
  2427. var self=this;
  2428. var visited,sentinel;
  2429. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2430. return smalltalk.withContext(function($ctx1) {
  2431. var $2,$1,$3,$5,$4;
  2432. sentinel=_st($Object())._new();
  2433. self._nonIndexesDo_((function(each){
  2434. return smalltalk.withContext(function($ctx2) {
  2435. visited=nil;
  2436. visited;
  2437. $2=self._collection();
  2438. $ctx2.sendIdx["collection"]=1;
  2439. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2440. visited=value1;
  2441. visited;
  2442. return sentinel;
  2443. }),(function(){
  2444. return smalltalk.withContext(function($ctx3) {
  2445. return self._sampleNewValue();
  2446. $ctx3.sendIdx["sampleNewValue"]=1;
  2447. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2448. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2449. $3=self._sampleNewValue();
  2450. $ctx2.sendIdx["sampleNewValue"]=2;
  2451. self._assert_equals_($1,$3);
  2452. $ctx2.sendIdx["assert:equals:"]=1;
  2453. return self._assert_(_st(visited)._isNil());
  2454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2455. self._samplesDo_((function(index,value){
  2456. return smalltalk.withContext(function($ctx2) {
  2457. visited=nil;
  2458. visited;
  2459. $5=self._collection();
  2460. $ctx2.sendIdx["collection"]=2;
  2461. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2462. visited=value2;
  2463. visited;
  2464. return sentinel;
  2465. }),(function(){
  2466. return smalltalk.withContext(function($ctx3) {
  2467. return self._sampleNewValue();
  2468. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2469. self._assert_equals_($4,sentinel);
  2470. $ctx2.sendIdx["assert:equals:"]=2;
  2471. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2472. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2473. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2474. args: [],
  2475. 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) ]",
  2476. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2477. referencedClasses: ["Object"]
  2478. }),
  2479. globals.IndexableCollectionTest);
  2480. smalltalk.addMethod(
  2481. smalltalk.method({
  2482. selector: "testAtPut",
  2483. protocol: 'tests',
  2484. fn: function (){
  2485. var self=this;
  2486. var newCollection;
  2487. return smalltalk.withContext(function($ctx1) {
  2488. newCollection=self._collection();
  2489. $ctx1.sendIdx["collection"]=1;
  2490. self._samplesDo_((function(index,value){
  2491. return smalltalk.withContext(function($ctx2) {
  2492. return _st(newCollection)._at_put_(index,value);
  2493. $ctx2.sendIdx["at:put:"]=1;
  2494. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2495. self._assert_equals_(newCollection,self._collection());
  2496. $ctx1.sendIdx["assert:equals:"]=1;
  2497. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2498. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2499. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2500. args: [],
  2501. 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",
  2502. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2503. referencedClasses: []
  2504. }),
  2505. globals.IndexableCollectionTest);
  2506. smalltalk.addMethod(
  2507. smalltalk.method({
  2508. selector: "testEquality",
  2509. protocol: 'tests',
  2510. fn: function (){
  2511. var self=this;
  2512. return smalltalk.withContext(function($ctx1) {
  2513. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2514. $2=self._collectionClass();
  2515. $ctx1.sendIdx["collectionClass"]=1;
  2516. $1=_st($2)._new();
  2517. $ctx1.sendIdx["new"]=1;
  2518. $4=self._collectionClass();
  2519. $ctx1.sendIdx["collectionClass"]=2;
  2520. $3=_st($4)._new();
  2521. $ctx1.sendIdx["new"]=2;
  2522. self._assert_equals_($1,$3);
  2523. $ctx1.sendIdx["assert:equals:"]=1;
  2524. $5=self._collection();
  2525. $ctx1.sendIdx["collection"]=1;
  2526. $6=self._collection();
  2527. $ctx1.sendIdx["collection"]=2;
  2528. self._assert_equals_($5,$6);
  2529. $ctx1.sendIdx["assert:equals:"]=2;
  2530. $7=self._collectionWithNewValue();
  2531. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2532. self._assert_equals_($7,self._collectionWithNewValue());
  2533. $10=self._collectionClass();
  2534. $ctx1.sendIdx["collectionClass"]=3;
  2535. $9=_st($10)._new();
  2536. $ctx1.sendIdx["new"]=3;
  2537. $11=self._collection();
  2538. $ctx1.sendIdx["collection"]=3;
  2539. $8=_st($9).__eq($11);
  2540. $ctx1.sendIdx["="]=1;
  2541. self._deny_($8);
  2542. $ctx1.sendIdx["deny:"]=1;
  2543. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2544. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2545. args: [],
  2546. 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",
  2547. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2548. referencedClasses: []
  2549. }),
  2550. globals.IndexableCollectionTest);
  2551. smalltalk.addMethod(
  2552. smalltalk.method({
  2553. selector: "testIndexOf",
  2554. protocol: 'tests',
  2555. fn: function (){
  2556. var self=this;
  2557. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2558. return smalltalk.withContext(function($ctx1) {
  2559. var $1;
  2560. self._should_raise_((function(){
  2561. return smalltalk.withContext(function($ctx2) {
  2562. $1=self._collection();
  2563. $ctx2.sendIdx["collection"]=1;
  2564. return _st($1)._indexOf_(self._sampleNewValue());
  2565. $ctx2.sendIdx["indexOf:"]=1;
  2566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2567. self._samplesDo_((function(index,value){
  2568. return smalltalk.withContext(function($ctx2) {
  2569. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2570. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2571. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2572. args: [],
  2573. 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 ]",
  2574. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2575. referencedClasses: ["Error"]
  2576. }),
  2577. globals.IndexableCollectionTest);
  2578. smalltalk.addMethod(
  2579. smalltalk.method({
  2580. selector: "testIndexOfWithNull",
  2581. protocol: 'tests',
  2582. fn: function (){
  2583. var self=this;
  2584. var jsNull;
  2585. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2586. return smalltalk.withContext(function($ctx1) {
  2587. var $1,$2;
  2588. jsNull=_st($JSON())._parse_("null");
  2589. self._samplesDo_((function(index,value){
  2590. return smalltalk.withContext(function($ctx2) {
  2591. $1=self._collection();
  2592. _st($1)._at_put_(index,jsNull);
  2593. $2=_st($1)._indexOf_(jsNull);
  2594. return self._assert_equals_($2,index);
  2595. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2596. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2597. args: [],
  2598. 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 ]",
  2599. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2600. referencedClasses: ["JSON"]
  2601. }),
  2602. globals.IndexableCollectionTest);
  2603. smalltalk.addMethod(
  2604. smalltalk.method({
  2605. selector: "testWithIndexDo",
  2606. protocol: 'tests',
  2607. fn: function (){
  2608. var self=this;
  2609. var collection;
  2610. return smalltalk.withContext(function($ctx1) {
  2611. collection=self._collection();
  2612. $ctx1.sendIdx["collection"]=1;
  2613. _st(self._collection())._withIndexDo_((function(each,index){
  2614. return smalltalk.withContext(function($ctx2) {
  2615. return self._assert_equals_(_st(collection)._at_(index),each);
  2616. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2617. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2618. args: [],
  2619. 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 ]",
  2620. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2621. referencedClasses: []
  2622. }),
  2623. globals.IndexableCollectionTest);
  2624. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2625. smalltalk.addMethod(
  2626. smalltalk.method({
  2627. selector: "collectionKeys",
  2628. protocol: 'fixture',
  2629. fn: function (){
  2630. var self=this;
  2631. return smalltalk.withContext(function($ctx1) {
  2632. self._subclassResponsibility();
  2633. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2634. args: [],
  2635. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2636. messageSends: ["subclassResponsibility"],
  2637. referencedClasses: []
  2638. }),
  2639. globals.AssociativeCollectionTest);
  2640. smalltalk.addMethod(
  2641. smalltalk.method({
  2642. selector: "collectionValues",
  2643. protocol: 'fixture',
  2644. fn: function (){
  2645. var self=this;
  2646. return smalltalk.withContext(function($ctx1) {
  2647. self._subclassResponsibility();
  2648. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2649. args: [],
  2650. source: "collectionValues\x0a\x09self subclassResponsibility",
  2651. messageSends: ["subclassResponsibility"],
  2652. referencedClasses: []
  2653. }),
  2654. globals.AssociativeCollectionTest);
  2655. smalltalk.addMethod(
  2656. smalltalk.method({
  2657. selector: "nonIndexesDo:",
  2658. protocol: 'fixture',
  2659. fn: function (aBlock){
  2660. var self=this;
  2661. return smalltalk.withContext(function($ctx1) {
  2662. _st(aBlock)._value_((5));
  2663. $ctx1.sendIdx["value:"]=1;
  2664. _st(aBlock)._value_("z");
  2665. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2666. args: ["aBlock"],
  2667. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2668. messageSends: ["value:"],
  2669. referencedClasses: []
  2670. }),
  2671. globals.AssociativeCollectionTest);
  2672. smalltalk.addMethod(
  2673. smalltalk.method({
  2674. selector: "sampleNewIndex",
  2675. protocol: 'fixture',
  2676. fn: function (){
  2677. var self=this;
  2678. return "new";
  2679. },
  2680. args: [],
  2681. source: "sampleNewIndex\x0a\x09^ 'new'",
  2682. messageSends: [],
  2683. referencedClasses: []
  2684. }),
  2685. globals.AssociativeCollectionTest);
  2686. smalltalk.addMethod(
  2687. smalltalk.method({
  2688. selector: "samplesDo:",
  2689. protocol: 'fixture',
  2690. fn: function (aBlock){
  2691. var self=this;
  2692. return smalltalk.withContext(function($ctx1) {
  2693. _st(aBlock)._value_value_("a",(2));
  2694. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2695. args: ["aBlock"],
  2696. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2697. messageSends: ["value:value:"],
  2698. referencedClasses: []
  2699. }),
  2700. globals.AssociativeCollectionTest);
  2701. smalltalk.addMethod(
  2702. smalltalk.method({
  2703. selector: "testAddAll",
  2704. protocol: 'tests',
  2705. fn: function (){
  2706. var self=this;
  2707. return smalltalk.withContext(function($ctx1) {
  2708. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2709. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2710. $ctx1.supercall = false;
  2711. $2=self._collection();
  2712. $ctx1.sendIdx["collection"]=1;
  2713. $3=$2;
  2714. $4=self._collection();
  2715. $ctx1.sendIdx["collection"]=2;
  2716. _st($3)._addAll_($4);
  2717. $ctx1.sendIdx["addAll:"]=1;
  2718. $5=_st($2)._yourself();
  2719. $ctx1.sendIdx["yourself"]=1;
  2720. $1=$5;
  2721. $6=self._collection();
  2722. $ctx1.sendIdx["collection"]=3;
  2723. self._assert_equals_($1,$6);
  2724. $ctx1.sendIdx["assert:equals:"]=1;
  2725. $8=self._collection();
  2726. $ctx1.sendIdx["collection"]=4;
  2727. $9=$8;
  2728. $10=self._collectionWithNewValue();
  2729. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2730. _st($9)._addAll_($10);
  2731. $ctx1.sendIdx["addAll:"]=2;
  2732. $11=_st($8)._yourself();
  2733. $ctx1.sendIdx["yourself"]=2;
  2734. $7=$11;
  2735. $12=self._collectionWithNewValue();
  2736. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2737. self._assert_equals_($7,$12);
  2738. $ctx1.sendIdx["assert:equals:"]=2;
  2739. $14=self._collectionWithNewValue();
  2740. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2741. _st($14)._addAll_(self._collection());
  2742. $15=_st($14)._yourself();
  2743. $13=$15;
  2744. self._assert_equals_($13,self._collectionWithNewValue());
  2745. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2746. args: [],
  2747. 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",
  2748. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2749. referencedClasses: []
  2750. }),
  2751. globals.AssociativeCollectionTest);
  2752. smalltalk.addMethod(
  2753. smalltalk.method({
  2754. selector: "testAsDictionary",
  2755. protocol: 'tests',
  2756. fn: function (){
  2757. var self=this;
  2758. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2759. return smalltalk.withContext(function($ctx1) {
  2760. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2761. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2762. args: [],
  2763. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2764. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2765. referencedClasses: ["Dictionary"]
  2766. }),
  2767. globals.AssociativeCollectionTest);
  2768. smalltalk.addMethod(
  2769. smalltalk.method({
  2770. selector: "testAsHashedCollection",
  2771. protocol: 'tests',
  2772. fn: function (){
  2773. var self=this;
  2774. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2775. return smalltalk.withContext(function($ctx1) {
  2776. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2777. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2778. args: [],
  2779. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2780. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2781. referencedClasses: ["HashedCollection"]
  2782. }),
  2783. globals.AssociativeCollectionTest);
  2784. smalltalk.addMethod(
  2785. smalltalk.method({
  2786. selector: "testComma",
  2787. protocol: 'tests',
  2788. fn: function (){
  2789. var self=this;
  2790. return smalltalk.withContext(function($ctx1) {
  2791. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2792. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2793. $ctx1.supercall = false;
  2794. $2=self._collection();
  2795. $ctx1.sendIdx["collection"]=1;
  2796. $3=self._collection();
  2797. $ctx1.sendIdx["collection"]=2;
  2798. $1=_st($2).__comma($3);
  2799. $ctx1.sendIdx[","]=1;
  2800. $4=self._collection();
  2801. $ctx1.sendIdx["collection"]=3;
  2802. self._assert_equals_($1,$4);
  2803. $ctx1.sendIdx["assert:equals:"]=1;
  2804. $6=self._collection();
  2805. $ctx1.sendIdx["collection"]=4;
  2806. $7=self._collectionWithNewValue();
  2807. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2808. $5=_st($6).__comma($7);
  2809. $ctx1.sendIdx[","]=2;
  2810. $8=self._collectionWithNewValue();
  2811. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2812. self._assert_equals_($5,$8);
  2813. $ctx1.sendIdx["assert:equals:"]=2;
  2814. $10=self._collectionWithNewValue();
  2815. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2816. $9=_st($10).__comma(self._collection());
  2817. self._assert_equals_($9,self._collectionWithNewValue());
  2818. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2819. args: [],
  2820. 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",
  2821. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2822. referencedClasses: []
  2823. }),
  2824. globals.AssociativeCollectionTest);
  2825. smalltalk.addMethod(
  2826. smalltalk.method({
  2827. selector: "testFrom",
  2828. protocol: 'tests',
  2829. fn: function (){
  2830. var self=this;
  2831. var associations;
  2832. return smalltalk.withContext(function($ctx1) {
  2833. var $1;
  2834. $1="a".__minus_gt((1));
  2835. $ctx1.sendIdx["->"]=1;
  2836. associations=[$1,"b".__minus_gt((2))];
  2837. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2838. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2839. args: [],
  2840. 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 }.",
  2841. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2842. referencedClasses: []
  2843. }),
  2844. globals.AssociativeCollectionTest);
  2845. smalltalk.addMethod(
  2846. smalltalk.method({
  2847. selector: "testKeys",
  2848. protocol: 'tests',
  2849. fn: function (){
  2850. var self=this;
  2851. return smalltalk.withContext(function($ctx1) {
  2852. var $2,$1,$3,$4;
  2853. $2=_st(_st(self._collectionClass())._new())._keys();
  2854. $ctx1.sendIdx["keys"]=1;
  2855. $1=_st($2)._isEmpty();
  2856. self._assert_($1);
  2857. $3=_st(self._collection())._keys();
  2858. $ctx1.sendIdx["keys"]=2;
  2859. $4=self._collectionKeys();
  2860. $ctx1.sendIdx["collectionKeys"]=1;
  2861. self._assertSameContents_as_($3,$4);
  2862. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2863. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2864. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2865. args: [],
  2866. 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 }",
  2867. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2868. referencedClasses: []
  2869. }),
  2870. globals.AssociativeCollectionTest);
  2871. smalltalk.addMethod(
  2872. smalltalk.method({
  2873. selector: "testNewFromPairs",
  2874. protocol: 'tests',
  2875. fn: function (){
  2876. var self=this;
  2877. var flattenedAssociations;
  2878. return smalltalk.withContext(function($ctx1) {
  2879. flattenedAssociations=["a",(1),"b",(2)];
  2880. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2881. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2882. args: [],
  2883. 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 }.",
  2884. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2885. referencedClasses: []
  2886. }),
  2887. globals.AssociativeCollectionTest);
  2888. smalltalk.addMethod(
  2889. smalltalk.method({
  2890. selector: "testPrintString",
  2891. protocol: 'tests',
  2892. fn: function (){
  2893. var self=this;
  2894. return smalltalk.withContext(function($ctx1) {
  2895. var $3,$2,$4,$1,$5;
  2896. $3=self._collectionClass();
  2897. $ctx1.sendIdx["collectionClass"]=1;
  2898. $2=_st($3)._new();
  2899. _st($2)._at_put_("firstname","James");
  2900. $ctx1.sendIdx["at:put:"]=1;
  2901. _st($2)._at_put_("lastname","Bond");
  2902. $4=_st($2)._printString();
  2903. $1=$4;
  2904. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2905. $ctx1.sendIdx[","]=1;
  2906. self._assert_equals_($1,$5);
  2907. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2908. args: [],
  2909. 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'')'",
  2910. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2911. referencedClasses: []
  2912. }),
  2913. globals.AssociativeCollectionTest);
  2914. smalltalk.addMethod(
  2915. smalltalk.method({
  2916. selector: "testRemoveKey",
  2917. protocol: 'tests',
  2918. fn: function (){
  2919. var self=this;
  2920. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2921. return smalltalk.withContext(function($ctx1) {
  2922. var $1,$2,$3,$5,$6,$4,$7,$8;
  2923. self._nonIndexesDo_((function(each){
  2924. var collection;
  2925. return smalltalk.withContext(function($ctx2) {
  2926. collection=self._collection();
  2927. $ctx2.sendIdx["collection"]=1;
  2928. collection;
  2929. self._should_raise_((function(){
  2930. return smalltalk.withContext(function($ctx3) {
  2931. return _st(collection)._removeKey_(each);
  2932. $ctx3.sendIdx["removeKey:"]=1;
  2933. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2934. $1=collection;
  2935. $2=self._collection();
  2936. $ctx2.sendIdx["collection"]=2;
  2937. return self._assert_equals_($1,$2);
  2938. $ctx2.sendIdx["assert:equals:"]=1;
  2939. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2940. self._samplesDo_((function(index,value){
  2941. var collection;
  2942. return smalltalk.withContext(function($ctx2) {
  2943. collection=self._collection();
  2944. $ctx2.sendIdx["collection"]=3;
  2945. collection;
  2946. $3=_st(collection)._removeKey_(index);
  2947. $ctx2.sendIdx["removeKey:"]=2;
  2948. self._assert_equals_($3,value);
  2949. $ctx2.sendIdx["assert:equals:"]=2;
  2950. $5=collection;
  2951. $6=self._collection();
  2952. $ctx2.sendIdx["collection"]=4;
  2953. $4=_st($5).__eq($6);
  2954. return self._deny_($4);
  2955. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2956. $7=self._collectionWithNewValue();
  2957. _st($7)._removeKey_(self._sampleNewIndex());
  2958. $8=_st($7)._yourself();
  2959. self._assert_equals_($8,self._collection());
  2960. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2961. args: [],
  2962. 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",
  2963. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2964. referencedClasses: ["Error"]
  2965. }),
  2966. globals.AssociativeCollectionTest);
  2967. smalltalk.addMethod(
  2968. smalltalk.method({
  2969. selector: "testRemoveKeyIfAbsent",
  2970. protocol: 'tests',
  2971. fn: function (){
  2972. var self=this;
  2973. return smalltalk.withContext(function($ctx1) {
  2974. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2975. self._nonIndexesDo_((function(each){
  2976. var collection;
  2977. return smalltalk.withContext(function($ctx2) {
  2978. collection=self._collection();
  2979. $ctx2.sendIdx["collection"]=1;
  2980. collection;
  2981. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2982. return smalltalk.withContext(function($ctx3) {
  2983. return self._sampleNewValue();
  2984. $ctx3.sendIdx["sampleNewValue"]=1;
  2985. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2986. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2987. $2=self._sampleNewValue();
  2988. $ctx2.sendIdx["sampleNewValue"]=2;
  2989. self._assert_equals_($1,$2);
  2990. $ctx2.sendIdx["assert:equals:"]=1;
  2991. $3=collection;
  2992. $4=self._collection();
  2993. $ctx2.sendIdx["collection"]=2;
  2994. return self._assert_equals_($3,$4);
  2995. $ctx2.sendIdx["assert:equals:"]=2;
  2996. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2997. self._samplesDo_((function(index,value){
  2998. var collection;
  2999. return smalltalk.withContext(function($ctx2) {
  3000. collection=self._collection();
  3001. $ctx2.sendIdx["collection"]=3;
  3002. collection;
  3003. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3004. return smalltalk.withContext(function($ctx3) {
  3005. return self._sampleNewValue();
  3006. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3007. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3008. self._assert_equals_($5,value);
  3009. $ctx2.sendIdx["assert:equals:"]=3;
  3010. $7=collection;
  3011. $8=self._collection();
  3012. $ctx2.sendIdx["collection"]=4;
  3013. $6=_st($7).__eq($8);
  3014. return self._deny_($6);
  3015. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3016. $9=self._collectionWithNewValue();
  3017. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3018. return smalltalk.withContext(function($ctx2) {
  3019. return self._assert_(false);
  3020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3021. $10=_st($9)._yourself();
  3022. self._assert_equals_($10,self._collection());
  3023. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3024. args: [],
  3025. 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",
  3026. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3027. referencedClasses: []
  3028. }),
  3029. globals.AssociativeCollectionTest);
  3030. smalltalk.addMethod(
  3031. smalltalk.method({
  3032. selector: "testValues",
  3033. protocol: 'tests',
  3034. fn: function (){
  3035. var self=this;
  3036. return smalltalk.withContext(function($ctx1) {
  3037. var $2,$1,$3,$4;
  3038. $2=_st(_st(self._collectionClass())._new())._values();
  3039. $ctx1.sendIdx["values"]=1;
  3040. $1=_st($2)._isEmpty();
  3041. self._assert_($1);
  3042. $3=_st(self._collection())._values();
  3043. $ctx1.sendIdx["values"]=2;
  3044. $4=self._collectionValues();
  3045. $ctx1.sendIdx["collectionValues"]=1;
  3046. self._assertSameContents_as_($3,$4);
  3047. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3048. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3049. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3050. args: [],
  3051. 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 }",
  3052. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3053. referencedClasses: []
  3054. }),
  3055. globals.AssociativeCollectionTest);
  3056. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3057. smalltalk.addMethod(
  3058. smalltalk.method({
  3059. selector: "collection",
  3060. protocol: 'fixture',
  3061. fn: function (){
  3062. var self=this;
  3063. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3064. return smalltalk.withContext(function($ctx1) {
  3065. var $2,$3,$1;
  3066. $2=_st($Dictionary())._new();
  3067. _st($2)._at_put_((1),(1));
  3068. $ctx1.sendIdx["at:put:"]=1;
  3069. _st($2)._at_put_("a",(2));
  3070. $ctx1.sendIdx["at:put:"]=2;
  3071. _st($2)._at_put_(true,(3));
  3072. $ctx1.sendIdx["at:put:"]=3;
  3073. _st($2)._at_put_((1).__at((3)),(-4));
  3074. $3=_st($2)._yourself();
  3075. $1=$3;
  3076. return $1;
  3077. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3078. args: [],
  3079. 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",
  3080. messageSends: ["at:put:", "new", "@", "yourself"],
  3081. referencedClasses: ["Dictionary"]
  3082. }),
  3083. globals.DictionaryTest);
  3084. smalltalk.addMethod(
  3085. smalltalk.method({
  3086. selector: "collectionKeys",
  3087. protocol: 'fixture',
  3088. fn: function (){
  3089. var self=this;
  3090. return smalltalk.withContext(function($ctx1) {
  3091. var $1;
  3092. $1=[(1),"a",true,(1).__at((3))];
  3093. return $1;
  3094. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3095. args: [],
  3096. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3097. messageSends: ["@"],
  3098. referencedClasses: []
  3099. }),
  3100. globals.DictionaryTest);
  3101. smalltalk.addMethod(
  3102. smalltalk.method({
  3103. selector: "collectionOfPrintStrings",
  3104. protocol: 'fixture',
  3105. fn: function (){
  3106. var self=this;
  3107. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3108. return smalltalk.withContext(function($ctx1) {
  3109. var $2,$3,$1;
  3110. $2=_st($Dictionary())._new();
  3111. _st($2)._at_put_((1),"1");
  3112. $ctx1.sendIdx["at:put:"]=1;
  3113. _st($2)._at_put_("a","2");
  3114. $ctx1.sendIdx["at:put:"]=2;
  3115. _st($2)._at_put_(true,"3");
  3116. $ctx1.sendIdx["at:put:"]=3;
  3117. _st($2)._at_put_((1).__at((3)),"-4");
  3118. $3=_st($2)._yourself();
  3119. $1=$3;
  3120. return $1;
  3121. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3122. args: [],
  3123. 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",
  3124. messageSends: ["at:put:", "new", "@", "yourself"],
  3125. referencedClasses: ["Dictionary"]
  3126. }),
  3127. globals.DictionaryTest);
  3128. smalltalk.addMethod(
  3129. smalltalk.method({
  3130. selector: "collectionSize",
  3131. protocol: 'fixture',
  3132. fn: function (){
  3133. var self=this;
  3134. return (4);
  3135. },
  3136. args: [],
  3137. source: "collectionSize\x0a\x09^ 4",
  3138. messageSends: [],
  3139. referencedClasses: []
  3140. }),
  3141. globals.DictionaryTest);
  3142. smalltalk.addMethod(
  3143. smalltalk.method({
  3144. selector: "collectionValues",
  3145. protocol: 'fixture',
  3146. fn: function (){
  3147. var self=this;
  3148. var $1;
  3149. $1=[(1),(2),(3),(-4)];
  3150. return $1;
  3151. },
  3152. args: [],
  3153. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3154. messageSends: [],
  3155. referencedClasses: []
  3156. }),
  3157. globals.DictionaryTest);
  3158. smalltalk.addMethod(
  3159. smalltalk.method({
  3160. selector: "collectionWithDuplicates",
  3161. protocol: 'fixture',
  3162. fn: function (){
  3163. var self=this;
  3164. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3165. return smalltalk.withContext(function($ctx1) {
  3166. var $2,$3,$1;
  3167. $2=_st($Dictionary())._new();
  3168. _st($2)._at_put_((1),(1));
  3169. $ctx1.sendIdx["at:put:"]=1;
  3170. _st($2)._at_put_("a",(2));
  3171. $ctx1.sendIdx["at:put:"]=2;
  3172. _st($2)._at_put_(true,(3));
  3173. $ctx1.sendIdx["at:put:"]=3;
  3174. _st($2)._at_put_((4),(-4));
  3175. $ctx1.sendIdx["at:put:"]=4;
  3176. _st($2)._at_put_("b",(1));
  3177. $ctx1.sendIdx["at:put:"]=5;
  3178. _st($2)._at_put_((3),(3));
  3179. $ctx1.sendIdx["at:put:"]=6;
  3180. _st($2)._at_put_(false,(12));
  3181. $3=_st($2)._yourself();
  3182. $1=$3;
  3183. return $1;
  3184. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3185. args: [],
  3186. 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",
  3187. messageSends: ["at:put:", "new", "yourself"],
  3188. referencedClasses: ["Dictionary"]
  3189. }),
  3190. globals.DictionaryTest);
  3191. smalltalk.addMethod(
  3192. smalltalk.method({
  3193. selector: "collectionWithNewValue",
  3194. protocol: 'fixture',
  3195. fn: function (){
  3196. var self=this;
  3197. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3198. return smalltalk.withContext(function($ctx1) {
  3199. var $2,$3,$1;
  3200. $2=_st($Dictionary())._new();
  3201. _st($2)._at_put_((1),(1));
  3202. $ctx1.sendIdx["at:put:"]=1;
  3203. _st($2)._at_put_("a",(2));
  3204. $ctx1.sendIdx["at:put:"]=2;
  3205. _st($2)._at_put_(true,(3));
  3206. $ctx1.sendIdx["at:put:"]=3;
  3207. _st($2)._at_put_((1).__at((3)),(-4));
  3208. $ctx1.sendIdx["at:put:"]=4;
  3209. _st($2)._at_put_("new","N");
  3210. $3=_st($2)._yourself();
  3211. $1=$3;
  3212. return $1;
  3213. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3214. args: [],
  3215. 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",
  3216. messageSends: ["at:put:", "new", "@", "yourself"],
  3217. referencedClasses: ["Dictionary"]
  3218. }),
  3219. globals.DictionaryTest);
  3220. smalltalk.addMethod(
  3221. smalltalk.method({
  3222. selector: "sampleNewValueAsCollection",
  3223. protocol: 'fixture',
  3224. fn: function (){
  3225. var self=this;
  3226. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3227. return smalltalk.withContext(function($ctx1) {
  3228. var $2,$3,$1;
  3229. $2=_st($Dictionary())._new();
  3230. _st($2)._at_put_("new","N");
  3231. $3=_st($2)._yourself();
  3232. $1=$3;
  3233. return $1;
  3234. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3235. args: [],
  3236. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3237. messageSends: ["at:put:", "new", "yourself"],
  3238. referencedClasses: ["Dictionary"]
  3239. }),
  3240. globals.DictionaryTest);
  3241. smalltalk.addMethod(
  3242. smalltalk.method({
  3243. selector: "samplesDo:",
  3244. protocol: 'fixture',
  3245. fn: function (aBlock){
  3246. var self=this;
  3247. return smalltalk.withContext(function($ctx1) {
  3248. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3249. $ctx1.supercall = false;
  3250. _st(aBlock)._value_value_(true,(3));
  3251. $ctx1.sendIdx["value:value:"]=1;
  3252. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3254. args: ["aBlock"],
  3255. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3256. messageSends: ["samplesDo:", "value:value:", "@"],
  3257. referencedClasses: []
  3258. }),
  3259. globals.DictionaryTest);
  3260. smalltalk.addMethod(
  3261. smalltalk.method({
  3262. selector: "testAccessing",
  3263. protocol: 'tests',
  3264. fn: function (){
  3265. var self=this;
  3266. var d;
  3267. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3268. return smalltalk.withContext(function($ctx1) {
  3269. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3270. d=_st($Dictionary())._new();
  3271. _st(d)._at_put_("hello","world");
  3272. $ctx1.sendIdx["at:put:"]=1;
  3273. $1=_st(d)._at_("hello");
  3274. $ctx1.sendIdx["at:"]=1;
  3275. self._assert_equals_($1,"world");
  3276. $ctx1.sendIdx["assert:equals:"]=1;
  3277. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3278. return nil;
  3279. }));
  3280. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3281. self._assert_equals_($2,"world");
  3282. $ctx1.sendIdx["assert:equals:"]=2;
  3283. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3284. return nil;
  3285. }))).__eq("world"));
  3286. $ctx1.sendIdx["deny:"]=1;
  3287. $3=_st(d)._includesKey_("hello");
  3288. $ctx1.sendIdx["includesKey:"]=1;
  3289. self._assert_($3);
  3290. $ctx1.sendIdx["assert:"]=1;
  3291. $4=_st(d)._includesKey_("foo");
  3292. $ctx1.sendIdx["includesKey:"]=2;
  3293. self._deny_($4);
  3294. $ctx1.sendIdx["deny:"]=2;
  3295. _st(d)._at_put_((1),(2));
  3296. $ctx1.sendIdx["at:put:"]=2;
  3297. $5=_st(d)._at_((1));
  3298. $ctx1.sendIdx["at:"]=2;
  3299. self._assert_equals_($5,(2));
  3300. $ctx1.sendIdx["assert:equals:"]=3;
  3301. $6=d;
  3302. $7=(1).__at((3));
  3303. $ctx1.sendIdx["@"]=1;
  3304. _st($6)._at_put_($7,(3));
  3305. $9=d;
  3306. $10=(1).__at((3));
  3307. $ctx1.sendIdx["@"]=2;
  3308. $8=_st($9)._at_($10);
  3309. self._assert_equals_($8,(3));
  3310. $12=d;
  3311. $13=(1).__at((3));
  3312. $ctx1.sendIdx["@"]=3;
  3313. $11=_st($12)._includesKey_($13);
  3314. $ctx1.sendIdx["includesKey:"]=3;
  3315. self._assert_($11);
  3316. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3317. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3318. args: [],
  3319. 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)",
  3320. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3321. referencedClasses: ["Dictionary"]
  3322. }),
  3323. globals.DictionaryTest);
  3324. smalltalk.addMethod(
  3325. smalltalk.method({
  3326. selector: "testDynamicDictionaries",
  3327. protocol: 'tests',
  3328. fn: function (){
  3329. var self=this;
  3330. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3331. return smalltalk.withContext(function($ctx1) {
  3332. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3333. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3334. args: [],
  3335. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3336. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3337. referencedClasses: ["Dictionary"]
  3338. }),
  3339. globals.DictionaryTest);
  3340. smalltalk.addMethod(
  3341. smalltalk.method({
  3342. selector: "collectionClass",
  3343. protocol: 'fixture',
  3344. fn: function (){
  3345. var self=this;
  3346. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3347. return $Dictionary();
  3348. },
  3349. args: [],
  3350. source: "collectionClass\x0a\x09^ Dictionary",
  3351. messageSends: [],
  3352. referencedClasses: ["Dictionary"]
  3353. }),
  3354. globals.DictionaryTest.klass);
  3355. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3356. smalltalk.addMethod(
  3357. smalltalk.method({
  3358. selector: "collection",
  3359. protocol: 'fixture',
  3360. fn: function (){
  3361. var self=this;
  3362. var $1;
  3363. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3364. return $1;
  3365. },
  3366. args: [],
  3367. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3368. messageSends: [],
  3369. referencedClasses: []
  3370. }),
  3371. globals.HashedCollectionTest);
  3372. smalltalk.addMethod(
  3373. smalltalk.method({
  3374. selector: "collectionKeys",
  3375. protocol: 'fixture',
  3376. fn: function (){
  3377. var self=this;
  3378. var $1;
  3379. $1=["b","a","c","d"];
  3380. return $1;
  3381. },
  3382. args: [],
  3383. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3384. messageSends: [],
  3385. referencedClasses: []
  3386. }),
  3387. globals.HashedCollectionTest);
  3388. smalltalk.addMethod(
  3389. smalltalk.method({
  3390. selector: "collectionOfPrintStrings",
  3391. protocol: 'fixture',
  3392. fn: function (){
  3393. var self=this;
  3394. var $1;
  3395. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3396. return $1;
  3397. },
  3398. args: [],
  3399. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3400. messageSends: [],
  3401. referencedClasses: []
  3402. }),
  3403. globals.HashedCollectionTest);
  3404. smalltalk.addMethod(
  3405. smalltalk.method({
  3406. selector: "collectionSize",
  3407. protocol: 'fixture',
  3408. fn: function (){
  3409. var self=this;
  3410. return (4);
  3411. },
  3412. args: [],
  3413. source: "collectionSize\x0a\x09^ 4",
  3414. messageSends: [],
  3415. referencedClasses: []
  3416. }),
  3417. globals.HashedCollectionTest);
  3418. smalltalk.addMethod(
  3419. smalltalk.method({
  3420. selector: "collectionValues",
  3421. protocol: 'fixture',
  3422. fn: function (){
  3423. var self=this;
  3424. var $1;
  3425. $1=[(1),(2),(3),(-4)];
  3426. return $1;
  3427. },
  3428. args: [],
  3429. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3430. messageSends: [],
  3431. referencedClasses: []
  3432. }),
  3433. globals.HashedCollectionTest);
  3434. smalltalk.addMethod(
  3435. smalltalk.method({
  3436. selector: "collectionWithDuplicates",
  3437. protocol: 'fixture',
  3438. fn: function (){
  3439. var self=this;
  3440. var $1;
  3441. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3442. return $1;
  3443. },
  3444. args: [],
  3445. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3446. messageSends: [],
  3447. referencedClasses: []
  3448. }),
  3449. globals.HashedCollectionTest);
  3450. smalltalk.addMethod(
  3451. smalltalk.method({
  3452. selector: "collectionWithNewValue",
  3453. protocol: 'fixture',
  3454. fn: function (){
  3455. var self=this;
  3456. var $1;
  3457. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3458. return $1;
  3459. },
  3460. args: [],
  3461. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3462. messageSends: [],
  3463. referencedClasses: []
  3464. }),
  3465. globals.HashedCollectionTest);
  3466. smalltalk.addMethod(
  3467. smalltalk.method({
  3468. selector: "sampleNewValueAsCollection",
  3469. protocol: 'fixture',
  3470. fn: function (){
  3471. var self=this;
  3472. var $1;
  3473. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3474. return $1;
  3475. },
  3476. args: [],
  3477. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3478. messageSends: [],
  3479. referencedClasses: []
  3480. }),
  3481. globals.HashedCollectionTest);
  3482. smalltalk.addMethod(
  3483. smalltalk.method({
  3484. selector: "testDynamicDictionaries",
  3485. protocol: 'tests',
  3486. fn: function (){
  3487. var self=this;
  3488. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3489. return smalltalk.withContext(function($ctx1) {
  3490. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3491. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3492. args: [],
  3493. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3494. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3495. referencedClasses: ["HashedCollection"]
  3496. }),
  3497. globals.HashedCollectionTest);
  3498. smalltalk.addMethod(
  3499. smalltalk.method({
  3500. selector: "collectionClass",
  3501. protocol: 'fixture',
  3502. fn: function (){
  3503. var self=this;
  3504. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3505. return $HashedCollection();
  3506. },
  3507. args: [],
  3508. source: "collectionClass\x0a\x09^ HashedCollection",
  3509. messageSends: [],
  3510. referencedClasses: ["HashedCollection"]
  3511. }),
  3512. globals.HashedCollectionTest.klass);
  3513. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3514. smalltalk.addMethod(
  3515. smalltalk.method({
  3516. selector: "collectionFirst",
  3517. protocol: 'fixture',
  3518. fn: function (){
  3519. var self=this;
  3520. return smalltalk.withContext(function($ctx1) {
  3521. self._subclassResponsibility();
  3522. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3523. args: [],
  3524. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3525. messageSends: ["subclassResponsibility"],
  3526. referencedClasses: []
  3527. }),
  3528. globals.SequenceableCollectionTest);
  3529. smalltalk.addMethod(
  3530. smalltalk.method({
  3531. selector: "collectionFirstTwo",
  3532. protocol: 'fixture',
  3533. fn: function (){
  3534. var self=this;
  3535. return smalltalk.withContext(function($ctx1) {
  3536. self._subclassResponsibility();
  3537. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3538. args: [],
  3539. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3540. messageSends: ["subclassResponsibility"],
  3541. referencedClasses: []
  3542. }),
  3543. globals.SequenceableCollectionTest);
  3544. smalltalk.addMethod(
  3545. smalltalk.method({
  3546. selector: "collectionLast",
  3547. protocol: 'fixture',
  3548. fn: function (){
  3549. var self=this;
  3550. return smalltalk.withContext(function($ctx1) {
  3551. self._subclassResponsibility();
  3552. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3553. args: [],
  3554. source: "collectionLast\x0a\x09self subclassResponsibility",
  3555. messageSends: ["subclassResponsibility"],
  3556. referencedClasses: []
  3557. }),
  3558. globals.SequenceableCollectionTest);
  3559. smalltalk.addMethod(
  3560. smalltalk.method({
  3561. selector: "collectionLastTwo",
  3562. protocol: 'fixture',
  3563. fn: function (){
  3564. var self=this;
  3565. return smalltalk.withContext(function($ctx1) {
  3566. self._subclassResponsibility();
  3567. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3568. args: [],
  3569. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3570. messageSends: ["subclassResponsibility"],
  3571. referencedClasses: []
  3572. }),
  3573. globals.SequenceableCollectionTest);
  3574. smalltalk.addMethod(
  3575. smalltalk.method({
  3576. selector: "nonIndexesDo:",
  3577. protocol: 'fixture',
  3578. fn: function (aBlock){
  3579. var self=this;
  3580. return smalltalk.withContext(function($ctx1) {
  3581. _st(aBlock)._value_((0));
  3582. $ctx1.sendIdx["value:"]=1;
  3583. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3584. $ctx1.sendIdx["value:"]=2;
  3585. _st(aBlock)._value_("z");
  3586. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3587. args: ["aBlock"],
  3588. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3589. messageSends: ["value:", "+", "collectionSize"],
  3590. referencedClasses: []
  3591. }),
  3592. globals.SequenceableCollectionTest);
  3593. smalltalk.addMethod(
  3594. smalltalk.method({
  3595. selector: "samplesDo:",
  3596. protocol: 'fixture',
  3597. fn: function (aBlock){
  3598. var self=this;
  3599. return smalltalk.withContext(function($ctx1) {
  3600. _st(aBlock)._value_value_((1),self._collectionFirst());
  3601. $ctx1.sendIdx["value:value:"]=1;
  3602. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3603. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3604. args: ["aBlock"],
  3605. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3606. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3607. referencedClasses: []
  3608. }),
  3609. globals.SequenceableCollectionTest);
  3610. smalltalk.addMethod(
  3611. smalltalk.method({
  3612. selector: "testBeginsWith",
  3613. protocol: 'tests',
  3614. fn: function (){
  3615. var self=this;
  3616. return smalltalk.withContext(function($ctx1) {
  3617. var $2,$1,$4,$5,$3,$7,$6;
  3618. $2=self._collection();
  3619. $ctx1.sendIdx["collection"]=1;
  3620. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3621. $ctx1.sendIdx["beginsWith:"]=1;
  3622. self._assert_($1);
  3623. $ctx1.sendIdx["assert:"]=1;
  3624. $4=self._collection();
  3625. $ctx1.sendIdx["collection"]=2;
  3626. $5=self._collection();
  3627. $ctx1.sendIdx["collection"]=3;
  3628. $3=_st($4)._beginsWith_($5);
  3629. $ctx1.sendIdx["beginsWith:"]=2;
  3630. self._assert_($3);
  3631. $ctx1.sendIdx["assert:"]=2;
  3632. $7=self._collection();
  3633. $ctx1.sendIdx["collection"]=4;
  3634. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3635. $ctx1.sendIdx["beginsWith:"]=3;
  3636. self._assert_($6);
  3637. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3638. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3639. args: [],
  3640. 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)",
  3641. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3642. referencedClasses: []
  3643. }),
  3644. globals.SequenceableCollectionTest);
  3645. smalltalk.addMethod(
  3646. smalltalk.method({
  3647. selector: "testEndsWith",
  3648. protocol: 'tests',
  3649. fn: function (){
  3650. var self=this;
  3651. return smalltalk.withContext(function($ctx1) {
  3652. var $2,$1,$4,$5,$3,$7,$6;
  3653. $2=self._collection();
  3654. $ctx1.sendIdx["collection"]=1;
  3655. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3656. $ctx1.sendIdx["endsWith:"]=1;
  3657. self._assert_($1);
  3658. $ctx1.sendIdx["assert:"]=1;
  3659. $4=self._collection();
  3660. $ctx1.sendIdx["collection"]=2;
  3661. $5=self._collection();
  3662. $ctx1.sendIdx["collection"]=3;
  3663. $3=_st($4)._endsWith_($5);
  3664. $ctx1.sendIdx["endsWith:"]=2;
  3665. self._assert_($3);
  3666. $ctx1.sendIdx["assert:"]=2;
  3667. $7=self._collection();
  3668. $ctx1.sendIdx["collection"]=4;
  3669. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3670. $ctx1.sendIdx["endsWith:"]=3;
  3671. self._assert_($6);
  3672. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3673. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3674. args: [],
  3675. 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)",
  3676. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3677. referencedClasses: []
  3678. }),
  3679. globals.SequenceableCollectionTest);
  3680. smalltalk.addMethod(
  3681. smalltalk.method({
  3682. selector: "testFirst",
  3683. protocol: 'tests',
  3684. fn: function (){
  3685. var self=this;
  3686. return smalltalk.withContext(function($ctx1) {
  3687. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3688. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3689. args: [],
  3690. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3691. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3692. referencedClasses: []
  3693. }),
  3694. globals.SequenceableCollectionTest);
  3695. smalltalk.addMethod(
  3696. smalltalk.method({
  3697. selector: "testFirstN",
  3698. protocol: 'tests',
  3699. fn: function (){
  3700. var self=this;
  3701. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3702. return smalltalk.withContext(function($ctx1) {
  3703. var $2,$1,$4,$3,$6,$5,$7;
  3704. $2=self._collection();
  3705. $ctx1.sendIdx["collection"]=1;
  3706. $1=_st($2)._first_((2));
  3707. $ctx1.sendIdx["first:"]=1;
  3708. self._assert_equals_($1,self._collectionFirstTwo());
  3709. $ctx1.sendIdx["assert:equals:"]=1;
  3710. $4=self._collection();
  3711. $ctx1.sendIdx["collection"]=2;
  3712. $3=_st($4)._first_((0));
  3713. $ctx1.sendIdx["first:"]=2;
  3714. self._assert_equals_($3,_st(self._collectionClass())._new());
  3715. $ctx1.sendIdx["assert:equals:"]=2;
  3716. $6=self._collection();
  3717. $ctx1.sendIdx["collection"]=3;
  3718. $5=_st($6)._first_(self._collectionSize());
  3719. $ctx1.sendIdx["first:"]=3;
  3720. $7=self._collection();
  3721. $ctx1.sendIdx["collection"]=4;
  3722. self._assert_equals_($5,$7);
  3723. self._should_raise_((function(){
  3724. return smalltalk.withContext(function($ctx2) {
  3725. return _st(self._collection())._first_((33));
  3726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3727. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3728. args: [],
  3729. 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",
  3730. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3731. referencedClasses: ["Error"]
  3732. }),
  3733. globals.SequenceableCollectionTest);
  3734. smalltalk.addMethod(
  3735. smalltalk.method({
  3736. selector: "testFourth",
  3737. protocol: 'tests',
  3738. fn: function (){
  3739. var self=this;
  3740. return smalltalk.withContext(function($ctx1) {
  3741. var $2,$1;
  3742. $2=self._collection();
  3743. $ctx1.sendIdx["collection"]=1;
  3744. $1=_st($2)._fourth();
  3745. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3746. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3747. args: [],
  3748. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3749. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3750. referencedClasses: []
  3751. }),
  3752. globals.SequenceableCollectionTest);
  3753. smalltalk.addMethod(
  3754. smalltalk.method({
  3755. selector: "testIndexOfStartingAt",
  3756. protocol: 'tests',
  3757. fn: function (){
  3758. var self=this;
  3759. var jsNull;
  3760. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3761. return smalltalk.withContext(function($ctx1) {
  3762. var $2,$1,$4,$3;
  3763. jsNull=_st($JSON())._parse_("null");
  3764. self._samplesDo_((function(index,value){
  3765. return smalltalk.withContext(function($ctx2) {
  3766. $2=self._collection();
  3767. $ctx2.sendIdx["collection"]=1;
  3768. $1=_st($2)._indexOf_startingAt_(value,(1));
  3769. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3770. self._assert_equals_($1,index);
  3771. $ctx2.sendIdx["assert:equals:"]=1;
  3772. $4=self._collection();
  3773. $ctx2.sendIdx["collection"]=2;
  3774. $3=_st($4)._indexOf_startingAt_(value,index);
  3775. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3776. self._assert_equals_($3,index);
  3777. $ctx2.sendIdx["assert:equals:"]=2;
  3778. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3779. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3780. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3781. args: [],
  3782. 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 ]",
  3783. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3784. referencedClasses: ["JSON"]
  3785. }),
  3786. globals.SequenceableCollectionTest);
  3787. smalltalk.addMethod(
  3788. smalltalk.method({
  3789. selector: "testIndexOfStartingAtWithNull",
  3790. protocol: 'tests',
  3791. fn: function (){
  3792. var self=this;
  3793. var jsNull;
  3794. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3795. return smalltalk.withContext(function($ctx1) {
  3796. var $1,$2;
  3797. jsNull=_st($JSON())._parse_("null");
  3798. self._samplesDo_((function(index,value){
  3799. var collection;
  3800. return smalltalk.withContext(function($ctx2) {
  3801. collection=self._collection();
  3802. collection;
  3803. _st(collection)._at_put_(index,jsNull);
  3804. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3805. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3806. self._assert_equals_($1,index);
  3807. $ctx2.sendIdx["assert:equals:"]=1;
  3808. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3809. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3810. self._assert_equals_($2,index);
  3811. $ctx2.sendIdx["assert:equals:"]=2;
  3812. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3813. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3814. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3815. args: [],
  3816. 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 ]",
  3817. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3818. referencedClasses: ["JSON"]
  3819. }),
  3820. globals.SequenceableCollectionTest);
  3821. smalltalk.addMethod(
  3822. smalltalk.method({
  3823. selector: "testLast",
  3824. protocol: 'tests',
  3825. fn: function (){
  3826. var self=this;
  3827. return smalltalk.withContext(function($ctx1) {
  3828. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3829. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3830. args: [],
  3831. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3832. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3833. referencedClasses: []
  3834. }),
  3835. globals.SequenceableCollectionTest);
  3836. smalltalk.addMethod(
  3837. smalltalk.method({
  3838. selector: "testLastN",
  3839. protocol: 'tests',
  3840. fn: function (){
  3841. var self=this;
  3842. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3843. return smalltalk.withContext(function($ctx1) {
  3844. var $2,$1,$4,$3,$6,$5,$7;
  3845. $2=self._collection();
  3846. $ctx1.sendIdx["collection"]=1;
  3847. $1=_st($2)._last_((2));
  3848. $ctx1.sendIdx["last:"]=1;
  3849. self._assert_equals_($1,self._collectionLastTwo());
  3850. $ctx1.sendIdx["assert:equals:"]=1;
  3851. $4=self._collection();
  3852. $ctx1.sendIdx["collection"]=2;
  3853. $3=_st($4)._last_((0));
  3854. $ctx1.sendIdx["last:"]=2;
  3855. self._assert_equals_($3,_st(self._collectionClass())._new());
  3856. $ctx1.sendIdx["assert:equals:"]=2;
  3857. $6=self._collection();
  3858. $ctx1.sendIdx["collection"]=3;
  3859. $5=_st($6)._last_(self._collectionSize());
  3860. $ctx1.sendIdx["last:"]=3;
  3861. $7=self._collection();
  3862. $ctx1.sendIdx["collection"]=4;
  3863. self._assert_equals_($5,$7);
  3864. self._should_raise_((function(){
  3865. return smalltalk.withContext(function($ctx2) {
  3866. return _st(self._collection())._last_((33));
  3867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3868. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3869. args: [],
  3870. 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",
  3871. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3872. referencedClasses: ["Error"]
  3873. }),
  3874. globals.SequenceableCollectionTest);
  3875. smalltalk.addMethod(
  3876. smalltalk.method({
  3877. selector: "testSecond",
  3878. protocol: 'tests',
  3879. fn: function (){
  3880. var self=this;
  3881. return smalltalk.withContext(function($ctx1) {
  3882. var $2,$1;
  3883. $2=self._collection();
  3884. $ctx1.sendIdx["collection"]=1;
  3885. $1=_st($2)._second();
  3886. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3887. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3888. args: [],
  3889. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3890. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3891. referencedClasses: []
  3892. }),
  3893. globals.SequenceableCollectionTest);
  3894. smalltalk.addMethod(
  3895. smalltalk.method({
  3896. selector: "testThird",
  3897. protocol: 'tests',
  3898. fn: function (){
  3899. var self=this;
  3900. return smalltalk.withContext(function($ctx1) {
  3901. var $2,$1;
  3902. $2=self._collection();
  3903. $ctx1.sendIdx["collection"]=1;
  3904. $1=_st($2)._third();
  3905. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3906. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3907. args: [],
  3908. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3909. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3910. referencedClasses: []
  3911. }),
  3912. globals.SequenceableCollectionTest);
  3913. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3914. smalltalk.addMethod(
  3915. smalltalk.method({
  3916. selector: "collection",
  3917. protocol: 'fixture',
  3918. fn: function (){
  3919. var self=this;
  3920. var $1;
  3921. $1=[(1), (2), (3), (-4)];
  3922. return $1;
  3923. },
  3924. args: [],
  3925. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3926. messageSends: [],
  3927. referencedClasses: []
  3928. }),
  3929. globals.ArrayTest);
  3930. smalltalk.addMethod(
  3931. smalltalk.method({
  3932. selector: "collectionFirst",
  3933. protocol: 'fixture',
  3934. fn: function (){
  3935. var self=this;
  3936. return (1);
  3937. },
  3938. args: [],
  3939. source: "collectionFirst\x0a\x09^ 1",
  3940. messageSends: [],
  3941. referencedClasses: []
  3942. }),
  3943. globals.ArrayTest);
  3944. smalltalk.addMethod(
  3945. smalltalk.method({
  3946. selector: "collectionFirstTwo",
  3947. protocol: 'fixture',
  3948. fn: function (){
  3949. var self=this;
  3950. var $1;
  3951. $1=[(1), (2)];
  3952. return $1;
  3953. },
  3954. args: [],
  3955. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3956. messageSends: [],
  3957. referencedClasses: []
  3958. }),
  3959. globals.ArrayTest);
  3960. smalltalk.addMethod(
  3961. smalltalk.method({
  3962. selector: "collectionLast",
  3963. protocol: 'fixture',
  3964. fn: function (){
  3965. var self=this;
  3966. return (-4);
  3967. },
  3968. args: [],
  3969. source: "collectionLast\x0a\x09^ -4",
  3970. messageSends: [],
  3971. referencedClasses: []
  3972. }),
  3973. globals.ArrayTest);
  3974. smalltalk.addMethod(
  3975. smalltalk.method({
  3976. selector: "collectionLastTwo",
  3977. protocol: 'fixture',
  3978. fn: function (){
  3979. var self=this;
  3980. var $1;
  3981. $1=[(3), (-4)];
  3982. return $1;
  3983. },
  3984. args: [],
  3985. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3986. messageSends: [],
  3987. referencedClasses: []
  3988. }),
  3989. globals.ArrayTest);
  3990. smalltalk.addMethod(
  3991. smalltalk.method({
  3992. selector: "collectionOfPrintStrings",
  3993. protocol: 'fixture',
  3994. fn: function (){
  3995. var self=this;
  3996. var $1;
  3997. $1=["1", "2", "3", "-4"];
  3998. return $1;
  3999. },
  4000. args: [],
  4001. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4002. messageSends: [],
  4003. referencedClasses: []
  4004. }),
  4005. globals.ArrayTest);
  4006. smalltalk.addMethod(
  4007. smalltalk.method({
  4008. selector: "collectionSize",
  4009. protocol: 'fixture',
  4010. fn: function (){
  4011. var self=this;
  4012. return (4);
  4013. },
  4014. args: [],
  4015. source: "collectionSize\x0a\x09^ 4",
  4016. messageSends: [],
  4017. referencedClasses: []
  4018. }),
  4019. globals.ArrayTest);
  4020. smalltalk.addMethod(
  4021. smalltalk.method({
  4022. selector: "collectionWithDuplicates",
  4023. protocol: 'fixture',
  4024. fn: function (){
  4025. var self=this;
  4026. var $1;
  4027. $1=["a", "b", "c", (1), (2), (1), "a"];
  4028. return $1;
  4029. },
  4030. args: [],
  4031. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4032. messageSends: [],
  4033. referencedClasses: []
  4034. }),
  4035. globals.ArrayTest);
  4036. smalltalk.addMethod(
  4037. smalltalk.method({
  4038. selector: "collectionWithNewValue",
  4039. protocol: 'fixture',
  4040. fn: function (){
  4041. var self=this;
  4042. var $1;
  4043. $1=[(1), (2), (3), (-4), "N"];
  4044. return $1;
  4045. },
  4046. args: [],
  4047. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4048. messageSends: [],
  4049. referencedClasses: []
  4050. }),
  4051. globals.ArrayTest);
  4052. smalltalk.addMethod(
  4053. smalltalk.method({
  4054. selector: "sampleNewIndex",
  4055. protocol: 'fixture',
  4056. fn: function (){
  4057. var self=this;
  4058. return (5);
  4059. },
  4060. args: [],
  4061. source: "sampleNewIndex\x0a\x09^ 5",
  4062. messageSends: [],
  4063. referencedClasses: []
  4064. }),
  4065. globals.ArrayTest);
  4066. smalltalk.addMethod(
  4067. smalltalk.method({
  4068. selector: "samplesDo:",
  4069. protocol: 'fixture',
  4070. fn: function (aBlock){
  4071. var self=this;
  4072. return smalltalk.withContext(function($ctx1) {
  4073. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4074. $ctx1.supercall = false;
  4075. _st(aBlock)._value_value_((3),(3));
  4076. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4077. args: ["aBlock"],
  4078. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4079. messageSends: ["samplesDo:", "value:value:"],
  4080. referencedClasses: []
  4081. }),
  4082. globals.ArrayTest);
  4083. smalltalk.addMethod(
  4084. smalltalk.method({
  4085. selector: "testAdd",
  4086. protocol: 'tests',
  4087. fn: function (){
  4088. var self=this;
  4089. var array;
  4090. return smalltalk.withContext(function($ctx1) {
  4091. array=self._collection();
  4092. _st(array)._add_((6));
  4093. self._assert_equals_(_st(array)._last(),(6));
  4094. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4095. args: [],
  4096. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4097. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4098. referencedClasses: []
  4099. }),
  4100. globals.ArrayTest);
  4101. smalltalk.addMethod(
  4102. smalltalk.method({
  4103. selector: "testAddFirst",
  4104. protocol: 'tests',
  4105. fn: function (){
  4106. var self=this;
  4107. return smalltalk.withContext(function($ctx1) {
  4108. var $1,$2;
  4109. $1=self._collection();
  4110. _st($1)._addFirst_((0));
  4111. $2=_st($1)._yourself();
  4112. self._assert_equals_(_st($2)._first(),(0));
  4113. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4114. args: [],
  4115. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4116. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4117. referencedClasses: []
  4118. }),
  4119. globals.ArrayTest);
  4120. smalltalk.addMethod(
  4121. smalltalk.method({
  4122. selector: "testPrintString",
  4123. protocol: 'tests',
  4124. fn: function (){
  4125. var self=this;
  4126. var array;
  4127. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4128. return smalltalk.withContext(function($ctx1) {
  4129. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4130. array=_st($Array())._new();
  4131. $1=_st(array)._printString();
  4132. $ctx1.sendIdx["printString"]=1;
  4133. self._assert_equals_($1,"an Array ()");
  4134. $ctx1.sendIdx["assert:equals:"]=1;
  4135. $2=array;
  4136. _st($2)._add_((1));
  4137. $ctx1.sendIdx["add:"]=1;
  4138. $3=_st($2)._add_((3));
  4139. $ctx1.sendIdx["add:"]=2;
  4140. $4=_st(array)._printString();
  4141. $ctx1.sendIdx["printString"]=2;
  4142. self._assert_equals_($4,"an Array (1 3)");
  4143. $ctx1.sendIdx["assert:equals:"]=2;
  4144. _st(array)._add_("foo");
  4145. $5=_st(array)._printString();
  4146. $ctx1.sendIdx["printString"]=3;
  4147. self._assert_equals_($5,"an Array (1 3 'foo')");
  4148. $ctx1.sendIdx["assert:equals:"]=3;
  4149. $6=array;
  4150. _st($6)._remove_((1));
  4151. $ctx1.sendIdx["remove:"]=1;
  4152. $7=_st($6)._remove_((3));
  4153. $8=_st(array)._printString();
  4154. $ctx1.sendIdx["printString"]=4;
  4155. self._assert_equals_($8,"an Array ('foo')");
  4156. $ctx1.sendIdx["assert:equals:"]=4;
  4157. _st(array)._addLast_((3));
  4158. $ctx1.sendIdx["addLast:"]=1;
  4159. $9=_st(array)._printString();
  4160. $ctx1.sendIdx["printString"]=5;
  4161. self._assert_equals_($9,"an Array ('foo' 3)");
  4162. $ctx1.sendIdx["assert:equals:"]=5;
  4163. _st(array)._addLast_((3));
  4164. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4165. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4166. args: [],
  4167. 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)'.",
  4168. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4169. referencedClasses: ["Array"]
  4170. }),
  4171. globals.ArrayTest);
  4172. smalltalk.addMethod(
  4173. smalltalk.method({
  4174. selector: "testRemove",
  4175. protocol: 'tests',
  4176. fn: function (){
  4177. var self=this;
  4178. var array;
  4179. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4180. return smalltalk.withContext(function($ctx1) {
  4181. array=[(1), (2), (3), (4), (5)];
  4182. _st(array)._remove_((3));
  4183. $ctx1.sendIdx["remove:"]=1;
  4184. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4185. self._should_raise_((function(){
  4186. return smalltalk.withContext(function($ctx2) {
  4187. return _st(array)._remove_((3));
  4188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4189. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4190. args: [],
  4191. 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",
  4192. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4193. referencedClasses: ["Error"]
  4194. }),
  4195. globals.ArrayTest);
  4196. smalltalk.addMethod(
  4197. smalltalk.method({
  4198. selector: "testRemoveFromTo",
  4199. protocol: 'tests',
  4200. fn: function (){
  4201. var self=this;
  4202. return smalltalk.withContext(function($ctx1) {
  4203. var $1,$2;
  4204. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4205. $ctx1.sendIdx["removeFrom:to:"]=1;
  4206. self._assert_equals_($1,[(4)]);
  4207. $ctx1.sendIdx["assert:equals:"]=1;
  4208. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4209. $ctx1.sendIdx["removeFrom:to:"]=2;
  4210. self._assert_equals_($2,[(1), (4)]);
  4211. $ctx1.sendIdx["assert:equals:"]=2;
  4212. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4213. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4214. args: [],
  4215. 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)",
  4216. messageSends: ["assert:equals:", "removeFrom:to:"],
  4217. referencedClasses: []
  4218. }),
  4219. globals.ArrayTest);
  4220. smalltalk.addMethod(
  4221. smalltalk.method({
  4222. selector: "testRemoveIndex",
  4223. protocol: 'tests',
  4224. fn: function (){
  4225. var self=this;
  4226. return smalltalk.withContext(function($ctx1) {
  4227. var $1,$2;
  4228. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4229. $ctx1.sendIdx["removeIndex:"]=1;
  4230. self._assert_equals_($1,[(1), (3), (4)]);
  4231. $ctx1.sendIdx["assert:equals:"]=1;
  4232. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4233. $ctx1.sendIdx["removeIndex:"]=2;
  4234. self._assert_equals_($2,[(2), (3), (4)]);
  4235. $ctx1.sendIdx["assert:equals:"]=2;
  4236. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4237. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4238. args: [],
  4239. 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: #()",
  4240. messageSends: ["assert:equals:", "removeIndex:"],
  4241. referencedClasses: []
  4242. }),
  4243. globals.ArrayTest);
  4244. smalltalk.addMethod(
  4245. smalltalk.method({
  4246. selector: "testRemoveLast",
  4247. protocol: 'tests',
  4248. fn: function (){
  4249. var self=this;
  4250. var array;
  4251. return smalltalk.withContext(function($ctx1) {
  4252. array=[(1), (2)];
  4253. _st(array)._removeLast();
  4254. self._assert_equals_(_st(array)._last(),(1));
  4255. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4256. args: [],
  4257. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4258. messageSends: ["removeLast", "assert:equals:", "last"],
  4259. referencedClasses: []
  4260. }),
  4261. globals.ArrayTest);
  4262. smalltalk.addMethod(
  4263. smalltalk.method({
  4264. selector: "testReversed",
  4265. protocol: 'tests',
  4266. fn: function (){
  4267. var self=this;
  4268. var array;
  4269. return smalltalk.withContext(function($ctx1) {
  4270. array=[(5), (4), (3), (2), (1)];
  4271. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4272. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4273. args: [],
  4274. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4275. messageSends: ["assert:equals:", "reversed"],
  4276. referencedClasses: []
  4277. }),
  4278. globals.ArrayTest);
  4279. smalltalk.addMethod(
  4280. smalltalk.method({
  4281. selector: "testSort",
  4282. protocol: 'tests',
  4283. fn: function (){
  4284. var self=this;
  4285. var array;
  4286. return smalltalk.withContext(function($ctx1) {
  4287. array=[(10), (1), (5)];
  4288. _st(array)._sort();
  4289. self._assert_equals_(array,[(1), (5), (10)]);
  4290. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4291. args: [],
  4292. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4293. messageSends: ["sort", "assert:equals:"],
  4294. referencedClasses: []
  4295. }),
  4296. globals.ArrayTest);
  4297. smalltalk.addMethod(
  4298. smalltalk.method({
  4299. selector: "collectionClass",
  4300. protocol: 'fixture',
  4301. fn: function (){
  4302. var self=this;
  4303. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4304. return $Array();
  4305. },
  4306. args: [],
  4307. source: "collectionClass\x0a\x09^ Array",
  4308. messageSends: [],
  4309. referencedClasses: ["Array"]
  4310. }),
  4311. globals.ArrayTest.klass);
  4312. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4313. smalltalk.addMethod(
  4314. smalltalk.method({
  4315. selector: "collection",
  4316. protocol: 'fixture',
  4317. fn: function (){
  4318. var self=this;
  4319. return "helLo";
  4320. },
  4321. args: [],
  4322. source: "collection\x0a\x09^ 'helLo'",
  4323. messageSends: [],
  4324. referencedClasses: []
  4325. }),
  4326. globals.StringTest);
  4327. smalltalk.addMethod(
  4328. smalltalk.method({
  4329. selector: "collectionFirst",
  4330. protocol: 'fixture',
  4331. fn: function (){
  4332. var self=this;
  4333. return "h";
  4334. },
  4335. args: [],
  4336. source: "collectionFirst\x0a\x09^ 'h'",
  4337. messageSends: [],
  4338. referencedClasses: []
  4339. }),
  4340. globals.StringTest);
  4341. smalltalk.addMethod(
  4342. smalltalk.method({
  4343. selector: "collectionFirstTwo",
  4344. protocol: 'fixture',
  4345. fn: function (){
  4346. var self=this;
  4347. return "he";
  4348. },
  4349. args: [],
  4350. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4351. messageSends: [],
  4352. referencedClasses: []
  4353. }),
  4354. globals.StringTest);
  4355. smalltalk.addMethod(
  4356. smalltalk.method({
  4357. selector: "collectionLast",
  4358. protocol: 'fixture',
  4359. fn: function (){
  4360. var self=this;
  4361. return "o";
  4362. },
  4363. args: [],
  4364. source: "collectionLast\x0a\x09^ 'o'",
  4365. messageSends: [],
  4366. referencedClasses: []
  4367. }),
  4368. globals.StringTest);
  4369. smalltalk.addMethod(
  4370. smalltalk.method({
  4371. selector: "collectionLastTwo",
  4372. protocol: 'fixture',
  4373. fn: function (){
  4374. var self=this;
  4375. return "Lo";
  4376. },
  4377. args: [],
  4378. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4379. messageSends: [],
  4380. referencedClasses: []
  4381. }),
  4382. globals.StringTest);
  4383. smalltalk.addMethod(
  4384. smalltalk.method({
  4385. selector: "collectionOfPrintStrings",
  4386. protocol: 'fixture',
  4387. fn: function (){
  4388. var self=this;
  4389. return "'h''e''l''L''o'";
  4390. },
  4391. args: [],
  4392. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4393. messageSends: [],
  4394. referencedClasses: []
  4395. }),
  4396. globals.StringTest);
  4397. smalltalk.addMethod(
  4398. smalltalk.method({
  4399. selector: "collectionSize",
  4400. protocol: 'fixture',
  4401. fn: function (){
  4402. var self=this;
  4403. return (5);
  4404. },
  4405. args: [],
  4406. source: "collectionSize\x0a\x09^ 5",
  4407. messageSends: [],
  4408. referencedClasses: []
  4409. }),
  4410. globals.StringTest);
  4411. smalltalk.addMethod(
  4412. smalltalk.method({
  4413. selector: "collectionWithDuplicates",
  4414. protocol: 'fixture',
  4415. fn: function (){
  4416. var self=this;
  4417. return "abbaerte";
  4418. },
  4419. args: [],
  4420. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4421. messageSends: [],
  4422. referencedClasses: []
  4423. }),
  4424. globals.StringTest);
  4425. smalltalk.addMethod(
  4426. smalltalk.method({
  4427. selector: "collectionWithNewValue",
  4428. protocol: 'fixture',
  4429. fn: function (){
  4430. var self=this;
  4431. return "helLoN";
  4432. },
  4433. args: [],
  4434. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4435. messageSends: [],
  4436. referencedClasses: []
  4437. }),
  4438. globals.StringTest);
  4439. smalltalk.addMethod(
  4440. smalltalk.method({
  4441. selector: "sampleNewValueAsCollection",
  4442. protocol: 'fixture',
  4443. fn: function (){
  4444. var self=this;
  4445. return "N";
  4446. },
  4447. args: [],
  4448. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4449. messageSends: [],
  4450. referencedClasses: []
  4451. }),
  4452. globals.StringTest);
  4453. smalltalk.addMethod(
  4454. smalltalk.method({
  4455. selector: "samplesDo:",
  4456. protocol: 'fixture',
  4457. fn: function (aBlock){
  4458. var self=this;
  4459. return smalltalk.withContext(function($ctx1) {
  4460. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4461. $ctx1.supercall = false;
  4462. _st(aBlock)._value_value_((3),"l");
  4463. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4464. args: ["aBlock"],
  4465. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4466. messageSends: ["samplesDo:", "value:value:"],
  4467. referencedClasses: []
  4468. }),
  4469. globals.StringTest);
  4470. smalltalk.addMethod(
  4471. smalltalk.method({
  4472. selector: "testAddAll",
  4473. protocol: 'tests',
  4474. fn: function (){
  4475. var self=this;
  4476. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4477. return smalltalk.withContext(function($ctx1) {
  4478. var $1;
  4479. self._should_raise_((function(){
  4480. return smalltalk.withContext(function($ctx2) {
  4481. $1=self._collection();
  4482. $ctx2.sendIdx["collection"]=1;
  4483. return _st($1)._addAll_(self._collection());
  4484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4485. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4486. args: [],
  4487. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4488. messageSends: ["should:raise:", "addAll:", "collection"],
  4489. referencedClasses: ["Error"]
  4490. }),
  4491. globals.StringTest);
  4492. smalltalk.addMethod(
  4493. smalltalk.method({
  4494. selector: "testAddRemove",
  4495. protocol: 'tests',
  4496. fn: function (){
  4497. var self=this;
  4498. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4499. return smalltalk.withContext(function($ctx1) {
  4500. self._should_raise_((function(){
  4501. return smalltalk.withContext(function($ctx2) {
  4502. return "hello"._add_("a");
  4503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4504. $ctx1.sendIdx["should:raise:"]=1;
  4505. self._should_raise_((function(){
  4506. return smalltalk.withContext(function($ctx2) {
  4507. return "hello"._remove_("h");
  4508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4509. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4510. args: [],
  4511. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4512. messageSends: ["should:raise:", "add:", "remove:"],
  4513. referencedClasses: ["Error"]
  4514. }),
  4515. globals.StringTest);
  4516. smalltalk.addMethod(
  4517. smalltalk.method({
  4518. selector: "testAsArray",
  4519. protocol: 'tests',
  4520. fn: function (){
  4521. var self=this;
  4522. return smalltalk.withContext(function($ctx1) {
  4523. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4524. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4525. args: [],
  4526. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4527. messageSends: ["assert:equals:", "asArray"],
  4528. referencedClasses: []
  4529. }),
  4530. globals.StringTest);
  4531. smalltalk.addMethod(
  4532. smalltalk.method({
  4533. selector: "testAsLowerCase",
  4534. protocol: 'tests',
  4535. fn: function (){
  4536. var self=this;
  4537. return smalltalk.withContext(function($ctx1) {
  4538. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4539. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4540. args: [],
  4541. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4542. messageSends: ["assert:equals:", "asLowercase"],
  4543. referencedClasses: []
  4544. }),
  4545. globals.StringTest);
  4546. smalltalk.addMethod(
  4547. smalltalk.method({
  4548. selector: "testAsNumber",
  4549. protocol: 'tests',
  4550. fn: function (){
  4551. var self=this;
  4552. return smalltalk.withContext(function($ctx1) {
  4553. var $1,$2;
  4554. $1="3"._asNumber();
  4555. $ctx1.sendIdx["asNumber"]=1;
  4556. self._assert_equals_($1,(3));
  4557. $ctx1.sendIdx["assert:equals:"]=1;
  4558. $2="-3"._asNumber();
  4559. $ctx1.sendIdx["asNumber"]=2;
  4560. self._assert_equals_($2,(-3));
  4561. $ctx1.sendIdx["assert:equals:"]=2;
  4562. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4563. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4564. args: [],
  4565. 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.",
  4566. messageSends: ["assert:equals:", "asNumber"],
  4567. referencedClasses: []
  4568. }),
  4569. globals.StringTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testAsUpperCase",
  4573. protocol: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. return smalltalk.withContext(function($ctx1) {
  4577. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4578. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4579. args: [],
  4580. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4581. messageSends: ["assert:equals:", "asUppercase"],
  4582. referencedClasses: []
  4583. }),
  4584. globals.StringTest);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "testAsciiValue",
  4588. protocol: 'tests',
  4589. fn: function (){
  4590. var self=this;
  4591. var characterA,characterU;
  4592. return smalltalk.withContext(function($ctx1) {
  4593. var $1;
  4594. characterA="A";
  4595. characterU="U";
  4596. $1=_st(characterA)._asciiValue();
  4597. $ctx1.sendIdx["asciiValue"]=1;
  4598. self._assert_equals_($1,(65));
  4599. $ctx1.sendIdx["assert:equals:"]=1;
  4600. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4601. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4602. args: [],
  4603. 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",
  4604. messageSends: ["assert:equals:", "asciiValue"],
  4605. referencedClasses: []
  4606. }),
  4607. globals.StringTest);
  4608. smalltalk.addMethod(
  4609. smalltalk.method({
  4610. selector: "testAtIfAbsentPut",
  4611. protocol: 'tests',
  4612. fn: function (){
  4613. var self=this;
  4614. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4615. return smalltalk.withContext(function($ctx1) {
  4616. self._should_raise_((function(){
  4617. return smalltalk.withContext(function($ctx2) {
  4618. return "hello"._at_ifAbsentPut_((6),(function(){
  4619. return "a";
  4620. }));
  4621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4622. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4623. args: [],
  4624. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4625. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4626. referencedClasses: ["Error"]
  4627. }),
  4628. globals.StringTest);
  4629. smalltalk.addMethod(
  4630. smalltalk.method({
  4631. selector: "testAtPut",
  4632. protocol: 'tests',
  4633. fn: function (){
  4634. var self=this;
  4635. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4636. return smalltalk.withContext(function($ctx1) {
  4637. self._should_raise_((function(){
  4638. return smalltalk.withContext(function($ctx2) {
  4639. return "hello"._at_put_((1),"a");
  4640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4641. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4642. args: [],
  4643. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4644. messageSends: ["should:raise:", "at:put:"],
  4645. referencedClasses: ["Error"]
  4646. }),
  4647. globals.StringTest);
  4648. smalltalk.addMethod(
  4649. smalltalk.method({
  4650. selector: "testCapitalized",
  4651. protocol: 'tests',
  4652. fn: function (){
  4653. var self=this;
  4654. return smalltalk.withContext(function($ctx1) {
  4655. var $1,$2,$3;
  4656. $1="test"._capitalized();
  4657. $ctx1.sendIdx["capitalized"]=1;
  4658. self._assert_equals_($1,"Test");
  4659. $ctx1.sendIdx["assert:equals:"]=1;
  4660. $2="Test"._capitalized();
  4661. $ctx1.sendIdx["capitalized"]=2;
  4662. self._assert_equals_($2,"Test");
  4663. $ctx1.sendIdx["assert:equals:"]=2;
  4664. self._assert_equals_(""._capitalized(),"");
  4665. $ctx1.sendIdx["assert:equals:"]=3;
  4666. $3="Test"._isCapitalized();
  4667. $ctx1.sendIdx["isCapitalized"]=1;
  4668. self._assert_equals_($3,true);
  4669. $ctx1.sendIdx["assert:equals:"]=4;
  4670. self._assert_equals_("test"._isCapitalized(),false);
  4671. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4672. args: [],
  4673. 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.",
  4674. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4675. referencedClasses: []
  4676. }),
  4677. globals.StringTest);
  4678. smalltalk.addMethod(
  4679. smalltalk.method({
  4680. selector: "testCharCodeAt",
  4681. protocol: 'tests',
  4682. fn: function (){
  4683. var self=this;
  4684. return smalltalk.withContext(function($ctx1) {
  4685. var $1,$2,$3,$4,$5;
  4686. $1="jackie"._charCodeAt_((1));
  4687. $ctx1.sendIdx["charCodeAt:"]=1;
  4688. self._assert_equals_($1,(106));
  4689. $ctx1.sendIdx["assert:equals:"]=1;
  4690. $2="jackie"._charCodeAt_((2));
  4691. $ctx1.sendIdx["charCodeAt:"]=2;
  4692. self._assert_equals_($2,(97));
  4693. $ctx1.sendIdx["assert:equals:"]=2;
  4694. $3="jackie"._charCodeAt_((3));
  4695. $ctx1.sendIdx["charCodeAt:"]=3;
  4696. self._assert_equals_($3,(99));
  4697. $ctx1.sendIdx["assert:equals:"]=3;
  4698. $4="jackie"._charCodeAt_((4));
  4699. $ctx1.sendIdx["charCodeAt:"]=4;
  4700. self._assert_equals_($4,(107));
  4701. $ctx1.sendIdx["assert:equals:"]=4;
  4702. $5="jackie"._charCodeAt_((5));
  4703. $ctx1.sendIdx["charCodeAt:"]=5;
  4704. self._assert_equals_($5,(105));
  4705. $ctx1.sendIdx["assert:equals:"]=5;
  4706. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4707. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4708. args: [],
  4709. 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",
  4710. messageSends: ["assert:equals:", "charCodeAt:"],
  4711. referencedClasses: []
  4712. }),
  4713. globals.StringTest);
  4714. smalltalk.addMethod(
  4715. smalltalk.method({
  4716. selector: "testCopyFromTo",
  4717. protocol: 'tests',
  4718. fn: function (){
  4719. var self=this;
  4720. return smalltalk.withContext(function($ctx1) {
  4721. var $1;
  4722. $1="jackie"._copyFrom_to_((1),(3));
  4723. $ctx1.sendIdx["copyFrom:to:"]=1;
  4724. self._assert_equals_($1,"jac");
  4725. $ctx1.sendIdx["assert:equals:"]=1;
  4726. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4727. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4728. args: [],
  4729. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4730. messageSends: ["assert:equals:", "copyFrom:to:"],
  4731. referencedClasses: []
  4732. }),
  4733. globals.StringTest);
  4734. smalltalk.addMethod(
  4735. smalltalk.method({
  4736. selector: "testCopyWithoutAll",
  4737. protocol: 'tests',
  4738. fn: function (){
  4739. var self=this;
  4740. return smalltalk.withContext(function($ctx1) {
  4741. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4742. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4743. args: [],
  4744. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4745. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4746. referencedClasses: []
  4747. }),
  4748. globals.StringTest);
  4749. smalltalk.addMethod(
  4750. smalltalk.method({
  4751. selector: "testEquality",
  4752. protocol: 'tests',
  4753. fn: function (){
  4754. var self=this;
  4755. return smalltalk.withContext(function($ctx1) {
  4756. var $1,$2,$3;
  4757. self._assert_equals_("hello","hello");
  4758. $ctx1.sendIdx["assert:equals:"]=1;
  4759. $1="hello".__eq("world");
  4760. $ctx1.sendIdx["="]=1;
  4761. self._deny_($1);
  4762. $ctx1.sendIdx["deny:"]=1;
  4763. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4764. })));
  4765. $ctx1.sendIdx["="]=2;
  4766. self._deny_($2);
  4767. $ctx1.sendIdx["deny:"]=2;
  4768. $3="hello"._yourself();
  4769. $ctx1.sendIdx["yourself"]=1;
  4770. self._assert_equals_("hello",$3);
  4771. $ctx1.sendIdx["assert:equals:"]=2;
  4772. self._assert_equals_("hello"._yourself(),"hello");
  4773. self._deny_("".__eq((0)));
  4774. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4775. args: [],
  4776. 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",
  4777. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4778. referencedClasses: []
  4779. }),
  4780. globals.StringTest);
  4781. smalltalk.addMethod(
  4782. smalltalk.method({
  4783. selector: "testIdentity",
  4784. protocol: 'tests',
  4785. fn: function (){
  4786. var self=this;
  4787. return smalltalk.withContext(function($ctx1) {
  4788. var $1,$2,$4,$3,$5;
  4789. $1="hello".__eq_eq("hello");
  4790. $ctx1.sendIdx["=="]=1;
  4791. self._assert_($1);
  4792. $ctx1.sendIdx["assert:"]=1;
  4793. $2="hello".__eq_eq("world");
  4794. $ctx1.sendIdx["=="]=2;
  4795. self._deny_($2);
  4796. $ctx1.sendIdx["deny:"]=1;
  4797. $4="hello"._yourself();
  4798. $ctx1.sendIdx["yourself"]=1;
  4799. $3="hello".__eq_eq($4);
  4800. $ctx1.sendIdx["=="]=3;
  4801. self._assert_($3);
  4802. $ctx1.sendIdx["assert:"]=2;
  4803. $5=_st("hello"._yourself()).__eq_eq("hello");
  4804. $ctx1.sendIdx["=="]=4;
  4805. self._assert_($5);
  4806. self._deny_("".__eq_eq((0)));
  4807. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4808. args: [],
  4809. 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",
  4810. messageSends: ["assert:", "==", "deny:", "yourself"],
  4811. referencedClasses: []
  4812. }),
  4813. globals.StringTest);
  4814. smalltalk.addMethod(
  4815. smalltalk.method({
  4816. selector: "testIdentityHash",
  4817. protocol: 'tests',
  4818. fn: function (){
  4819. var self=this;
  4820. return smalltalk.withContext(function($ctx1) {
  4821. var $1,$2,$4,$3;
  4822. $1="foo"._identityHash();
  4823. $ctx1.sendIdx["identityHash"]=1;
  4824. $2="foo"._identityHash();
  4825. $ctx1.sendIdx["identityHash"]=2;
  4826. self._assert_equals_($1,$2);
  4827. $4="foo"._identityHash();
  4828. $ctx1.sendIdx["identityHash"]=3;
  4829. $3=_st($4).__eq("bar"._identityHash());
  4830. self._deny_($3);
  4831. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4832. args: [],
  4833. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4834. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4835. referencedClasses: []
  4836. }),
  4837. globals.StringTest);
  4838. smalltalk.addMethod(
  4839. smalltalk.method({
  4840. selector: "testIncludesSubString",
  4841. protocol: 'tests',
  4842. fn: function (){
  4843. var self=this;
  4844. return smalltalk.withContext(function($ctx1) {
  4845. var $1;
  4846. $1="amber"._includesSubString_("ber");
  4847. $ctx1.sendIdx["includesSubString:"]=1;
  4848. self._assert_($1);
  4849. self._deny_("amber"._includesSubString_("zork"));
  4850. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4851. args: [],
  4852. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4853. messageSends: ["assert:", "includesSubString:", "deny:"],
  4854. referencedClasses: []
  4855. }),
  4856. globals.StringTest);
  4857. smalltalk.addMethod(
  4858. smalltalk.method({
  4859. selector: "testIndexOfStartingAtWithNull",
  4860. protocol: 'tests',
  4861. fn: function (){
  4862. var self=this;
  4863. return self},
  4864. args: [],
  4865. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4866. messageSends: [],
  4867. referencedClasses: []
  4868. }),
  4869. globals.StringTest);
  4870. smalltalk.addMethod(
  4871. smalltalk.method({
  4872. selector: "testIndexOfWithNull",
  4873. protocol: 'tests',
  4874. fn: function (){
  4875. var self=this;
  4876. return self},
  4877. args: [],
  4878. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4879. messageSends: [],
  4880. referencedClasses: []
  4881. }),
  4882. globals.StringTest);
  4883. smalltalk.addMethod(
  4884. smalltalk.method({
  4885. selector: "testIsVowel",
  4886. protocol: 'tests',
  4887. fn: function (){
  4888. var self=this;
  4889. var vowel,consonant;
  4890. return smalltalk.withContext(function($ctx1) {
  4891. var $1;
  4892. vowel="u";
  4893. consonant="z";
  4894. $1=_st(vowel)._isVowel();
  4895. $ctx1.sendIdx["isVowel"]=1;
  4896. self._assert_equals_($1,true);
  4897. $ctx1.sendIdx["assert:equals:"]=1;
  4898. self._assert_equals_(_st(consonant)._isVowel(),false);
  4899. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4900. args: [],
  4901. 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",
  4902. messageSends: ["assert:equals:", "isVowel"],
  4903. referencedClasses: []
  4904. }),
  4905. globals.StringTest);
  4906. smalltalk.addMethod(
  4907. smalltalk.method({
  4908. selector: "testJoin",
  4909. protocol: 'tests',
  4910. fn: function (){
  4911. var self=this;
  4912. return smalltalk.withContext(function($ctx1) {
  4913. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4914. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4915. args: [],
  4916. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4917. messageSends: ["assert:equals:", "join:"],
  4918. referencedClasses: []
  4919. }),
  4920. globals.StringTest);
  4921. smalltalk.addMethod(
  4922. smalltalk.method({
  4923. selector: "testRemoveAll",
  4924. protocol: 'tests',
  4925. fn: function (){
  4926. var self=this;
  4927. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4928. return smalltalk.withContext(function($ctx1) {
  4929. self._should_raise_((function(){
  4930. return smalltalk.withContext(function($ctx2) {
  4931. return _st(self._collection())._removeAll();
  4932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4933. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4934. args: [],
  4935. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4936. messageSends: ["should:raise:", "removeAll", "collection"],
  4937. referencedClasses: ["Error"]
  4938. }),
  4939. globals.StringTest);
  4940. smalltalk.addMethod(
  4941. smalltalk.method({
  4942. selector: "testReversed",
  4943. protocol: 'tests',
  4944. fn: function (){
  4945. var self=this;
  4946. return smalltalk.withContext(function($ctx1) {
  4947. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4948. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4949. args: [],
  4950. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4951. messageSends: ["assert:equals:", "reversed"],
  4952. referencedClasses: []
  4953. }),
  4954. globals.StringTest);
  4955. smalltalk.addMethod(
  4956. smalltalk.method({
  4957. selector: "testStreamContents",
  4958. protocol: 'tests',
  4959. fn: function (){
  4960. var self=this;
  4961. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4962. return smalltalk.withContext(function($ctx1) {
  4963. var $1;
  4964. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4965. return smalltalk.withContext(function($ctx2) {
  4966. _st(aStream)._nextPutAll_("hello");
  4967. $ctx2.sendIdx["nextPutAll:"]=1;
  4968. _st(aStream)._space();
  4969. $1=_st(aStream)._nextPutAll_("world");
  4970. return $1;
  4971. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4972. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  4973. args: [],
  4974. 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'",
  4975. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4976. referencedClasses: ["String"]
  4977. }),
  4978. globals.StringTest);
  4979. smalltalk.addMethod(
  4980. smalltalk.method({
  4981. selector: "testSubStrings",
  4982. protocol: 'tests',
  4983. fn: function (){
  4984. var self=this;
  4985. return smalltalk.withContext(function($ctx1) {
  4986. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4987. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  4988. args: [],
  4989. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4990. messageSends: ["assert:equals:", "subStrings:"],
  4991. referencedClasses: []
  4992. }),
  4993. globals.StringTest);
  4994. smalltalk.addMethod(
  4995. smalltalk.method({
  4996. selector: "testTrim",
  4997. protocol: 'tests',
  4998. fn: function (){
  4999. var self=this;
  5000. return smalltalk.withContext(function($ctx1) {
  5001. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5002. $ctx1.sendIdx["assert:equals:"]=1;
  5003. self._assert_equals_("jackie "._trimRight(),"jackie");
  5004. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5005. args: [],
  5006. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5007. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5008. referencedClasses: []
  5009. }),
  5010. globals.StringTest);
  5011. smalltalk.addMethod(
  5012. smalltalk.method({
  5013. selector: "testValue",
  5014. protocol: 'tests',
  5015. fn: function (){
  5016. var self=this;
  5017. return smalltalk.withContext(function($ctx1) {
  5018. self._assert_equals_("asString"._value_((1)),"1");
  5019. $ctx1.sendIdx["assert:equals:"]=1;
  5020. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5021. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  5022. args: [],
  5023. 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')",
  5024. messageSends: ["assert:equals:", "value:", "collect:"],
  5025. referencedClasses: []
  5026. }),
  5027. globals.StringTest);
  5028. smalltalk.addMethod(
  5029. smalltalk.method({
  5030. selector: "collectionClass",
  5031. protocol: 'fixture',
  5032. fn: function (){
  5033. var self=this;
  5034. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5035. return $String();
  5036. },
  5037. args: [],
  5038. source: "collectionClass\x0a\x09^ String",
  5039. messageSends: [],
  5040. referencedClasses: ["String"]
  5041. }),
  5042. globals.StringTest.klass);
  5043. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5044. smalltalk.addMethod(
  5045. smalltalk.method({
  5046. selector: "collection",
  5047. protocol: 'fixture',
  5048. fn: function (){
  5049. var self=this;
  5050. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5051. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5052. return smalltalk.withContext(function($ctx1) {
  5053. var $2,$3,$1;
  5054. $2=_st($Set())._new();
  5055. _st($2)._add_($Smalltalk());
  5056. $ctx1.sendIdx["add:"]=1;
  5057. _st($2)._add_(nil);
  5058. $ctx1.sendIdx["add:"]=2;
  5059. _st($2)._add_((3).__at((3)));
  5060. $ctx1.sendIdx["add:"]=3;
  5061. _st($2)._add_(false);
  5062. $3=_st($2)._yourself();
  5063. $1=$3;
  5064. return $1;
  5065. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5066. args: [],
  5067. 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",
  5068. messageSends: ["add:", "new", "@", "yourself"],
  5069. referencedClasses: ["Set", "Smalltalk"]
  5070. }),
  5071. globals.SetTest);
  5072. smalltalk.addMethod(
  5073. smalltalk.method({
  5074. selector: "collectionOfPrintStrings",
  5075. protocol: 'fixture',
  5076. fn: function (){
  5077. var self=this;
  5078. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5079. return smalltalk.withContext(function($ctx1) {
  5080. var $2,$3,$1;
  5081. $2=_st($Set())._new();
  5082. _st($2)._add_("a SmalltalkImage");
  5083. $ctx1.sendIdx["add:"]=1;
  5084. _st($2)._add_("nil");
  5085. $ctx1.sendIdx["add:"]=2;
  5086. _st($2)._add_("3@3");
  5087. $ctx1.sendIdx["add:"]=3;
  5088. _st($2)._add_("false");
  5089. $3=_st($2)._yourself();
  5090. $1=$3;
  5091. return $1;
  5092. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5093. args: [],
  5094. 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",
  5095. messageSends: ["add:", "new", "yourself"],
  5096. referencedClasses: ["Set"]
  5097. }),
  5098. globals.SetTest);
  5099. smalltalk.addMethod(
  5100. smalltalk.method({
  5101. selector: "collectionSize",
  5102. protocol: 'fixture',
  5103. fn: function (){
  5104. var self=this;
  5105. return (4);
  5106. },
  5107. args: [],
  5108. source: "collectionSize\x0a\x09^ 4",
  5109. messageSends: [],
  5110. referencedClasses: []
  5111. }),
  5112. globals.SetTest);
  5113. smalltalk.addMethod(
  5114. smalltalk.method({
  5115. selector: "collectionWithDuplicates",
  5116. protocol: 'fixture',
  5117. fn: function (){
  5118. var self=this;
  5119. return smalltalk.withContext(function($ctx1) {
  5120. var $2,$3,$1;
  5121. $2=self._collection();
  5122. _st($2)._add_((0));
  5123. $3=_st($2)._yourself();
  5124. $1=$3;
  5125. return $1;
  5126. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5127. args: [],
  5128. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5129. messageSends: ["add:", "collection", "yourself"],
  5130. referencedClasses: []
  5131. }),
  5132. globals.SetTest);
  5133. smalltalk.addMethod(
  5134. smalltalk.method({
  5135. selector: "collectionWithNewValue",
  5136. protocol: 'fixture',
  5137. fn: function (){
  5138. var self=this;
  5139. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5140. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5141. return smalltalk.withContext(function($ctx1) {
  5142. var $2,$3,$1;
  5143. $2=_st($Set())._new();
  5144. _st($2)._add_($Smalltalk());
  5145. $ctx1.sendIdx["add:"]=1;
  5146. _st($2)._add_(nil);
  5147. $ctx1.sendIdx["add:"]=2;
  5148. _st($2)._add_((3).__at((3)));
  5149. $ctx1.sendIdx["add:"]=3;
  5150. _st($2)._add_("N");
  5151. $ctx1.sendIdx["add:"]=4;
  5152. _st($2)._add_(false);
  5153. $3=_st($2)._yourself();
  5154. $1=$3;
  5155. return $1;
  5156. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5157. args: [],
  5158. 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",
  5159. messageSends: ["add:", "new", "@", "yourself"],
  5160. referencedClasses: ["Set", "Smalltalk"]
  5161. }),
  5162. globals.SetTest);
  5163. smalltalk.addMethod(
  5164. smalltalk.method({
  5165. selector: "testAddAll",
  5166. protocol: 'tests',
  5167. fn: function (){
  5168. var self=this;
  5169. return smalltalk.withContext(function($ctx1) {
  5170. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5171. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5172. $ctx1.supercall = false;
  5173. $2=self._collection();
  5174. $ctx1.sendIdx["collection"]=1;
  5175. $3=$2;
  5176. $4=self._collection();
  5177. $ctx1.sendIdx["collection"]=2;
  5178. _st($3)._addAll_($4);
  5179. $ctx1.sendIdx["addAll:"]=1;
  5180. $5=_st($2)._yourself();
  5181. $ctx1.sendIdx["yourself"]=1;
  5182. $1=$5;
  5183. $6=self._collection();
  5184. $ctx1.sendIdx["collection"]=3;
  5185. self._assert_equals_($1,$6);
  5186. $ctx1.sendIdx["assert:equals:"]=1;
  5187. $8=self._collection();
  5188. $ctx1.sendIdx["collection"]=4;
  5189. $9=$8;
  5190. $10=self._collectionWithNewValue();
  5191. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5192. _st($9)._addAll_($10);
  5193. $ctx1.sendIdx["addAll:"]=2;
  5194. $11=_st($8)._yourself();
  5195. $ctx1.sendIdx["yourself"]=2;
  5196. $7=$11;
  5197. $12=self._collectionWithNewValue();
  5198. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5199. self._assert_equals_($7,$12);
  5200. $ctx1.sendIdx["assert:equals:"]=2;
  5201. $14=self._collectionWithNewValue();
  5202. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5203. _st($14)._addAll_(self._collection());
  5204. $15=_st($14)._yourself();
  5205. $13=$15;
  5206. self._assert_equals_($13,self._collectionWithNewValue());
  5207. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5208. args: [],
  5209. 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",
  5210. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5211. referencedClasses: []
  5212. }),
  5213. globals.SetTest);
  5214. smalltalk.addMethod(
  5215. smalltalk.method({
  5216. selector: "testAddRemove",
  5217. protocol: 'tests',
  5218. fn: function (){
  5219. var self=this;
  5220. var set;
  5221. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5222. return smalltalk.withContext(function($ctx1) {
  5223. var $1,$2;
  5224. set=_st($Set())._new();
  5225. self._assert_(_st(set)._isEmpty());
  5226. $ctx1.sendIdx["assert:"]=1;
  5227. _st(set)._add_((3));
  5228. $ctx1.sendIdx["add:"]=1;
  5229. $1=_st(set)._includes_((3));
  5230. $ctx1.sendIdx["includes:"]=1;
  5231. self._assert_($1);
  5232. $ctx1.sendIdx["assert:"]=2;
  5233. _st(set)._add_((5));
  5234. $2=_st(set)._includes_((5));
  5235. $ctx1.sendIdx["includes:"]=2;
  5236. self._assert_($2);
  5237. _st(set)._remove_((3));
  5238. self._deny_(_st(set)._includes_((3)));
  5239. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5240. args: [],
  5241. 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)",
  5242. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5243. referencedClasses: ["Set"]
  5244. }),
  5245. globals.SetTest);
  5246. smalltalk.addMethod(
  5247. smalltalk.method({
  5248. selector: "testAt",
  5249. protocol: 'tests',
  5250. fn: function (){
  5251. var self=this;
  5252. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5253. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5254. return smalltalk.withContext(function($ctx1) {
  5255. self._should_raise_((function(){
  5256. return smalltalk.withContext(function($ctx2) {
  5257. return _st(_st($Set())._new())._at_put_((1),(2));
  5258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5259. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5260. args: [],
  5261. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5262. messageSends: ["should:raise:", "at:put:", "new"],
  5263. referencedClasses: ["Set", "Error"]
  5264. }),
  5265. globals.SetTest);
  5266. smalltalk.addMethod(
  5267. smalltalk.method({
  5268. selector: "testCollect",
  5269. protocol: 'tests',
  5270. fn: function (){
  5271. var self=this;
  5272. return smalltalk.withContext(function($ctx1) {
  5273. var $2,$1;
  5274. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5275. $ctx1.supercall = false;
  5276. $2=[(5), (6), (8)]._asSet();
  5277. $ctx1.sendIdx["asSet"]=1;
  5278. $1=_st($2)._collect_((function(x){
  5279. return smalltalk.withContext(function($ctx2) {
  5280. return _st(x).__backslash_backslash((3));
  5281. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5282. self._assert_equals_($1,[(0), (2)]._asSet());
  5283. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5284. args: [],
  5285. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5286. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5287. referencedClasses: []
  5288. }),
  5289. globals.SetTest);
  5290. smalltalk.addMethod(
  5291. smalltalk.method({
  5292. selector: "testComma",
  5293. protocol: 'tests',
  5294. fn: function (){
  5295. var self=this;
  5296. return smalltalk.withContext(function($ctx1) {
  5297. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5298. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5299. $ctx1.supercall = false;
  5300. $2=self._collection();
  5301. $ctx1.sendIdx["collection"]=1;
  5302. $3=self._collection();
  5303. $ctx1.sendIdx["collection"]=2;
  5304. $1=_st($2).__comma($3);
  5305. $ctx1.sendIdx[","]=1;
  5306. $4=self._collection();
  5307. $ctx1.sendIdx["collection"]=3;
  5308. self._assert_equals_($1,$4);
  5309. $ctx1.sendIdx["assert:equals:"]=1;
  5310. $6=self._collection();
  5311. $ctx1.sendIdx["collection"]=4;
  5312. $7=self._collectionWithNewValue();
  5313. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5314. $5=_st($6).__comma($7);
  5315. $ctx1.sendIdx[","]=2;
  5316. $8=self._collectionWithNewValue();
  5317. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5318. self._assert_equals_($5,$8);
  5319. $ctx1.sendIdx["assert:equals:"]=2;
  5320. $10=self._collectionWithNewValue();
  5321. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5322. $9=_st($10).__comma(self._collection());
  5323. self._assert_equals_($9,self._collectionWithNewValue());
  5324. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5325. args: [],
  5326. 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",
  5327. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5328. referencedClasses: []
  5329. }),
  5330. globals.SetTest);
  5331. smalltalk.addMethod(
  5332. smalltalk.method({
  5333. selector: "testComparing",
  5334. protocol: 'tests',
  5335. fn: function (){
  5336. var self=this;
  5337. return smalltalk.withContext(function($ctx1) {
  5338. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5339. $1=[(0), (2)]._asSet();
  5340. $ctx1.sendIdx["asSet"]=1;
  5341. $2=[(0), (2)]._asSet();
  5342. $ctx1.sendIdx["asSet"]=2;
  5343. self._assert_equals_($1,$2);
  5344. $ctx1.sendIdx["assert:equals:"]=1;
  5345. $3=[(2), (0)]._asSet();
  5346. $ctx1.sendIdx["asSet"]=3;
  5347. $4=[(0), (2)]._asSet();
  5348. $ctx1.sendIdx["asSet"]=4;
  5349. self._assert_equals_($3,$4);
  5350. $6=[(0), (2), (3)]._asSet();
  5351. $ctx1.sendIdx["asSet"]=5;
  5352. $7=[(0), (2)]._asSet();
  5353. $ctx1.sendIdx["asSet"]=6;
  5354. $5=_st($6).__eq($7);
  5355. $ctx1.sendIdx["="]=1;
  5356. self._deny_($5);
  5357. $ctx1.sendIdx["deny:"]=1;
  5358. $9=[(1), (2)]._asSet();
  5359. $ctx1.sendIdx["asSet"]=7;
  5360. $8=_st($9).__eq([(0), (2)]._asSet());
  5361. self._deny_($8);
  5362. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5363. args: [],
  5364. 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",
  5365. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5366. referencedClasses: []
  5367. }),
  5368. globals.SetTest);
  5369. smalltalk.addMethod(
  5370. smalltalk.method({
  5371. selector: "testPrintString",
  5372. protocol: 'tests',
  5373. fn: function (){
  5374. var self=this;
  5375. var set;
  5376. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5377. return smalltalk.withContext(function($ctx1) {
  5378. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5379. set=_st($Set())._new();
  5380. $1=_st(set)._printString();
  5381. $ctx1.sendIdx["printString"]=1;
  5382. self._assert_equals_($1,"a Set ()");
  5383. $ctx1.sendIdx["assert:equals:"]=1;
  5384. $2=set;
  5385. _st($2)._add_((1));
  5386. $ctx1.sendIdx["add:"]=1;
  5387. $3=_st($2)._add_((3));
  5388. $ctx1.sendIdx["add:"]=2;
  5389. $4=_st(set)._printString();
  5390. $ctx1.sendIdx["printString"]=2;
  5391. self._assert_equals_($4,"a Set (1 3)");
  5392. $ctx1.sendIdx["assert:equals:"]=2;
  5393. _st(set)._add_("foo");
  5394. $ctx1.sendIdx["add:"]=3;
  5395. $5=_st(set)._printString();
  5396. $ctx1.sendIdx["printString"]=3;
  5397. self._assert_equals_($5,"a Set (1 3 'foo')");
  5398. $ctx1.sendIdx["assert:equals:"]=3;
  5399. $6=set;
  5400. _st($6)._remove_((1));
  5401. $ctx1.sendIdx["remove:"]=1;
  5402. $7=_st($6)._remove_((3));
  5403. $8=_st(set)._printString();
  5404. $ctx1.sendIdx["printString"]=4;
  5405. self._assert_equals_($8,"a Set ('foo')");
  5406. $ctx1.sendIdx["assert:equals:"]=4;
  5407. _st(set)._add_((3));
  5408. $ctx1.sendIdx["add:"]=4;
  5409. $9=_st(set)._printString();
  5410. $ctx1.sendIdx["printString"]=5;
  5411. self._assert_equals_($9,"a Set (3 'foo')");
  5412. $ctx1.sendIdx["assert:equals:"]=5;
  5413. _st(set)._add_((3));
  5414. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5415. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5416. args: [],
  5417. 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'')'",
  5418. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5419. referencedClasses: ["Set"]
  5420. }),
  5421. globals.SetTest);
  5422. smalltalk.addMethod(
  5423. smalltalk.method({
  5424. selector: "testUnboxedObjects",
  5425. protocol: 'tests',
  5426. fn: function (){
  5427. var self=this;
  5428. return smalltalk.withContext(function($ctx1) {
  5429. var $4,$3,$2,$1;
  5430. $4="foo"._yourself();
  5431. $ctx1.sendIdx["yourself"]=1;
  5432. $3=[$4,"foo"._yourself()];
  5433. $2=_st($3)._asSet();
  5434. $1=_st($2)._asArray();
  5435. self._assert_equals_($1,["foo"]);
  5436. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5437. args: [],
  5438. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5439. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5440. referencedClasses: []
  5441. }),
  5442. globals.SetTest);
  5443. smalltalk.addMethod(
  5444. smalltalk.method({
  5445. selector: "testUnicity",
  5446. protocol: 'tests',
  5447. fn: function (){
  5448. var self=this;
  5449. var set;
  5450. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5451. return smalltalk.withContext(function($ctx1) {
  5452. var $1;
  5453. set=_st($Set())._new();
  5454. _st(set)._add_((21));
  5455. $ctx1.sendIdx["add:"]=1;
  5456. _st(set)._add_("hello");
  5457. $ctx1.sendIdx["add:"]=2;
  5458. _st(set)._add_((21));
  5459. $ctx1.sendIdx["add:"]=3;
  5460. $1=_st(set)._size();
  5461. $ctx1.sendIdx["size"]=1;
  5462. self._assert_equals_($1,(2));
  5463. $ctx1.sendIdx["assert:equals:"]=1;
  5464. _st(set)._add_("hello");
  5465. self._assert_equals_(_st(set)._size(),(2));
  5466. $ctx1.sendIdx["assert:equals:"]=2;
  5467. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5468. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5469. args: [],
  5470. 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')",
  5471. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5472. referencedClasses: ["Set"]
  5473. }),
  5474. globals.SetTest);
  5475. smalltalk.addMethod(
  5476. smalltalk.method({
  5477. selector: "collectionClass",
  5478. protocol: 'fixture',
  5479. fn: function (){
  5480. var self=this;
  5481. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5482. return $Set();
  5483. },
  5484. args: [],
  5485. source: "collectionClass\x0a\x09^ Set",
  5486. messageSends: [],
  5487. referencedClasses: ["Set"]
  5488. }),
  5489. globals.SetTest.klass);
  5490. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5491. smalltalk.addMethod(
  5492. smalltalk.method({
  5493. selector: "testShow",
  5494. protocol: 'tests',
  5495. fn: function (){
  5496. var self=this;
  5497. var originalTranscript;
  5498. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5499. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5500. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5501. return smalltalk.withContext(function($ctx1) {
  5502. originalTranscript=_st($Transcript())._current();
  5503. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5504. $ctx1.sendIdx["register:"]=1;
  5505. self._shouldnt_raise_((function(){
  5506. return smalltalk.withContext(function($ctx2) {
  5507. return _st($Transcript())._show_("Hello console!");
  5508. $ctx2.sendIdx["show:"]=1;
  5509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5510. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5511. self._shouldnt_raise_((function(){
  5512. return smalltalk.withContext(function($ctx2) {
  5513. return _st($Transcript())._show_(console);
  5514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5515. _st($Transcript())._register_(originalTranscript);
  5516. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5517. args: [],
  5518. 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.",
  5519. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5520. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5521. }),
  5522. globals.ConsoleTranscriptTest);
  5523. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5524. smalltalk.addMethod(
  5525. smalltalk.method({
  5526. selector: "jsObject",
  5527. protocol: 'accessing',
  5528. fn: function (){
  5529. var self=this;
  5530. return smalltalk.withContext(function($ctx1) {
  5531. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5532. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5533. args: [],
  5534. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5535. messageSends: [],
  5536. referencedClasses: []
  5537. }),
  5538. globals.JSObjectProxyTest);
  5539. smalltalk.addMethod(
  5540. smalltalk.method({
  5541. selector: "testAtIfAbsent",
  5542. protocol: 'tests',
  5543. fn: function (){
  5544. var self=this;
  5545. var testObject;
  5546. return smalltalk.withContext(function($ctx1) {
  5547. var $1,$2,$3;
  5548. testObject=self._jsObject();
  5549. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5550. return "Property does not exist";
  5551. }));
  5552. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5553. self._assert_equals_($1,"Property does not exist");
  5554. $ctx1.sendIdx["assert:equals:"]=1;
  5555. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5556. return "Property does not exist";
  5557. }));
  5558. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5559. self._assert_equals_($2,nil);
  5560. $ctx1.sendIdx["assert:equals:"]=2;
  5561. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5562. return "Property does not exist";
  5563. }));
  5564. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5565. self._assert_equals_($3,(1));
  5566. $ctx1.sendIdx["assert:equals:"]=3;
  5567. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5568. return "Property does not exist";
  5569. })),nil);
  5570. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5571. args: [],
  5572. 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.",
  5573. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5574. referencedClasses: []
  5575. }),
  5576. globals.JSObjectProxyTest);
  5577. smalltalk.addMethod(
  5578. smalltalk.method({
  5579. selector: "testAtIfPresent",
  5580. protocol: 'tests',
  5581. fn: function (){
  5582. var self=this;
  5583. var testObject;
  5584. return smalltalk.withContext(function($ctx1) {
  5585. var $2,$1,$4,$3,$6,$5;
  5586. testObject=self._jsObject();
  5587. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5588. return smalltalk.withContext(function($ctx2) {
  5589. $2=_st(x)._asString();
  5590. $ctx2.sendIdx["asString"]=1;
  5591. return "hello ".__comma($2);
  5592. $ctx2.sendIdx[","]=1;
  5593. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5594. $ctx1.sendIdx["at:ifPresent:"]=1;
  5595. self._assert_equals_($1,nil);
  5596. $ctx1.sendIdx["assert:equals:"]=1;
  5597. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5598. return smalltalk.withContext(function($ctx2) {
  5599. $4=_st(x)._asString();
  5600. $ctx2.sendIdx["asString"]=2;
  5601. return "hello ".__comma($4);
  5602. $ctx2.sendIdx[","]=2;
  5603. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5604. $ctx1.sendIdx["at:ifPresent:"]=2;
  5605. self._assert_equals_($3,"hello nil");
  5606. $ctx1.sendIdx["assert:equals:"]=2;
  5607. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5608. return smalltalk.withContext(function($ctx2) {
  5609. $6=_st(x)._asString();
  5610. $ctx2.sendIdx["asString"]=3;
  5611. return "hello ".__comma($6);
  5612. $ctx2.sendIdx[","]=3;
  5613. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5614. $ctx1.sendIdx["at:ifPresent:"]=3;
  5615. self._assert_equals_($5,"hello 1");
  5616. $ctx1.sendIdx["assert:equals:"]=3;
  5617. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5618. return smalltalk.withContext(function($ctx2) {
  5619. return "hello ".__comma(_st(x)._asString());
  5620. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5621. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5622. args: [],
  5623. 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'.",
  5624. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5625. referencedClasses: []
  5626. }),
  5627. globals.JSObjectProxyTest);
  5628. smalltalk.addMethod(
  5629. smalltalk.method({
  5630. selector: "testAtIfPresentIfAbsent",
  5631. protocol: 'tests',
  5632. fn: function (){
  5633. var self=this;
  5634. var testObject;
  5635. return smalltalk.withContext(function($ctx1) {
  5636. var $2,$1,$4,$3,$6,$5;
  5637. testObject=self._jsObject();
  5638. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5639. return smalltalk.withContext(function($ctx2) {
  5640. $2=_st(x)._asString();
  5641. $ctx2.sendIdx["asString"]=1;
  5642. return "hello ".__comma($2);
  5643. $ctx2.sendIdx[","]=1;
  5644. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5645. return "not present";
  5646. }));
  5647. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5648. self._assert_equals_($1,"not present");
  5649. $ctx1.sendIdx["assert:equals:"]=1;
  5650. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5651. return smalltalk.withContext(function($ctx2) {
  5652. $4=_st(x)._asString();
  5653. $ctx2.sendIdx["asString"]=2;
  5654. return "hello ".__comma($4);
  5655. $ctx2.sendIdx[","]=2;
  5656. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5657. return "not present";
  5658. }));
  5659. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5660. self._assert_equals_($3,"hello nil");
  5661. $ctx1.sendIdx["assert:equals:"]=2;
  5662. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5663. return smalltalk.withContext(function($ctx2) {
  5664. $6=_st(x)._asString();
  5665. $ctx2.sendIdx["asString"]=3;
  5666. return "hello ".__comma($6);
  5667. $ctx2.sendIdx[","]=3;
  5668. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5669. return "not present";
  5670. }));
  5671. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5672. self._assert_equals_($5,"hello 1");
  5673. $ctx1.sendIdx["assert:equals:"]=3;
  5674. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5675. return smalltalk.withContext(function($ctx2) {
  5676. return "hello ".__comma(_st(x)._asString());
  5677. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5678. return "not present";
  5679. })),"hello nil");
  5680. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5681. args: [],
  5682. 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'.",
  5683. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5684. referencedClasses: []
  5685. }),
  5686. globals.JSObjectProxyTest);
  5687. smalltalk.addMethod(
  5688. smalltalk.method({
  5689. selector: "testAtPut",
  5690. protocol: 'tests',
  5691. fn: function (){
  5692. var self=this;
  5693. var testObject;
  5694. return smalltalk.withContext(function($ctx1) {
  5695. var $2,$1;
  5696. testObject=self._jsObject();
  5697. $2=_st(testObject)._at_("abc");
  5698. $ctx1.sendIdx["at:"]=1;
  5699. $1=_st($2).__tild_eq("xyz");
  5700. self._assert_($1);
  5701. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5702. $ctx1.sendIdx["assert:equals:"]=1;
  5703. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5704. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5705. args: [],
  5706. 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'",
  5707. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5708. referencedClasses: []
  5709. }),
  5710. globals.JSObjectProxyTest);
  5711. smalltalk.addMethod(
  5712. smalltalk.method({
  5713. selector: "testComparison",
  5714. protocol: 'tests',
  5715. fn: function (){
  5716. var self=this;
  5717. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5718. return smalltalk.withContext(function($ctx1) {
  5719. var $1,$2;
  5720. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5721. $1=_st(console).__eq(console);
  5722. $ctx1.sendIdx["="]=1;
  5723. self._assert_($1);
  5724. $2=_st(console).__eq(_st($Object())._new());
  5725. $ctx1.sendIdx["="]=2;
  5726. self._deny_($2);
  5727. $ctx1.sendIdx["deny:"]=1;
  5728. self._deny_(_st(console).__eq(self._jsObject()));
  5729. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5730. args: [],
  5731. 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",
  5732. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5733. referencedClasses: ["Object"]
  5734. }),
  5735. globals.JSObjectProxyTest);
  5736. smalltalk.addMethod(
  5737. smalltalk.method({
  5738. selector: "testDNU",
  5739. protocol: 'tests',
  5740. fn: function (){
  5741. var self=this;
  5742. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5743. return smalltalk.withContext(function($ctx1) {
  5744. self._should_raise_((function(){
  5745. return smalltalk.withContext(function($ctx2) {
  5746. return _st(self._jsObject())._foo();
  5747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5748. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5749. args: [],
  5750. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5751. messageSends: ["should:raise:", "foo", "jsObject"],
  5752. referencedClasses: ["MessageNotUnderstood"]
  5753. }),
  5754. globals.JSObjectProxyTest);
  5755. smalltalk.addMethod(
  5756. smalltalk.method({
  5757. selector: "testMessageSend",
  5758. protocol: 'tests',
  5759. fn: function (){
  5760. var self=this;
  5761. return smalltalk.withContext(function($ctx1) {
  5762. var $2,$1,$4,$3;
  5763. $2=self._jsObject();
  5764. $ctx1.sendIdx["jsObject"]=1;
  5765. $1=_st($2)._a();
  5766. self._assert_equals_($1,(1));
  5767. $ctx1.sendIdx["assert:equals:"]=1;
  5768. $4=self._jsObject();
  5769. $ctx1.sendIdx["jsObject"]=2;
  5770. $3=_st($4)._b();
  5771. self._assert_equals_($3,(2));
  5772. $ctx1.sendIdx["assert:equals:"]=2;
  5773. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5774. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5775. args: [],
  5776. 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",
  5777. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5778. referencedClasses: []
  5779. }),
  5780. globals.JSObjectProxyTest);
  5781. smalltalk.addMethod(
  5782. smalltalk.method({
  5783. selector: "testMethodWithArguments",
  5784. protocol: 'tests',
  5785. fn: function (){
  5786. var self=this;
  5787. return smalltalk.withContext(function($ctx1) {
  5788. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5789. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5790. args: [],
  5791. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5792. messageSends: ["assert:equals:", "c:", "jsObject"],
  5793. referencedClasses: []
  5794. }),
  5795. globals.JSObjectProxyTest);
  5796. smalltalk.addMethod(
  5797. smalltalk.method({
  5798. selector: "testPrinting",
  5799. protocol: 'tests',
  5800. fn: function (){
  5801. var self=this;
  5802. return smalltalk.withContext(function($ctx1) {
  5803. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5804. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5805. args: [],
  5806. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5807. messageSends: ["assert:equals:", "printString", "jsObject"],
  5808. referencedClasses: []
  5809. }),
  5810. globals.JSObjectProxyTest);
  5811. smalltalk.addMethod(
  5812. smalltalk.method({
  5813. selector: "testPropertyThatReturnsEmptyString",
  5814. protocol: 'tests',
  5815. fn: function (){
  5816. var self=this;
  5817. var object;
  5818. return smalltalk.withContext(function($ctx1) {
  5819. var $1;
  5820. object=self._jsObject();
  5821. $1=_st(object)._d();
  5822. $ctx1.sendIdx["d"]=1;
  5823. self._assert_equals_($1,"");
  5824. $ctx1.sendIdx["assert:equals:"]=1;
  5825. _st(object)._d_("hello");
  5826. self._assert_equals_(_st(object)._d(),"hello");
  5827. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5828. args: [],
  5829. 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'",
  5830. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5831. referencedClasses: []
  5832. }),
  5833. globals.JSObjectProxyTest);
  5834. smalltalk.addMethod(
  5835. smalltalk.method({
  5836. selector: "testPropertyThatReturnsUndefined",
  5837. protocol: 'tests',
  5838. fn: function (){
  5839. var self=this;
  5840. var object;
  5841. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5842. return smalltalk.withContext(function($ctx1) {
  5843. object=self._jsObject();
  5844. self._shouldnt_raise_((function(){
  5845. return smalltalk.withContext(function($ctx2) {
  5846. return _st(object)._e();
  5847. $ctx2.sendIdx["e"]=1;
  5848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5849. self._assert_(_st(_st(object)._e())._isNil());
  5850. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5851. args: [],
  5852. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5853. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5854. referencedClasses: ["MessageNotUnderstood"]
  5855. }),
  5856. globals.JSObjectProxyTest);
  5857. smalltalk.addMethod(
  5858. smalltalk.method({
  5859. selector: "testValue",
  5860. protocol: 'tests',
  5861. fn: function (){
  5862. var self=this;
  5863. var testObject;
  5864. return smalltalk.withContext(function($ctx1) {
  5865. testObject=self._jsObject();
  5866. _st(testObject)._at_put_("value","aValue");
  5867. self._assert_equals_(_st(testObject)._value(),"aValue");
  5868. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5869. args: [],
  5870. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5871. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5872. referencedClasses: []
  5873. }),
  5874. globals.JSObjectProxyTest);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "testYourself",
  5878. protocol: 'tests',
  5879. fn: function (){
  5880. var self=this;
  5881. var object;
  5882. return smalltalk.withContext(function($ctx1) {
  5883. var $1,$2;
  5884. $1=self._jsObject();
  5885. _st($1)._d_("test");
  5886. $2=_st($1)._yourself();
  5887. object=$2;
  5888. self._assert_equals_(_st(object)._d(),"test");
  5889. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5890. args: [],
  5891. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5892. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5893. referencedClasses: []
  5894. }),
  5895. globals.JSObjectProxyTest);
  5896. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5897. smalltalk.addMethod(
  5898. smalltalk.method({
  5899. selector: "testCatchingException",
  5900. protocol: 'tests',
  5901. fn: function (){
  5902. var self=this;
  5903. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5904. return smalltalk.withContext(function($ctx1) {
  5905. _st((function(){
  5906. return smalltalk.withContext(function($ctx2) {
  5907. return self._throwException();
  5908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5909. return smalltalk.withContext(function($ctx2) {
  5910. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5911. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5912. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5913. args: [],
  5914. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5915. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5916. referencedClasses: ["Error"]
  5917. }),
  5918. globals.JavaScriptExceptionTest);
  5919. smalltalk.addMethod(
  5920. smalltalk.method({
  5921. selector: "testRaisingException",
  5922. protocol: 'tests',
  5923. fn: function (){
  5924. var self=this;
  5925. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5926. return smalltalk.withContext(function($ctx1) {
  5927. self._should_raise_((function(){
  5928. return smalltalk.withContext(function($ctx2) {
  5929. return self._throwException();
  5930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5931. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5932. args: [],
  5933. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5934. messageSends: ["should:raise:", "throwException"],
  5935. referencedClasses: ["JavaScriptException"]
  5936. }),
  5937. globals.JavaScriptExceptionTest);
  5938. smalltalk.addMethod(
  5939. smalltalk.method({
  5940. selector: "throwException",
  5941. protocol: 'helpers',
  5942. fn: function (){
  5943. var self=this;
  5944. return smalltalk.withContext(function($ctx1) {
  5945. throw 'test';
  5946. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  5947. args: [],
  5948. source: "throwException\x0a\x09<throw 'test'>",
  5949. messageSends: [],
  5950. referencedClasses: []
  5951. }),
  5952. globals.JavaScriptExceptionTest);
  5953. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5954. smalltalk.addMethod(
  5955. smalltalk.method({
  5956. selector: "testValue",
  5957. protocol: 'tests',
  5958. fn: function (){
  5959. var self=this;
  5960. var messageSend;
  5961. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5962. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5963. return smalltalk.withContext(function($ctx1) {
  5964. var $1,$2;
  5965. $1=_st($MessageSend())._new();
  5966. $ctx1.sendIdx["new"]=1;
  5967. _st($1)._receiver_(_st($Object())._new());
  5968. _st($1)._selector_("asString");
  5969. $2=_st($1)._yourself();
  5970. messageSend=$2;
  5971. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5972. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  5973. args: [],
  5974. 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'",
  5975. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5976. referencedClasses: ["MessageSend", "Object"]
  5977. }),
  5978. globals.MessageSendTest);
  5979. smalltalk.addMethod(
  5980. smalltalk.method({
  5981. selector: "testValueWithArguments",
  5982. protocol: 'tests',
  5983. fn: function (){
  5984. var self=this;
  5985. var messageSend;
  5986. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5987. return smalltalk.withContext(function($ctx1) {
  5988. var $1,$2;
  5989. $1=_st($MessageSend())._new();
  5990. _st($1)._receiver_((2));
  5991. _st($1)._selector_("+");
  5992. $2=_st($1)._yourself();
  5993. messageSend=$2;
  5994. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5995. $ctx1.sendIdx["assert:equals:"]=1;
  5996. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5997. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  5998. args: [],
  5999. 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",
  6000. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6001. referencedClasses: ["MessageSend"]
  6002. }),
  6003. globals.MessageSendTest);
  6004. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6005. smalltalk.addMethod(
  6006. smalltalk.method({
  6007. selector: "codeGeneratorClass",
  6008. protocol: 'accessing',
  6009. fn: function (){
  6010. var self=this;
  6011. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6012. return $CodeGenerator();
  6013. },
  6014. args: [],
  6015. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6016. messageSends: [],
  6017. referencedClasses: ["CodeGenerator"]
  6018. }),
  6019. globals.MethodInheritanceTest);
  6020. smalltalk.addMethod(
  6021. smalltalk.method({
  6022. selector: "compiler",
  6023. protocol: 'factory',
  6024. fn: function (){
  6025. var self=this;
  6026. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6027. return smalltalk.withContext(function($ctx1) {
  6028. var $2,$3,$1;
  6029. $2=_st($Compiler())._new();
  6030. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6031. $3=_st($2)._yourself();
  6032. $1=$3;
  6033. return $1;
  6034. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6035. args: [],
  6036. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6037. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6038. referencedClasses: ["Compiler"]
  6039. }),
  6040. globals.MethodInheritanceTest);
  6041. smalltalk.addMethod(
  6042. smalltalk.method({
  6043. selector: "deinstallBottom",
  6044. protocol: 'testing',
  6045. fn: function (){
  6046. var self=this;
  6047. return smalltalk.withContext(function($ctx1) {
  6048. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6049. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6050. args: [],
  6051. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6052. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6053. referencedClasses: []
  6054. }),
  6055. globals.MethodInheritanceTest);
  6056. smalltalk.addMethod(
  6057. smalltalk.method({
  6058. selector: "deinstallMiddle",
  6059. protocol: 'testing',
  6060. fn: function (){
  6061. var self=this;
  6062. return smalltalk.withContext(function($ctx1) {
  6063. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6064. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6065. args: [],
  6066. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6067. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6068. referencedClasses: []
  6069. }),
  6070. globals.MethodInheritanceTest);
  6071. smalltalk.addMethod(
  6072. smalltalk.method({
  6073. selector: "deinstallTop",
  6074. protocol: 'testing',
  6075. fn: function (){
  6076. var self=this;
  6077. return smalltalk.withContext(function($ctx1) {
  6078. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6079. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6080. args: [],
  6081. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6082. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6083. referencedClasses: []
  6084. }),
  6085. globals.MethodInheritanceTest);
  6086. smalltalk.addMethod(
  6087. smalltalk.method({
  6088. selector: "installBottom:",
  6089. protocol: 'testing',
  6090. fn: function (aString){
  6091. var self=this;
  6092. return smalltalk.withContext(function($ctx1) {
  6093. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6094. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6095. args: ["aString"],
  6096. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6097. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6098. referencedClasses: []
  6099. }),
  6100. globals.MethodInheritanceTest);
  6101. smalltalk.addMethod(
  6102. smalltalk.method({
  6103. selector: "installMiddle:",
  6104. protocol: 'testing',
  6105. fn: function (aString){
  6106. var self=this;
  6107. return smalltalk.withContext(function($ctx1) {
  6108. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6109. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6110. args: ["aString"],
  6111. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6112. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6113. referencedClasses: []
  6114. }),
  6115. globals.MethodInheritanceTest);
  6116. smalltalk.addMethod(
  6117. smalltalk.method({
  6118. selector: "installTop:",
  6119. protocol: 'testing',
  6120. fn: function (aString){
  6121. var self=this;
  6122. return smalltalk.withContext(function($ctx1) {
  6123. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6124. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6125. args: ["aString"],
  6126. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6127. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6128. referencedClasses: []
  6129. }),
  6130. globals.MethodInheritanceTest);
  6131. smalltalk.addMethod(
  6132. smalltalk.method({
  6133. selector: "setUp",
  6134. protocol: 'initialization',
  6135. fn: function (){
  6136. var self=this;
  6137. return smalltalk.withContext(function($ctx1) {
  6138. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6139. $ctx1.sendIdx["new"]=1;
  6140. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6141. $ctx1.sendIdx["new"]=2;
  6142. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6143. self["@method"]=nil;
  6144. self["@performBlock"]=(function(){
  6145. return smalltalk.withContext(function($ctx2) {
  6146. return self._error_("performBlock not initialized");
  6147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6148. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6149. args: [],
  6150. 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' ]",
  6151. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6152. referencedClasses: []
  6153. }),
  6154. globals.MethodInheritanceTest);
  6155. smalltalk.addMethod(
  6156. smalltalk.method({
  6157. selector: "shouldMNU",
  6158. protocol: 'testing',
  6159. fn: function (){
  6160. var self=this;
  6161. return smalltalk.withContext(function($ctx1) {
  6162. self._shouldMNUTop();
  6163. self._shouldMNUMiddle();
  6164. self._shouldMNUBottom();
  6165. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6166. args: [],
  6167. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6168. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6169. referencedClasses: []
  6170. }),
  6171. globals.MethodInheritanceTest);
  6172. smalltalk.addMethod(
  6173. smalltalk.method({
  6174. selector: "shouldMNUBottom",
  6175. protocol: 'testing',
  6176. fn: function (){
  6177. var self=this;
  6178. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6179. return smalltalk.withContext(function($ctx1) {
  6180. self._should_raise_((function(){
  6181. return smalltalk.withContext(function($ctx2) {
  6182. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6184. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6185. args: [],
  6186. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6187. messageSends: ["should:raise:", "value:"],
  6188. referencedClasses: ["MessageNotUnderstood"]
  6189. }),
  6190. globals.MethodInheritanceTest);
  6191. smalltalk.addMethod(
  6192. smalltalk.method({
  6193. selector: "shouldMNUMiddle",
  6194. protocol: 'testing',
  6195. fn: function (){
  6196. var self=this;
  6197. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6198. return smalltalk.withContext(function($ctx1) {
  6199. self._should_raise_((function(){
  6200. return smalltalk.withContext(function($ctx2) {
  6201. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6203. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6204. args: [],
  6205. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6206. messageSends: ["should:raise:", "value:"],
  6207. referencedClasses: ["MessageNotUnderstood"]
  6208. }),
  6209. globals.MethodInheritanceTest);
  6210. smalltalk.addMethod(
  6211. smalltalk.method({
  6212. selector: "shouldMNUTop",
  6213. protocol: 'testing',
  6214. fn: function (){
  6215. var self=this;
  6216. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6217. return smalltalk.withContext(function($ctx1) {
  6218. self._should_raise_((function(){
  6219. return smalltalk.withContext(function($ctx2) {
  6220. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6222. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6223. args: [],
  6224. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6225. messageSends: ["should:raise:", "value:"],
  6226. referencedClasses: ["MessageNotUnderstood"]
  6227. }),
  6228. globals.MethodInheritanceTest);
  6229. smalltalk.addMethod(
  6230. smalltalk.method({
  6231. selector: "shouldReturn:",
  6232. protocol: 'testing',
  6233. fn: function (anObject){
  6234. var self=this;
  6235. var result;
  6236. return smalltalk.withContext(function($ctx1) {
  6237. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6238. $ctx1.sendIdx["value:"]=1;
  6239. self._assert_equals_(["top",anObject],["top",result]);
  6240. $ctx1.sendIdx["assert:equals:"]=1;
  6241. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6242. $ctx1.sendIdx["value:"]=2;
  6243. self._assert_equals_(["middle",anObject],["middle",result]);
  6244. $ctx1.sendIdx["assert:equals:"]=2;
  6245. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6246. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6247. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6248. args: ["anObject"],
  6249. 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 }",
  6250. messageSends: ["value:", "assert:equals:"],
  6251. referencedClasses: []
  6252. }),
  6253. globals.MethodInheritanceTest);
  6254. smalltalk.addMethod(
  6255. smalltalk.method({
  6256. selector: "shouldReturn:and:and:",
  6257. protocol: 'testing',
  6258. fn: function (anObject,anObject2,anObject3){
  6259. var self=this;
  6260. var result;
  6261. return smalltalk.withContext(function($ctx1) {
  6262. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6263. $ctx1.sendIdx["value:"]=1;
  6264. self._assert_equals_(["top",anObject],["top",result]);
  6265. $ctx1.sendIdx["assert:equals:"]=1;
  6266. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6267. $ctx1.sendIdx["value:"]=2;
  6268. self._assert_equals_(["middle",anObject2],["middle",result]);
  6269. $ctx1.sendIdx["assert:equals:"]=2;
  6270. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6271. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6272. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6273. args: ["anObject", "anObject2", "anObject3"],
  6274. 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 }",
  6275. messageSends: ["value:", "assert:equals:"],
  6276. referencedClasses: []
  6277. }),
  6278. globals.MethodInheritanceTest);
  6279. smalltalk.addMethod(
  6280. smalltalk.method({
  6281. selector: "targetClassBottom",
  6282. protocol: 'accessing',
  6283. fn: function (){
  6284. var self=this;
  6285. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6286. return $JavaScriptException();
  6287. },
  6288. args: [],
  6289. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6290. messageSends: [],
  6291. referencedClasses: ["JavaScriptException"]
  6292. }),
  6293. globals.MethodInheritanceTest);
  6294. smalltalk.addMethod(
  6295. smalltalk.method({
  6296. selector: "targetClassMiddle",
  6297. protocol: 'accessing',
  6298. fn: function (){
  6299. var self=this;
  6300. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6301. return $Error();
  6302. },
  6303. args: [],
  6304. source: "targetClassMiddle\x0a\x09^ Error",
  6305. messageSends: [],
  6306. referencedClasses: ["Error"]
  6307. }),
  6308. globals.MethodInheritanceTest);
  6309. smalltalk.addMethod(
  6310. smalltalk.method({
  6311. selector: "targetClassTop",
  6312. protocol: 'accessing',
  6313. fn: function (){
  6314. var self=this;
  6315. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6316. return $Object();
  6317. },
  6318. args: [],
  6319. source: "targetClassTop\x0a\x09^ Object",
  6320. messageSends: [],
  6321. referencedClasses: ["Object"]
  6322. }),
  6323. globals.MethodInheritanceTest);
  6324. smalltalk.addMethod(
  6325. smalltalk.method({
  6326. selector: "tearDown",
  6327. protocol: 'initialization',
  6328. fn: function (){
  6329. var self=this;
  6330. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6331. return smalltalk.withContext(function($ctx1) {
  6332. _st((function(){
  6333. return smalltalk.withContext(function($ctx2) {
  6334. return self._deinstallTop();
  6335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6336. }));
  6337. $ctx1.sendIdx["on:do:"]=1;
  6338. _st((function(){
  6339. return smalltalk.withContext(function($ctx2) {
  6340. return self._deinstallMiddle();
  6341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6342. }));
  6343. $ctx1.sendIdx["on:do:"]=2;
  6344. _st((function(){
  6345. return smalltalk.withContext(function($ctx2) {
  6346. return self._deinstallBottom();
  6347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6348. }));
  6349. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6350. args: [],
  6351. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6352. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6353. referencedClasses: ["Error"]
  6354. }),
  6355. globals.MethodInheritanceTest);
  6356. smalltalk.addMethod(
  6357. smalltalk.method({
  6358. selector: "testMNU11",
  6359. protocol: 'tests',
  6360. fn: function (){
  6361. var self=this;
  6362. return smalltalk.withContext(function($ctx1) {
  6363. self["@performBlock"]=(function(x){
  6364. return smalltalk.withContext(function($ctx2) {
  6365. return _st(x)._foo();
  6366. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6367. self._shouldMNU();
  6368. $ctx1.sendIdx["shouldMNU"]=1;
  6369. self._installTop_("foo ^ false");
  6370. $ctx1.sendIdx["installTop:"]=1;
  6371. self._installTop_("foo ^ true");
  6372. self._deinstallTop();
  6373. self._shouldMNU();
  6374. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6375. args: [],
  6376. 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",
  6377. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6378. referencedClasses: []
  6379. }),
  6380. globals.MethodInheritanceTest);
  6381. smalltalk.addMethod(
  6382. smalltalk.method({
  6383. selector: "testMNU22",
  6384. protocol: 'tests',
  6385. fn: function (){
  6386. var self=this;
  6387. return smalltalk.withContext(function($ctx1) {
  6388. self["@performBlock"]=(function(x){
  6389. return smalltalk.withContext(function($ctx2) {
  6390. return _st(x)._foo();
  6391. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6392. self._shouldMNU();
  6393. $ctx1.sendIdx["shouldMNU"]=1;
  6394. self._installMiddle_("foo ^ false");
  6395. $ctx1.sendIdx["installMiddle:"]=1;
  6396. self._installMiddle_("foo ^ true");
  6397. self._deinstallMiddle();
  6398. self._shouldMNU();
  6399. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6400. args: [],
  6401. 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",
  6402. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6403. referencedClasses: []
  6404. }),
  6405. globals.MethodInheritanceTest);
  6406. smalltalk.addMethod(
  6407. smalltalk.method({
  6408. selector: "testReturns1",
  6409. protocol: 'tests',
  6410. fn: function (){
  6411. var self=this;
  6412. return smalltalk.withContext(function($ctx1) {
  6413. self["@performBlock"]=(function(x){
  6414. return smalltalk.withContext(function($ctx2) {
  6415. return _st(x)._foo();
  6416. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6417. self._installTop_("foo ^ false");
  6418. $ctx1.sendIdx["installTop:"]=1;
  6419. self._shouldReturn_(false);
  6420. $ctx1.sendIdx["shouldReturn:"]=1;
  6421. self._installTop_("foo ^ true");
  6422. self._shouldReturn_(true);
  6423. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6424. args: [],
  6425. 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",
  6426. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6427. referencedClasses: []
  6428. }),
  6429. globals.MethodInheritanceTest);
  6430. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6431. smalltalk.addMethod(
  6432. smalltalk.method({
  6433. selector: "testAbs",
  6434. protocol: 'tests',
  6435. fn: function (){
  6436. var self=this;
  6437. return smalltalk.withContext(function($ctx1) {
  6438. var $1;
  6439. $1=(4)._abs();
  6440. $ctx1.sendIdx["abs"]=1;
  6441. self._assert_equals_($1,(4));
  6442. $ctx1.sendIdx["assert:equals:"]=1;
  6443. self._assert_equals_((-4)._abs(),(4));
  6444. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6445. args: [],
  6446. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6447. messageSends: ["assert:equals:", "abs"],
  6448. referencedClasses: []
  6449. }),
  6450. globals.NumberTest);
  6451. smalltalk.addMethod(
  6452. smalltalk.method({
  6453. selector: "testArithmetic",
  6454. protocol: 'tests',
  6455. fn: function (){
  6456. var self=this;
  6457. return smalltalk.withContext(function($ctx1) {
  6458. var $1,$2,$3,$5,$4;
  6459. $1=(1.5).__plus((1));
  6460. $ctx1.sendIdx["+"]=1;
  6461. self._assert_equals_($1,(2.5));
  6462. $ctx1.sendIdx["assert:equals:"]=1;
  6463. $2=(2).__minus((1));
  6464. $ctx1.sendIdx["-"]=1;
  6465. self._assert_equals_($2,(1));
  6466. $ctx1.sendIdx["assert:equals:"]=2;
  6467. self._assert_equals_((-2).__minus((1)),(-3));
  6468. $ctx1.sendIdx["assert:equals:"]=3;
  6469. self._assert_equals_((12).__slash((2)),(6));
  6470. $ctx1.sendIdx["assert:equals:"]=4;
  6471. $3=(3).__star((4));
  6472. $ctx1.sendIdx["*"]=1;
  6473. self._assert_equals_($3,(12));
  6474. $ctx1.sendIdx["assert:equals:"]=5;
  6475. self._assert_equals_((7).__slash_slash((2)),(3));
  6476. $ctx1.sendIdx["assert:equals:"]=6;
  6477. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6478. $ctx1.sendIdx["assert:equals:"]=7;
  6479. $5=(1).__plus((2));
  6480. $ctx1.sendIdx["+"]=2;
  6481. $4=_st($5).__star((3));
  6482. $ctx1.sendIdx["*"]=2;
  6483. self._assert_equals_($4,(9));
  6484. $ctx1.sendIdx["assert:equals:"]=8;
  6485. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6486. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6487. args: [],
  6488. 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",
  6489. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6490. referencedClasses: []
  6491. }),
  6492. globals.NumberTest);
  6493. smalltalk.addMethod(
  6494. smalltalk.method({
  6495. selector: "testAsNumber",
  6496. protocol: 'tests',
  6497. fn: function (){
  6498. var self=this;
  6499. return smalltalk.withContext(function($ctx1) {
  6500. self._assert_equals_((3)._asNumber(),(3));
  6501. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6502. args: [],
  6503. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6504. messageSends: ["assert:equals:", "asNumber"],
  6505. referencedClasses: []
  6506. }),
  6507. globals.NumberTest);
  6508. smalltalk.addMethod(
  6509. smalltalk.method({
  6510. selector: "testCeiling",
  6511. protocol: 'tests',
  6512. fn: function (){
  6513. var self=this;
  6514. return smalltalk.withContext(function($ctx1) {
  6515. var $1,$2;
  6516. $1=(1.2)._ceiling();
  6517. $ctx1.sendIdx["ceiling"]=1;
  6518. self._assert_equals_($1,(2));
  6519. $ctx1.sendIdx["assert:equals:"]=1;
  6520. $2=(-1.2)._ceiling();
  6521. $ctx1.sendIdx["ceiling"]=2;
  6522. self._assert_equals_($2,(-1));
  6523. $ctx1.sendIdx["assert:equals:"]=2;
  6524. self._assert_equals_((1)._ceiling(),(1));
  6525. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6526. args: [],
  6527. 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.",
  6528. messageSends: ["assert:equals:", "ceiling"],
  6529. referencedClasses: []
  6530. }),
  6531. globals.NumberTest);
  6532. smalltalk.addMethod(
  6533. smalltalk.method({
  6534. selector: "testComparison",
  6535. protocol: 'tests',
  6536. fn: function (){
  6537. var self=this;
  6538. return smalltalk.withContext(function($ctx1) {
  6539. var $1,$2,$3,$4;
  6540. $1=(3).__gt((2));
  6541. $ctx1.sendIdx[">"]=1;
  6542. self._assert_($1);
  6543. $ctx1.sendIdx["assert:"]=1;
  6544. $2=(2).__lt((3));
  6545. $ctx1.sendIdx["<"]=1;
  6546. self._assert_($2);
  6547. $ctx1.sendIdx["assert:"]=2;
  6548. self._deny_((3).__lt((2)));
  6549. $ctx1.sendIdx["deny:"]=1;
  6550. self._deny_((2).__gt((3)));
  6551. $3=(3).__gt_eq((3));
  6552. $ctx1.sendIdx[">="]=1;
  6553. self._assert_($3);
  6554. $ctx1.sendIdx["assert:"]=3;
  6555. self._assert_((3.1).__gt_eq((3)));
  6556. $ctx1.sendIdx["assert:"]=4;
  6557. $4=(3).__lt_eq((3));
  6558. $ctx1.sendIdx["<="]=1;
  6559. self._assert_($4);
  6560. $ctx1.sendIdx["assert:"]=5;
  6561. self._assert_((3).__lt_eq((3.1)));
  6562. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6563. args: [],
  6564. 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",
  6565. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6566. referencedClasses: []
  6567. }),
  6568. globals.NumberTest);
  6569. smalltalk.addMethod(
  6570. smalltalk.method({
  6571. selector: "testCopying",
  6572. protocol: 'tests',
  6573. fn: function (){
  6574. var self=this;
  6575. return smalltalk.withContext(function($ctx1) {
  6576. var $1;
  6577. $1=_st((1)._copy()).__eq_eq((1));
  6578. $ctx1.sendIdx["=="]=1;
  6579. self._assert_($1);
  6580. $ctx1.sendIdx["assert:"]=1;
  6581. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6582. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6583. args: [],
  6584. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6585. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6586. referencedClasses: []
  6587. }),
  6588. globals.NumberTest);
  6589. smalltalk.addMethod(
  6590. smalltalk.method({
  6591. selector: "testEquality",
  6592. protocol: 'tests',
  6593. fn: function (){
  6594. var self=this;
  6595. return smalltalk.withContext(function($ctx1) {
  6596. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6597. $1=(1).__eq((1));
  6598. $ctx1.sendIdx["="]=1;
  6599. self._assert_($1);
  6600. $ctx1.sendIdx["assert:"]=1;
  6601. $2=(0).__eq((0));
  6602. $ctx1.sendIdx["="]=2;
  6603. self._assert_($2);
  6604. $ctx1.sendIdx["assert:"]=2;
  6605. $3=(1).__eq((0));
  6606. $ctx1.sendIdx["="]=3;
  6607. self._deny_($3);
  6608. $ctx1.sendIdx["deny:"]=1;
  6609. $5=(1)._yourself();
  6610. $ctx1.sendIdx["yourself"]=1;
  6611. $4=_st($5).__eq((1));
  6612. $ctx1.sendIdx["="]=4;
  6613. self._assert_($4);
  6614. $ctx1.sendIdx["assert:"]=3;
  6615. $7=(1)._yourself();
  6616. $ctx1.sendIdx["yourself"]=2;
  6617. $6=(1).__eq($7);
  6618. $ctx1.sendIdx["="]=5;
  6619. self._assert_($6);
  6620. $ctx1.sendIdx["assert:"]=4;
  6621. $9=(1)._yourself();
  6622. $ctx1.sendIdx["yourself"]=3;
  6623. $8=_st($9).__eq((1)._yourself());
  6624. $ctx1.sendIdx["="]=6;
  6625. self._assert_($8);
  6626. $10=(0).__eq(false);
  6627. $ctx1.sendIdx["="]=7;
  6628. self._deny_($10);
  6629. $ctx1.sendIdx["deny:"]=2;
  6630. $11=false.__eq((0));
  6631. $ctx1.sendIdx["="]=8;
  6632. self._deny_($11);
  6633. $ctx1.sendIdx["deny:"]=3;
  6634. $12="".__eq((0));
  6635. $ctx1.sendIdx["="]=9;
  6636. self._deny_($12);
  6637. $ctx1.sendIdx["deny:"]=4;
  6638. self._deny_((0).__eq(""));
  6639. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6640. args: [],
  6641. 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 = ''",
  6642. messageSends: ["assert:", "=", "deny:", "yourself"],
  6643. referencedClasses: []
  6644. }),
  6645. globals.NumberTest);
  6646. smalltalk.addMethod(
  6647. smalltalk.method({
  6648. selector: "testFloor",
  6649. protocol: 'tests',
  6650. fn: function (){
  6651. var self=this;
  6652. return smalltalk.withContext(function($ctx1) {
  6653. var $1,$2;
  6654. $1=(1.2)._floor();
  6655. $ctx1.sendIdx["floor"]=1;
  6656. self._assert_equals_($1,(1));
  6657. $ctx1.sendIdx["assert:equals:"]=1;
  6658. $2=(-1.2)._floor();
  6659. $ctx1.sendIdx["floor"]=2;
  6660. self._assert_equals_($2,(-2));
  6661. $ctx1.sendIdx["assert:equals:"]=2;
  6662. self._assert_equals_((1)._floor(),(1));
  6663. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6664. args: [],
  6665. 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.",
  6666. messageSends: ["assert:equals:", "floor"],
  6667. referencedClasses: []
  6668. }),
  6669. globals.NumberTest);
  6670. smalltalk.addMethod(
  6671. smalltalk.method({
  6672. selector: "testHexNumbers",
  6673. protocol: 'tests',
  6674. fn: function (){
  6675. var self=this;
  6676. return smalltalk.withContext(function($ctx1) {
  6677. var $1,$2,$3,$4,$5;
  6678. self._assert_equals_((9),(9));
  6679. $ctx1.sendIdx["assert:equals:"]=1;
  6680. $1=(10)._truncated();
  6681. $ctx1.sendIdx["truncated"]=1;
  6682. self._assert_equals_($1,(10));
  6683. $ctx1.sendIdx["assert:equals:"]=2;
  6684. $2=(11)._truncated();
  6685. $ctx1.sendIdx["truncated"]=2;
  6686. self._assert_equals_($2,(11));
  6687. $ctx1.sendIdx["assert:equals:"]=3;
  6688. $3=(12)._truncated();
  6689. $ctx1.sendIdx["truncated"]=3;
  6690. self._assert_equals_($3,(12));
  6691. $ctx1.sendIdx["assert:equals:"]=4;
  6692. $4=(13)._truncated();
  6693. $ctx1.sendIdx["truncated"]=4;
  6694. self._assert_equals_($4,(13));
  6695. $ctx1.sendIdx["assert:equals:"]=5;
  6696. $5=(14)._truncated();
  6697. $ctx1.sendIdx["truncated"]=5;
  6698. self._assert_equals_($5,(14));
  6699. $ctx1.sendIdx["assert:equals:"]=6;
  6700. self._assert_equals_((15)._truncated(),(15));
  6701. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6702. args: [],
  6703. 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",
  6704. messageSends: ["assert:equals:", "truncated"],
  6705. referencedClasses: []
  6706. }),
  6707. globals.NumberTest);
  6708. smalltalk.addMethod(
  6709. smalltalk.method({
  6710. selector: "testIdentity",
  6711. protocol: 'tests',
  6712. fn: function (){
  6713. var self=this;
  6714. return smalltalk.withContext(function($ctx1) {
  6715. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6716. $1=(1).__eq_eq((1));
  6717. $ctx1.sendIdx["=="]=1;
  6718. self._assert_($1);
  6719. $ctx1.sendIdx["assert:"]=1;
  6720. $2=(0).__eq_eq((0));
  6721. $ctx1.sendIdx["=="]=2;
  6722. self._assert_($2);
  6723. $ctx1.sendIdx["assert:"]=2;
  6724. $3=(1).__eq_eq((0));
  6725. $ctx1.sendIdx["=="]=3;
  6726. self._deny_($3);
  6727. $ctx1.sendIdx["deny:"]=1;
  6728. $5=(1)._yourself();
  6729. $ctx1.sendIdx["yourself"]=1;
  6730. $4=_st($5).__eq_eq((1));
  6731. $ctx1.sendIdx["=="]=4;
  6732. self._assert_($4);
  6733. $ctx1.sendIdx["assert:"]=3;
  6734. $7=(1)._yourself();
  6735. $ctx1.sendIdx["yourself"]=2;
  6736. $6=(1).__eq_eq($7);
  6737. $ctx1.sendIdx["=="]=5;
  6738. self._assert_($6);
  6739. $ctx1.sendIdx["assert:"]=4;
  6740. $9=(1)._yourself();
  6741. $ctx1.sendIdx["yourself"]=3;
  6742. $8=_st($9).__eq_eq((1)._yourself());
  6743. $ctx1.sendIdx["=="]=6;
  6744. self._assert_($8);
  6745. self._deny_((1).__eq_eq((2)));
  6746. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6747. args: [],
  6748. 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",
  6749. messageSends: ["assert:", "==", "deny:", "yourself"],
  6750. referencedClasses: []
  6751. }),
  6752. globals.NumberTest);
  6753. smalltalk.addMethod(
  6754. smalltalk.method({
  6755. selector: "testInvalidHexNumbers",
  6756. protocol: 'tests',
  6757. fn: function (){
  6758. var self=this;
  6759. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6760. return smalltalk.withContext(function($ctx1) {
  6761. self._should_raise_((function(){
  6762. return smalltalk.withContext(function($ctx2) {
  6763. return (16)._rG();
  6764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6765. $ctx1.sendIdx["should:raise:"]=1;
  6766. self._should_raise_((function(){
  6767. return smalltalk.withContext(function($ctx2) {
  6768. return (16)._rg();
  6769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6770. $ctx1.sendIdx["should:raise:"]=2;
  6771. self._should_raise_((function(){
  6772. return smalltalk.withContext(function($ctx2) {
  6773. return (16)._rH();
  6774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6775. $ctx1.sendIdx["should:raise:"]=3;
  6776. self._should_raise_((function(){
  6777. return smalltalk.withContext(function($ctx2) {
  6778. return (16)._rh();
  6779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6780. $ctx1.sendIdx["should:raise:"]=4;
  6781. self._should_raise_((function(){
  6782. return smalltalk.withContext(function($ctx2) {
  6783. return (16)._rI();
  6784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6785. $ctx1.sendIdx["should:raise:"]=5;
  6786. self._should_raise_((function(){
  6787. return smalltalk.withContext(function($ctx2) {
  6788. return (16)._ri();
  6789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6790. $ctx1.sendIdx["should:raise:"]=6;
  6791. self._should_raise_((function(){
  6792. return smalltalk.withContext(function($ctx2) {
  6793. return (16)._rJ();
  6794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6795. $ctx1.sendIdx["should:raise:"]=7;
  6796. self._should_raise_((function(){
  6797. return smalltalk.withContext(function($ctx2) {
  6798. return (16)._rj();
  6799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6800. $ctx1.sendIdx["should:raise:"]=8;
  6801. self._should_raise_((function(){
  6802. return smalltalk.withContext(function($ctx2) {
  6803. return (16)._rK();
  6804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6805. $ctx1.sendIdx["should:raise:"]=9;
  6806. self._should_raise_((function(){
  6807. return smalltalk.withContext(function($ctx2) {
  6808. return (16)._rk();
  6809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6810. $ctx1.sendIdx["should:raise:"]=10;
  6811. self._should_raise_((function(){
  6812. return smalltalk.withContext(function($ctx2) {
  6813. return (16)._rL();
  6814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6815. $ctx1.sendIdx["should:raise:"]=11;
  6816. self._should_raise_((function(){
  6817. return smalltalk.withContext(function($ctx2) {
  6818. return (16)._rl();
  6819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6820. $ctx1.sendIdx["should:raise:"]=12;
  6821. self._should_raise_((function(){
  6822. return smalltalk.withContext(function($ctx2) {
  6823. return (16)._rM();
  6824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6825. $ctx1.sendIdx["should:raise:"]=13;
  6826. self._should_raise_((function(){
  6827. return smalltalk.withContext(function($ctx2) {
  6828. return (16)._rm();
  6829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6830. $ctx1.sendIdx["should:raise:"]=14;
  6831. self._should_raise_((function(){
  6832. return smalltalk.withContext(function($ctx2) {
  6833. return (16)._rN();
  6834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6835. $ctx1.sendIdx["should:raise:"]=15;
  6836. self._should_raise_((function(){
  6837. return smalltalk.withContext(function($ctx2) {
  6838. return (16)._rn();
  6839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6840. $ctx1.sendIdx["should:raise:"]=16;
  6841. self._should_raise_((function(){
  6842. return smalltalk.withContext(function($ctx2) {
  6843. return (16)._rO();
  6844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6845. $ctx1.sendIdx["should:raise:"]=17;
  6846. self._should_raise_((function(){
  6847. return smalltalk.withContext(function($ctx2) {
  6848. return (16)._ro();
  6849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6850. $ctx1.sendIdx["should:raise:"]=18;
  6851. self._should_raise_((function(){
  6852. return smalltalk.withContext(function($ctx2) {
  6853. return (16)._rP();
  6854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6855. $ctx1.sendIdx["should:raise:"]=19;
  6856. self._should_raise_((function(){
  6857. return smalltalk.withContext(function($ctx2) {
  6858. return (16)._rp();
  6859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6860. $ctx1.sendIdx["should:raise:"]=20;
  6861. self._should_raise_((function(){
  6862. return smalltalk.withContext(function($ctx2) {
  6863. return (16)._rQ();
  6864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6865. $ctx1.sendIdx["should:raise:"]=21;
  6866. self._should_raise_((function(){
  6867. return smalltalk.withContext(function($ctx2) {
  6868. return (16)._rq();
  6869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6870. $ctx1.sendIdx["should:raise:"]=22;
  6871. self._should_raise_((function(){
  6872. return smalltalk.withContext(function($ctx2) {
  6873. return (16)._rR();
  6874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6875. $ctx1.sendIdx["should:raise:"]=23;
  6876. self._should_raise_((function(){
  6877. return smalltalk.withContext(function($ctx2) {
  6878. return (16)._rr();
  6879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6880. $ctx1.sendIdx["should:raise:"]=24;
  6881. self._should_raise_((function(){
  6882. return smalltalk.withContext(function($ctx2) {
  6883. return (16)._rS();
  6884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6885. $ctx1.sendIdx["should:raise:"]=25;
  6886. self._should_raise_((function(){
  6887. return smalltalk.withContext(function($ctx2) {
  6888. return (16)._rs();
  6889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6890. $ctx1.sendIdx["should:raise:"]=26;
  6891. self._should_raise_((function(){
  6892. return smalltalk.withContext(function($ctx2) {
  6893. return (16)._rT();
  6894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6895. $ctx1.sendIdx["should:raise:"]=27;
  6896. self._should_raise_((function(){
  6897. return smalltalk.withContext(function($ctx2) {
  6898. return (16)._rt();
  6899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6900. $ctx1.sendIdx["should:raise:"]=28;
  6901. self._should_raise_((function(){
  6902. return smalltalk.withContext(function($ctx2) {
  6903. return (16)._rU();
  6904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6905. $ctx1.sendIdx["should:raise:"]=29;
  6906. self._should_raise_((function(){
  6907. return smalltalk.withContext(function($ctx2) {
  6908. return (16)._ru();
  6909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6910. $ctx1.sendIdx["should:raise:"]=30;
  6911. self._should_raise_((function(){
  6912. return smalltalk.withContext(function($ctx2) {
  6913. return (16)._rV();
  6914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6915. $ctx1.sendIdx["should:raise:"]=31;
  6916. self._should_raise_((function(){
  6917. return smalltalk.withContext(function($ctx2) {
  6918. return (16)._rv();
  6919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6920. $ctx1.sendIdx["should:raise:"]=32;
  6921. self._should_raise_((function(){
  6922. return smalltalk.withContext(function($ctx2) {
  6923. return (16)._rW();
  6924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6925. $ctx1.sendIdx["should:raise:"]=33;
  6926. self._should_raise_((function(){
  6927. return smalltalk.withContext(function($ctx2) {
  6928. return (16)._rw();
  6929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6930. $ctx1.sendIdx["should:raise:"]=34;
  6931. self._should_raise_((function(){
  6932. return smalltalk.withContext(function($ctx2) {
  6933. return (16)._rX();
  6934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6935. $ctx1.sendIdx["should:raise:"]=35;
  6936. self._should_raise_((function(){
  6937. return smalltalk.withContext(function($ctx2) {
  6938. return (16)._rx();
  6939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6940. $ctx1.sendIdx["should:raise:"]=36;
  6941. self._should_raise_((function(){
  6942. return smalltalk.withContext(function($ctx2) {
  6943. return (16)._rY();
  6944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6945. $ctx1.sendIdx["should:raise:"]=37;
  6946. self._should_raise_((function(){
  6947. return smalltalk.withContext(function($ctx2) {
  6948. return (16)._ry();
  6949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6950. $ctx1.sendIdx["should:raise:"]=38;
  6951. self._should_raise_((function(){
  6952. return smalltalk.withContext(function($ctx2) {
  6953. return (16)._rZ();
  6954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6955. $ctx1.sendIdx["should:raise:"]=39;
  6956. self._should_raise_((function(){
  6957. return smalltalk.withContext(function($ctx2) {
  6958. return (16)._rz();
  6959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6960. $ctx1.sendIdx["should:raise:"]=40;
  6961. self._should_raise_((function(){
  6962. return smalltalk.withContext(function($ctx2) {
  6963. return (11259375)._Z();
  6964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6965. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6966. args: [],
  6967. 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.",
  6968. 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"],
  6969. referencedClasses: ["MessageNotUnderstood"]
  6970. }),
  6971. globals.NumberTest);
  6972. smalltalk.addMethod(
  6973. smalltalk.method({
  6974. selector: "testLog",
  6975. protocol: 'tests',
  6976. fn: function (){
  6977. var self=this;
  6978. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  6979. return smalltalk.withContext(function($ctx1) {
  6980. self._assert_equals_((10000)._log(),(4));
  6981. $ctx1.sendIdx["assert:equals:"]=1;
  6982. self._assert_equals_((512)._log_((2)),(9));
  6983. $ctx1.sendIdx["assert:equals:"]=2;
  6984. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6985. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  6986. args: [],
  6987. 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.",
  6988. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6989. referencedClasses: ["Number"]
  6990. }),
  6991. globals.NumberTest);
  6992. smalltalk.addMethod(
  6993. smalltalk.method({
  6994. selector: "testMinMax",
  6995. protocol: 'tests',
  6996. fn: function (){
  6997. var self=this;
  6998. return smalltalk.withContext(function($ctx1) {
  6999. self._assert_equals_((2)._max_((5)),(5));
  7000. $ctx1.sendIdx["assert:equals:"]=1;
  7001. self._assert_equals_((2)._min_((5)),(2));
  7002. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7003. args: [],
  7004. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7005. messageSends: ["assert:equals:", "max:", "min:"],
  7006. referencedClasses: []
  7007. }),
  7008. globals.NumberTest);
  7009. smalltalk.addMethod(
  7010. smalltalk.method({
  7011. selector: "testNegated",
  7012. protocol: 'tests',
  7013. fn: function (){
  7014. var self=this;
  7015. return smalltalk.withContext(function($ctx1) {
  7016. var $1;
  7017. $1=(3)._negated();
  7018. $ctx1.sendIdx["negated"]=1;
  7019. self._assert_equals_($1,(-3));
  7020. $ctx1.sendIdx["assert:equals:"]=1;
  7021. self._assert_equals_((-3)._negated(),(3));
  7022. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7023. args: [],
  7024. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7025. messageSends: ["assert:equals:", "negated"],
  7026. referencedClasses: []
  7027. }),
  7028. globals.NumberTest);
  7029. smalltalk.addMethod(
  7030. smalltalk.method({
  7031. selector: "testPrintShowingDecimalPlaces",
  7032. protocol: 'tests',
  7033. fn: function (){
  7034. var self=this;
  7035. return smalltalk.withContext(function($ctx1) {
  7036. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7037. $1=(23)._printShowingDecimalPlaces_((2));
  7038. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7039. self._assert_equals_($1,"23.00");
  7040. $ctx1.sendIdx["assert:equals:"]=1;
  7041. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7042. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7043. self._assert_equals_($2,"23.57");
  7044. $ctx1.sendIdx["assert:equals:"]=2;
  7045. $4=(234.567)._negated();
  7046. $ctx1.sendIdx["negated"]=1;
  7047. $3=_st($4)._printShowingDecimalPlaces_((5));
  7048. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7049. self._assert_equals_($3,"-234.56700");
  7050. $ctx1.sendIdx["assert:equals:"]=3;
  7051. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7052. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7053. self._assert_equals_($5,"23");
  7054. $ctx1.sendIdx["assert:equals:"]=4;
  7055. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7056. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7057. self._assert_equals_($6,"24");
  7058. $ctx1.sendIdx["assert:equals:"]=5;
  7059. $8=(23.4567)._negated();
  7060. $ctx1.sendIdx["negated"]=2;
  7061. $7=_st($8)._printShowingDecimalPlaces_((0));
  7062. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7063. self._assert_equals_($7,"-23");
  7064. $ctx1.sendIdx["assert:equals:"]=6;
  7065. $10=(23.5567)._negated();
  7066. $ctx1.sendIdx["negated"]=3;
  7067. $9=_st($10)._printShowingDecimalPlaces_((0));
  7068. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7069. self._assert_equals_($9,"-24");
  7070. $ctx1.sendIdx["assert:equals:"]=7;
  7071. $11=(100000000)._printShowingDecimalPlaces_((1));
  7072. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7073. self._assert_equals_($11,"100000000.0");
  7074. $ctx1.sendIdx["assert:equals:"]=8;
  7075. $12=(0.98)._printShowingDecimalPlaces_((5));
  7076. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7077. self._assert_equals_($12,"0.98000");
  7078. $ctx1.sendIdx["assert:equals:"]=9;
  7079. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7080. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7081. self._assert_equals_($13,"-0.98");
  7082. $ctx1.sendIdx["assert:equals:"]=10;
  7083. $14=(2.567)._printShowingDecimalPlaces_((2));
  7084. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7085. self._assert_equals_($14,"2.57");
  7086. $ctx1.sendIdx["assert:equals:"]=11;
  7087. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7088. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7089. self._assert_equals_($15,"-2.57");
  7090. $ctx1.sendIdx["assert:equals:"]=12;
  7091. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7092. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7093. args: [],
  7094. 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'.",
  7095. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7096. referencedClasses: []
  7097. }),
  7098. globals.NumberTest);
  7099. smalltalk.addMethod(
  7100. smalltalk.method({
  7101. selector: "testRaisedTo",
  7102. protocol: 'tests',
  7103. fn: function (){
  7104. var self=this;
  7105. return smalltalk.withContext(function($ctx1) {
  7106. var $1,$2,$3;
  7107. $1=(2)._raisedTo_((4));
  7108. $ctx1.sendIdx["raisedTo:"]=1;
  7109. self._assert_equals_($1,(16));
  7110. $ctx1.sendIdx["assert:equals:"]=1;
  7111. $2=(2)._raisedTo_((0));
  7112. $ctx1.sendIdx["raisedTo:"]=2;
  7113. self._assert_equals_($2,(1));
  7114. $ctx1.sendIdx["assert:equals:"]=2;
  7115. $3=(2)._raisedTo_((-3));
  7116. $ctx1.sendIdx["raisedTo:"]=3;
  7117. self._assert_equals_($3,(0.125));
  7118. $ctx1.sendIdx["assert:equals:"]=3;
  7119. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7120. $ctx1.sendIdx["assert:equals:"]=4;
  7121. self._assert_equals_((2).__star_star((4)),(16));
  7122. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7123. args: [],
  7124. 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.",
  7125. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7126. referencedClasses: []
  7127. }),
  7128. globals.NumberTest);
  7129. smalltalk.addMethod(
  7130. smalltalk.method({
  7131. selector: "testRounded",
  7132. protocol: 'tests',
  7133. fn: function (){
  7134. var self=this;
  7135. return smalltalk.withContext(function($ctx1) {
  7136. var $1,$2;
  7137. $1=(3)._rounded();
  7138. $ctx1.sendIdx["rounded"]=1;
  7139. self._assert_equals_($1,(3));
  7140. $ctx1.sendIdx["assert:equals:"]=1;
  7141. $2=(3.212)._rounded();
  7142. $ctx1.sendIdx["rounded"]=2;
  7143. self._assert_equals_($2,(3));
  7144. $ctx1.sendIdx["assert:equals:"]=2;
  7145. self._assert_equals_((3.51)._rounded(),(4));
  7146. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7147. args: [],
  7148. 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",
  7149. messageSends: ["assert:equals:", "rounded"],
  7150. referencedClasses: []
  7151. }),
  7152. globals.NumberTest);
  7153. smalltalk.addMethod(
  7154. smalltalk.method({
  7155. selector: "testSign",
  7156. protocol: 'tests',
  7157. fn: function (){
  7158. var self=this;
  7159. return smalltalk.withContext(function($ctx1) {
  7160. var $1,$2;
  7161. $1=(5)._sign();
  7162. $ctx1.sendIdx["sign"]=1;
  7163. self._assert_equals_($1,(1));
  7164. $ctx1.sendIdx["assert:equals:"]=1;
  7165. $2=(0)._sign();
  7166. $ctx1.sendIdx["sign"]=2;
  7167. self._assert_equals_($2,(0));
  7168. $ctx1.sendIdx["assert:equals:"]=2;
  7169. self._assert_equals_((-1.4)._sign(),(-1));
  7170. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7171. args: [],
  7172. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7173. messageSends: ["assert:equals:", "sign"],
  7174. referencedClasses: []
  7175. }),
  7176. globals.NumberTest);
  7177. smalltalk.addMethod(
  7178. smalltalk.method({
  7179. selector: "testSqrt",
  7180. protocol: 'tests',
  7181. fn: function (){
  7182. var self=this;
  7183. return smalltalk.withContext(function($ctx1) {
  7184. var $1;
  7185. $1=(4)._sqrt();
  7186. $ctx1.sendIdx["sqrt"]=1;
  7187. self._assert_equals_($1,(2));
  7188. $ctx1.sendIdx["assert:equals:"]=1;
  7189. self._assert_equals_((16)._sqrt(),(4));
  7190. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7191. args: [],
  7192. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7193. messageSends: ["assert:equals:", "sqrt"],
  7194. referencedClasses: []
  7195. }),
  7196. globals.NumberTest);
  7197. smalltalk.addMethod(
  7198. smalltalk.method({
  7199. selector: "testSquared",
  7200. protocol: 'tests',
  7201. fn: function (){
  7202. var self=this;
  7203. return smalltalk.withContext(function($ctx1) {
  7204. self._assert_equals_((4)._squared(),(16));
  7205. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7206. args: [],
  7207. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7208. messageSends: ["assert:equals:", "squared"],
  7209. referencedClasses: []
  7210. }),
  7211. globals.NumberTest);
  7212. smalltalk.addMethod(
  7213. smalltalk.method({
  7214. selector: "testTimesRepeat",
  7215. protocol: 'tests',
  7216. fn: function (){
  7217. var self=this;
  7218. var i;
  7219. return smalltalk.withContext(function($ctx1) {
  7220. i=(0);
  7221. (0)._timesRepeat_((function(){
  7222. return smalltalk.withContext(function($ctx2) {
  7223. i=_st(i).__plus((1));
  7224. $ctx2.sendIdx["+"]=1;
  7225. return i;
  7226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7227. $ctx1.sendIdx["timesRepeat:"]=1;
  7228. self._assert_equals_(i,(0));
  7229. $ctx1.sendIdx["assert:equals:"]=1;
  7230. (5)._timesRepeat_((function(){
  7231. return smalltalk.withContext(function($ctx2) {
  7232. i=_st(i).__plus((1));
  7233. return i;
  7234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7235. self._assert_equals_(i,(5));
  7236. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7237. args: [],
  7238. 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",
  7239. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7240. referencedClasses: []
  7241. }),
  7242. globals.NumberTest);
  7243. smalltalk.addMethod(
  7244. smalltalk.method({
  7245. selector: "testTo",
  7246. protocol: 'tests',
  7247. fn: function (){
  7248. var self=this;
  7249. return smalltalk.withContext(function($ctx1) {
  7250. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7251. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7252. args: [],
  7253. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7254. messageSends: ["assert:equals:", "to:"],
  7255. referencedClasses: []
  7256. }),
  7257. globals.NumberTest);
  7258. smalltalk.addMethod(
  7259. smalltalk.method({
  7260. selector: "testToBy",
  7261. protocol: 'tests',
  7262. fn: function (){
  7263. var self=this;
  7264. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7265. return smalltalk.withContext(function($ctx1) {
  7266. var $1;
  7267. $1=(0)._to_by_((6),(2));
  7268. $ctx1.sendIdx["to:by:"]=1;
  7269. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7270. self._should_raise_((function(){
  7271. return smalltalk.withContext(function($ctx2) {
  7272. return (1)._to_by_((4),(0));
  7273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7274. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7275. args: [],
  7276. 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",
  7277. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7278. referencedClasses: ["Error"]
  7279. }),
  7280. globals.NumberTest);
  7281. smalltalk.addMethod(
  7282. smalltalk.method({
  7283. selector: "testTrigonometry",
  7284. protocol: 'tests',
  7285. fn: function (){
  7286. var self=this;
  7287. return smalltalk.withContext(function($ctx1) {
  7288. self._assert_equals_((0)._cos(),(1));
  7289. $ctx1.sendIdx["assert:equals:"]=1;
  7290. self._assert_equals_((0)._sin(),(0));
  7291. $ctx1.sendIdx["assert:equals:"]=2;
  7292. self._assert_equals_((0)._tan(),(0));
  7293. $ctx1.sendIdx["assert:equals:"]=3;
  7294. self._assert_equals_((1)._arcCos(),(0));
  7295. $ctx1.sendIdx["assert:equals:"]=4;
  7296. self._assert_equals_((0)._arcSin(),(0));
  7297. $ctx1.sendIdx["assert:equals:"]=5;
  7298. self._assert_equals_((0)._arcTan(),(0));
  7299. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7300. args: [],
  7301. 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.",
  7302. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7303. referencedClasses: []
  7304. }),
  7305. globals.NumberTest);
  7306. smalltalk.addMethod(
  7307. smalltalk.method({
  7308. selector: "testTruncated",
  7309. protocol: 'tests',
  7310. fn: function (){
  7311. var self=this;
  7312. return smalltalk.withContext(function($ctx1) {
  7313. var $1,$2;
  7314. $1=(3)._truncated();
  7315. $ctx1.sendIdx["truncated"]=1;
  7316. self._assert_equals_($1,(3));
  7317. $ctx1.sendIdx["assert:equals:"]=1;
  7318. $2=(3.212)._truncated();
  7319. $ctx1.sendIdx["truncated"]=2;
  7320. self._assert_equals_($2,(3));
  7321. $ctx1.sendIdx["assert:equals:"]=2;
  7322. self._assert_equals_((3.51)._truncated(),(3));
  7323. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7324. args: [],
  7325. 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",
  7326. messageSends: ["assert:equals:", "truncated"],
  7327. referencedClasses: []
  7328. }),
  7329. globals.NumberTest);
  7330. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7331. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7332. smalltalk.addMethod(
  7333. smalltalk.method({
  7334. selector: "foo",
  7335. protocol: 'not yet classified',
  7336. fn: function (){
  7337. var self=this;
  7338. var $1;
  7339. $1=self["@foo"];
  7340. return $1;
  7341. },
  7342. args: [],
  7343. source: "foo\x0a\x09^ foo",
  7344. messageSends: [],
  7345. referencedClasses: []
  7346. }),
  7347. globals.ObjectMock);
  7348. smalltalk.addMethod(
  7349. smalltalk.method({
  7350. selector: "foo:",
  7351. protocol: 'not yet classified',
  7352. fn: function (anObject){
  7353. var self=this;
  7354. self["@foo"]=anObject;
  7355. return self},
  7356. args: ["anObject"],
  7357. source: "foo: anObject\x0a\x09foo := anObject",
  7358. messageSends: [],
  7359. referencedClasses: []
  7360. }),
  7361. globals.ObjectMock);
  7362. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7363. smalltalk.addMethod(
  7364. smalltalk.method({
  7365. selector: "notDefined",
  7366. protocol: 'tests',
  7367. fn: function (){
  7368. var self=this;
  7369. return smalltalk.withContext(function($ctx1) {
  7370. return void 0;;
  7371. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7372. args: [],
  7373. source: "notDefined\x0a\x09<return void 0;>",
  7374. messageSends: [],
  7375. referencedClasses: []
  7376. }),
  7377. globals.ObjectTest);
  7378. smalltalk.addMethod(
  7379. smalltalk.method({
  7380. selector: "testBasicAccess",
  7381. protocol: 'tests',
  7382. fn: function (){
  7383. var self=this;
  7384. var o;
  7385. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7386. return smalltalk.withContext(function($ctx1) {
  7387. var $1;
  7388. o=_st($Object())._new();
  7389. _st(o)._basicAt_put_("a",(1));
  7390. $1=_st(o)._basicAt_("a");
  7391. $ctx1.sendIdx["basicAt:"]=1;
  7392. self._assert_equals_($1,(1));
  7393. $ctx1.sendIdx["assert:equals:"]=1;
  7394. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7395. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7396. args: [],
  7397. 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",
  7398. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7399. referencedClasses: ["Object"]
  7400. }),
  7401. globals.ObjectTest);
  7402. smalltalk.addMethod(
  7403. smalltalk.method({
  7404. selector: "testBasicPerform",
  7405. protocol: 'tests',
  7406. fn: function (){
  7407. var self=this;
  7408. var o;
  7409. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7410. return smalltalk.withContext(function($ctx1) {
  7411. o=_st($Object())._new();
  7412. _st(o)._basicAt_put_("func",(function(){
  7413. return "hello";
  7414. }));
  7415. $ctx1.sendIdx["basicAt:put:"]=1;
  7416. _st(o)._basicAt_put_("func2",(function(a){
  7417. return smalltalk.withContext(function($ctx2) {
  7418. return _st(a).__plus((1));
  7419. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7420. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7421. $ctx1.sendIdx["assert:equals:"]=1;
  7422. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7423. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7424. args: [],
  7425. 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",
  7426. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7427. referencedClasses: ["Object"]
  7428. }),
  7429. globals.ObjectTest);
  7430. smalltalk.addMethod(
  7431. smalltalk.method({
  7432. selector: "testDNU",
  7433. protocol: 'tests',
  7434. fn: function (){
  7435. var self=this;
  7436. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7437. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7438. return smalltalk.withContext(function($ctx1) {
  7439. self._should_raise_((function(){
  7440. return smalltalk.withContext(function($ctx2) {
  7441. return _st(_st($Object())._new())._foo();
  7442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7443. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7444. args: [],
  7445. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7446. messageSends: ["should:raise:", "foo", "new"],
  7447. referencedClasses: ["Object", "MessageNotUnderstood"]
  7448. }),
  7449. globals.ObjectTest);
  7450. smalltalk.addMethod(
  7451. smalltalk.method({
  7452. selector: "testEquality",
  7453. protocol: 'tests',
  7454. fn: function (){
  7455. var self=this;
  7456. var o;
  7457. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7458. return smalltalk.withContext(function($ctx1) {
  7459. var $1,$2,$4,$3;
  7460. o=_st($Object())._new();
  7461. $ctx1.sendIdx["new"]=1;
  7462. $1=_st(o).__eq(_st($Object())._new());
  7463. $ctx1.sendIdx["="]=1;
  7464. self._deny_($1);
  7465. $2=_st(o).__eq(o);
  7466. $ctx1.sendIdx["="]=2;
  7467. self._assert_($2);
  7468. $ctx1.sendIdx["assert:"]=1;
  7469. $4=_st(o)._yourself();
  7470. $ctx1.sendIdx["yourself"]=1;
  7471. $3=_st($4).__eq(o);
  7472. $ctx1.sendIdx["="]=3;
  7473. self._assert_($3);
  7474. $ctx1.sendIdx["assert:"]=2;
  7475. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7476. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7477. args: [],
  7478. 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)",
  7479. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7480. referencedClasses: ["Object"]
  7481. }),
  7482. globals.ObjectTest);
  7483. smalltalk.addMethod(
  7484. smalltalk.method({
  7485. selector: "testHalt",
  7486. protocol: 'tests',
  7487. fn: function (){
  7488. var self=this;
  7489. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7490. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7491. return smalltalk.withContext(function($ctx1) {
  7492. self._should_raise_((function(){
  7493. return smalltalk.withContext(function($ctx2) {
  7494. return _st(_st($Object())._new())._halt();
  7495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7496. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7497. args: [],
  7498. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7499. messageSends: ["should:raise:", "halt", "new"],
  7500. referencedClasses: ["Object", "Error"]
  7501. }),
  7502. globals.ObjectTest);
  7503. smalltalk.addMethod(
  7504. smalltalk.method({
  7505. selector: "testIdentity",
  7506. protocol: 'tests',
  7507. fn: function (){
  7508. var self=this;
  7509. var o;
  7510. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7511. return smalltalk.withContext(function($ctx1) {
  7512. var $1,$2,$4,$3;
  7513. o=_st($Object())._new();
  7514. $ctx1.sendIdx["new"]=1;
  7515. $1=_st(o).__eq_eq(_st($Object())._new());
  7516. $ctx1.sendIdx["=="]=1;
  7517. self._deny_($1);
  7518. $2=_st(o).__eq_eq(o);
  7519. $ctx1.sendIdx["=="]=2;
  7520. self._assert_($2);
  7521. $ctx1.sendIdx["assert:"]=1;
  7522. $4=_st(o)._yourself();
  7523. $ctx1.sendIdx["yourself"]=1;
  7524. $3=_st($4).__eq_eq(o);
  7525. $ctx1.sendIdx["=="]=3;
  7526. self._assert_($3);
  7527. $ctx1.sendIdx["assert:"]=2;
  7528. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7529. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7530. args: [],
  7531. 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",
  7532. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7533. referencedClasses: ["Object"]
  7534. }),
  7535. globals.ObjectTest);
  7536. smalltalk.addMethod(
  7537. smalltalk.method({
  7538. selector: "testIfNil",
  7539. protocol: 'tests',
  7540. fn: function (){
  7541. var self=this;
  7542. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7543. return smalltalk.withContext(function($ctx1) {
  7544. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7545. $2=_st($Object())._new();
  7546. $ctx1.sendIdx["new"]=1;
  7547. $1=_st($2)._isNil();
  7548. self._deny_($1);
  7549. $ctx1.sendIdx["deny:"]=1;
  7550. $5=_st($Object())._new();
  7551. $ctx1.sendIdx["new"]=2;
  7552. if(($receiver = $5) == null || $receiver.isNil){
  7553. $4=true;
  7554. } else {
  7555. $4=$5;
  7556. };
  7557. $3=_st($4).__eq(true);
  7558. self._deny_($3);
  7559. $7=_st($Object())._new();
  7560. $ctx1.sendIdx["new"]=3;
  7561. if(($receiver = $7) == null || $receiver.isNil){
  7562. $6=$7;
  7563. } else {
  7564. $6=true;
  7565. };
  7566. self._assert_equals_($6,true);
  7567. $ctx1.sendIdx["assert:equals:"]=1;
  7568. $9=_st($Object())._new();
  7569. $ctx1.sendIdx["new"]=4;
  7570. if(($receiver = $9) == null || $receiver.isNil){
  7571. $8=false;
  7572. } else {
  7573. $8=true;
  7574. };
  7575. self._assert_equals_($8,true);
  7576. $ctx1.sendIdx["assert:equals:"]=2;
  7577. $11=_st($Object())._new();
  7578. if(($receiver = $11) == null || $receiver.isNil){
  7579. $10=false;
  7580. } else {
  7581. $10=true;
  7582. };
  7583. self._assert_equals_($10,true);
  7584. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7585. args: [],
  7586. 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",
  7587. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7588. referencedClasses: ["Object"]
  7589. }),
  7590. globals.ObjectTest);
  7591. smalltalk.addMethod(
  7592. smalltalk.method({
  7593. selector: "testInstVars",
  7594. protocol: 'tests',
  7595. fn: function (){
  7596. var self=this;
  7597. var o;
  7598. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7599. return smalltalk.withContext(function($ctx1) {
  7600. var $1,$2;
  7601. o=_st($ObjectMock())._new();
  7602. $1=_st(o)._instVarAt_("foo");
  7603. $ctx1.sendIdx["instVarAt:"]=1;
  7604. self._assert_equals_($1,nil);
  7605. $ctx1.sendIdx["assert:equals:"]=1;
  7606. _st(o)._instVarAt_put_("foo",(1));
  7607. $2=_st(o)._instVarAt_("foo");
  7608. $ctx1.sendIdx["instVarAt:"]=2;
  7609. self._assert_equals_($2,(1));
  7610. $ctx1.sendIdx["assert:equals:"]=2;
  7611. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7612. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7613. args: [],
  7614. 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",
  7615. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7616. referencedClasses: ["ObjectMock"]
  7617. }),
  7618. globals.ObjectTest);
  7619. smalltalk.addMethod(
  7620. smalltalk.method({
  7621. selector: "testNilUndefined",
  7622. protocol: 'tests',
  7623. fn: function (){
  7624. var self=this;
  7625. return smalltalk.withContext(function($ctx1) {
  7626. self._assert_equals_(self._notDefined(),nil);
  7627. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7628. args: [],
  7629. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7630. messageSends: ["assert:equals:", "notDefined"],
  7631. referencedClasses: []
  7632. }),
  7633. globals.ObjectTest);
  7634. smalltalk.addMethod(
  7635. smalltalk.method({
  7636. selector: "testYourself",
  7637. protocol: 'tests',
  7638. fn: function (){
  7639. var self=this;
  7640. var o;
  7641. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7642. return smalltalk.withContext(function($ctx1) {
  7643. o=_st($ObjectMock())._new();
  7644. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7645. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7646. args: [],
  7647. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7648. messageSends: ["new", "assert:", "==", "yourself"],
  7649. referencedClasses: ["ObjectMock"]
  7650. }),
  7651. globals.ObjectTest);
  7652. smalltalk.addMethod(
  7653. smalltalk.method({
  7654. selector: "testidentityHash",
  7655. protocol: 'tests',
  7656. fn: function (){
  7657. var self=this;
  7658. var o1,o2;
  7659. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7660. return smalltalk.withContext(function($ctx1) {
  7661. var $2,$3,$1,$5,$4;
  7662. o1=_st($Object())._new();
  7663. $ctx1.sendIdx["new"]=1;
  7664. o2=_st($Object())._new();
  7665. $2=_st(o1)._identityHash();
  7666. $ctx1.sendIdx["identityHash"]=1;
  7667. $3=_st(o1)._identityHash();
  7668. $ctx1.sendIdx["identityHash"]=2;
  7669. $1=_st($2).__eq_eq($3);
  7670. $ctx1.sendIdx["=="]=1;
  7671. self._assert_($1);
  7672. $5=_st(o1)._identityHash();
  7673. $ctx1.sendIdx["identityHash"]=3;
  7674. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7675. self._deny_($4);
  7676. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7677. args: [],
  7678. 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",
  7679. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7680. referencedClasses: ["Object"]
  7681. }),
  7682. globals.ObjectTest);
  7683. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7684. smalltalk.addMethod(
  7685. smalltalk.method({
  7686. selector: "testAccessing",
  7687. protocol: 'tests',
  7688. fn: function (){
  7689. var self=this;
  7690. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7691. return smalltalk.withContext(function($ctx1) {
  7692. var $2,$1,$3,$6,$5,$4;
  7693. $2=_st($Point())._x_y_((3),(4));
  7694. $ctx1.sendIdx["x:y:"]=1;
  7695. $1=_st($2)._x();
  7696. $ctx1.sendIdx["x"]=1;
  7697. self._assert_equals_($1,(3));
  7698. $ctx1.sendIdx["assert:equals:"]=1;
  7699. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7700. $ctx1.sendIdx["y"]=1;
  7701. self._assert_equals_($3,(4));
  7702. $ctx1.sendIdx["assert:equals:"]=2;
  7703. $6=_st($Point())._new();
  7704. $ctx1.sendIdx["new"]=1;
  7705. $5=_st($6)._x_((3));
  7706. $4=_st($5)._x();
  7707. self._assert_equals_($4,(3));
  7708. $ctx1.sendIdx["assert:equals:"]=3;
  7709. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7710. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7711. args: [],
  7712. 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",
  7713. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7714. referencedClasses: ["Point"]
  7715. }),
  7716. globals.PointTest);
  7717. smalltalk.addMethod(
  7718. smalltalk.method({
  7719. selector: "testArithmetic",
  7720. protocol: 'tests',
  7721. fn: function (){
  7722. var self=this;
  7723. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7724. return smalltalk.withContext(function($ctx1) {
  7725. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7726. $2=(3).__at((4));
  7727. $ctx1.sendIdx["@"]=1;
  7728. $3=(3).__at((4));
  7729. $ctx1.sendIdx["@"]=2;
  7730. $1=_st($2).__star($3);
  7731. $4=_st($Point())._x_y_((9),(16));
  7732. $ctx1.sendIdx["x:y:"]=1;
  7733. self._assert_equals_($1,$4);
  7734. $ctx1.sendIdx["assert:equals:"]=1;
  7735. $6=(3).__at((4));
  7736. $ctx1.sendIdx["@"]=3;
  7737. $7=(3).__at((4));
  7738. $ctx1.sendIdx["@"]=4;
  7739. $5=_st($6).__plus($7);
  7740. $8=_st($Point())._x_y_((6),(8));
  7741. $ctx1.sendIdx["x:y:"]=2;
  7742. self._assert_equals_($5,$8);
  7743. $ctx1.sendIdx["assert:equals:"]=2;
  7744. $10=(3).__at((4));
  7745. $ctx1.sendIdx["@"]=5;
  7746. $11=(3).__at((4));
  7747. $ctx1.sendIdx["@"]=6;
  7748. $9=_st($10).__minus($11);
  7749. $12=_st($Point())._x_y_((0),(0));
  7750. $ctx1.sendIdx["x:y:"]=3;
  7751. self._assert_equals_($9,$12);
  7752. $ctx1.sendIdx["assert:equals:"]=3;
  7753. $14=(6).__at((8));
  7754. $ctx1.sendIdx["@"]=7;
  7755. $13=_st($14).__slash((3).__at((4)));
  7756. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7757. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7758. args: [],
  7759. 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)",
  7760. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7761. referencedClasses: ["Point"]
  7762. }),
  7763. globals.PointTest);
  7764. smalltalk.addMethod(
  7765. smalltalk.method({
  7766. selector: "testAt",
  7767. protocol: 'tests',
  7768. fn: function (){
  7769. var self=this;
  7770. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7771. return smalltalk.withContext(function($ctx1) {
  7772. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7773. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7774. args: [],
  7775. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7776. messageSends: ["assert:equals:", "@", "x:y:"],
  7777. referencedClasses: ["Point"]
  7778. }),
  7779. globals.PointTest);
  7780. smalltalk.addMethod(
  7781. smalltalk.method({
  7782. selector: "testComparison",
  7783. protocol: 'tests',
  7784. fn: function (){
  7785. var self=this;
  7786. return smalltalk.withContext(function($ctx1) {
  7787. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7788. $2=(3).__at((4));
  7789. $ctx1.sendIdx["@"]=1;
  7790. $3=(4).__at((5));
  7791. $ctx1.sendIdx["@"]=2;
  7792. $1=_st($2).__lt($3);
  7793. $ctx1.sendIdx["<"]=1;
  7794. self._assert_($1);
  7795. $ctx1.sendIdx["assert:"]=1;
  7796. $5=(3).__at((4));
  7797. $ctx1.sendIdx["@"]=3;
  7798. $6=(4).__at((4));
  7799. $ctx1.sendIdx["@"]=4;
  7800. $4=_st($5).__lt($6);
  7801. self._deny_($4);
  7802. $ctx1.sendIdx["deny:"]=1;
  7803. $8=(4).__at((5));
  7804. $ctx1.sendIdx["@"]=5;
  7805. $9=(4).__at((5));
  7806. $ctx1.sendIdx["@"]=6;
  7807. $7=_st($8).__lt_eq($9);
  7808. $ctx1.sendIdx["<="]=1;
  7809. self._assert_($7);
  7810. $ctx1.sendIdx["assert:"]=2;
  7811. $11=(4).__at((5));
  7812. $ctx1.sendIdx["@"]=7;
  7813. $12=(3).__at((5));
  7814. $ctx1.sendIdx["@"]=8;
  7815. $10=_st($11).__lt_eq($12);
  7816. self._deny_($10);
  7817. $ctx1.sendIdx["deny:"]=2;
  7818. $14=(5).__at((6));
  7819. $ctx1.sendIdx["@"]=9;
  7820. $15=(4).__at((5));
  7821. $ctx1.sendIdx["@"]=10;
  7822. $13=_st($14).__gt($15);
  7823. $ctx1.sendIdx[">"]=1;
  7824. self._assert_($13);
  7825. $ctx1.sendIdx["assert:"]=3;
  7826. $17=(5).__at((6));
  7827. $ctx1.sendIdx["@"]=11;
  7828. $18=(6).__at((6));
  7829. $ctx1.sendIdx["@"]=12;
  7830. $16=_st($17).__gt($18);
  7831. self._deny_($16);
  7832. $ctx1.sendIdx["deny:"]=3;
  7833. $20=(4).__at((5));
  7834. $ctx1.sendIdx["@"]=13;
  7835. $21=(4).__at((5));
  7836. $ctx1.sendIdx["@"]=14;
  7837. $19=_st($20).__gt_eq($21);
  7838. $ctx1.sendIdx[">="]=1;
  7839. self._assert_($19);
  7840. $23=(4).__at((5));
  7841. $ctx1.sendIdx["@"]=15;
  7842. $22=_st($23).__gt_eq((5).__at((5)));
  7843. self._deny_($22);
  7844. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  7845. args: [],
  7846. 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)",
  7847. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  7848. referencedClasses: []
  7849. }),
  7850. globals.PointTest);
  7851. smalltalk.addMethod(
  7852. smalltalk.method({
  7853. selector: "testEgality",
  7854. protocol: 'tests',
  7855. fn: function (){
  7856. var self=this;
  7857. return smalltalk.withContext(function($ctx1) {
  7858. var $2,$3,$1,$5,$4;
  7859. $2=(3).__at((4));
  7860. $ctx1.sendIdx["@"]=1;
  7861. $3=(3).__at((4));
  7862. $ctx1.sendIdx["@"]=2;
  7863. $1=_st($2).__eq($3);
  7864. $ctx1.sendIdx["="]=1;
  7865. self._assert_($1);
  7866. $5=(3).__at((5));
  7867. $ctx1.sendIdx["@"]=3;
  7868. $4=_st($5).__eq((3).__at((6)));
  7869. self._deny_($4);
  7870. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7871. args: [],
  7872. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7873. messageSends: ["assert:", "=", "@", "deny:"],
  7874. referencedClasses: []
  7875. }),
  7876. globals.PointTest);
  7877. smalltalk.addMethod(
  7878. smalltalk.method({
  7879. selector: "testNew",
  7880. protocol: 'tests',
  7881. fn: function (){
  7882. var self=this;
  7883. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7884. return smalltalk.withContext(function($ctx1) {
  7885. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7886. $3=_st($Point())._new();
  7887. $ctx1.sendIdx["new"]=1;
  7888. $2=_st($3)._x_((3));
  7889. $ctx1.sendIdx["x:"]=1;
  7890. $1=_st($2)._y();
  7891. $ctx1.sendIdx["y"]=1;
  7892. self._assert_equals_($1,nil);
  7893. $ctx1.sendIdx["assert:equals:"]=1;
  7894. $7=_st($Point())._new();
  7895. $ctx1.sendIdx["new"]=2;
  7896. $6=_st($7)._x_((3));
  7897. $5=_st($6)._x();
  7898. $ctx1.sendIdx["x"]=1;
  7899. $4=_st($5).__eq((0));
  7900. $ctx1.sendIdx["="]=1;
  7901. self._deny_($4);
  7902. $ctx1.sendIdx["deny:"]=1;
  7903. $10=_st($Point())._new();
  7904. $ctx1.sendIdx["new"]=3;
  7905. $9=_st($10)._y_((4));
  7906. $ctx1.sendIdx["y:"]=1;
  7907. $8=_st($9)._x();
  7908. self._assert_equals_($8,nil);
  7909. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7910. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7911. args: [],
  7912. 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",
  7913. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7914. referencedClasses: ["Point"]
  7915. }),
  7916. globals.PointTest);
  7917. smalltalk.addMethod(
  7918. smalltalk.method({
  7919. selector: "testTranslateBy",
  7920. protocol: 'tests',
  7921. fn: function (){
  7922. var self=this;
  7923. return smalltalk.withContext(function($ctx1) {
  7924. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7925. $2=(3).__at((3));
  7926. $ctx1.sendIdx["@"]=1;
  7927. $3=(0).__at((1));
  7928. $ctx1.sendIdx["@"]=2;
  7929. $1=_st($2)._translateBy_($3);
  7930. $ctx1.sendIdx["translateBy:"]=1;
  7931. $4=(3).__at((4));
  7932. $ctx1.sendIdx["@"]=3;
  7933. self._assert_equals_($1,$4);
  7934. $ctx1.sendIdx["assert:equals:"]=1;
  7935. $6=(3).__at((3));
  7936. $ctx1.sendIdx["@"]=4;
  7937. $8=(1)._negated();
  7938. $ctx1.sendIdx["negated"]=1;
  7939. $7=(0).__at($8);
  7940. $ctx1.sendIdx["@"]=5;
  7941. $5=_st($6)._translateBy_($7);
  7942. $ctx1.sendIdx["translateBy:"]=2;
  7943. $9=(3).__at((2));
  7944. $ctx1.sendIdx["@"]=6;
  7945. self._assert_equals_($5,$9);
  7946. $ctx1.sendIdx["assert:equals:"]=2;
  7947. $11=(3).__at((3));
  7948. $ctx1.sendIdx["@"]=7;
  7949. $12=(2).__at((3));
  7950. $ctx1.sendIdx["@"]=8;
  7951. $10=_st($11)._translateBy_($12);
  7952. $ctx1.sendIdx["translateBy:"]=3;
  7953. $13=(5).__at((6));
  7954. $ctx1.sendIdx["@"]=9;
  7955. self._assert_equals_($10,$13);
  7956. $ctx1.sendIdx["assert:equals:"]=3;
  7957. $15=(3).__at((3));
  7958. $ctx1.sendIdx["@"]=10;
  7959. $16=_st((3)._negated()).__at((0));
  7960. $ctx1.sendIdx["@"]=11;
  7961. $14=_st($15)._translateBy_($16);
  7962. self._assert_equals_($14,(0).__at((3)));
  7963. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7964. args: [],
  7965. 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.",
  7966. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7967. referencedClasses: []
  7968. }),
  7969. globals.PointTest);
  7970. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7971. smalltalk.addMethod(
  7972. smalltalk.method({
  7973. selector: "testNextIfAbsent",
  7974. protocol: 'tests',
  7975. fn: function (){
  7976. var self=this;
  7977. var queue;
  7978. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7979. return smalltalk.withContext(function($ctx1) {
  7980. var $2,$1;
  7981. queue=_st($Queue())._new();
  7982. _st(queue)._nextPut_("index1");
  7983. $2=_st(queue)._nextIfAbsent_("empty");
  7984. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7985. $1=_st($2).__eq("index1");
  7986. $ctx1.sendIdx["="]=1;
  7987. self._assert_($1);
  7988. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7989. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7990. args: [],
  7991. 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'",
  7992. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7993. referencedClasses: ["Queue"]
  7994. }),
  7995. globals.QueueTest);
  7996. smalltalk.addMethod(
  7997. smalltalk.method({
  7998. selector: "testQueueNext",
  7999. protocol: 'tests',
  8000. fn: function (){
  8001. var self=this;
  8002. var queue;
  8003. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8004. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8005. return smalltalk.withContext(function($ctx1) {
  8006. var $1,$2,$4,$3,$6,$5;
  8007. queue=_st($Queue())._new();
  8008. $1=queue;
  8009. _st($1)._nextPut_("index1");
  8010. $ctx1.sendIdx["nextPut:"]=1;
  8011. $2=_st($1)._nextPut_("index2");
  8012. $4=_st(queue)._next();
  8013. $ctx1.sendIdx["next"]=1;
  8014. $3=_st($4).__eq("index1");
  8015. $ctx1.sendIdx["="]=1;
  8016. self._assert_($3);
  8017. $6=_st(queue)._next();
  8018. $ctx1.sendIdx["next"]=2;
  8019. $5=_st($6).__eq("index");
  8020. self._deny_($5);
  8021. self._should_raise_((function(){
  8022. return smalltalk.withContext(function($ctx2) {
  8023. return _st(queue)._next();
  8024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8025. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  8026. args: [],
  8027. 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",
  8028. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8029. referencedClasses: ["Queue", "Error"]
  8030. }),
  8031. globals.QueueTest);
  8032. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8033. smalltalk.addMethod(
  8034. smalltalk.method({
  8035. selector: "testAtRandomNumber",
  8036. protocol: 'tests',
  8037. fn: function (){
  8038. var self=this;
  8039. var val;
  8040. return smalltalk.withContext(function($ctx1) {
  8041. (100)._timesRepeat_((function(){
  8042. return smalltalk.withContext(function($ctx2) {
  8043. val=(10)._atRandom();
  8044. val;
  8045. self._assert_(_st(val).__gt((0)));
  8046. $ctx2.sendIdx["assert:"]=1;
  8047. return self._assert_(_st(val).__lt((11)));
  8048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8049. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8050. args: [],
  8051. 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]",
  8052. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8053. referencedClasses: []
  8054. }),
  8055. globals.RandomTest);
  8056. smalltalk.addMethod(
  8057. smalltalk.method({
  8058. selector: "testAtRandomSequenceableCollection",
  8059. protocol: 'tests',
  8060. fn: function (){
  8061. var self=this;
  8062. var val;
  8063. return smalltalk.withContext(function($ctx1) {
  8064. var $3,$4,$2,$1;
  8065. (100)._timesRepeat_((function(){
  8066. return smalltalk.withContext(function($ctx2) {
  8067. val="abc"._atRandom();
  8068. val;
  8069. $3=_st(val).__eq("a");
  8070. $ctx2.sendIdx["="]=1;
  8071. $4=_st(val).__eq("b");
  8072. $ctx2.sendIdx["="]=2;
  8073. $2=_st($3).__or($4);
  8074. $1=_st($2).__or(_st(val).__eq("c"));
  8075. $ctx2.sendIdx["|"]=1;
  8076. return self._assert_($1);
  8077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8078. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8079. args: [],
  8080. 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].",
  8081. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8082. referencedClasses: []
  8083. }),
  8084. globals.RandomTest);
  8085. smalltalk.addMethod(
  8086. smalltalk.method({
  8087. selector: "textNext",
  8088. protocol: 'tests',
  8089. fn: function (){
  8090. var self=this;
  8091. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8092. return smalltalk.withContext(function($ctx1) {
  8093. var $1;
  8094. (10000)._timesRepeat_((function(){
  8095. var current,next;
  8096. return smalltalk.withContext(function($ctx2) {
  8097. next=_st(_st($Random())._new())._next();
  8098. next;
  8099. self._assert_(_st(next).__gt_eq((0)));
  8100. $ctx2.sendIdx["assert:"]=1;
  8101. self._assert_(_st(next).__lt((1)));
  8102. $1=_st(current).__eq(next);
  8103. $ctx2.sendIdx["="]=1;
  8104. self._deny_($1);
  8105. return _st(next).__eq(current);
  8106. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8107. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8108. args: [],
  8109. 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 ]",
  8110. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8111. referencedClasses: ["Random"]
  8112. }),
  8113. globals.RandomTest);
  8114. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8115. smalltalk.addMethod(
  8116. smalltalk.method({
  8117. selector: "collectionClass",
  8118. protocol: 'accessing',
  8119. fn: function (){
  8120. var self=this;
  8121. return smalltalk.withContext(function($ctx1) {
  8122. var $1;
  8123. $1=_st(self._class())._collectionClass();
  8124. return $1;
  8125. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8126. args: [],
  8127. source: "collectionClass\x0a\x09^ self class collectionClass",
  8128. messageSends: ["collectionClass", "class"],
  8129. referencedClasses: []
  8130. }),
  8131. globals.StreamTest);
  8132. smalltalk.addMethod(
  8133. smalltalk.method({
  8134. selector: "newCollection",
  8135. protocol: 'accessing',
  8136. fn: function (){
  8137. var self=this;
  8138. return smalltalk.withContext(function($ctx1) {
  8139. var $1;
  8140. $1=_st(self._collectionClass())._new();
  8141. return $1;
  8142. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8143. args: [],
  8144. source: "newCollection\x0a\x09^ self collectionClass new",
  8145. messageSends: ["new", "collectionClass"],
  8146. referencedClasses: []
  8147. }),
  8148. globals.StreamTest);
  8149. smalltalk.addMethod(
  8150. smalltalk.method({
  8151. selector: "newStream",
  8152. protocol: 'accessing',
  8153. fn: function (){
  8154. var self=this;
  8155. return smalltalk.withContext(function($ctx1) {
  8156. var $1;
  8157. $1=_st(_st(self._collectionClass())._new())._stream();
  8158. return $1;
  8159. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8160. args: [],
  8161. source: "newStream\x0a\x09^ self collectionClass new stream",
  8162. messageSends: ["stream", "new", "collectionClass"],
  8163. referencedClasses: []
  8164. }),
  8165. globals.StreamTest);
  8166. smalltalk.addMethod(
  8167. smalltalk.method({
  8168. selector: "testAtStartAtEnd",
  8169. protocol: 'tests',
  8170. fn: function (){
  8171. var self=this;
  8172. var stream;
  8173. return smalltalk.withContext(function($ctx1) {
  8174. var $1,$2,$3,$4;
  8175. stream=self._newStream();
  8176. $1=_st(stream)._atStart();
  8177. $ctx1.sendIdx["atStart"]=1;
  8178. self._assert_($1);
  8179. $ctx1.sendIdx["assert:"]=1;
  8180. $2=_st(stream)._atEnd();
  8181. $ctx1.sendIdx["atEnd"]=1;
  8182. self._assert_($2);
  8183. $ctx1.sendIdx["assert:"]=2;
  8184. _st(stream)._nextPutAll_(self._newCollection());
  8185. $3=_st(stream)._atEnd();
  8186. $ctx1.sendIdx["atEnd"]=2;
  8187. self._assert_($3);
  8188. $4=_st(stream)._atStart();
  8189. $ctx1.sendIdx["atStart"]=2;
  8190. self._deny_($4);
  8191. $ctx1.sendIdx["deny:"]=1;
  8192. _st(stream)._position_((1));
  8193. self._deny_(_st(stream)._atEnd());
  8194. $ctx1.sendIdx["deny:"]=2;
  8195. self._deny_(_st(stream)._atStart());
  8196. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8197. args: [],
  8198. 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",
  8199. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8200. referencedClasses: []
  8201. }),
  8202. globals.StreamTest);
  8203. smalltalk.addMethod(
  8204. smalltalk.method({
  8205. selector: "testContents",
  8206. protocol: 'tests',
  8207. fn: function (){
  8208. var self=this;
  8209. var stream;
  8210. return smalltalk.withContext(function($ctx1) {
  8211. var $1,$2;
  8212. stream=self._newStream();
  8213. $1=stream;
  8214. $2=self._newCollection();
  8215. $ctx1.sendIdx["newCollection"]=1;
  8216. _st($1)._nextPutAll_($2);
  8217. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8218. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8219. args: [],
  8220. 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",
  8221. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8222. referencedClasses: []
  8223. }),
  8224. globals.StreamTest);
  8225. smalltalk.addMethod(
  8226. smalltalk.method({
  8227. selector: "testIsEmpty",
  8228. protocol: 'tests',
  8229. fn: function (){
  8230. var self=this;
  8231. var stream;
  8232. return smalltalk.withContext(function($ctx1) {
  8233. var $1;
  8234. stream=self._newStream();
  8235. $1=_st(stream)._isEmpty();
  8236. $ctx1.sendIdx["isEmpty"]=1;
  8237. self._assert_($1);
  8238. _st(stream)._nextPutAll_(self._newCollection());
  8239. self._deny_(_st(stream)._isEmpty());
  8240. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8241. args: [],
  8242. 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",
  8243. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8244. referencedClasses: []
  8245. }),
  8246. globals.StreamTest);
  8247. smalltalk.addMethod(
  8248. smalltalk.method({
  8249. selector: "testPosition",
  8250. protocol: 'tests',
  8251. fn: function (){
  8252. var self=this;
  8253. var collection,stream;
  8254. return smalltalk.withContext(function($ctx1) {
  8255. var $1,$2,$3;
  8256. collection=self._newCollection();
  8257. stream=self._newStream();
  8258. _st(stream)._nextPutAll_(collection);
  8259. $1=_st(stream)._position();
  8260. $ctx1.sendIdx["position"]=1;
  8261. self._assert_equals_($1,_st(collection)._size());
  8262. $ctx1.sendIdx["assert:equals:"]=1;
  8263. _st(stream)._position_((0));
  8264. $2=_st(stream)._position();
  8265. $ctx1.sendIdx["position"]=2;
  8266. self._assert_equals_($2,(0));
  8267. $ctx1.sendIdx["assert:equals:"]=2;
  8268. _st(stream)._next();
  8269. $ctx1.sendIdx["next"]=1;
  8270. $3=_st(stream)._position();
  8271. $ctx1.sendIdx["position"]=3;
  8272. self._assert_equals_($3,(1));
  8273. $ctx1.sendIdx["assert:equals:"]=3;
  8274. _st(stream)._next();
  8275. self._assert_equals_(_st(stream)._position(),(2));
  8276. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8277. args: [],
  8278. 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",
  8279. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8280. referencedClasses: []
  8281. }),
  8282. globals.StreamTest);
  8283. smalltalk.addMethod(
  8284. smalltalk.method({
  8285. selector: "testReading",
  8286. protocol: 'tests',
  8287. fn: function (){
  8288. var self=this;
  8289. var stream,collection;
  8290. return smalltalk.withContext(function($ctx1) {
  8291. var $1,$2,$3;
  8292. collection=self._newCollection();
  8293. stream=self._newStream();
  8294. $1=stream;
  8295. _st($1)._nextPutAll_(collection);
  8296. $2=_st($1)._position_((0));
  8297. _st(collection)._do_((function(each){
  8298. return smalltalk.withContext(function($ctx2) {
  8299. $3=_st(stream)._next();
  8300. $ctx2.sendIdx["next"]=1;
  8301. return self._assert_equals_($3,each);
  8302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8303. self._assert_(_st(_st(stream)._next())._isNil());
  8304. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8305. args: [],
  8306. 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",
  8307. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8308. referencedClasses: []
  8309. }),
  8310. globals.StreamTest);
  8311. smalltalk.addMethod(
  8312. smalltalk.method({
  8313. selector: "testStreamContents",
  8314. protocol: 'tests',
  8315. fn: function (){
  8316. var self=this;
  8317. return self},
  8318. args: [],
  8319. source: "testStreamContents",
  8320. messageSends: [],
  8321. referencedClasses: []
  8322. }),
  8323. globals.StreamTest);
  8324. smalltalk.addMethod(
  8325. smalltalk.method({
  8326. selector: "testWrite",
  8327. protocol: 'tests',
  8328. fn: function (){
  8329. var self=this;
  8330. var stream,collection;
  8331. return smalltalk.withContext(function($ctx1) {
  8332. collection=self._newCollection();
  8333. stream=self._newStream();
  8334. _st(collection)._do_((function(each){
  8335. return smalltalk.withContext(function($ctx2) {
  8336. return _st(stream).__lt_lt(each);
  8337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8338. self._assert_equals_(_st(stream)._contents(),collection);
  8339. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8340. args: [],
  8341. 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",
  8342. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8343. referencedClasses: []
  8344. }),
  8345. globals.StreamTest);
  8346. smalltalk.addMethod(
  8347. smalltalk.method({
  8348. selector: "testWriting",
  8349. protocol: 'tests',
  8350. fn: function (){
  8351. var self=this;
  8352. var stream,collection;
  8353. return smalltalk.withContext(function($ctx1) {
  8354. var $1;
  8355. collection=self._newCollection();
  8356. stream=self._newStream();
  8357. $ctx1.sendIdx["newStream"]=1;
  8358. _st(collection)._do_((function(each){
  8359. return smalltalk.withContext(function($ctx2) {
  8360. return _st(stream)._nextPut_(each);
  8361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8362. $1=_st(stream)._contents();
  8363. $ctx1.sendIdx["contents"]=1;
  8364. self._assert_equals_($1,collection);
  8365. $ctx1.sendIdx["assert:equals:"]=1;
  8366. stream=self._newStream();
  8367. _st(stream)._nextPutAll_(collection);
  8368. self._assert_equals_(_st(stream)._contents(),collection);
  8369. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8370. args: [],
  8371. 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",
  8372. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8373. referencedClasses: []
  8374. }),
  8375. globals.StreamTest);
  8376. smalltalk.addMethod(
  8377. smalltalk.method({
  8378. selector: "collectionClass",
  8379. protocol: 'accessing',
  8380. fn: function (){
  8381. var self=this;
  8382. return nil;
  8383. },
  8384. args: [],
  8385. source: "collectionClass\x0a\x09^ nil",
  8386. messageSends: [],
  8387. referencedClasses: []
  8388. }),
  8389. globals.StreamTest.klass);
  8390. smalltalk.addMethod(
  8391. smalltalk.method({
  8392. selector: "isAbstract",
  8393. protocol: 'testing',
  8394. fn: function (){
  8395. var self=this;
  8396. return smalltalk.withContext(function($ctx1) {
  8397. var $1;
  8398. $1=_st(self._collectionClass())._isNil();
  8399. return $1;
  8400. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8401. args: [],
  8402. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8403. messageSends: ["isNil", "collectionClass"],
  8404. referencedClasses: []
  8405. }),
  8406. globals.StreamTest.klass);
  8407. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8408. smalltalk.addMethod(
  8409. smalltalk.method({
  8410. selector: "newCollection",
  8411. protocol: 'accessing',
  8412. fn: function (){
  8413. var self=this;
  8414. return smalltalk.withContext(function($ctx1) {
  8415. var $1;
  8416. $1=[true,(1),(3).__at((4)),"foo"];
  8417. return $1;
  8418. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8419. args: [],
  8420. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8421. messageSends: ["@"],
  8422. referencedClasses: []
  8423. }),
  8424. globals.ArrayStreamTest);
  8425. smalltalk.addMethod(
  8426. smalltalk.method({
  8427. selector: "collectionClass",
  8428. protocol: 'accessing',
  8429. fn: function (){
  8430. var self=this;
  8431. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8432. return $Array();
  8433. },
  8434. args: [],
  8435. source: "collectionClass\x0a\x09^ Array",
  8436. messageSends: [],
  8437. referencedClasses: ["Array"]
  8438. }),
  8439. globals.ArrayStreamTest.klass);
  8440. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8441. smalltalk.addMethod(
  8442. smalltalk.method({
  8443. selector: "newCollection",
  8444. protocol: 'accessing',
  8445. fn: function (){
  8446. var self=this;
  8447. return "hello world";
  8448. },
  8449. args: [],
  8450. source: "newCollection\x0a\x09^ 'hello world'",
  8451. messageSends: [],
  8452. referencedClasses: []
  8453. }),
  8454. globals.StringStreamTest);
  8455. smalltalk.addMethod(
  8456. smalltalk.method({
  8457. selector: "collectionClass",
  8458. protocol: 'accessing',
  8459. fn: function (){
  8460. var self=this;
  8461. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8462. return $String();
  8463. },
  8464. args: [],
  8465. source: "collectionClass\x0a\x09^ String",
  8466. messageSends: [],
  8467. referencedClasses: ["String"]
  8468. }),
  8469. globals.StringStreamTest.klass);
  8470. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8471. smalltalk.addMethod(
  8472. smalltalk.method({
  8473. selector: "testCopying",
  8474. protocol: 'tests',
  8475. fn: function (){
  8476. var self=this;
  8477. return smalltalk.withContext(function($ctx1) {
  8478. self._assert_equals_(nil._copy(),nil);
  8479. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8480. args: [],
  8481. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8482. messageSends: ["assert:equals:", "copy"],
  8483. referencedClasses: []
  8484. }),
  8485. globals.UndefinedTest);
  8486. smalltalk.addMethod(
  8487. smalltalk.method({
  8488. selector: "testDeepCopy",
  8489. protocol: 'tests',
  8490. fn: function (){
  8491. var self=this;
  8492. return smalltalk.withContext(function($ctx1) {
  8493. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8494. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8495. args: [],
  8496. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8497. messageSends: ["assert:", "=", "deepCopy"],
  8498. referencedClasses: []
  8499. }),
  8500. globals.UndefinedTest);
  8501. smalltalk.addMethod(
  8502. smalltalk.method({
  8503. selector: "testIfNil",
  8504. protocol: 'tests',
  8505. fn: function (){
  8506. var self=this;
  8507. return smalltalk.withContext(function($ctx1) {
  8508. var $1,$3,$2,$4,$6,$5,$receiver;
  8509. if(($receiver = nil) == null || $receiver.isNil){
  8510. $1=true;
  8511. } else {
  8512. $1=nil;
  8513. };
  8514. self._assert_equals_($1,true);
  8515. $ctx1.sendIdx["assert:equals:"]=1;
  8516. if(($receiver = nil) == null || $receiver.isNil){
  8517. $3=nil;
  8518. } else {
  8519. $3=true;
  8520. };
  8521. $2=_st($3).__eq(true);
  8522. $ctx1.sendIdx["="]=1;
  8523. self._deny_($2);
  8524. $ctx1.sendIdx["deny:"]=1;
  8525. if(($receiver = nil) == null || $receiver.isNil){
  8526. $4=true;
  8527. } else {
  8528. $4=false;
  8529. };
  8530. self._assert_equals_($4,true);
  8531. if(($receiver = nil) == null || $receiver.isNil){
  8532. $6=false;
  8533. } else {
  8534. $6=true;
  8535. };
  8536. $5=_st($6).__eq(true);
  8537. self._deny_($5);
  8538. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8539. args: [],
  8540. 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",
  8541. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8542. referencedClasses: []
  8543. }),
  8544. globals.UndefinedTest);
  8545. smalltalk.addMethod(
  8546. smalltalk.method({
  8547. selector: "testIsNil",
  8548. protocol: 'tests',
  8549. fn: function (){
  8550. var self=this;
  8551. return smalltalk.withContext(function($ctx1) {
  8552. self._assert_(nil._isNil());
  8553. self._deny_(nil._notNil());
  8554. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8555. args: [],
  8556. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8557. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8558. referencedClasses: []
  8559. }),
  8560. globals.UndefinedTest);
  8561. });