Kernel-Tests.js 334 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108
  1. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Tests');
  4. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "testAddExtensionMethod",
  9. protocol: 'tests',
  10. fn: function (){
  11. var self=this;
  12. var method,dirty;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  15. $2=self._class();
  16. $ctx1.sendIdx["class"]=1;
  17. $1=_st($2)._package();
  18. $ctx1.sendIdx["package"]=1;
  19. dirty=_st($1)._isDirty();
  20. $ctx1.sendIdx["isDirty"]=1;
  21. $4=self._class();
  22. $ctx1.sendIdx["class"]=2;
  23. $3=_st($4)._package();
  24. $ctx1.sendIdx["package"]=2;
  25. _st($3)._beClean();
  26. $5=self._class();
  27. $ctx1.sendIdx["class"]=3;
  28. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  29. $8=self._class();
  30. $ctx1.sendIdx["class"]=4;
  31. $7=_st($8)._package();
  32. $ctx1.sendIdx["package"]=3;
  33. $6=_st($7)._isDirty();
  34. self._deny_($6);
  35. $9=self._class();
  36. $ctx1.sendIdx["class"]=5;
  37. _st($9)._removeCompiledMethod_(method);
  38. $10=dirty;
  39. if(smalltalk.assert($10)){
  40. _st(_st(self._class())._package())._beDirty();
  41. };
  42. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)})},
  43. args: [],
  44. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  45. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"],
  46. referencedClasses: []
  47. }),
  48. globals.AnnouncementSubscriptionTest);
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "testHandlesAnnouncement",
  52. protocol: 'tests',
  53. fn: function (){
  54. var self=this;
  55. var subscription,announcementClass1,announcementClass2,classBuilder;
  56. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  57. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  59. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  60. return smalltalk.withContext(function($ctx1) {
  61. var $1,$2;
  62. classBuilder=_st($ClassBuilder())._new();
  63. $ctx1.sendIdx["new"]=1;
  64. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  65. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  66. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  67. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  68. self._assert_equals_($1,true);
  69. $ctx1.sendIdx["assert:equals:"]=1;
  70. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  71. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  72. self._assert_equals_($2,true);
  73. $ctx1.sendIdx["assert:equals:"]=2;
  74. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  75. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  76. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  77. args: [],
  78. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  79. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  80. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  81. }),
  82. globals.AnnouncementSubscriptionTest);
  83. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "testOnDo",
  87. protocol: 'tests',
  88. fn: function (){
  89. var self=this;
  90. var counter,announcer;
  91. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  92. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  93. return smalltalk.withContext(function($ctx1) {
  94. var $1,$2;
  95. counter=(0);
  96. announcer=_st($Announcer())._new();
  97. $ctx1.sendIdx["new"]=1;
  98. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. counter=_st(counter).__plus((1));
  101. return counter;
  102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  103. $1=announcer;
  104. $2=_st($SystemAnnouncement())._new();
  105. $ctx1.sendIdx["new"]=2;
  106. _st($1)._announce_($2);
  107. $ctx1.sendIdx["announce:"]=1;
  108. self._assert_equals_(counter,(1));
  109. $ctx1.sendIdx["assert:equals:"]=1;
  110. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  111. self._assert_equals_(counter,(2));
  112. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  113. args: [],
  114. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  115. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  116. referencedClasses: ["Announcer", "SystemAnnouncement"]
  117. }),
  118. globals.AnnouncerTest);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "testOnDoFor",
  122. protocol: 'tests',
  123. fn: function (){
  124. var self=this;
  125. var counter,announcer;
  126. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  127. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  128. return smalltalk.withContext(function($ctx1) {
  129. var $1,$2,$3,$4;
  130. counter=(0);
  131. announcer=_st($Announcer())._new();
  132. $ctx1.sendIdx["new"]=1;
  133. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  134. return smalltalk.withContext(function($ctx2) {
  135. counter=_st(counter).__plus((1));
  136. return counter;
  137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  138. $1=announcer;
  139. $2=_st($SystemAnnouncement())._new();
  140. $ctx1.sendIdx["new"]=2;
  141. _st($1)._announce_($2);
  142. $ctx1.sendIdx["announce:"]=1;
  143. self._assert_equals_(counter,(1));
  144. $ctx1.sendIdx["assert:equals:"]=1;
  145. $3=announcer;
  146. $4=_st($SystemAnnouncement())._new();
  147. $ctx1.sendIdx["new"]=3;
  148. _st($3)._announce_($4);
  149. $ctx1.sendIdx["announce:"]=2;
  150. self._assert_equals_(counter,(2));
  151. $ctx1.sendIdx["assert:equals:"]=2;
  152. _st(announcer)._unsubscribe_(self);
  153. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  154. self._assert_equals_(counter,(2));
  155. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  156. args: [],
  157. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  158. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  159. referencedClasses: ["Announcer", "SystemAnnouncement"]
  160. }),
  161. globals.AnnouncerTest);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "testOnDoOnce",
  165. protocol: 'tests',
  166. fn: function (){
  167. var self=this;
  168. var counter,announcer;
  169. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  170. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  171. return smalltalk.withContext(function($ctx1) {
  172. var $1,$2;
  173. counter=(0);
  174. announcer=_st($Announcer())._new();
  175. $ctx1.sendIdx["new"]=1;
  176. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  177. return smalltalk.withContext(function($ctx2) {
  178. counter=_st(counter).__plus((1));
  179. return counter;
  180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  181. $1=announcer;
  182. $2=_st($SystemAnnouncement())._new();
  183. $ctx1.sendIdx["new"]=2;
  184. _st($1)._announce_($2);
  185. $ctx1.sendIdx["announce:"]=1;
  186. self._assert_equals_(counter,(1));
  187. $ctx1.sendIdx["assert:equals:"]=1;
  188. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  189. self._assert_equals_(counter,(1));
  190. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  191. args: [],
  192. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  193. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  194. referencedClasses: ["Announcer", "SystemAnnouncement"]
  195. }),
  196. globals.AnnouncerTest);
  197. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "testCanClearInterval",
  201. protocol: 'tests',
  202. fn: function (){
  203. var self=this;
  204. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  205. return smalltalk.withContext(function($ctx1) {
  206. self._shouldnt_raise_((function(){
  207. return smalltalk.withContext(function($ctx2) {
  208. return _st(_st((function(){
  209. return smalltalk.withContext(function($ctx3) {
  210. return _st(_st($Error())._new())._signal();
  211. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  213. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  214. args: [],
  215. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  216. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  217. referencedClasses: ["Error"]
  218. }),
  219. globals.BlockClosureTest);
  220. smalltalk.addMethod(
  221. smalltalk.method({
  222. selector: "testCanClearTimeout",
  223. protocol: 'tests',
  224. fn: function (){
  225. var self=this;
  226. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  227. return smalltalk.withContext(function($ctx1) {
  228. self._shouldnt_raise_((function(){
  229. return smalltalk.withContext(function($ctx2) {
  230. return _st(_st((function(){
  231. return smalltalk.withContext(function($ctx3) {
  232. return _st(_st($Error())._new())._signal();
  233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  235. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  236. args: [],
  237. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  238. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  239. referencedClasses: ["Error"]
  240. }),
  241. globals.BlockClosureTest);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "testCompiledSource",
  245. protocol: 'tests',
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) {
  249. self._assert_(_st(_st((function(){
  250. return smalltalk.withContext(function($ctx2) {
  251. return (1).__plus((1));
  252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  253. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  254. args: [],
  255. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  256. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  257. referencedClasses: []
  258. }),
  259. globals.BlockClosureTest);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "testCurrySelf",
  263. protocol: 'tests',
  264. fn: function (){
  265. var self=this;
  266. var curriedMethod,array;
  267. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  268. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  269. return smalltalk.withContext(function($ctx1) {
  270. curriedMethod=_st(_st((function(selfarg,x){
  271. return smalltalk.withContext(function($ctx2) {
  272. return _st(selfarg)._at_(x);
  273. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  274. array=[(3), (1), (4)];
  275. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  276. _st((function(){
  277. return smalltalk.withContext(function($ctx2) {
  278. return self._assert_equals_(_st(array)._foo_((2)),(1));
  279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  280. return smalltalk.withContext(function($ctx2) {
  281. return _st($Array())._removeCompiledMethod_(curriedMethod);
  282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  283. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  284. args: [],
  285. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  286. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  287. referencedClasses: ["ClassBuilder", "Array"]
  288. }),
  289. globals.BlockClosureTest);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "testEnsure",
  293. protocol: 'tests',
  294. fn: function (){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) {
  297. self._assert_equals_(_st((function(){
  298. return (3);
  299. }))._ensure_((function(){
  300. return (4);
  301. })),(3));
  302. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  303. args: [],
  304. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  305. messageSends: ["assert:equals:", "ensure:"],
  306. referencedClasses: []
  307. }),
  308. globals.BlockClosureTest);
  309. smalltalk.addMethod(
  310. smalltalk.method({
  311. selector: "testEnsureRaises",
  312. protocol: 'tests',
  313. fn: function (){
  314. var self=this;
  315. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  316. return smalltalk.withContext(function($ctx1) {
  317. self._should_raise_((function(){
  318. return smalltalk.withContext(function($ctx2) {
  319. return _st((function(){
  320. return smalltalk.withContext(function($ctx3) {
  321. return _st(_st($Error())._new())._signal();
  322. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  323. return true;
  324. }));
  325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  326. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  327. args: [],
  328. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  329. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  330. referencedClasses: ["Error"]
  331. }),
  332. globals.BlockClosureTest);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "testExceptionSemantics",
  336. protocol: 'tests',
  337. fn: function (){
  338. var self=this;
  339. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  340. return smalltalk.withContext(function($ctx1) {
  341. self._timeout_((100));
  342. _st(self._async_((function(){
  343. return smalltalk.withContext(function($ctx2) {
  344. return _st((function(){
  345. return smalltalk.withContext(function($ctx3) {
  346. self._assert_(true);
  347. _st($Error())._signal();
  348. self._deny_(true);
  349. return self._finished();
  350. $ctx3.sendIdx["finished"]=1;
  351. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  352. return smalltalk.withContext(function($ctx3) {
  353. return self._finished();
  354. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  356. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  357. args: [],
  358. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  359. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  360. referencedClasses: ["Error"]
  361. }),
  362. globals.BlockClosureTest);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "testNewWithValues",
  366. protocol: 'tests',
  367. fn: function (){
  368. var self=this;
  369. return smalltalk.withContext(function($ctx1) {
  370. function TestConstructor(arg1, arg2, arg3) {}
  371. TestConstructor.prototype.name = 'theTestPrototype';
  372. var wrappedConstructor = _st(TestConstructor);
  373. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  374. self._assert_(result instanceof TestConstructor);
  375. self._assert_equals_(result.name, 'theTestPrototype');
  376. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  377. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  378. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  379. args: [],
  380. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  381. messageSends: [],
  382. referencedClasses: []
  383. }),
  384. globals.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testNumArgs",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st((function(){
  394. }))._numArgs();
  395. $ctx1.sendIdx["numArgs"]=1;
  396. self._assert_equals_($1,(0));
  397. $ctx1.sendIdx["assert:equals:"]=1;
  398. self._assert_equals_(_st((function(a,b){
  399. }))._numArgs(),(2));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  401. args: [],
  402. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  403. messageSends: ["assert:equals:", "numArgs"],
  404. referencedClasses: []
  405. }),
  406. globals.BlockClosureTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testOnDo",
  410. protocol: 'tests',
  411. fn: function (){
  412. var self=this;
  413. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  414. return smalltalk.withContext(function($ctx1) {
  415. self._assert_(_st((function(){
  416. return smalltalk.withContext(function($ctx2) {
  417. return _st(_st($Error())._new())._signal();
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  419. return true;
  420. })));
  421. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  422. args: [],
  423. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  424. messageSends: ["assert:", "on:do:", "signal", "new"],
  425. referencedClasses: ["Error"]
  426. }),
  427. globals.BlockClosureTest);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testValue",
  431. protocol: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $1;
  436. $1=_st((function(){
  437. return smalltalk.withContext(function($ctx2) {
  438. return (1).__plus((1));
  439. $ctx2.sendIdx["+"]=1;
  440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  441. $ctx1.sendIdx["value"]=1;
  442. self._assert_equals_($1,(2));
  443. $ctx1.sendIdx["assert:equals:"]=1;
  444. self._assert_equals_(_st((function(x){
  445. return smalltalk.withContext(function($ctx2) {
  446. return _st(x).__plus((1));
  447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  448. $ctx1.sendIdx["assert:equals:"]=2;
  449. self._assert_equals_(_st((function(x,y){
  450. return smalltalk.withContext(function($ctx2) {
  451. return _st(x).__star(y);
  452. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  453. $ctx1.sendIdx["assert:equals:"]=3;
  454. self._assert_equals_(_st((function(a,b,c){
  455. return (1);
  456. }))._value(),(1));
  457. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  458. args: [],
  459. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  460. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  461. referencedClasses: []
  462. }),
  463. globals.BlockClosureTest);
  464. smalltalk.addMethod(
  465. smalltalk.method({
  466. selector: "testValueWithPossibleArguments",
  467. protocol: 'tests',
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) {
  471. var $1,$2;
  472. $1=_st((function(){
  473. return (1);
  474. }))._valueWithPossibleArguments_([(3), (4)]);
  475. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  476. self._assert_equals_($1,(1));
  477. $ctx1.sendIdx["assert:equals:"]=1;
  478. $2=_st((function(a){
  479. return smalltalk.withContext(function($ctx2) {
  480. return _st(a).__plus((4));
  481. $ctx2.sendIdx["+"]=1;
  482. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  483. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  484. self._assert_equals_($2,(7));
  485. $ctx1.sendIdx["assert:equals:"]=2;
  486. self._assert_equals_(_st((function(a,b){
  487. return smalltalk.withContext(function($ctx2) {
  488. return _st(a).__plus(b);
  489. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  490. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  491. args: [],
  492. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  493. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  494. referencedClasses: []
  495. }),
  496. globals.BlockClosureTest);
  497. smalltalk.addMethod(
  498. smalltalk.method({
  499. selector: "testWhileFalse",
  500. protocol: 'tests',
  501. fn: function (){
  502. var self=this;
  503. var i;
  504. return smalltalk.withContext(function($ctx1) {
  505. i=(0);
  506. _st((function(){
  507. return smalltalk.withContext(function($ctx2) {
  508. return _st(i).__gt((5));
  509. $ctx2.sendIdx[">"]=1;
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  511. return smalltalk.withContext(function($ctx2) {
  512. i=_st(i).__plus((1));
  513. $ctx2.sendIdx["+"]=1;
  514. return i;
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  516. self._assert_equals_(i,(6));
  517. $ctx1.sendIdx["assert:equals:"]=1;
  518. i=(0);
  519. _st((function(){
  520. return smalltalk.withContext(function($ctx2) {
  521. i=_st(i).__plus((1));
  522. i;
  523. return _st(i).__gt((5));
  524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  525. self._assert_equals_(i,(6));
  526. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  527. args: [],
  528. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  529. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  530. referencedClasses: []
  531. }),
  532. globals.BlockClosureTest);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "testWhileTrue",
  536. protocol: 'tests',
  537. fn: function (){
  538. var self=this;
  539. var i;
  540. return smalltalk.withContext(function($ctx1) {
  541. i=(0);
  542. _st((function(){
  543. return smalltalk.withContext(function($ctx2) {
  544. return _st(i).__lt((5));
  545. $ctx2.sendIdx["<"]=1;
  546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  547. return smalltalk.withContext(function($ctx2) {
  548. i=_st(i).__plus((1));
  549. $ctx2.sendIdx["+"]=1;
  550. return i;
  551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  552. self._assert_equals_(i,(5));
  553. $ctx1.sendIdx["assert:equals:"]=1;
  554. i=(0);
  555. _st((function(){
  556. return smalltalk.withContext(function($ctx2) {
  557. i=_st(i).__plus((1));
  558. i;
  559. return _st(i).__lt((5));
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  561. self._assert_equals_(i,(5));
  562. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  563. args: [],
  564. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  565. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  566. referencedClasses: []
  567. }),
  568. globals.BlockClosureTest);
  569. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  570. smalltalk.addMethod(
  571. smalltalk.method({
  572. selector: "testEquality",
  573. protocol: 'tests',
  574. fn: function (){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  578. $1=(0).__eq(false);
  579. $ctx1.sendIdx["="]=1;
  580. self._deny_($1);
  581. $ctx1.sendIdx["deny:"]=1;
  582. $2=false.__eq((0));
  583. $ctx1.sendIdx["="]=2;
  584. self._deny_($2);
  585. $ctx1.sendIdx["deny:"]=2;
  586. $3="".__eq(false);
  587. $ctx1.sendIdx["="]=3;
  588. self._deny_($3);
  589. $ctx1.sendIdx["deny:"]=3;
  590. $4=false.__eq("");
  591. $ctx1.sendIdx["="]=4;
  592. self._deny_($4);
  593. $ctx1.sendIdx["deny:"]=4;
  594. $5=true.__eq(true);
  595. $ctx1.sendIdx["="]=5;
  596. self._assert_($5);
  597. $ctx1.sendIdx["assert:"]=1;
  598. $6=false.__eq(true);
  599. $ctx1.sendIdx["="]=6;
  600. self._deny_($6);
  601. $ctx1.sendIdx["deny:"]=5;
  602. $7=true.__eq(false);
  603. $ctx1.sendIdx["="]=7;
  604. self._deny_($7);
  605. $8=false.__eq(false);
  606. $ctx1.sendIdx["="]=8;
  607. self._assert_($8);
  608. $ctx1.sendIdx["assert:"]=2;
  609. $10=true._yourself();
  610. $ctx1.sendIdx["yourself"]=1;
  611. $9=_st($10).__eq(true);
  612. $ctx1.sendIdx["="]=9;
  613. self._assert_($9);
  614. $ctx1.sendIdx["assert:"]=3;
  615. $12=true._yourself();
  616. $ctx1.sendIdx["yourself"]=2;
  617. $11=_st($12).__eq(true._yourself());
  618. self._assert_($11);
  619. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  620. args: [],
  621. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  622. messageSends: ["deny:", "=", "assert:", "yourself"],
  623. referencedClasses: []
  624. }),
  625. globals.BooleanTest);
  626. smalltalk.addMethod(
  627. smalltalk.method({
  628. selector: "testIdentity",
  629. protocol: 'tests',
  630. fn: function (){
  631. var self=this;
  632. return smalltalk.withContext(function($ctx1) {
  633. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  634. $1=(0).__eq_eq(false);
  635. $ctx1.sendIdx["=="]=1;
  636. self._deny_($1);
  637. $ctx1.sendIdx["deny:"]=1;
  638. $2=false.__eq_eq((0));
  639. $ctx1.sendIdx["=="]=2;
  640. self._deny_($2);
  641. $ctx1.sendIdx["deny:"]=2;
  642. $3="".__eq_eq(false);
  643. $ctx1.sendIdx["=="]=3;
  644. self._deny_($3);
  645. $ctx1.sendIdx["deny:"]=3;
  646. $4=false.__eq_eq("");
  647. $ctx1.sendIdx["=="]=4;
  648. self._deny_($4);
  649. $ctx1.sendIdx["deny:"]=4;
  650. $5=true.__eq_eq(true);
  651. $ctx1.sendIdx["=="]=5;
  652. self._assert_($5);
  653. $ctx1.sendIdx["assert:"]=1;
  654. $6=false.__eq_eq(true);
  655. $ctx1.sendIdx["=="]=6;
  656. self._deny_($6);
  657. $ctx1.sendIdx["deny:"]=5;
  658. $7=true.__eq_eq(false);
  659. $ctx1.sendIdx["=="]=7;
  660. self._deny_($7);
  661. $8=false.__eq_eq(false);
  662. $ctx1.sendIdx["=="]=8;
  663. self._assert_($8);
  664. $ctx1.sendIdx["assert:"]=2;
  665. $10=true._yourself();
  666. $ctx1.sendIdx["yourself"]=1;
  667. $9=_st($10).__eq_eq(true);
  668. $ctx1.sendIdx["=="]=9;
  669. self._assert_($9);
  670. $ctx1.sendIdx["assert:"]=3;
  671. $12=true._yourself();
  672. $ctx1.sendIdx["yourself"]=2;
  673. $11=_st($12).__eq_eq(true._yourself());
  674. self._assert_($11);
  675. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  676. args: [],
  677. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  678. messageSends: ["deny:", "==", "assert:", "yourself"],
  679. referencedClasses: []
  680. }),
  681. globals.BooleanTest);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "testIfTrueIfFalse",
  685. protocol: 'tests',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1,$2,$3,$4,$5,$6,$7,$8;
  690. if(smalltalk.assert(true)){
  691. $1="alternative block";
  692. };
  693. self._assert_equals_($1,"alternative block");
  694. $ctx1.sendIdx["assert:equals:"]=1;
  695. if(! smalltalk.assert(true)){
  696. $2="alternative block";
  697. };
  698. self._assert_equals_($2,nil);
  699. $ctx1.sendIdx["assert:equals:"]=2;
  700. if(smalltalk.assert(false)){
  701. $3="alternative block";
  702. };
  703. self._assert_equals_($3,nil);
  704. $ctx1.sendIdx["assert:equals:"]=3;
  705. if(! smalltalk.assert(false)){
  706. $4="alternative block";
  707. };
  708. self._assert_equals_($4,"alternative block");
  709. $ctx1.sendIdx["assert:equals:"]=4;
  710. if(smalltalk.assert(false)){
  711. $5="alternative block";
  712. } else {
  713. $5="alternative block2";
  714. };
  715. self._assert_equals_($5,"alternative block2");
  716. $ctx1.sendIdx["assert:equals:"]=5;
  717. if(smalltalk.assert(false)){
  718. $6="alternative block2";
  719. } else {
  720. $6="alternative block";
  721. };
  722. self._assert_equals_($6,"alternative block");
  723. $ctx1.sendIdx["assert:equals:"]=6;
  724. if(smalltalk.assert(true)){
  725. $7="alternative block";
  726. } else {
  727. $7="alternative block2";
  728. };
  729. self._assert_equals_($7,"alternative block");
  730. $ctx1.sendIdx["assert:equals:"]=7;
  731. if(smalltalk.assert(true)){
  732. $8="alternative block2";
  733. } else {
  734. $8="alternative block";
  735. };
  736. self._assert_equals_($8,"alternative block2");
  737. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  738. args: [],
  739. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  740. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  741. referencedClasses: []
  742. }),
  743. globals.BooleanTest);
  744. smalltalk.addMethod(
  745. smalltalk.method({
  746. selector: "testIfTrueIfFalseWithBoxing",
  747. protocol: 'tests',
  748. fn: function (){
  749. var self=this;
  750. return smalltalk.withContext(function($ctx1) {
  751. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  752. $2=true._yourself();
  753. $ctx1.sendIdx["yourself"]=1;
  754. if(smalltalk.assert($2)){
  755. $1="alternative block";
  756. };
  757. self._assert_equals_($1,"alternative block");
  758. $ctx1.sendIdx["assert:equals:"]=1;
  759. $4=true._yourself();
  760. $ctx1.sendIdx["yourself"]=2;
  761. if(! smalltalk.assert($4)){
  762. $3="alternative block";
  763. };
  764. self._assert_equals_($3,nil);
  765. $ctx1.sendIdx["assert:equals:"]=2;
  766. $6=false._yourself();
  767. $ctx1.sendIdx["yourself"]=3;
  768. if(smalltalk.assert($6)){
  769. $5="alternative block";
  770. };
  771. self._assert_equals_($5,nil);
  772. $ctx1.sendIdx["assert:equals:"]=3;
  773. $8=false._yourself();
  774. $ctx1.sendIdx["yourself"]=4;
  775. if(! smalltalk.assert($8)){
  776. $7="alternative block";
  777. };
  778. self._assert_equals_($7,"alternative block");
  779. $ctx1.sendIdx["assert:equals:"]=4;
  780. $10=false._yourself();
  781. $ctx1.sendIdx["yourself"]=5;
  782. if(smalltalk.assert($10)){
  783. $9="alternative block";
  784. } else {
  785. $9="alternative block2";
  786. };
  787. self._assert_equals_($9,"alternative block2");
  788. $ctx1.sendIdx["assert:equals:"]=5;
  789. $12=false._yourself();
  790. $ctx1.sendIdx["yourself"]=6;
  791. if(smalltalk.assert($12)){
  792. $11="alternative block2";
  793. } else {
  794. $11="alternative block";
  795. };
  796. self._assert_equals_($11,"alternative block");
  797. $ctx1.sendIdx["assert:equals:"]=6;
  798. $14=true._yourself();
  799. $ctx1.sendIdx["yourself"]=7;
  800. if(smalltalk.assert($14)){
  801. $13="alternative block";
  802. } else {
  803. $13="alternative block2";
  804. };
  805. self._assert_equals_($13,"alternative block");
  806. $ctx1.sendIdx["assert:equals:"]=7;
  807. $16=true._yourself();
  808. if(smalltalk.assert($16)){
  809. $15="alternative block2";
  810. } else {
  811. $15="alternative block";
  812. };
  813. self._assert_equals_($15,"alternative block2");
  814. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  815. args: [],
  816. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  817. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  818. referencedClasses: []
  819. }),
  820. globals.BooleanTest);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "testLogic",
  824. protocol: 'tests',
  825. fn: function (){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  829. $1=true.__and(true);
  830. $ctx1.sendIdx["&"]=1;
  831. self._assert_($1);
  832. $ctx1.sendIdx["assert:"]=1;
  833. $2=true.__and(false);
  834. $ctx1.sendIdx["&"]=2;
  835. self._deny_($2);
  836. $ctx1.sendIdx["deny:"]=1;
  837. $3=false.__and(true);
  838. $ctx1.sendIdx["&"]=3;
  839. self._deny_($3);
  840. $ctx1.sendIdx["deny:"]=2;
  841. $5=false.__and(false);
  842. $ctx1.sendIdx["&"]=4;
  843. $4=self._deny_($5);
  844. $ctx1.sendIdx["deny:"]=3;
  845. $6=true.__or(true);
  846. $ctx1.sendIdx["|"]=1;
  847. self._assert_($6);
  848. $ctx1.sendIdx["assert:"]=2;
  849. $7=true.__or(false);
  850. $ctx1.sendIdx["|"]=2;
  851. self._assert_($7);
  852. $ctx1.sendIdx["assert:"]=3;
  853. $8=false.__or(true);
  854. $ctx1.sendIdx["|"]=3;
  855. self._assert_($8);
  856. $ctx1.sendIdx["assert:"]=4;
  857. $10=false.__or(false);
  858. $ctx1.sendIdx["|"]=4;
  859. $9=self._deny_($10);
  860. $ctx1.sendIdx["deny:"]=4;
  861. $12=(1).__gt((0));
  862. $ctx1.sendIdx[">"]=1;
  863. $11=true.__and($12);
  864. $ctx1.sendIdx["&"]=5;
  865. self._assert_($11);
  866. $ctx1.sendIdx["assert:"]=5;
  867. $14=(1).__gt((0));
  868. $ctx1.sendIdx[">"]=2;
  869. $13=_st($14).__and(false);
  870. $ctx1.sendIdx["&"]=6;
  871. self._deny_($13);
  872. $ctx1.sendIdx["deny:"]=5;
  873. $17=(1).__gt((0));
  874. $ctx1.sendIdx[">"]=3;
  875. $18=(1).__gt((2));
  876. $ctx1.sendIdx[">"]=4;
  877. $16=_st($17).__and($18);
  878. $15=self._deny_($16);
  879. $20=(1).__gt((0));
  880. $ctx1.sendIdx[">"]=5;
  881. $19=false.__or($20);
  882. $ctx1.sendIdx["|"]=5;
  883. self._assert_($19);
  884. $ctx1.sendIdx["assert:"]=6;
  885. $22=(1).__gt((0));
  886. $ctx1.sendIdx[">"]=6;
  887. $21=_st($22).__or(false);
  888. $ctx1.sendIdx["|"]=6;
  889. self._assert_($21);
  890. $ctx1.sendIdx["assert:"]=7;
  891. $25=(1).__gt((0));
  892. $ctx1.sendIdx[">"]=7;
  893. $24=_st($25).__or((1).__gt((2)));
  894. $23=self._assert_($24);
  895. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  896. args: [],
  897. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  898. messageSends: ["assert:", "&", "deny:", "|", ">"],
  899. referencedClasses: []
  900. }),
  901. globals.BooleanTest);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "testLogicKeywords",
  905. protocol: 'tests',
  906. fn: function (){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  910. $1=true._and_((function(){
  911. return true;
  912. }));
  913. $ctx1.sendIdx["and:"]=1;
  914. self._assert_($1);
  915. $ctx1.sendIdx["assert:"]=1;
  916. $2=true._and_((function(){
  917. return false;
  918. }));
  919. $ctx1.sendIdx["and:"]=2;
  920. self._deny_($2);
  921. $ctx1.sendIdx["deny:"]=1;
  922. $3=false._and_((function(){
  923. return true;
  924. }));
  925. $ctx1.sendIdx["and:"]=3;
  926. self._deny_($3);
  927. $ctx1.sendIdx["deny:"]=2;
  928. $5=false._and_((function(){
  929. return false;
  930. }));
  931. $ctx1.sendIdx["and:"]=4;
  932. $4=self._deny_($5);
  933. $ctx1.sendIdx["deny:"]=3;
  934. $6=true._or_((function(){
  935. return true;
  936. }));
  937. $ctx1.sendIdx["or:"]=1;
  938. self._assert_($6);
  939. $ctx1.sendIdx["assert:"]=2;
  940. $7=true._or_((function(){
  941. return false;
  942. }));
  943. $ctx1.sendIdx["or:"]=2;
  944. self._assert_($7);
  945. $ctx1.sendIdx["assert:"]=3;
  946. $8=false._or_((function(){
  947. return true;
  948. }));
  949. $ctx1.sendIdx["or:"]=3;
  950. self._assert_($8);
  951. $ctx1.sendIdx["assert:"]=4;
  952. $10=false._or_((function(){
  953. return false;
  954. }));
  955. $ctx1.sendIdx["or:"]=4;
  956. $9=self._deny_($10);
  957. $ctx1.sendIdx["deny:"]=4;
  958. $11=true._and_((function(){
  959. return smalltalk.withContext(function($ctx2) {
  960. return (1).__gt((0));
  961. $ctx2.sendIdx[">"]=1;
  962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  963. $ctx1.sendIdx["and:"]=5;
  964. self._assert_($11);
  965. $ctx1.sendIdx["assert:"]=5;
  966. $13=(1).__gt((0));
  967. $ctx1.sendIdx[">"]=2;
  968. $12=_st($13)._and_((function(){
  969. return false;
  970. }));
  971. $ctx1.sendIdx["and:"]=6;
  972. self._deny_($12);
  973. $ctx1.sendIdx["deny:"]=5;
  974. $16=(1).__gt((0));
  975. $ctx1.sendIdx[">"]=3;
  976. $15=_st($16)._and_((function(){
  977. return smalltalk.withContext(function($ctx2) {
  978. return (1).__gt((2));
  979. $ctx2.sendIdx[">"]=4;
  980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  981. $14=self._deny_($15);
  982. $17=false._or_((function(){
  983. return smalltalk.withContext(function($ctx2) {
  984. return (1).__gt((0));
  985. $ctx2.sendIdx[">"]=5;
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  987. $ctx1.sendIdx["or:"]=5;
  988. self._assert_($17);
  989. $ctx1.sendIdx["assert:"]=6;
  990. $19=(1).__gt((0));
  991. $ctx1.sendIdx[">"]=6;
  992. $18=_st($19)._or_((function(){
  993. return false;
  994. }));
  995. $ctx1.sendIdx["or:"]=6;
  996. self._assert_($18);
  997. $ctx1.sendIdx["assert:"]=7;
  998. $22=(1).__gt((0));
  999. $ctx1.sendIdx[">"]=7;
  1000. $21=_st($22)._or_((function(){
  1001. return smalltalk.withContext(function($ctx2) {
  1002. return (1).__gt((2));
  1003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  1004. $20=self._assert_($21);
  1005. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  1006. args: [],
  1007. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  1008. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  1009. referencedClasses: []
  1010. }),
  1011. globals.BooleanTest);
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "testNonBooleanError",
  1015. protocol: 'tests',
  1016. fn: function (){
  1017. var self=this;
  1018. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1019. return smalltalk.withContext(function($ctx1) {
  1020. self._should_raise_((function(){
  1021. return smalltalk.withContext(function($ctx2) {
  1022. if(smalltalk.assert("")){
  1023. } else {
  1024. };
  1025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  1026. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  1027. args: [],
  1028. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1029. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1030. referencedClasses: ["NonBooleanReceiver"]
  1031. }),
  1032. globals.BooleanTest);
  1033. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1034. smalltalk.addMethod(
  1035. smalltalk.method({
  1036. selector: "setUp",
  1037. protocol: 'running',
  1038. fn: function (){
  1039. var self=this;
  1040. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1041. return smalltalk.withContext(function($ctx1) {
  1042. self["@builder"]=_st($ClassBuilder())._new();
  1043. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1044. args: [],
  1045. source: "setUp\x0a\x09builder := ClassBuilder new",
  1046. messageSends: ["new"],
  1047. referencedClasses: ["ClassBuilder"]
  1048. }),
  1049. globals.ClassBuilderTest);
  1050. smalltalk.addMethod(
  1051. smalltalk.method({
  1052. selector: "tearDown",
  1053. protocol: 'running',
  1054. fn: function (){
  1055. var self=this;
  1056. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1,$receiver;
  1059. $1=self["@theClass"];
  1060. if(($receiver = $1) == null || $receiver.isNil){
  1061. $1;
  1062. } else {
  1063. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1064. self["@theClass"]=nil;
  1065. self["@theClass"];
  1066. };
  1067. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1068. args: [],
  1069. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1070. messageSends: ["ifNotNil:", "removeClass:"],
  1071. referencedClasses: ["Smalltalk"]
  1072. }),
  1073. globals.ClassBuilderTest);
  1074. smalltalk.addMethod(
  1075. smalltalk.method({
  1076. selector: "testClassCopy",
  1077. protocol: 'tests',
  1078. fn: function (){
  1079. var self=this;
  1080. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1081. return smalltalk.withContext(function($ctx1) {
  1082. var $2,$1,$4,$3,$6,$5,$8,$7;
  1083. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1084. $2=_st(self["@theClass"])._superclass();
  1085. $ctx1.sendIdx["superclass"]=1;
  1086. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1087. $ctx1.sendIdx["=="]=1;
  1088. self._assert_($1);
  1089. $ctx1.sendIdx["assert:"]=1;
  1090. $4=_st(self["@theClass"])._instanceVariableNames();
  1091. $ctx1.sendIdx["instanceVariableNames"]=1;
  1092. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1093. $ctx1.sendIdx["=="]=2;
  1094. self._assert_($3);
  1095. $ctx1.sendIdx["assert:"]=2;
  1096. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1097. $ctx1.sendIdx["assert:equals:"]=1;
  1098. $6=_st(self["@theClass"])._package();
  1099. $ctx1.sendIdx["package"]=1;
  1100. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1101. self._assert_($5);
  1102. $8=_st(self["@theClass"])._methodDictionary();
  1103. $ctx1.sendIdx["methodDictionary"]=1;
  1104. $7=_st($8)._keys();
  1105. $ctx1.sendIdx["keys"]=1;
  1106. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1107. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1108. args: [],
  1109. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1110. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1111. referencedClasses: ["ObjectMock"]
  1112. }),
  1113. globals.ClassBuilderTest);
  1114. smalltalk.addMethod(
  1115. smalltalk.method({
  1116. selector: "testClassMigration",
  1117. protocol: 'tests',
  1118. fn: function (){
  1119. var self=this;
  1120. var instance,oldClass;
  1121. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1122. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1123. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1124. return smalltalk.withContext(function($ctx1) {
  1125. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1126. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1127. $2=_st($Smalltalk())._globals();
  1128. $ctx1.sendIdx["globals"]=1;
  1129. $1=_st($2)._at_("ObjectMock2");
  1130. $ctx1.sendIdx["at:"]=1;
  1131. instance=_st($1)._new();
  1132. $4=_st($Smalltalk())._globals();
  1133. $ctx1.sendIdx["globals"]=2;
  1134. $3=_st($4)._at_("ObjectMock2");
  1135. $ctx1.sendIdx["at:"]=2;
  1136. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1137. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1138. $ctx1.sendIdx["=="]=1;
  1139. self._deny_($5);
  1140. $ctx1.sendIdx["deny:"]=1;
  1141. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1142. $ctx1.sendIdx["=="]=2;
  1143. self._assert_($6);
  1144. $ctx1.sendIdx["assert:"]=1;
  1145. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1146. $ctx1.sendIdx["assert:"]=2;
  1147. $7=_st($ObjectMock2())._selectors();
  1148. $ctx1.sendIdx["selectors"]=1;
  1149. self._assert_equals_($7,_st(oldClass)._selectors());
  1150. $ctx1.sendIdx["assert:equals:"]=1;
  1151. $8=_st($ObjectMock2())._comment();
  1152. $ctx1.sendIdx["comment"]=1;
  1153. self._assert_equals_($8,_st(oldClass)._comment());
  1154. $ctx1.sendIdx["assert:equals:"]=2;
  1155. $9=_st(_st($ObjectMock2())._package())._name();
  1156. $ctx1.sendIdx["name"]=1;
  1157. self._assert_equals_($9,"Kernel-Tests");
  1158. $11=_st(instance)._class();
  1159. $ctx1.sendIdx["class"]=1;
  1160. $10=_st($11).__eq_eq($ObjectMock2());
  1161. self._deny_($10);
  1162. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1163. _st($Smalltalk())._removeClass_($ObjectMock2());
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1165. args: [],
  1166. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1167. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1168. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1169. }),
  1170. globals.ClassBuilderTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "testClassMigrationWithClassInstanceVariables",
  1174. protocol: 'tests',
  1175. fn: function (){
  1176. var self=this;
  1177. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1178. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1179. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1183. $1=_st($ObjectMock2())._class();
  1184. $ctx1.sendIdx["class"]=1;
  1185. _st($1)._instanceVariableNames_("foo bar");
  1186. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1187. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1188. _st($Smalltalk())._removeClass_($ObjectMock2());
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1192. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1193. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1194. }),
  1195. globals.ClassBuilderTest);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "testClassMigrationWithSubclasses",
  1199. protocol: 'tests',
  1200. fn: function (){
  1201. var self=this;
  1202. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1203. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1204. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1205. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1206. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. var $2,$1,$4,$3;
  1209. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1210. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1211. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1212. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1213. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1214. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1215. $2=_st($ObjectMock())._subclasses();
  1216. $ctx1.sendIdx["subclasses"]=1;
  1217. $1=_st($2)._includes_($ObjectMock2());
  1218. $ctx1.sendIdx["includes:"]=1;
  1219. self._assert_($1);
  1220. $ctx1.sendIdx["assert:"]=1;
  1221. $4=_st($ObjectMock2())._subclasses();
  1222. $ctx1.sendIdx["subclasses"]=2;
  1223. $3=_st($4)._includes_($ObjectMock3());
  1224. $ctx1.sendIdx["includes:"]=2;
  1225. self._assert_($3);
  1226. $ctx1.sendIdx["assert:"]=2;
  1227. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1228. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1229. return smalltalk.withContext(function($ctx2) {
  1230. return _st($Smalltalk())._removeClass_(each);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1233. args: [],
  1234. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  1235. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1236. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1237. }),
  1238. globals.ClassBuilderTest);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "testInstanceVariableNames",
  1242. protocol: 'tests',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1247. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1248. args: [],
  1249. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1250. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1251. referencedClasses: []
  1252. }),
  1253. globals.ClassBuilderTest);
  1254. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "assertSameContents:as:",
  1258. protocol: 'convenience',
  1259. fn: function (aCollection,anotherCollection){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $2,$1,$4,$3;
  1263. $2=_st(aCollection)._size();
  1264. $ctx1.sendIdx["size"]=1;
  1265. $1=_st($2).__eq(_st(anotherCollection)._size());
  1266. $ctx1.sendIdx["="]=1;
  1267. self._assert_($1);
  1268. $ctx1.sendIdx["assert:"]=1;
  1269. _st(aCollection)._do_((function(each){
  1270. return smalltalk.withContext(function($ctx2) {
  1271. $4=_st(aCollection)._occurrencesOf_(each);
  1272. $ctx2.sendIdx["occurrencesOf:"]=1;
  1273. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1274. return self._assert_($3);
  1275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1276. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1277. args: ["aCollection", "anotherCollection"],
  1278. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1279. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1280. referencedClasses: []
  1281. }),
  1282. globals.CollectionTest);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "collection",
  1286. protocol: 'fixture',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. self._subclassResponsibility();
  1291. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1292. args: [],
  1293. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1294. messageSends: ["subclassResponsibility"],
  1295. referencedClasses: []
  1296. }),
  1297. globals.CollectionTest);
  1298. smalltalk.addMethod(
  1299. smalltalk.method({
  1300. selector: "collectionClass",
  1301. protocol: 'fixture',
  1302. fn: function (){
  1303. var self=this;
  1304. return smalltalk.withContext(function($ctx1) {
  1305. var $1;
  1306. $1=_st(self._class())._collectionClass();
  1307. return $1;
  1308. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1309. args: [],
  1310. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1311. messageSends: ["collectionClass", "class"],
  1312. referencedClasses: []
  1313. }),
  1314. globals.CollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "collectionOfPrintStrings",
  1318. protocol: 'fixture',
  1319. fn: function (){
  1320. var self=this;
  1321. return smalltalk.withContext(function($ctx1) {
  1322. self._subclassResponsibility();
  1323. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1324. args: [],
  1325. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1326. messageSends: ["subclassResponsibility"],
  1327. referencedClasses: []
  1328. }),
  1329. globals.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "collectionSize",
  1333. protocol: 'fixture',
  1334. fn: function (){
  1335. var self=this;
  1336. return smalltalk.withContext(function($ctx1) {
  1337. self._subclassResponsibility();
  1338. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1339. args: [],
  1340. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1341. messageSends: ["subclassResponsibility"],
  1342. referencedClasses: []
  1343. }),
  1344. globals.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "collectionWithDuplicates",
  1348. protocol: 'fixture',
  1349. fn: function (){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) {
  1352. self._subclassResponsibility();
  1353. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1354. args: [],
  1355. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1356. messageSends: ["subclassResponsibility"],
  1357. referencedClasses: []
  1358. }),
  1359. globals.CollectionTest);
  1360. smalltalk.addMethod(
  1361. smalltalk.method({
  1362. selector: "collectionWithNewValue",
  1363. protocol: 'fixture',
  1364. fn: function (){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. self._subclassResponsibility();
  1368. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1369. args: [],
  1370. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1371. messageSends: ["subclassResponsibility"],
  1372. referencedClasses: []
  1373. }),
  1374. globals.CollectionTest);
  1375. smalltalk.addMethod(
  1376. smalltalk.method({
  1377. selector: "isCollectionReadOnly",
  1378. protocol: 'testing',
  1379. fn: function (){
  1380. var self=this;
  1381. return false;
  1382. },
  1383. args: [],
  1384. source: "isCollectionReadOnly\x0a\x09^ false",
  1385. messageSends: [],
  1386. referencedClasses: []
  1387. }),
  1388. globals.CollectionTest);
  1389. smalltalk.addMethod(
  1390. smalltalk.method({
  1391. selector: "sampleNewValue",
  1392. protocol: 'fixture',
  1393. fn: function (){
  1394. var self=this;
  1395. return "N";
  1396. },
  1397. args: [],
  1398. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1399. messageSends: [],
  1400. referencedClasses: []
  1401. }),
  1402. globals.CollectionTest);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "sampleNewValueAsCollection",
  1406. protocol: 'fixture',
  1407. fn: function (){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) {
  1410. var $1;
  1411. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1414. args: [],
  1415. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1416. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1417. referencedClasses: []
  1418. }),
  1419. globals.CollectionTest);
  1420. smalltalk.addMethod(
  1421. smalltalk.method({
  1422. selector: "testAddAll",
  1423. protocol: 'tests',
  1424. fn: function (){
  1425. var self=this;
  1426. return smalltalk.withContext(function($ctx1) {
  1427. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1428. $2=self._collection();
  1429. $ctx1.sendIdx["collection"]=1;
  1430. $3=$2;
  1431. $5=self._collectionClass();
  1432. $ctx1.sendIdx["collectionClass"]=1;
  1433. $4=_st($5)._new();
  1434. $ctx1.sendIdx["new"]=1;
  1435. _st($3)._addAll_($4);
  1436. $ctx1.sendIdx["addAll:"]=1;
  1437. $6=_st($2)._yourself();
  1438. $ctx1.sendIdx["yourself"]=1;
  1439. $1=$6;
  1440. $7=self._collection();
  1441. $ctx1.sendIdx["collection"]=2;
  1442. self._assert_equals_($1,$7);
  1443. $ctx1.sendIdx["assert:equals:"]=1;
  1444. $10=self._collectionClass();
  1445. $ctx1.sendIdx["collectionClass"]=2;
  1446. $9=_st($10)._new();
  1447. $ctx1.sendIdx["new"]=2;
  1448. $11=$9;
  1449. $12=self._collection();
  1450. $ctx1.sendIdx["collection"]=3;
  1451. _st($11)._addAll_($12);
  1452. $ctx1.sendIdx["addAll:"]=2;
  1453. $13=_st($9)._yourself();
  1454. $ctx1.sendIdx["yourself"]=2;
  1455. $8=$13;
  1456. $14=self._collection();
  1457. $ctx1.sendIdx["collection"]=4;
  1458. self._assert_equals_($8,$14);
  1459. $ctx1.sendIdx["assert:equals:"]=2;
  1460. $17=self._collectionClass();
  1461. $ctx1.sendIdx["collectionClass"]=3;
  1462. $16=_st($17)._new();
  1463. $ctx1.sendIdx["new"]=3;
  1464. $18=$16;
  1465. $20=self._collectionClass();
  1466. $ctx1.sendIdx["collectionClass"]=4;
  1467. $19=_st($20)._new();
  1468. $ctx1.sendIdx["new"]=4;
  1469. _st($18)._addAll_($19);
  1470. $ctx1.sendIdx["addAll:"]=3;
  1471. $21=_st($16)._yourself();
  1472. $ctx1.sendIdx["yourself"]=3;
  1473. $15=$21;
  1474. self._assert_equals_($15,_st(self._collectionClass())._new());
  1475. $ctx1.sendIdx["assert:equals:"]=3;
  1476. $23=self._collection();
  1477. $ctx1.sendIdx["collection"]=5;
  1478. $24=$23;
  1479. $25=self._sampleNewValueAsCollection();
  1480. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1481. _st($24)._addAll_($25);
  1482. $ctx1.sendIdx["addAll:"]=4;
  1483. $26=_st($23)._yourself();
  1484. $ctx1.sendIdx["yourself"]=4;
  1485. $22=$26;
  1486. $27=self._collectionWithNewValue();
  1487. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1488. self._assert_equals_($22,$27);
  1489. $28=self._sampleNewValueAsCollection();
  1490. _st($28)._addAll_(self._collection());
  1491. $29=_st($28)._yourself();
  1492. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1493. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1494. args: [],
  1495. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1496. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1497. referencedClasses: []
  1498. }),
  1499. globals.CollectionTest);
  1500. smalltalk.addMethod(
  1501. smalltalk.method({
  1502. selector: "testAllSatisfy",
  1503. protocol: 'tests',
  1504. fn: function (){
  1505. var self=this;
  1506. var collection,anyOne;
  1507. return smalltalk.withContext(function($ctx1) {
  1508. var $1;
  1509. collection=self._collection();
  1510. anyOne=_st(collection)._anyOne();
  1511. $1=_st(collection)._allSatisfy_((function(each){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. return _st(collection)._includes_(each);
  1514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1515. $ctx1.sendIdx["allSatisfy:"]=1;
  1516. self._assert_($1);
  1517. self._deny_(_st(collection)._allSatisfy_((function(each){
  1518. return smalltalk.withContext(function($ctx2) {
  1519. return _st(each).__tild_eq(anyOne);
  1520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1522. args: [],
  1523. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1524. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1525. referencedClasses: []
  1526. }),
  1527. globals.CollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testAnyOne",
  1531. protocol: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1535. return smalltalk.withContext(function($ctx1) {
  1536. var $2,$1;
  1537. self._should_raise_((function(){
  1538. return smalltalk.withContext(function($ctx2) {
  1539. return _st(_st(self._collectionClass())._new())._anyOne();
  1540. $ctx2.sendIdx["anyOne"]=1;
  1541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1542. $2=self._collection();
  1543. $ctx1.sendIdx["collection"]=1;
  1544. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1545. self._assert_($1);
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1547. args: [],
  1548. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1549. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1550. referencedClasses: ["Error"]
  1551. }),
  1552. globals.CollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testAnySatisfy",
  1556. protocol: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var anyOne;
  1560. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $1,$3,$2;
  1563. $1=self._collection();
  1564. $ctx1.sendIdx["collection"]=1;
  1565. anyOne=_st($1)._anyOne();
  1566. $3=self._collection();
  1567. $ctx1.sendIdx["collection"]=2;
  1568. $2=_st($3)._anySatisfy_((function(each){
  1569. return smalltalk.withContext(function($ctx2) {
  1570. return _st(each).__eq(anyOne);
  1571. $ctx2.sendIdx["="]=1;
  1572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1573. $ctx1.sendIdx["anySatisfy:"]=1;
  1574. self._assert_($2);
  1575. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1576. return smalltalk.withContext(function($ctx2) {
  1577. return _st(each).__eq(_st($Object())._new());
  1578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1579. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1580. args: [],
  1581. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1582. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1583. referencedClasses: ["Object"]
  1584. }),
  1585. globals.CollectionTest);
  1586. smalltalk.addMethod(
  1587. smalltalk.method({
  1588. selector: "testAsArray",
  1589. protocol: 'tests',
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $1;
  1594. $1=self._collection();
  1595. $ctx1.sendIdx["collection"]=1;
  1596. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1597. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1598. args: [],
  1599. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1600. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1601. referencedClasses: []
  1602. }),
  1603. globals.CollectionTest);
  1604. smalltalk.addMethod(
  1605. smalltalk.method({
  1606. selector: "testAsOrderedCollection",
  1607. protocol: 'tests',
  1608. fn: function (){
  1609. var self=this;
  1610. return smalltalk.withContext(function($ctx1) {
  1611. var $1;
  1612. $1=self._collection();
  1613. $ctx1.sendIdx["collection"]=1;
  1614. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1615. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1616. args: [],
  1617. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1618. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1619. referencedClasses: []
  1620. }),
  1621. globals.CollectionTest);
  1622. smalltalk.addMethod(
  1623. smalltalk.method({
  1624. selector: "testAsSet",
  1625. protocol: 'tests',
  1626. fn: function (){
  1627. var self=this;
  1628. var c,set;
  1629. return smalltalk.withContext(function($ctx1) {
  1630. c=self._collectionWithDuplicates();
  1631. set=_st(c)._asSet();
  1632. self._assert_equals_(_st(set)._size(),(5));
  1633. _st(c)._do_((function(each){
  1634. return smalltalk.withContext(function($ctx2) {
  1635. return self._assert_(_st(set)._includes_(each));
  1636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1637. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1638. args: [],
  1639. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  1640. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1641. referencedClasses: []
  1642. }),
  1643. globals.CollectionTest);
  1644. smalltalk.addMethod(
  1645. smalltalk.method({
  1646. selector: "testCollect",
  1647. protocol: 'tests',
  1648. fn: function (){
  1649. var self=this;
  1650. return smalltalk.withContext(function($ctx1) {
  1651. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1652. $2=self._collection();
  1653. $ctx1.sendIdx["collection"]=1;
  1654. $1=_st($2)._collect_((function(each){
  1655. return each;
  1656. }));
  1657. $ctx1.sendIdx["collect:"]=1;
  1658. $3=self._collection();
  1659. $ctx1.sendIdx["collection"]=2;
  1660. self._assert_equals_($1,$3);
  1661. $ctx1.sendIdx["assert:equals:"]=1;
  1662. $5=self._collectionWithNewValue();
  1663. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1664. $4=_st($5)._collect_((function(each){
  1665. return each;
  1666. }));
  1667. $ctx1.sendIdx["collect:"]=2;
  1668. self._assert_equals_($4,self._collectionWithNewValue());
  1669. $ctx1.sendIdx["assert:equals:"]=2;
  1670. $8=self._collectionClass();
  1671. $ctx1.sendIdx["collectionClass"]=1;
  1672. $7=_st($8)._new();
  1673. $ctx1.sendIdx["new"]=1;
  1674. $6=_st($7)._collect_((function(each){
  1675. return smalltalk.withContext(function($ctx2) {
  1676. return _st(each)._printString();
  1677. $ctx2.sendIdx["printString"]=1;
  1678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1679. $ctx1.sendIdx["collect:"]=3;
  1680. self._assert_equals_($6,_st(self._collectionClass())._new());
  1681. $ctx1.sendIdx["assert:equals:"]=3;
  1682. $11=self._collection();
  1683. $ctx1.sendIdx["collection"]=3;
  1684. $10=_st($11)._collect_((function(){
  1685. return smalltalk.withContext(function($ctx2) {
  1686. return self._sampleNewValue();
  1687. $ctx2.sendIdx["sampleNewValue"]=1;
  1688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1689. $ctx1.sendIdx["collect:"]=4;
  1690. $9=_st($10)._detect_((function(){
  1691. return true;
  1692. }));
  1693. self._assert_equals_($9,self._sampleNewValue());
  1694. $ctx1.sendIdx["assert:equals:"]=4;
  1695. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1696. return smalltalk.withContext(function($ctx2) {
  1697. return _st(each)._printString();
  1698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1699. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1700. args: [],
  1701. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1702. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1703. referencedClasses: []
  1704. }),
  1705. globals.CollectionTest);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "testComma",
  1709. protocol: 'tests',
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1714. $2=self._collection();
  1715. $ctx1.sendIdx["collection"]=1;
  1716. $4=self._collectionClass();
  1717. $ctx1.sendIdx["collectionClass"]=1;
  1718. $3=_st($4)._new();
  1719. $ctx1.sendIdx["new"]=1;
  1720. $1=_st($2).__comma($3);
  1721. $ctx1.sendIdx[","]=1;
  1722. $5=self._collection();
  1723. $ctx1.sendIdx["collection"]=2;
  1724. self._assert_equals_($1,$5);
  1725. $ctx1.sendIdx["assert:equals:"]=1;
  1726. $8=self._collectionClass();
  1727. $ctx1.sendIdx["collectionClass"]=2;
  1728. $7=_st($8)._new();
  1729. $ctx1.sendIdx["new"]=2;
  1730. $9=self._collection();
  1731. $ctx1.sendIdx["collection"]=3;
  1732. $6=_st($7).__comma($9);
  1733. $ctx1.sendIdx[","]=2;
  1734. $10=self._collection();
  1735. $ctx1.sendIdx["collection"]=4;
  1736. self._assert_equals_($6,$10);
  1737. $ctx1.sendIdx["assert:equals:"]=2;
  1738. $13=self._collectionClass();
  1739. $ctx1.sendIdx["collectionClass"]=3;
  1740. $12=_st($13)._new();
  1741. $ctx1.sendIdx["new"]=3;
  1742. $15=self._collectionClass();
  1743. $ctx1.sendIdx["collectionClass"]=4;
  1744. $14=_st($15)._new();
  1745. $ctx1.sendIdx["new"]=4;
  1746. $11=_st($12).__comma($14);
  1747. $ctx1.sendIdx[","]=3;
  1748. self._assert_equals_($11,_st(self._collectionClass())._new());
  1749. $ctx1.sendIdx["assert:equals:"]=3;
  1750. $17=self._collection();
  1751. $ctx1.sendIdx["collection"]=5;
  1752. $18=self._sampleNewValueAsCollection();
  1753. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1754. $16=_st($17).__comma($18);
  1755. $ctx1.sendIdx[","]=4;
  1756. $19=self._collectionWithNewValue();
  1757. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1758. self._assert_equals_($16,$19);
  1759. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1761. args: [],
  1762. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1763. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1764. referencedClasses: []
  1765. }),
  1766. globals.CollectionTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testDetect",
  1770. protocol: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1774. return smalltalk.withContext(function($ctx1) {
  1775. var $1,$2,$3,$4,$6,$5,$7;
  1776. self._shouldnt_raise_((function(){
  1777. return smalltalk.withContext(function($ctx2) {
  1778. $1=self._collection();
  1779. $ctx2.sendIdx["collection"]=1;
  1780. return _st($1)._detect_((function(){
  1781. return true;
  1782. }));
  1783. $ctx2.sendIdx["detect:"]=1;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1785. self._should_raise_((function(){
  1786. return smalltalk.withContext(function($ctx2) {
  1787. $2=self._collection();
  1788. $ctx2.sendIdx["collection"]=2;
  1789. return _st($2)._detect_((function(){
  1790. return false;
  1791. }));
  1792. $ctx2.sendIdx["detect:"]=2;
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1794. $ctx1.sendIdx["should:raise:"]=1;
  1795. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1796. return true;
  1797. }));
  1798. $ctx1.sendIdx["detect:"]=3;
  1799. $4=self._sampleNewValue();
  1800. $ctx1.sendIdx["sampleNewValue"]=1;
  1801. self._assert_equals_($3,$4);
  1802. $ctx1.sendIdx["assert:equals:"]=1;
  1803. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. $6=self._sampleNewValue();
  1806. $ctx2.sendIdx["sampleNewValue"]=2;
  1807. return _st(each).__eq($6);
  1808. $ctx2.sendIdx["="]=1;
  1809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1810. $ctx1.sendIdx["detect:"]=4;
  1811. $7=self._sampleNewValue();
  1812. $ctx1.sendIdx["sampleNewValue"]=3;
  1813. self._assert_equals_($5,$7);
  1814. self._should_raise_((function(){
  1815. return smalltalk.withContext(function($ctx2) {
  1816. return _st(self._collection())._detect_((function(each){
  1817. return smalltalk.withContext(function($ctx3) {
  1818. return _st(each).__eq(self._sampleNewValue());
  1819. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1821. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1822. args: [],
  1823. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1824. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1825. referencedClasses: ["Error"]
  1826. }),
  1827. globals.CollectionTest);
  1828. smalltalk.addMethod(
  1829. smalltalk.method({
  1830. selector: "testDetectIfNone",
  1831. protocol: 'tests',
  1832. fn: function (){
  1833. var self=this;
  1834. var sentinel;
  1835. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1836. return smalltalk.withContext(function($ctx1) {
  1837. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1838. sentinel=_st($Object())._new();
  1839. $3=self._collection();
  1840. $ctx1.sendIdx["collection"]=1;
  1841. $2=_st($3)._detect_ifNone_((function(){
  1842. return true;
  1843. }),(function(){
  1844. return sentinel;
  1845. }));
  1846. $ctx1.sendIdx["detect:ifNone:"]=1;
  1847. $1=_st($2).__tild_eq(sentinel);
  1848. self._assert_($1);
  1849. $5=self._collection();
  1850. $ctx1.sendIdx["collection"]=2;
  1851. $4=_st($5)._detect_ifNone_((function(){
  1852. return false;
  1853. }),(function(){
  1854. return sentinel;
  1855. }));
  1856. $ctx1.sendIdx["detect:ifNone:"]=2;
  1857. self._assert_equals_($4,sentinel);
  1858. $ctx1.sendIdx["assert:equals:"]=1;
  1859. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1860. return true;
  1861. }),(function(){
  1862. return sentinel;
  1863. }));
  1864. $ctx1.sendIdx["detect:ifNone:"]=3;
  1865. $7=self._sampleNewValue();
  1866. $ctx1.sendIdx["sampleNewValue"]=1;
  1867. self._assert_equals_($6,$7);
  1868. $ctx1.sendIdx["assert:equals:"]=2;
  1869. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1870. return smalltalk.withContext(function($ctx2) {
  1871. $9=self._sampleNewValue();
  1872. $ctx2.sendIdx["sampleNewValue"]=2;
  1873. return _st(each).__eq($9);
  1874. $ctx2.sendIdx["="]=1;
  1875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1876. return sentinel;
  1877. }));
  1878. $ctx1.sendIdx["detect:ifNone:"]=4;
  1879. $10=self._sampleNewValue();
  1880. $ctx1.sendIdx["sampleNewValue"]=3;
  1881. self._assert_equals_($8,$10);
  1882. $ctx1.sendIdx["assert:equals:"]=3;
  1883. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1884. return smalltalk.withContext(function($ctx2) {
  1885. return _st(each).__eq(self._sampleNewValue());
  1886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1887. return sentinel;
  1888. })),sentinel);
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1890. args: [],
  1891. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1892. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1893. referencedClasses: ["Object"]
  1894. }),
  1895. globals.CollectionTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testDo",
  1899. protocol: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. var newCollection;
  1903. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1904. return smalltalk.withContext(function($ctx1) {
  1905. var $1,$2;
  1906. newCollection=_st($OrderedCollection())._new();
  1907. $ctx1.sendIdx["new"]=1;
  1908. $1=self._collection();
  1909. $ctx1.sendIdx["collection"]=1;
  1910. _st($1)._do_((function(each){
  1911. return smalltalk.withContext(function($ctx2) {
  1912. return _st(newCollection)._add_(each);
  1913. $ctx2.sendIdx["add:"]=1;
  1914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1915. $ctx1.sendIdx["do:"]=1;
  1916. self._assertSameContents_as_(self._collection(),newCollection);
  1917. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1918. newCollection=_st($OrderedCollection())._new();
  1919. $2=self._collectionWithDuplicates();
  1920. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1921. _st($2)._do_((function(each){
  1922. return smalltalk.withContext(function($ctx2) {
  1923. return _st(newCollection)._add_(each);
  1924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1925. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1926. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1927. args: [],
  1928. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1929. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1930. referencedClasses: ["OrderedCollection"]
  1931. }),
  1932. globals.CollectionTest);
  1933. smalltalk.addMethod(
  1934. smalltalk.method({
  1935. selector: "testIfEmptyFamily",
  1936. protocol: 'tests',
  1937. fn: function (){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) {
  1940. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  1941. $3=self._collectionClass();
  1942. $ctx1.sendIdx["collectionClass"]=1;
  1943. $2=_st($3)._new();
  1944. $ctx1.sendIdx["new"]=1;
  1945. $1=_st($2)._ifEmpty_((function(){
  1946. return (42);
  1947. }));
  1948. $ctx1.sendIdx["ifEmpty:"]=1;
  1949. self._assert_equals_($1,(42));
  1950. $ctx1.sendIdx["assert:equals:"]=1;
  1951. $5=self._collection();
  1952. $ctx1.sendIdx["collection"]=1;
  1953. $4=_st($5)._ifEmpty_((function(){
  1954. return (42);
  1955. }));
  1956. $6=self._collection();
  1957. $ctx1.sendIdx["collection"]=2;
  1958. self._assert_equals_($4,$6);
  1959. $ctx1.sendIdx["assert:equals:"]=2;
  1960. $9=self._collectionClass();
  1961. $ctx1.sendIdx["collectionClass"]=2;
  1962. $8=_st($9)._new();
  1963. $ctx1.sendIdx["new"]=2;
  1964. $7=_st($8)._ifNotEmpty_((function(){
  1965. return (42);
  1966. }));
  1967. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1968. $11=self._collectionClass();
  1969. $ctx1.sendIdx["collectionClass"]=3;
  1970. $10=_st($11)._new();
  1971. $ctx1.sendIdx["new"]=3;
  1972. self._assert_equals_($7,$10);
  1973. $ctx1.sendIdx["assert:equals:"]=3;
  1974. $13=self._collection();
  1975. $ctx1.sendIdx["collection"]=3;
  1976. $12=_st($13)._ifNotEmpty_((function(){
  1977. return (42);
  1978. }));
  1979. $ctx1.sendIdx["ifNotEmpty:"]=2;
  1980. self._assert_equals_($12,(42));
  1981. $ctx1.sendIdx["assert:equals:"]=4;
  1982. $15=self._collection();
  1983. $ctx1.sendIdx["collection"]=4;
  1984. $14=_st($15)._ifNotEmpty_((function(col){
  1985. return col;
  1986. }));
  1987. $16=self._collection();
  1988. $ctx1.sendIdx["collection"]=5;
  1989. self._assert_equals_($14,$16);
  1990. $ctx1.sendIdx["assert:equals:"]=5;
  1991. $19=self._collectionClass();
  1992. $ctx1.sendIdx["collectionClass"]=4;
  1993. $18=_st($19)._new();
  1994. $ctx1.sendIdx["new"]=4;
  1995. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1996. return (42);
  1997. }),(function(){
  1998. return (999);
  1999. }));
  2000. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  2001. self._assert_equals_($17,(42));
  2002. $ctx1.sendIdx["assert:equals:"]=6;
  2003. $21=self._collection();
  2004. $ctx1.sendIdx["collection"]=6;
  2005. $20=_st($21)._ifEmpty_ifNotEmpty_((function(){
  2006. return (42);
  2007. }),(function(){
  2008. return (999);
  2009. }));
  2010. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  2011. self._assert_equals_($20,(999));
  2012. $ctx1.sendIdx["assert:equals:"]=7;
  2013. $23=self._collection();
  2014. $ctx1.sendIdx["collection"]=7;
  2015. $22=_st($23)._ifEmpty_ifNotEmpty_((function(){
  2016. return (42);
  2017. }),(function(col){
  2018. return col;
  2019. }));
  2020. $24=self._collection();
  2021. $ctx1.sendIdx["collection"]=8;
  2022. self._assert_equals_($22,$24);
  2023. $ctx1.sendIdx["assert:equals:"]=8;
  2024. $25=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  2025. return (42);
  2026. }),(function(){
  2027. return (999);
  2028. }));
  2029. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  2030. self._assert_equals_($25,(999));
  2031. $ctx1.sendIdx["assert:equals:"]=9;
  2032. $27=self._collection();
  2033. $ctx1.sendIdx["collection"]=9;
  2034. $26=_st($27)._ifNotEmpty_ifEmpty_((function(){
  2035. return (42);
  2036. }),(function(){
  2037. return (999);
  2038. }));
  2039. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  2040. self._assert_equals_($26,(42));
  2041. $ctx1.sendIdx["assert:equals:"]=10;
  2042. $29=self._collection();
  2043. $ctx1.sendIdx["collection"]=10;
  2044. $28=_st($29)._ifNotEmpty_ifEmpty_((function(col){
  2045. return col;
  2046. }),(function(){
  2047. return (999);
  2048. }));
  2049. self._assert_equals_($28,self._collection());
  2050. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  2051. args: [],
  2052. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  2053. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2054. referencedClasses: []
  2055. }),
  2056. globals.CollectionTest);
  2057. smalltalk.addMethod(
  2058. smalltalk.method({
  2059. selector: "testIsEmpty",
  2060. protocol: 'tests',
  2061. fn: function (){
  2062. var self=this;
  2063. return smalltalk.withContext(function($ctx1) {
  2064. var $1;
  2065. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2066. $ctx1.sendIdx["isEmpty"]=1;
  2067. self._assert_($1);
  2068. self._deny_(_st(self._collection())._isEmpty());
  2069. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  2070. args: [],
  2071. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2072. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2073. referencedClasses: []
  2074. }),
  2075. globals.CollectionTest);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "testNoneSatisfy",
  2079. protocol: 'tests',
  2080. fn: function (){
  2081. var self=this;
  2082. var anyOne;
  2083. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2084. return smalltalk.withContext(function($ctx1) {
  2085. var $1,$3,$2;
  2086. $1=self._collection();
  2087. $ctx1.sendIdx["collection"]=1;
  2088. anyOne=_st($1)._anyOne();
  2089. $3=self._collection();
  2090. $ctx1.sendIdx["collection"]=2;
  2091. $2=_st($3)._noneSatisfy_((function(each){
  2092. return smalltalk.withContext(function($ctx2) {
  2093. return _st(each).__eq(anyOne);
  2094. $ctx2.sendIdx["="]=1;
  2095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2096. $ctx1.sendIdx["noneSatisfy:"]=1;
  2097. self._deny_($2);
  2098. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2099. return smalltalk.withContext(function($ctx2) {
  2100. return _st(each).__eq(_st($Object())._new());
  2101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2102. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2103. args: [],
  2104. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  2105. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2106. referencedClasses: ["Object"]
  2107. }),
  2108. globals.CollectionTest);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "testRemoveAll",
  2112. protocol: 'tests',
  2113. fn: function (){
  2114. var self=this;
  2115. return smalltalk.withContext(function($ctx1) {
  2116. var $1,$2;
  2117. $1=self._collection();
  2118. _st($1)._removeAll();
  2119. $2=_st($1)._yourself();
  2120. self._assert_equals_($2,_st(self._collectionClass())._new());
  2121. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2122. args: [],
  2123. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2124. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2125. referencedClasses: []
  2126. }),
  2127. globals.CollectionTest);
  2128. smalltalk.addMethod(
  2129. smalltalk.method({
  2130. selector: "testSelect",
  2131. protocol: 'tests',
  2132. fn: function (){
  2133. var self=this;
  2134. return smalltalk.withContext(function($ctx1) {
  2135. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2136. $2=self._collection();
  2137. $ctx1.sendIdx["collection"]=1;
  2138. $1=_st($2)._select_((function(){
  2139. return false;
  2140. }));
  2141. $ctx1.sendIdx["select:"]=1;
  2142. $4=self._collectionClass();
  2143. $ctx1.sendIdx["collectionClass"]=1;
  2144. $3=_st($4)._new();
  2145. $ctx1.sendIdx["new"]=1;
  2146. self._assert_equals_($1,$3);
  2147. $ctx1.sendIdx["assert:equals:"]=1;
  2148. $6=self._collection();
  2149. $ctx1.sendIdx["collection"]=2;
  2150. $5=_st($6)._select_((function(){
  2151. return true;
  2152. }));
  2153. $ctx1.sendIdx["select:"]=2;
  2154. $7=self._collection();
  2155. $ctx1.sendIdx["collection"]=3;
  2156. self._assert_equals_($5,$7);
  2157. $ctx1.sendIdx["assert:equals:"]=2;
  2158. $9=self._collectionWithNewValue();
  2159. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2160. $8=_st($9)._select_((function(each){
  2161. return smalltalk.withContext(function($ctx2) {
  2162. $10=self._sampleNewValue();
  2163. $ctx2.sendIdx["sampleNewValue"]=1;
  2164. return _st(each).__eq($10);
  2165. $ctx2.sendIdx["="]=1;
  2166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2167. $ctx1.sendIdx["select:"]=3;
  2168. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2169. $ctx1.sendIdx["assert:equals:"]=3;
  2170. $12=self._collectionWithNewValue();
  2171. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2172. $11=_st($12)._select_((function(each){
  2173. return smalltalk.withContext(function($ctx2) {
  2174. $13=self._sampleNewValue();
  2175. $ctx2.sendIdx["sampleNewValue"]=2;
  2176. return _st(each).__tild_eq($13);
  2177. $ctx2.sendIdx["~="]=1;
  2178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2179. $ctx1.sendIdx["select:"]=4;
  2180. $14=self._collection();
  2181. $ctx1.sendIdx["collection"]=4;
  2182. self._assert_equals_($11,$14);
  2183. $ctx1.sendIdx["assert:equals:"]=4;
  2184. $16=self._collection();
  2185. $ctx1.sendIdx["collection"]=5;
  2186. $15=_st($16)._select_((function(each){
  2187. return smalltalk.withContext(function($ctx2) {
  2188. $17=self._sampleNewValue();
  2189. $ctx2.sendIdx["sampleNewValue"]=3;
  2190. return _st(each).__eq($17);
  2191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2192. $ctx1.sendIdx["select:"]=5;
  2193. self._assert_equals_($15,_st(self._collectionClass())._new());
  2194. $ctx1.sendIdx["assert:equals:"]=5;
  2195. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2196. return smalltalk.withContext(function($ctx2) {
  2197. return _st(each).__tild_eq(self._sampleNewValue());
  2198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2199. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2200. args: [],
  2201. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2202. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2203. referencedClasses: []
  2204. }),
  2205. globals.CollectionTest);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "testSize",
  2209. protocol: 'tests',
  2210. fn: function (){
  2211. var self=this;
  2212. return smalltalk.withContext(function($ctx1) {
  2213. var $1,$2;
  2214. $1=_st(_st(self._collectionClass())._new())._size();
  2215. $ctx1.sendIdx["size"]=1;
  2216. self._assert_equals_($1,(0));
  2217. $ctx1.sendIdx["assert:equals:"]=1;
  2218. $2=_st(self._sampleNewValueAsCollection())._size();
  2219. $ctx1.sendIdx["size"]=2;
  2220. self._assert_equals_($2,(1));
  2221. $ctx1.sendIdx["assert:equals:"]=2;
  2222. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2223. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2224. args: [],
  2225. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2226. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2227. referencedClasses: []
  2228. }),
  2229. globals.CollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "collectionClass",
  2233. protocol: 'fixture',
  2234. fn: function (){
  2235. var self=this;
  2236. return nil;
  2237. },
  2238. args: [],
  2239. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2240. messageSends: [],
  2241. referencedClasses: []
  2242. }),
  2243. globals.CollectionTest.klass);
  2244. smalltalk.addMethod(
  2245. smalltalk.method({
  2246. selector: "isAbstract",
  2247. protocol: 'testing',
  2248. fn: function (){
  2249. var self=this;
  2250. return smalltalk.withContext(function($ctx1) {
  2251. var $1;
  2252. $1=_st(self._collectionClass())._isNil();
  2253. return $1;
  2254. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2255. args: [],
  2256. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2257. messageSends: ["isNil", "collectionClass"],
  2258. referencedClasses: []
  2259. }),
  2260. globals.CollectionTest.klass);
  2261. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "collectionWithNewValue",
  2265. protocol: 'fixture',
  2266. fn: function (){
  2267. var self=this;
  2268. return smalltalk.withContext(function($ctx1) {
  2269. self._subclassResponsibility();
  2270. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2271. args: [],
  2272. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2273. messageSends: ["subclassResponsibility"],
  2274. referencedClasses: []
  2275. }),
  2276. globals.IndexableCollectionTest);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "sampleNewIndex",
  2280. protocol: 'fixture',
  2281. fn: function (){
  2282. var self=this;
  2283. return smalltalk.withContext(function($ctx1) {
  2284. self._subclassResponsibility();
  2285. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2286. args: [],
  2287. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2288. messageSends: ["subclassResponsibility"],
  2289. referencedClasses: []
  2290. }),
  2291. globals.IndexableCollectionTest);
  2292. smalltalk.addMethod(
  2293. smalltalk.method({
  2294. selector: "sampleNonIndexesDo:",
  2295. protocol: 'fixture',
  2296. fn: function (aBlock){
  2297. var self=this;
  2298. return smalltalk.withContext(function($ctx1) {
  2299. self._subclassResponsibility();
  2300. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2301. args: ["aBlock"],
  2302. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2303. messageSends: ["subclassResponsibility"],
  2304. referencedClasses: []
  2305. }),
  2306. globals.IndexableCollectionTest);
  2307. smalltalk.addMethod(
  2308. smalltalk.method({
  2309. selector: "samplesDo:",
  2310. protocol: 'fixture',
  2311. fn: function (aBlock){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) {
  2314. self._subclassResponsibility();
  2315. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2316. args: ["aBlock"],
  2317. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2318. messageSends: ["subclassResponsibility"],
  2319. referencedClasses: []
  2320. }),
  2321. globals.IndexableCollectionTest);
  2322. smalltalk.addMethod(
  2323. smalltalk.method({
  2324. selector: "testAt",
  2325. protocol: 'tests',
  2326. fn: function (){
  2327. var self=this;
  2328. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2329. return smalltalk.withContext(function($ctx1) {
  2330. var $1;
  2331. self._nonIndexesDo_((function(each){
  2332. return smalltalk.withContext(function($ctx2) {
  2333. return self._should_raise_((function(){
  2334. return smalltalk.withContext(function($ctx3) {
  2335. $1=self._collection();
  2336. $ctx3.sendIdx["collection"]=1;
  2337. return _st($1)._at_(each);
  2338. $ctx3.sendIdx["at:"]=1;
  2339. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2341. self._samplesDo_((function(index,value){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2344. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2345. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2346. args: [],
  2347. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2348. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2349. referencedClasses: ["Error"]
  2350. }),
  2351. globals.IndexableCollectionTest);
  2352. smalltalk.addMethod(
  2353. smalltalk.method({
  2354. selector: "testAtIfAbsent",
  2355. protocol: 'tests',
  2356. fn: function (){
  2357. var self=this;
  2358. return smalltalk.withContext(function($ctx1) {
  2359. var $2,$1,$3;
  2360. self._nonIndexesDo_((function(each){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. $2=self._collection();
  2363. $ctx2.sendIdx["collection"]=1;
  2364. $1=_st($2)._at_ifAbsent_(each,(function(){
  2365. return smalltalk.withContext(function($ctx3) {
  2366. return self._sampleNewValue();
  2367. $ctx3.sendIdx["sampleNewValue"]=1;
  2368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2369. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2370. $3=self._sampleNewValue();
  2371. $ctx2.sendIdx["sampleNewValue"]=2;
  2372. return self._assert_equals_($1,$3);
  2373. $ctx2.sendIdx["assert:equals:"]=1;
  2374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2375. self._samplesDo_((function(index,value){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2378. return smalltalk.withContext(function($ctx3) {
  2379. return self._sampleNewValue();
  2380. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2381. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2382. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2383. args: [],
  2384. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2385. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2386. referencedClasses: []
  2387. }),
  2388. globals.IndexableCollectionTest);
  2389. smalltalk.addMethod(
  2390. smalltalk.method({
  2391. selector: "testAtIfAbsentPut",
  2392. protocol: 'tests',
  2393. fn: function (){
  2394. var self=this;
  2395. var newCollection;
  2396. return smalltalk.withContext(function($ctx1) {
  2397. var $1;
  2398. newCollection=self._collection();
  2399. $ctx1.sendIdx["collection"]=1;
  2400. self._samplesDo_((function(index,value){
  2401. return smalltalk.withContext(function($ctx2) {
  2402. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2403. return smalltalk.withContext(function($ctx3) {
  2404. return self._sampleNewValue();
  2405. $ctx3.sendIdx["sampleNewValue"]=1;
  2406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2407. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2408. return self._assert_equals_($1,value);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2411. self._assert_equals_(newCollection,self._collection());
  2412. $ctx1.sendIdx["assert:equals:"]=2;
  2413. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2414. return smalltalk.withContext(function($ctx2) {
  2415. return self._sampleNewValue();
  2416. $ctx2.sendIdx["sampleNewValue"]=2;
  2417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2418. $ctx1.sendIdx["assert:equals:"]=3;
  2419. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2420. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2421. args: [],
  2422. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2423. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2424. referencedClasses: []
  2425. }),
  2426. globals.IndexableCollectionTest);
  2427. smalltalk.addMethod(
  2428. smalltalk.method({
  2429. selector: "testAtIfPresent",
  2430. protocol: 'tests',
  2431. fn: function (){
  2432. var self=this;
  2433. var visited,sentinel;
  2434. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2435. return smalltalk.withContext(function($ctx1) {
  2436. var $2,$1,$4,$3;
  2437. sentinel=_st($Object())._new();
  2438. self._nonIndexesDo_((function(each){
  2439. return smalltalk.withContext(function($ctx2) {
  2440. visited=nil;
  2441. visited;
  2442. $2=self._collection();
  2443. $ctx2.sendIdx["collection"]=1;
  2444. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2445. visited=value1;
  2446. visited;
  2447. return sentinel;
  2448. }));
  2449. $ctx2.sendIdx["at:ifPresent:"]=1;
  2450. self._assert_equals_($1,nil);
  2451. $ctx2.sendIdx["assert:equals:"]=1;
  2452. return self._assert_(_st(visited)._isNil());
  2453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2454. self._samplesDo_((function(index,value){
  2455. return smalltalk.withContext(function($ctx2) {
  2456. visited=nil;
  2457. visited;
  2458. $4=self._collection();
  2459. $ctx2.sendIdx["collection"]=2;
  2460. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2461. visited=value2;
  2462. visited;
  2463. return sentinel;
  2464. }));
  2465. self._assert_equals_($3,sentinel);
  2466. $ctx2.sendIdx["assert:equals:"]=2;
  2467. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2468. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2470. args: [],
  2471. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. globals.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtIfPresentIfAbsent",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var visited,sentinel;
  2483. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2484. return smalltalk.withContext(function($ctx1) {
  2485. var $2,$1,$3,$5,$4;
  2486. sentinel=_st($Object())._new();
  2487. self._nonIndexesDo_((function(each){
  2488. return smalltalk.withContext(function($ctx2) {
  2489. visited=nil;
  2490. visited;
  2491. $2=self._collection();
  2492. $ctx2.sendIdx["collection"]=1;
  2493. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2494. visited=value1;
  2495. visited;
  2496. return sentinel;
  2497. }),(function(){
  2498. return smalltalk.withContext(function($ctx3) {
  2499. return self._sampleNewValue();
  2500. $ctx3.sendIdx["sampleNewValue"]=1;
  2501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2502. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2503. $3=self._sampleNewValue();
  2504. $ctx2.sendIdx["sampleNewValue"]=2;
  2505. self._assert_equals_($1,$3);
  2506. $ctx2.sendIdx["assert:equals:"]=1;
  2507. return self._assert_(_st(visited)._isNil());
  2508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2509. self._samplesDo_((function(index,value){
  2510. return smalltalk.withContext(function($ctx2) {
  2511. visited=nil;
  2512. visited;
  2513. $5=self._collection();
  2514. $ctx2.sendIdx["collection"]=2;
  2515. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2516. visited=value2;
  2517. visited;
  2518. return sentinel;
  2519. }),(function(){
  2520. return smalltalk.withContext(function($ctx3) {
  2521. return self._sampleNewValue();
  2522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2523. self._assert_equals_($4,sentinel);
  2524. $ctx2.sendIdx["assert:equals:"]=2;
  2525. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2526. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2527. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2528. args: [],
  2529. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2530. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2531. referencedClasses: ["Object"]
  2532. }),
  2533. globals.IndexableCollectionTest);
  2534. smalltalk.addMethod(
  2535. smalltalk.method({
  2536. selector: "testAtPut",
  2537. protocol: 'tests',
  2538. fn: function (){
  2539. var self=this;
  2540. var newCollection;
  2541. return smalltalk.withContext(function($ctx1) {
  2542. newCollection=self._collection();
  2543. $ctx1.sendIdx["collection"]=1;
  2544. self._samplesDo_((function(index,value){
  2545. return smalltalk.withContext(function($ctx2) {
  2546. return _st(newCollection)._at_put_(index,value);
  2547. $ctx2.sendIdx["at:put:"]=1;
  2548. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2549. self._assert_equals_(newCollection,self._collection());
  2550. $ctx1.sendIdx["assert:equals:"]=1;
  2551. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2552. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2553. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2554. args: [],
  2555. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2556. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2557. referencedClasses: []
  2558. }),
  2559. globals.IndexableCollectionTest);
  2560. smalltalk.addMethod(
  2561. smalltalk.method({
  2562. selector: "testEquality",
  2563. protocol: 'tests',
  2564. fn: function (){
  2565. var self=this;
  2566. return smalltalk.withContext(function($ctx1) {
  2567. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2568. $2=self._collectionClass();
  2569. $ctx1.sendIdx["collectionClass"]=1;
  2570. $1=_st($2)._new();
  2571. $ctx1.sendIdx["new"]=1;
  2572. $4=self._collectionClass();
  2573. $ctx1.sendIdx["collectionClass"]=2;
  2574. $3=_st($4)._new();
  2575. $ctx1.sendIdx["new"]=2;
  2576. self._assert_equals_($1,$3);
  2577. $ctx1.sendIdx["assert:equals:"]=1;
  2578. $5=self._collection();
  2579. $ctx1.sendIdx["collection"]=1;
  2580. $6=self._collection();
  2581. $ctx1.sendIdx["collection"]=2;
  2582. self._assert_equals_($5,$6);
  2583. $ctx1.sendIdx["assert:equals:"]=2;
  2584. $7=self._collectionWithNewValue();
  2585. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2586. self._assert_equals_($7,self._collectionWithNewValue());
  2587. $10=self._collectionClass();
  2588. $ctx1.sendIdx["collectionClass"]=3;
  2589. $9=_st($10)._new();
  2590. $ctx1.sendIdx["new"]=3;
  2591. $11=self._collection();
  2592. $ctx1.sendIdx["collection"]=3;
  2593. $8=_st($9).__eq($11);
  2594. $ctx1.sendIdx["="]=1;
  2595. self._deny_($8);
  2596. $ctx1.sendIdx["deny:"]=1;
  2597. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2598. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2599. args: [],
  2600. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2601. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2602. referencedClasses: []
  2603. }),
  2604. globals.IndexableCollectionTest);
  2605. smalltalk.addMethod(
  2606. smalltalk.method({
  2607. selector: "testIndexOf",
  2608. protocol: 'tests',
  2609. fn: function (){
  2610. var self=this;
  2611. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2612. return smalltalk.withContext(function($ctx1) {
  2613. var $1;
  2614. self._should_raise_((function(){
  2615. return smalltalk.withContext(function($ctx2) {
  2616. $1=self._collection();
  2617. $ctx2.sendIdx["collection"]=1;
  2618. return _st($1)._indexOf_(self._sampleNewValue());
  2619. $ctx2.sendIdx["indexOf:"]=1;
  2620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2621. self._samplesDo_((function(index,value){
  2622. return smalltalk.withContext(function($ctx2) {
  2623. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2624. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2625. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2626. args: [],
  2627. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2628. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2629. referencedClasses: ["Error"]
  2630. }),
  2631. globals.IndexableCollectionTest);
  2632. smalltalk.addMethod(
  2633. smalltalk.method({
  2634. selector: "testIndexOfWithNull",
  2635. protocol: 'tests',
  2636. fn: function (){
  2637. var self=this;
  2638. var jsNull;
  2639. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2640. return smalltalk.withContext(function($ctx1) {
  2641. var $1,$2;
  2642. jsNull=_st($JSON())._parse_("null");
  2643. self._samplesDo_((function(index,value){
  2644. return smalltalk.withContext(function($ctx2) {
  2645. $1=self._collection();
  2646. _st($1)._at_put_(index,jsNull);
  2647. $2=_st($1)._indexOf_(jsNull);
  2648. return self._assert_equals_($2,index);
  2649. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2650. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2651. args: [],
  2652. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  2653. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2654. referencedClasses: ["JSON"]
  2655. }),
  2656. globals.IndexableCollectionTest);
  2657. smalltalk.addMethod(
  2658. smalltalk.method({
  2659. selector: "testWithIndexDo",
  2660. protocol: 'tests',
  2661. fn: function (){
  2662. var self=this;
  2663. var collection;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. collection=self._collection();
  2666. $ctx1.sendIdx["collection"]=1;
  2667. _st(self._collection())._withIndexDo_((function(each,index){
  2668. return smalltalk.withContext(function($ctx2) {
  2669. return self._assert_equals_(_st(collection)._at_(index),each);
  2670. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2671. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2672. args: [],
  2673. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  2674. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2675. referencedClasses: []
  2676. }),
  2677. globals.IndexableCollectionTest);
  2678. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2679. smalltalk.addMethod(
  2680. smalltalk.method({
  2681. selector: "collectionKeys",
  2682. protocol: 'fixture',
  2683. fn: function (){
  2684. var self=this;
  2685. return smalltalk.withContext(function($ctx1) {
  2686. self._subclassResponsibility();
  2687. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2688. args: [],
  2689. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2690. messageSends: ["subclassResponsibility"],
  2691. referencedClasses: []
  2692. }),
  2693. globals.AssociativeCollectionTest);
  2694. smalltalk.addMethod(
  2695. smalltalk.method({
  2696. selector: "collectionValues",
  2697. protocol: 'fixture',
  2698. fn: function (){
  2699. var self=this;
  2700. return smalltalk.withContext(function($ctx1) {
  2701. self._subclassResponsibility();
  2702. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2703. args: [],
  2704. source: "collectionValues\x0a\x09self subclassResponsibility",
  2705. messageSends: ["subclassResponsibility"],
  2706. referencedClasses: []
  2707. }),
  2708. globals.AssociativeCollectionTest);
  2709. smalltalk.addMethod(
  2710. smalltalk.method({
  2711. selector: "nonIndexesDo:",
  2712. protocol: 'fixture',
  2713. fn: function (aBlock){
  2714. var self=this;
  2715. return smalltalk.withContext(function($ctx1) {
  2716. _st(aBlock)._value_((5));
  2717. $ctx1.sendIdx["value:"]=1;
  2718. _st(aBlock)._value_("z");
  2719. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2720. args: ["aBlock"],
  2721. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2722. messageSends: ["value:"],
  2723. referencedClasses: []
  2724. }),
  2725. globals.AssociativeCollectionTest);
  2726. smalltalk.addMethod(
  2727. smalltalk.method({
  2728. selector: "sampleNewIndex",
  2729. protocol: 'fixture',
  2730. fn: function (){
  2731. var self=this;
  2732. return "new";
  2733. },
  2734. args: [],
  2735. source: "sampleNewIndex\x0a\x09^ 'new'",
  2736. messageSends: [],
  2737. referencedClasses: []
  2738. }),
  2739. globals.AssociativeCollectionTest);
  2740. smalltalk.addMethod(
  2741. smalltalk.method({
  2742. selector: "samplesDo:",
  2743. protocol: 'fixture',
  2744. fn: function (aBlock){
  2745. var self=this;
  2746. return smalltalk.withContext(function($ctx1) {
  2747. _st(aBlock)._value_value_("a",(2));
  2748. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2749. args: ["aBlock"],
  2750. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2751. messageSends: ["value:value:"],
  2752. referencedClasses: []
  2753. }),
  2754. globals.AssociativeCollectionTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testAddAll",
  2758. protocol: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. return smalltalk.withContext(function($ctx1) {
  2762. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2763. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2764. $ctx1.supercall = false;
  2765. $2=self._collection();
  2766. $ctx1.sendIdx["collection"]=1;
  2767. $3=$2;
  2768. $4=self._collection();
  2769. $ctx1.sendIdx["collection"]=2;
  2770. _st($3)._addAll_($4);
  2771. $ctx1.sendIdx["addAll:"]=1;
  2772. $5=_st($2)._yourself();
  2773. $ctx1.sendIdx["yourself"]=1;
  2774. $1=$5;
  2775. $6=self._collection();
  2776. $ctx1.sendIdx["collection"]=3;
  2777. self._assert_equals_($1,$6);
  2778. $ctx1.sendIdx["assert:equals:"]=1;
  2779. $8=self._collection();
  2780. $ctx1.sendIdx["collection"]=4;
  2781. $9=$8;
  2782. $10=self._collectionWithNewValue();
  2783. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2784. _st($9)._addAll_($10);
  2785. $ctx1.sendIdx["addAll:"]=2;
  2786. $11=_st($8)._yourself();
  2787. $ctx1.sendIdx["yourself"]=2;
  2788. $7=$11;
  2789. $12=self._collectionWithNewValue();
  2790. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2791. self._assert_equals_($7,$12);
  2792. $ctx1.sendIdx["assert:equals:"]=2;
  2793. $14=self._collectionWithNewValue();
  2794. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2795. _st($14)._addAll_(self._collection());
  2796. $15=_st($14)._yourself();
  2797. $13=$15;
  2798. self._assert_equals_($13,self._collectionWithNewValue());
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2800. args: [],
  2801. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  2802. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2803. referencedClasses: []
  2804. }),
  2805. globals.AssociativeCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testAsDictionary",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2813. return smalltalk.withContext(function($ctx1) {
  2814. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2815. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2816. args: [],
  2817. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2818. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2819. referencedClasses: ["Dictionary"]
  2820. }),
  2821. globals.AssociativeCollectionTest);
  2822. smalltalk.addMethod(
  2823. smalltalk.method({
  2824. selector: "testAsHashedCollection",
  2825. protocol: 'tests',
  2826. fn: function (){
  2827. var self=this;
  2828. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2829. return smalltalk.withContext(function($ctx1) {
  2830. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2831. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2832. args: [],
  2833. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2834. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2835. referencedClasses: ["HashedCollection"]
  2836. }),
  2837. globals.AssociativeCollectionTest);
  2838. smalltalk.addMethod(
  2839. smalltalk.method({
  2840. selector: "testComma",
  2841. protocol: 'tests',
  2842. fn: function (){
  2843. var self=this;
  2844. return smalltalk.withContext(function($ctx1) {
  2845. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2846. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2847. $ctx1.supercall = false;
  2848. $2=self._collection();
  2849. $ctx1.sendIdx["collection"]=1;
  2850. $3=self._collection();
  2851. $ctx1.sendIdx["collection"]=2;
  2852. $1=_st($2).__comma($3);
  2853. $ctx1.sendIdx[","]=1;
  2854. $4=self._collection();
  2855. $ctx1.sendIdx["collection"]=3;
  2856. self._assert_equals_($1,$4);
  2857. $ctx1.sendIdx["assert:equals:"]=1;
  2858. $6=self._collection();
  2859. $ctx1.sendIdx["collection"]=4;
  2860. $7=self._collectionWithNewValue();
  2861. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2862. $5=_st($6).__comma($7);
  2863. $ctx1.sendIdx[","]=2;
  2864. $8=self._collectionWithNewValue();
  2865. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2866. self._assert_equals_($5,$8);
  2867. $ctx1.sendIdx["assert:equals:"]=2;
  2868. $10=self._collectionWithNewValue();
  2869. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2870. $9=_st($10).__comma(self._collection());
  2871. self._assert_equals_($9,self._collectionWithNewValue());
  2872. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2873. args: [],
  2874. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  2875. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2876. referencedClasses: []
  2877. }),
  2878. globals.AssociativeCollectionTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "testFrom",
  2882. protocol: 'tests',
  2883. fn: function (){
  2884. var self=this;
  2885. var associations;
  2886. return smalltalk.withContext(function($ctx1) {
  2887. var $1;
  2888. $1="a".__minus_gt((1));
  2889. $ctx1.sendIdx["->"]=1;
  2890. associations=[$1,"b".__minus_gt((2))];
  2891. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2892. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2893. args: [],
  2894. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  2895. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2896. referencedClasses: []
  2897. }),
  2898. globals.AssociativeCollectionTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "testKeys",
  2902. protocol: 'tests',
  2903. fn: function (){
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) {
  2906. var $2,$1,$3,$4;
  2907. $2=_st(_st(self._collectionClass())._new())._keys();
  2908. $ctx1.sendIdx["keys"]=1;
  2909. $1=_st($2)._isEmpty();
  2910. self._assert_($1);
  2911. $3=_st(self._collection())._keys();
  2912. $ctx1.sendIdx["keys"]=2;
  2913. $4=self._collectionKeys();
  2914. $ctx1.sendIdx["collectionKeys"]=1;
  2915. self._assertSameContents_as_($3,$4);
  2916. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2917. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2918. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2919. args: [],
  2920. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2921. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2922. referencedClasses: []
  2923. }),
  2924. globals.AssociativeCollectionTest);
  2925. smalltalk.addMethod(
  2926. smalltalk.method({
  2927. selector: "testNewFromPairs",
  2928. protocol: 'tests',
  2929. fn: function (){
  2930. var self=this;
  2931. var flattenedAssociations;
  2932. return smalltalk.withContext(function($ctx1) {
  2933. flattenedAssociations=["a",(1),"b",(2)];
  2934. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2935. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2936. args: [],
  2937. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  2938. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2939. referencedClasses: []
  2940. }),
  2941. globals.AssociativeCollectionTest);
  2942. smalltalk.addMethod(
  2943. smalltalk.method({
  2944. selector: "testPrintString",
  2945. protocol: 'tests',
  2946. fn: function (){
  2947. var self=this;
  2948. return smalltalk.withContext(function($ctx1) {
  2949. var $3,$2,$4,$1,$5;
  2950. $3=self._collectionClass();
  2951. $ctx1.sendIdx["collectionClass"]=1;
  2952. $2=_st($3)._new();
  2953. _st($2)._at_put_("firstname","James");
  2954. $ctx1.sendIdx["at:put:"]=1;
  2955. _st($2)._at_put_("lastname","Bond");
  2956. $4=_st($2)._printString();
  2957. $1=$4;
  2958. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2959. $ctx1.sendIdx[","]=1;
  2960. self._assert_equals_($1,$5);
  2961. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2962. args: [],
  2963. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2964. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2965. referencedClasses: []
  2966. }),
  2967. globals.AssociativeCollectionTest);
  2968. smalltalk.addMethod(
  2969. smalltalk.method({
  2970. selector: "testRemoveKey",
  2971. protocol: 'tests',
  2972. fn: function (){
  2973. var self=this;
  2974. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2975. return smalltalk.withContext(function($ctx1) {
  2976. var $1,$2,$3,$5,$6,$4,$7,$8;
  2977. self._nonIndexesDo_((function(each){
  2978. var collection;
  2979. return smalltalk.withContext(function($ctx2) {
  2980. collection=self._collection();
  2981. $ctx2.sendIdx["collection"]=1;
  2982. collection;
  2983. self._should_raise_((function(){
  2984. return smalltalk.withContext(function($ctx3) {
  2985. return _st(collection)._removeKey_(each);
  2986. $ctx3.sendIdx["removeKey:"]=1;
  2987. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2988. $1=collection;
  2989. $2=self._collection();
  2990. $ctx2.sendIdx["collection"]=2;
  2991. return self._assert_equals_($1,$2);
  2992. $ctx2.sendIdx["assert:equals:"]=1;
  2993. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2994. self._samplesDo_((function(index,value){
  2995. var collection;
  2996. return smalltalk.withContext(function($ctx2) {
  2997. collection=self._collection();
  2998. $ctx2.sendIdx["collection"]=3;
  2999. collection;
  3000. $3=_st(collection)._removeKey_(index);
  3001. $ctx2.sendIdx["removeKey:"]=2;
  3002. self._assert_equals_($3,value);
  3003. $ctx2.sendIdx["assert:equals:"]=2;
  3004. $5=collection;
  3005. $6=self._collection();
  3006. $ctx2.sendIdx["collection"]=4;
  3007. $4=_st($5).__eq($6);
  3008. return self._deny_($4);
  3009. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3010. $7=self._collectionWithNewValue();
  3011. _st($7)._removeKey_(self._sampleNewIndex());
  3012. $8=_st($7)._yourself();
  3013. self._assert_equals_($8,self._collection());
  3014. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  3015. args: [],
  3016. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  3017. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  3018. referencedClasses: ["Error"]
  3019. }),
  3020. globals.AssociativeCollectionTest);
  3021. smalltalk.addMethod(
  3022. smalltalk.method({
  3023. selector: "testRemoveKeyIfAbsent",
  3024. protocol: 'tests',
  3025. fn: function (){
  3026. var self=this;
  3027. return smalltalk.withContext(function($ctx1) {
  3028. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  3029. self._nonIndexesDo_((function(each){
  3030. var collection;
  3031. return smalltalk.withContext(function($ctx2) {
  3032. collection=self._collection();
  3033. $ctx2.sendIdx["collection"]=1;
  3034. collection;
  3035. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  3036. return smalltalk.withContext(function($ctx3) {
  3037. return self._sampleNewValue();
  3038. $ctx3.sendIdx["sampleNewValue"]=1;
  3039. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  3040. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  3041. $2=self._sampleNewValue();
  3042. $ctx2.sendIdx["sampleNewValue"]=2;
  3043. self._assert_equals_($1,$2);
  3044. $ctx2.sendIdx["assert:equals:"]=1;
  3045. $3=collection;
  3046. $4=self._collection();
  3047. $ctx2.sendIdx["collection"]=2;
  3048. return self._assert_equals_($3,$4);
  3049. $ctx2.sendIdx["assert:equals:"]=2;
  3050. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  3051. self._samplesDo_((function(index,value){
  3052. var collection;
  3053. return smalltalk.withContext(function($ctx2) {
  3054. collection=self._collection();
  3055. $ctx2.sendIdx["collection"]=3;
  3056. collection;
  3057. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3058. return smalltalk.withContext(function($ctx3) {
  3059. return self._sampleNewValue();
  3060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3061. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3062. self._assert_equals_($5,value);
  3063. $ctx2.sendIdx["assert:equals:"]=3;
  3064. $7=collection;
  3065. $8=self._collection();
  3066. $ctx2.sendIdx["collection"]=4;
  3067. $6=_st($7).__eq($8);
  3068. return self._deny_($6);
  3069. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3070. $9=self._collectionWithNewValue();
  3071. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3072. return smalltalk.withContext(function($ctx2) {
  3073. return self._assert_(false);
  3074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3075. $10=_st($9)._yourself();
  3076. self._assert_equals_($10,self._collection());
  3077. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3078. args: [],
  3079. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  3080. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3081. referencedClasses: []
  3082. }),
  3083. globals.AssociativeCollectionTest);
  3084. smalltalk.addMethod(
  3085. smalltalk.method({
  3086. selector: "testValues",
  3087. protocol: 'tests',
  3088. fn: function (){
  3089. var self=this;
  3090. return smalltalk.withContext(function($ctx1) {
  3091. var $2,$1,$3,$4;
  3092. $2=_st(_st(self._collectionClass())._new())._values();
  3093. $ctx1.sendIdx["values"]=1;
  3094. $1=_st($2)._isEmpty();
  3095. self._assert_($1);
  3096. $3=_st(self._collection())._values();
  3097. $ctx1.sendIdx["values"]=2;
  3098. $4=self._collectionValues();
  3099. $ctx1.sendIdx["collectionValues"]=1;
  3100. self._assertSameContents_as_($3,$4);
  3101. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3102. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3103. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3104. args: [],
  3105. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  3106. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3107. referencedClasses: []
  3108. }),
  3109. globals.AssociativeCollectionTest);
  3110. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3111. smalltalk.addMethod(
  3112. smalltalk.method({
  3113. selector: "collection",
  3114. protocol: 'fixture',
  3115. fn: function (){
  3116. var self=this;
  3117. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3118. return smalltalk.withContext(function($ctx1) {
  3119. var $2,$3,$1;
  3120. $2=_st($Dictionary())._new();
  3121. _st($2)._at_put_((1),(1));
  3122. $ctx1.sendIdx["at:put:"]=1;
  3123. _st($2)._at_put_("a",(2));
  3124. $ctx1.sendIdx["at:put:"]=2;
  3125. _st($2)._at_put_(true,(3));
  3126. $ctx1.sendIdx["at:put:"]=3;
  3127. _st($2)._at_put_((1).__at((3)),(-4));
  3128. $3=_st($2)._yourself();
  3129. $1=$3;
  3130. return $1;
  3131. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3132. args: [],
  3133. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09yourself",
  3134. messageSends: ["at:put:", "new", "@", "yourself"],
  3135. referencedClasses: ["Dictionary"]
  3136. }),
  3137. globals.DictionaryTest);
  3138. smalltalk.addMethod(
  3139. smalltalk.method({
  3140. selector: "collectionKeys",
  3141. protocol: 'fixture',
  3142. fn: function (){
  3143. var self=this;
  3144. return smalltalk.withContext(function($ctx1) {
  3145. var $1;
  3146. $1=[(1),"a",true,(1).__at((3))];
  3147. return $1;
  3148. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3149. args: [],
  3150. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3151. messageSends: ["@"],
  3152. referencedClasses: []
  3153. }),
  3154. globals.DictionaryTest);
  3155. smalltalk.addMethod(
  3156. smalltalk.method({
  3157. selector: "collectionOfPrintStrings",
  3158. protocol: 'fixture',
  3159. fn: function (){
  3160. var self=this;
  3161. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3162. return smalltalk.withContext(function($ctx1) {
  3163. var $2,$3,$1;
  3164. $2=_st($Dictionary())._new();
  3165. _st($2)._at_put_((1),"1");
  3166. $ctx1.sendIdx["at:put:"]=1;
  3167. _st($2)._at_put_("a","2");
  3168. $ctx1.sendIdx["at:put:"]=2;
  3169. _st($2)._at_put_(true,"3");
  3170. $ctx1.sendIdx["at:put:"]=3;
  3171. _st($2)._at_put_((1).__at((3)),"-4");
  3172. $3=_st($2)._yourself();
  3173. $1=$3;
  3174. return $1;
  3175. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3176. args: [],
  3177. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09yourself",
  3178. messageSends: ["at:put:", "new", "@", "yourself"],
  3179. referencedClasses: ["Dictionary"]
  3180. }),
  3181. globals.DictionaryTest);
  3182. smalltalk.addMethod(
  3183. smalltalk.method({
  3184. selector: "collectionSize",
  3185. protocol: 'fixture',
  3186. fn: function (){
  3187. var self=this;
  3188. return (4);
  3189. },
  3190. args: [],
  3191. source: "collectionSize\x0a\x09^ 4",
  3192. messageSends: [],
  3193. referencedClasses: []
  3194. }),
  3195. globals.DictionaryTest);
  3196. smalltalk.addMethod(
  3197. smalltalk.method({
  3198. selector: "collectionValues",
  3199. protocol: 'fixture',
  3200. fn: function (){
  3201. var self=this;
  3202. var $1;
  3203. $1=[(1),(2),(3),(-4)];
  3204. return $1;
  3205. },
  3206. args: [],
  3207. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3208. messageSends: [],
  3209. referencedClasses: []
  3210. }),
  3211. globals.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "collectionWithDuplicates",
  3215. protocol: 'fixture',
  3216. fn: function (){
  3217. var self=this;
  3218. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3219. return smalltalk.withContext(function($ctx1) {
  3220. var $2,$3,$1;
  3221. $2=_st($Dictionary())._new();
  3222. _st($2)._at_put_((1),(1));
  3223. $ctx1.sendIdx["at:put:"]=1;
  3224. _st($2)._at_put_("a",(2));
  3225. $ctx1.sendIdx["at:put:"]=2;
  3226. _st($2)._at_put_(true,(3));
  3227. $ctx1.sendIdx["at:put:"]=3;
  3228. _st($2)._at_put_((4),(-4));
  3229. $ctx1.sendIdx["at:put:"]=4;
  3230. _st($2)._at_put_("b",(1));
  3231. $ctx1.sendIdx["at:put:"]=5;
  3232. _st($2)._at_put_((3),(3));
  3233. $ctx1.sendIdx["at:put:"]=6;
  3234. _st($2)._at_put_(false,(12));
  3235. $3=_st($2)._yourself();
  3236. $1=$3;
  3237. return $1;
  3238. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3239. args: [],
  3240. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  3241. messageSends: ["at:put:", "new", "yourself"],
  3242. referencedClasses: ["Dictionary"]
  3243. }),
  3244. globals.DictionaryTest);
  3245. smalltalk.addMethod(
  3246. smalltalk.method({
  3247. selector: "collectionWithNewValue",
  3248. protocol: 'fixture',
  3249. fn: function (){
  3250. var self=this;
  3251. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3252. return smalltalk.withContext(function($ctx1) {
  3253. var $2,$3,$1;
  3254. $2=_st($Dictionary())._new();
  3255. _st($2)._at_put_((1),(1));
  3256. $ctx1.sendIdx["at:put:"]=1;
  3257. _st($2)._at_put_("a",(2));
  3258. $ctx1.sendIdx["at:put:"]=2;
  3259. _st($2)._at_put_(true,(3));
  3260. $ctx1.sendIdx["at:put:"]=3;
  3261. _st($2)._at_put_((1).__at((3)),(-4));
  3262. $ctx1.sendIdx["at:put:"]=4;
  3263. _st($2)._at_put_("new","N");
  3264. $3=_st($2)._yourself();
  3265. $1=$3;
  3266. return $1;
  3267. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3268. args: [],
  3269. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3270. messageSends: ["at:put:", "new", "@", "yourself"],
  3271. referencedClasses: ["Dictionary"]
  3272. }),
  3273. globals.DictionaryTest);
  3274. smalltalk.addMethod(
  3275. smalltalk.method({
  3276. selector: "sampleNewValueAsCollection",
  3277. protocol: 'fixture',
  3278. fn: function (){
  3279. var self=this;
  3280. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3281. return smalltalk.withContext(function($ctx1) {
  3282. var $2,$3,$1;
  3283. $2=_st($Dictionary())._new();
  3284. _st($2)._at_put_("new","N");
  3285. $3=_st($2)._yourself();
  3286. $1=$3;
  3287. return $1;
  3288. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3289. args: [],
  3290. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3291. messageSends: ["at:put:", "new", "yourself"],
  3292. referencedClasses: ["Dictionary"]
  3293. }),
  3294. globals.DictionaryTest);
  3295. smalltalk.addMethod(
  3296. smalltalk.method({
  3297. selector: "samplesDo:",
  3298. protocol: 'fixture',
  3299. fn: function (aBlock){
  3300. var self=this;
  3301. return smalltalk.withContext(function($ctx1) {
  3302. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3303. $ctx1.supercall = false;
  3304. _st(aBlock)._value_value_(true,(3));
  3305. $ctx1.sendIdx["value:value:"]=1;
  3306. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3307. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3308. args: ["aBlock"],
  3309. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3310. messageSends: ["samplesDo:", "value:value:", "@"],
  3311. referencedClasses: []
  3312. }),
  3313. globals.DictionaryTest);
  3314. smalltalk.addMethod(
  3315. smalltalk.method({
  3316. selector: "testAccessing",
  3317. protocol: 'tests',
  3318. fn: function (){
  3319. var self=this;
  3320. var d;
  3321. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3322. return smalltalk.withContext(function($ctx1) {
  3323. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3324. d=_st($Dictionary())._new();
  3325. _st(d)._at_put_("hello","world");
  3326. $ctx1.sendIdx["at:put:"]=1;
  3327. $1=_st(d)._at_("hello");
  3328. $ctx1.sendIdx["at:"]=1;
  3329. self._assert_equals_($1,"world");
  3330. $ctx1.sendIdx["assert:equals:"]=1;
  3331. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3332. return nil;
  3333. }));
  3334. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3335. self._assert_equals_($2,"world");
  3336. $ctx1.sendIdx["assert:equals:"]=2;
  3337. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3338. return nil;
  3339. }))).__eq("world"));
  3340. $ctx1.sendIdx["deny:"]=1;
  3341. $3=_st(d)._includesKey_("hello");
  3342. $ctx1.sendIdx["includesKey:"]=1;
  3343. self._assert_($3);
  3344. $ctx1.sendIdx["assert:"]=1;
  3345. $4=_st(d)._includesKey_("foo");
  3346. $ctx1.sendIdx["includesKey:"]=2;
  3347. self._deny_($4);
  3348. $ctx1.sendIdx["deny:"]=2;
  3349. _st(d)._at_put_((1),(2));
  3350. $ctx1.sendIdx["at:put:"]=2;
  3351. $5=_st(d)._at_((1));
  3352. $ctx1.sendIdx["at:"]=2;
  3353. self._assert_equals_($5,(2));
  3354. $ctx1.sendIdx["assert:equals:"]=3;
  3355. $6=d;
  3356. $7=(1).__at((3));
  3357. $ctx1.sendIdx["@"]=1;
  3358. _st($6)._at_put_($7,(3));
  3359. $9=d;
  3360. $10=(1).__at((3));
  3361. $ctx1.sendIdx["@"]=2;
  3362. $8=_st($9)._at_($10);
  3363. self._assert_equals_($8,(3));
  3364. $12=d;
  3365. $13=(1).__at((3));
  3366. $ctx1.sendIdx["@"]=3;
  3367. $11=_st($12)._includesKey_($13);
  3368. $ctx1.sendIdx["includesKey:"]=3;
  3369. self._assert_($11);
  3370. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3371. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3372. args: [],
  3373. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  3374. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3375. referencedClasses: ["Dictionary"]
  3376. }),
  3377. globals.DictionaryTest);
  3378. smalltalk.addMethod(
  3379. smalltalk.method({
  3380. selector: "testDynamicDictionaries",
  3381. protocol: 'tests',
  3382. fn: function (){
  3383. var self=this;
  3384. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3385. return smalltalk.withContext(function($ctx1) {
  3386. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3387. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3388. args: [],
  3389. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3390. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3391. referencedClasses: ["Dictionary"]
  3392. }),
  3393. globals.DictionaryTest);
  3394. smalltalk.addMethod(
  3395. smalltalk.method({
  3396. selector: "collectionClass",
  3397. protocol: 'fixture',
  3398. fn: function (){
  3399. var self=this;
  3400. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3401. return $Dictionary();
  3402. },
  3403. args: [],
  3404. source: "collectionClass\x0a\x09^ Dictionary",
  3405. messageSends: [],
  3406. referencedClasses: ["Dictionary"]
  3407. }),
  3408. globals.DictionaryTest.klass);
  3409. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3410. smalltalk.addMethod(
  3411. smalltalk.method({
  3412. selector: "collection",
  3413. protocol: 'fixture',
  3414. fn: function (){
  3415. var self=this;
  3416. var $1;
  3417. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3418. return $1;
  3419. },
  3420. args: [],
  3421. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3422. messageSends: [],
  3423. referencedClasses: []
  3424. }),
  3425. globals.HashedCollectionTest);
  3426. smalltalk.addMethod(
  3427. smalltalk.method({
  3428. selector: "collectionKeys",
  3429. protocol: 'fixture',
  3430. fn: function (){
  3431. var self=this;
  3432. var $1;
  3433. $1=["b","a","c","d"];
  3434. return $1;
  3435. },
  3436. args: [],
  3437. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3438. messageSends: [],
  3439. referencedClasses: []
  3440. }),
  3441. globals.HashedCollectionTest);
  3442. smalltalk.addMethod(
  3443. smalltalk.method({
  3444. selector: "collectionOfPrintStrings",
  3445. protocol: 'fixture',
  3446. fn: function (){
  3447. var self=this;
  3448. var $1;
  3449. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3450. return $1;
  3451. },
  3452. args: [],
  3453. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3454. messageSends: [],
  3455. referencedClasses: []
  3456. }),
  3457. globals.HashedCollectionTest);
  3458. smalltalk.addMethod(
  3459. smalltalk.method({
  3460. selector: "collectionSize",
  3461. protocol: 'fixture',
  3462. fn: function (){
  3463. var self=this;
  3464. return (4);
  3465. },
  3466. args: [],
  3467. source: "collectionSize\x0a\x09^ 4",
  3468. messageSends: [],
  3469. referencedClasses: []
  3470. }),
  3471. globals.HashedCollectionTest);
  3472. smalltalk.addMethod(
  3473. smalltalk.method({
  3474. selector: "collectionValues",
  3475. protocol: 'fixture',
  3476. fn: function (){
  3477. var self=this;
  3478. var $1;
  3479. $1=[(1),(2),(3),(-4)];
  3480. return $1;
  3481. },
  3482. args: [],
  3483. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3484. messageSends: [],
  3485. referencedClasses: []
  3486. }),
  3487. globals.HashedCollectionTest);
  3488. smalltalk.addMethod(
  3489. smalltalk.method({
  3490. selector: "collectionWithDuplicates",
  3491. protocol: 'fixture',
  3492. fn: function (){
  3493. var self=this;
  3494. var $1;
  3495. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3496. return $1;
  3497. },
  3498. args: [],
  3499. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3500. messageSends: [],
  3501. referencedClasses: []
  3502. }),
  3503. globals.HashedCollectionTest);
  3504. smalltalk.addMethod(
  3505. smalltalk.method({
  3506. selector: "collectionWithNewValue",
  3507. protocol: 'fixture',
  3508. fn: function (){
  3509. var self=this;
  3510. var $1;
  3511. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3512. return $1;
  3513. },
  3514. args: [],
  3515. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3516. messageSends: [],
  3517. referencedClasses: []
  3518. }),
  3519. globals.HashedCollectionTest);
  3520. smalltalk.addMethod(
  3521. smalltalk.method({
  3522. selector: "sampleNewValueAsCollection",
  3523. protocol: 'fixture',
  3524. fn: function (){
  3525. var self=this;
  3526. var $1;
  3527. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3528. return $1;
  3529. },
  3530. args: [],
  3531. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3532. messageSends: [],
  3533. referencedClasses: []
  3534. }),
  3535. globals.HashedCollectionTest);
  3536. smalltalk.addMethod(
  3537. smalltalk.method({
  3538. selector: "testDynamicDictionaries",
  3539. protocol: 'tests',
  3540. fn: function (){
  3541. var self=this;
  3542. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3543. return smalltalk.withContext(function($ctx1) {
  3544. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3545. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3546. args: [],
  3547. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3548. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3549. referencedClasses: ["HashedCollection"]
  3550. }),
  3551. globals.HashedCollectionTest);
  3552. smalltalk.addMethod(
  3553. smalltalk.method({
  3554. selector: "collectionClass",
  3555. protocol: 'fixture',
  3556. fn: function (){
  3557. var self=this;
  3558. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3559. return $HashedCollection();
  3560. },
  3561. args: [],
  3562. source: "collectionClass\x0a\x09^ HashedCollection",
  3563. messageSends: [],
  3564. referencedClasses: ["HashedCollection"]
  3565. }),
  3566. globals.HashedCollectionTest.klass);
  3567. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "collectionFirst",
  3571. protocol: 'fixture',
  3572. fn: function (){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. self._subclassResponsibility();
  3576. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3577. args: [],
  3578. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3579. messageSends: ["subclassResponsibility"],
  3580. referencedClasses: []
  3581. }),
  3582. globals.SequenceableCollectionTest);
  3583. smalltalk.addMethod(
  3584. smalltalk.method({
  3585. selector: "collectionFirstTwo",
  3586. protocol: 'fixture',
  3587. fn: function (){
  3588. var self=this;
  3589. return smalltalk.withContext(function($ctx1) {
  3590. self._subclassResponsibility();
  3591. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3592. args: [],
  3593. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3594. messageSends: ["subclassResponsibility"],
  3595. referencedClasses: []
  3596. }),
  3597. globals.SequenceableCollectionTest);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "collectionLast",
  3601. protocol: 'fixture',
  3602. fn: function (){
  3603. var self=this;
  3604. return smalltalk.withContext(function($ctx1) {
  3605. self._subclassResponsibility();
  3606. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3607. args: [],
  3608. source: "collectionLast\x0a\x09self subclassResponsibility",
  3609. messageSends: ["subclassResponsibility"],
  3610. referencedClasses: []
  3611. }),
  3612. globals.SequenceableCollectionTest);
  3613. smalltalk.addMethod(
  3614. smalltalk.method({
  3615. selector: "collectionLastTwo",
  3616. protocol: 'fixture',
  3617. fn: function (){
  3618. var self=this;
  3619. return smalltalk.withContext(function($ctx1) {
  3620. self._subclassResponsibility();
  3621. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3622. args: [],
  3623. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3624. messageSends: ["subclassResponsibility"],
  3625. referencedClasses: []
  3626. }),
  3627. globals.SequenceableCollectionTest);
  3628. smalltalk.addMethod(
  3629. smalltalk.method({
  3630. selector: "nonIndexesDo:",
  3631. protocol: 'fixture',
  3632. fn: function (aBlock){
  3633. var self=this;
  3634. return smalltalk.withContext(function($ctx1) {
  3635. _st(aBlock)._value_((0));
  3636. $ctx1.sendIdx["value:"]=1;
  3637. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3638. $ctx1.sendIdx["value:"]=2;
  3639. _st(aBlock)._value_("z");
  3640. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3641. args: ["aBlock"],
  3642. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3643. messageSends: ["value:", "+", "collectionSize"],
  3644. referencedClasses: []
  3645. }),
  3646. globals.SequenceableCollectionTest);
  3647. smalltalk.addMethod(
  3648. smalltalk.method({
  3649. selector: "samplesDo:",
  3650. protocol: 'fixture',
  3651. fn: function (aBlock){
  3652. var self=this;
  3653. return smalltalk.withContext(function($ctx1) {
  3654. _st(aBlock)._value_value_((1),self._collectionFirst());
  3655. $ctx1.sendIdx["value:value:"]=1;
  3656. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3657. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3658. args: ["aBlock"],
  3659. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3660. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3661. referencedClasses: []
  3662. }),
  3663. globals.SequenceableCollectionTest);
  3664. smalltalk.addMethod(
  3665. smalltalk.method({
  3666. selector: "testBeginsWith",
  3667. protocol: 'tests',
  3668. fn: function (){
  3669. var self=this;
  3670. return smalltalk.withContext(function($ctx1) {
  3671. var $2,$1,$4,$5,$3,$7,$6;
  3672. $2=self._collection();
  3673. $ctx1.sendIdx["collection"]=1;
  3674. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3675. $ctx1.sendIdx["beginsWith:"]=1;
  3676. self._assert_($1);
  3677. $ctx1.sendIdx["assert:"]=1;
  3678. $4=self._collection();
  3679. $ctx1.sendIdx["collection"]=2;
  3680. $5=self._collection();
  3681. $ctx1.sendIdx["collection"]=3;
  3682. $3=_st($4)._beginsWith_($5);
  3683. $ctx1.sendIdx["beginsWith:"]=2;
  3684. self._assert_($3);
  3685. $ctx1.sendIdx["assert:"]=2;
  3686. $7=self._collection();
  3687. $ctx1.sendIdx["collection"]=4;
  3688. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3689. $ctx1.sendIdx["beginsWith:"]=3;
  3690. self._assert_($6);
  3691. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3692. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3693. args: [],
  3694. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  3695. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3696. referencedClasses: []
  3697. }),
  3698. globals.SequenceableCollectionTest);
  3699. smalltalk.addMethod(
  3700. smalltalk.method({
  3701. selector: "testEndsWith",
  3702. protocol: 'tests',
  3703. fn: function (){
  3704. var self=this;
  3705. return smalltalk.withContext(function($ctx1) {
  3706. var $2,$1,$4,$5,$3,$7,$6;
  3707. $2=self._collection();
  3708. $ctx1.sendIdx["collection"]=1;
  3709. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3710. $ctx1.sendIdx["endsWith:"]=1;
  3711. self._assert_($1);
  3712. $ctx1.sendIdx["assert:"]=1;
  3713. $4=self._collection();
  3714. $ctx1.sendIdx["collection"]=2;
  3715. $5=self._collection();
  3716. $ctx1.sendIdx["collection"]=3;
  3717. $3=_st($4)._endsWith_($5);
  3718. $ctx1.sendIdx["endsWith:"]=2;
  3719. self._assert_($3);
  3720. $ctx1.sendIdx["assert:"]=2;
  3721. $7=self._collection();
  3722. $ctx1.sendIdx["collection"]=4;
  3723. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3724. $ctx1.sendIdx["endsWith:"]=3;
  3725. self._assert_($6);
  3726. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3727. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3728. args: [],
  3729. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  3730. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3731. referencedClasses: []
  3732. }),
  3733. globals.SequenceableCollectionTest);
  3734. smalltalk.addMethod(
  3735. smalltalk.method({
  3736. selector: "testFirst",
  3737. protocol: 'tests',
  3738. fn: function (){
  3739. var self=this;
  3740. return smalltalk.withContext(function($ctx1) {
  3741. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3742. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3743. args: [],
  3744. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3745. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3746. referencedClasses: []
  3747. }),
  3748. globals.SequenceableCollectionTest);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "testFirstN",
  3752. protocol: 'tests',
  3753. fn: function (){
  3754. var self=this;
  3755. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3756. return smalltalk.withContext(function($ctx1) {
  3757. var $2,$1,$4,$3,$6,$5,$7;
  3758. $2=self._collection();
  3759. $ctx1.sendIdx["collection"]=1;
  3760. $1=_st($2)._first_((2));
  3761. $ctx1.sendIdx["first:"]=1;
  3762. self._assert_equals_($1,self._collectionFirstTwo());
  3763. $ctx1.sendIdx["assert:equals:"]=1;
  3764. $4=self._collection();
  3765. $ctx1.sendIdx["collection"]=2;
  3766. $3=_st($4)._first_((0));
  3767. $ctx1.sendIdx["first:"]=2;
  3768. self._assert_equals_($3,_st(self._collectionClass())._new());
  3769. $ctx1.sendIdx["assert:equals:"]=2;
  3770. $6=self._collection();
  3771. $ctx1.sendIdx["collection"]=3;
  3772. $5=_st($6)._first_(self._collectionSize());
  3773. $ctx1.sendIdx["first:"]=3;
  3774. $7=self._collection();
  3775. $ctx1.sendIdx["collection"]=4;
  3776. self._assert_equals_($5,$7);
  3777. self._should_raise_((function(){
  3778. return smalltalk.withContext(function($ctx2) {
  3779. return _st(self._collection())._first_((33));
  3780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3781. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3782. args: [],
  3783. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3784. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3785. referencedClasses: ["Error"]
  3786. }),
  3787. globals.SequenceableCollectionTest);
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "testFourth",
  3791. protocol: 'tests',
  3792. fn: function (){
  3793. var self=this;
  3794. return smalltalk.withContext(function($ctx1) {
  3795. var $2,$1;
  3796. $2=self._collection();
  3797. $ctx1.sendIdx["collection"]=1;
  3798. $1=_st($2)._fourth();
  3799. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3800. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3801. args: [],
  3802. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3803. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3804. referencedClasses: []
  3805. }),
  3806. globals.SequenceableCollectionTest);
  3807. smalltalk.addMethod(
  3808. smalltalk.method({
  3809. selector: "testIndexOfStartingAt",
  3810. protocol: 'tests',
  3811. fn: function (){
  3812. var self=this;
  3813. var jsNull;
  3814. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3815. return smalltalk.withContext(function($ctx1) {
  3816. var $2,$1,$4,$3;
  3817. jsNull=_st($JSON())._parse_("null");
  3818. self._samplesDo_((function(index,value){
  3819. return smalltalk.withContext(function($ctx2) {
  3820. $2=self._collection();
  3821. $ctx2.sendIdx["collection"]=1;
  3822. $1=_st($2)._indexOf_startingAt_(value,(1));
  3823. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3824. self._assert_equals_($1,index);
  3825. $ctx2.sendIdx["assert:equals:"]=1;
  3826. $4=self._collection();
  3827. $ctx2.sendIdx["collection"]=2;
  3828. $3=_st($4)._indexOf_startingAt_(value,index);
  3829. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3830. self._assert_equals_($3,index);
  3831. $ctx2.sendIdx["assert:equals:"]=2;
  3832. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3833. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3834. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3835. args: [],
  3836. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  3837. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3838. referencedClasses: ["JSON"]
  3839. }),
  3840. globals.SequenceableCollectionTest);
  3841. smalltalk.addMethod(
  3842. smalltalk.method({
  3843. selector: "testIndexOfStartingAtWithNull",
  3844. protocol: 'tests',
  3845. fn: function (){
  3846. var self=this;
  3847. var jsNull;
  3848. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3849. return smalltalk.withContext(function($ctx1) {
  3850. var $1,$2;
  3851. jsNull=_st($JSON())._parse_("null");
  3852. self._samplesDo_((function(index,value){
  3853. var collection;
  3854. return smalltalk.withContext(function($ctx2) {
  3855. collection=self._collection();
  3856. collection;
  3857. _st(collection)._at_put_(index,jsNull);
  3858. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3859. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3860. self._assert_equals_($1,index);
  3861. $ctx2.sendIdx["assert:equals:"]=1;
  3862. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3863. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3864. self._assert_equals_($2,index);
  3865. $ctx2.sendIdx["assert:equals:"]=2;
  3866. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3867. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3868. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3869. args: [],
  3870. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  3871. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3872. referencedClasses: ["JSON"]
  3873. }),
  3874. globals.SequenceableCollectionTest);
  3875. smalltalk.addMethod(
  3876. smalltalk.method({
  3877. selector: "testLast",
  3878. protocol: 'tests',
  3879. fn: function (){
  3880. var self=this;
  3881. return smalltalk.withContext(function($ctx1) {
  3882. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3883. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3884. args: [],
  3885. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3886. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3887. referencedClasses: []
  3888. }),
  3889. globals.SequenceableCollectionTest);
  3890. smalltalk.addMethod(
  3891. smalltalk.method({
  3892. selector: "testLastN",
  3893. protocol: 'tests',
  3894. fn: function (){
  3895. var self=this;
  3896. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3897. return smalltalk.withContext(function($ctx1) {
  3898. var $2,$1,$4,$3,$6,$5,$7;
  3899. $2=self._collection();
  3900. $ctx1.sendIdx["collection"]=1;
  3901. $1=_st($2)._last_((2));
  3902. $ctx1.sendIdx["last:"]=1;
  3903. self._assert_equals_($1,self._collectionLastTwo());
  3904. $ctx1.sendIdx["assert:equals:"]=1;
  3905. $4=self._collection();
  3906. $ctx1.sendIdx["collection"]=2;
  3907. $3=_st($4)._last_((0));
  3908. $ctx1.sendIdx["last:"]=2;
  3909. self._assert_equals_($3,_st(self._collectionClass())._new());
  3910. $ctx1.sendIdx["assert:equals:"]=2;
  3911. $6=self._collection();
  3912. $ctx1.sendIdx["collection"]=3;
  3913. $5=_st($6)._last_(self._collectionSize());
  3914. $ctx1.sendIdx["last:"]=3;
  3915. $7=self._collection();
  3916. $ctx1.sendIdx["collection"]=4;
  3917. self._assert_equals_($5,$7);
  3918. self._should_raise_((function(){
  3919. return smalltalk.withContext(function($ctx2) {
  3920. return _st(self._collection())._last_((33));
  3921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3922. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3923. args: [],
  3924. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3925. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3926. referencedClasses: ["Error"]
  3927. }),
  3928. globals.SequenceableCollectionTest);
  3929. smalltalk.addMethod(
  3930. smalltalk.method({
  3931. selector: "testSecond",
  3932. protocol: 'tests',
  3933. fn: function (){
  3934. var self=this;
  3935. return smalltalk.withContext(function($ctx1) {
  3936. var $2,$1;
  3937. $2=self._collection();
  3938. $ctx1.sendIdx["collection"]=1;
  3939. $1=_st($2)._second();
  3940. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3941. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3942. args: [],
  3943. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3944. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3945. referencedClasses: []
  3946. }),
  3947. globals.SequenceableCollectionTest);
  3948. smalltalk.addMethod(
  3949. smalltalk.method({
  3950. selector: "testThird",
  3951. protocol: 'tests',
  3952. fn: function (){
  3953. var self=this;
  3954. return smalltalk.withContext(function($ctx1) {
  3955. var $2,$1;
  3956. $2=self._collection();
  3957. $ctx1.sendIdx["collection"]=1;
  3958. $1=_st($2)._third();
  3959. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3960. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3961. args: [],
  3962. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3963. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3964. referencedClasses: []
  3965. }),
  3966. globals.SequenceableCollectionTest);
  3967. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3968. smalltalk.addMethod(
  3969. smalltalk.method({
  3970. selector: "collection",
  3971. protocol: 'fixture',
  3972. fn: function (){
  3973. var self=this;
  3974. var $1;
  3975. $1=[(1), (2), (3), (-4)];
  3976. return $1;
  3977. },
  3978. args: [],
  3979. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3980. messageSends: [],
  3981. referencedClasses: []
  3982. }),
  3983. globals.ArrayTest);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "collectionFirst",
  3987. protocol: 'fixture',
  3988. fn: function (){
  3989. var self=this;
  3990. return (1);
  3991. },
  3992. args: [],
  3993. source: "collectionFirst\x0a\x09^ 1",
  3994. messageSends: [],
  3995. referencedClasses: []
  3996. }),
  3997. globals.ArrayTest);
  3998. smalltalk.addMethod(
  3999. smalltalk.method({
  4000. selector: "collectionFirstTwo",
  4001. protocol: 'fixture',
  4002. fn: function (){
  4003. var self=this;
  4004. var $1;
  4005. $1=[(1), (2)];
  4006. return $1;
  4007. },
  4008. args: [],
  4009. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. globals.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "collectionLast",
  4017. protocol: 'fixture',
  4018. fn: function (){
  4019. var self=this;
  4020. return (-4);
  4021. },
  4022. args: [],
  4023. source: "collectionLast\x0a\x09^ -4",
  4024. messageSends: [],
  4025. referencedClasses: []
  4026. }),
  4027. globals.ArrayTest);
  4028. smalltalk.addMethod(
  4029. smalltalk.method({
  4030. selector: "collectionLastTwo",
  4031. protocol: 'fixture',
  4032. fn: function (){
  4033. var self=this;
  4034. var $1;
  4035. $1=[(3), (-4)];
  4036. return $1;
  4037. },
  4038. args: [],
  4039. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4040. messageSends: [],
  4041. referencedClasses: []
  4042. }),
  4043. globals.ArrayTest);
  4044. smalltalk.addMethod(
  4045. smalltalk.method({
  4046. selector: "collectionOfPrintStrings",
  4047. protocol: 'fixture',
  4048. fn: function (){
  4049. var self=this;
  4050. var $1;
  4051. $1=["1", "2", "3", "-4"];
  4052. return $1;
  4053. },
  4054. args: [],
  4055. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4056. messageSends: [],
  4057. referencedClasses: []
  4058. }),
  4059. globals.ArrayTest);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "collectionSize",
  4063. protocol: 'fixture',
  4064. fn: function (){
  4065. var self=this;
  4066. return (4);
  4067. },
  4068. args: [],
  4069. source: "collectionSize\x0a\x09^ 4",
  4070. messageSends: [],
  4071. referencedClasses: []
  4072. }),
  4073. globals.ArrayTest);
  4074. smalltalk.addMethod(
  4075. smalltalk.method({
  4076. selector: "collectionWithDuplicates",
  4077. protocol: 'fixture',
  4078. fn: function (){
  4079. var self=this;
  4080. var $1;
  4081. $1=["a", "b", "c", (1), (2), (1), "a"];
  4082. return $1;
  4083. },
  4084. args: [],
  4085. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4086. messageSends: [],
  4087. referencedClasses: []
  4088. }),
  4089. globals.ArrayTest);
  4090. smalltalk.addMethod(
  4091. smalltalk.method({
  4092. selector: "collectionWithNewValue",
  4093. protocol: 'fixture',
  4094. fn: function (){
  4095. var self=this;
  4096. var $1;
  4097. $1=[(1), (2), (3), (-4), "N"];
  4098. return $1;
  4099. },
  4100. args: [],
  4101. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4102. messageSends: [],
  4103. referencedClasses: []
  4104. }),
  4105. globals.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "sampleNewIndex",
  4109. protocol: 'fixture',
  4110. fn: function (){
  4111. var self=this;
  4112. return (5);
  4113. },
  4114. args: [],
  4115. source: "sampleNewIndex\x0a\x09^ 5",
  4116. messageSends: [],
  4117. referencedClasses: []
  4118. }),
  4119. globals.ArrayTest);
  4120. smalltalk.addMethod(
  4121. smalltalk.method({
  4122. selector: "samplesDo:",
  4123. protocol: 'fixture',
  4124. fn: function (aBlock){
  4125. var self=this;
  4126. return smalltalk.withContext(function($ctx1) {
  4127. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4128. $ctx1.supercall = false;
  4129. _st(aBlock)._value_value_((3),(3));
  4130. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4131. args: ["aBlock"],
  4132. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4133. messageSends: ["samplesDo:", "value:value:"],
  4134. referencedClasses: []
  4135. }),
  4136. globals.ArrayTest);
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "testAdd",
  4140. protocol: 'tests',
  4141. fn: function (){
  4142. var self=this;
  4143. var array;
  4144. return smalltalk.withContext(function($ctx1) {
  4145. array=self._collection();
  4146. _st(array)._add_((6));
  4147. self._assert_equals_(_st(array)._last(),(6));
  4148. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4149. args: [],
  4150. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4151. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4152. referencedClasses: []
  4153. }),
  4154. globals.ArrayTest);
  4155. smalltalk.addMethod(
  4156. smalltalk.method({
  4157. selector: "testAddFirst",
  4158. protocol: 'tests',
  4159. fn: function (){
  4160. var self=this;
  4161. return smalltalk.withContext(function($ctx1) {
  4162. var $1,$2;
  4163. $1=self._collection();
  4164. _st($1)._addFirst_((0));
  4165. $2=_st($1)._yourself();
  4166. self._assert_equals_(_st($2)._first(),(0));
  4167. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4168. args: [],
  4169. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4170. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4171. referencedClasses: []
  4172. }),
  4173. globals.ArrayTest);
  4174. smalltalk.addMethod(
  4175. smalltalk.method({
  4176. selector: "testPrintString",
  4177. protocol: 'tests',
  4178. fn: function (){
  4179. var self=this;
  4180. var array;
  4181. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4182. return smalltalk.withContext(function($ctx1) {
  4183. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4184. array=_st($Array())._new();
  4185. $1=_st(array)._printString();
  4186. $ctx1.sendIdx["printString"]=1;
  4187. self._assert_equals_($1,"an Array ()");
  4188. $ctx1.sendIdx["assert:equals:"]=1;
  4189. $2=array;
  4190. _st($2)._add_((1));
  4191. $ctx1.sendIdx["add:"]=1;
  4192. $3=_st($2)._add_((3));
  4193. $ctx1.sendIdx["add:"]=2;
  4194. $4=_st(array)._printString();
  4195. $ctx1.sendIdx["printString"]=2;
  4196. self._assert_equals_($4,"an Array (1 3)");
  4197. $ctx1.sendIdx["assert:equals:"]=2;
  4198. _st(array)._add_("foo");
  4199. $5=_st(array)._printString();
  4200. $ctx1.sendIdx["printString"]=3;
  4201. self._assert_equals_($5,"an Array (1 3 'foo')");
  4202. $ctx1.sendIdx["assert:equals:"]=3;
  4203. $6=array;
  4204. _st($6)._remove_((1));
  4205. $ctx1.sendIdx["remove:"]=1;
  4206. $7=_st($6)._remove_((3));
  4207. $8=_st(array)._printString();
  4208. $ctx1.sendIdx["printString"]=4;
  4209. self._assert_equals_($8,"an Array ('foo')");
  4210. $ctx1.sendIdx["assert:equals:"]=4;
  4211. _st(array)._addLast_((3));
  4212. $ctx1.sendIdx["addLast:"]=1;
  4213. $9=_st(array)._printString();
  4214. $ctx1.sendIdx["printString"]=5;
  4215. self._assert_equals_($9,"an Array ('foo' 3)");
  4216. $ctx1.sendIdx["assert:equals:"]=5;
  4217. _st(array)._addLast_((3));
  4218. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4219. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4220. args: [],
  4221. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  4222. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4223. referencedClasses: ["Array"]
  4224. }),
  4225. globals.ArrayTest);
  4226. smalltalk.addMethod(
  4227. smalltalk.method({
  4228. selector: "testRemove",
  4229. protocol: 'tests',
  4230. fn: function (){
  4231. var self=this;
  4232. var array;
  4233. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4234. return smalltalk.withContext(function($ctx1) {
  4235. array=[(1), (2), (3), (4), (5)];
  4236. _st(array)._remove_((3));
  4237. $ctx1.sendIdx["remove:"]=1;
  4238. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4239. self._should_raise_((function(){
  4240. return smalltalk.withContext(function($ctx2) {
  4241. return _st(array)._remove_((3));
  4242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4243. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4244. args: [],
  4245. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  4246. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4247. referencedClasses: ["Error"]
  4248. }),
  4249. globals.ArrayTest);
  4250. smalltalk.addMethod(
  4251. smalltalk.method({
  4252. selector: "testRemoveFromTo",
  4253. protocol: 'tests',
  4254. fn: function (){
  4255. var self=this;
  4256. return smalltalk.withContext(function($ctx1) {
  4257. var $1,$2;
  4258. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4259. $ctx1.sendIdx["removeFrom:to:"]=1;
  4260. self._assert_equals_($1,[(4)]);
  4261. $ctx1.sendIdx["assert:equals:"]=1;
  4262. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4263. $ctx1.sendIdx["removeFrom:to:"]=2;
  4264. self._assert_equals_($2,[(1), (4)]);
  4265. $ctx1.sendIdx["assert:equals:"]=2;
  4266. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4267. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4268. args: [],
  4269. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  4270. messageSends: ["assert:equals:", "removeFrom:to:"],
  4271. referencedClasses: []
  4272. }),
  4273. globals.ArrayTest);
  4274. smalltalk.addMethod(
  4275. smalltalk.method({
  4276. selector: "testRemoveIndex",
  4277. protocol: 'tests',
  4278. fn: function (){
  4279. var self=this;
  4280. return smalltalk.withContext(function($ctx1) {
  4281. var $1,$2;
  4282. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4283. $ctx1.sendIdx["removeIndex:"]=1;
  4284. self._assert_equals_($1,[(1), (3), (4)]);
  4285. $ctx1.sendIdx["assert:equals:"]=1;
  4286. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4287. $ctx1.sendIdx["removeIndex:"]=2;
  4288. self._assert_equals_($2,[(2), (3), (4)]);
  4289. $ctx1.sendIdx["assert:equals:"]=2;
  4290. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4291. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4292. args: [],
  4293. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  4294. messageSends: ["assert:equals:", "removeIndex:"],
  4295. referencedClasses: []
  4296. }),
  4297. globals.ArrayTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "testRemoveLast",
  4301. protocol: 'tests',
  4302. fn: function (){
  4303. var self=this;
  4304. var array;
  4305. return smalltalk.withContext(function($ctx1) {
  4306. array=[(1), (2)];
  4307. _st(array)._removeLast();
  4308. self._assert_equals_(_st(array)._last(),(1));
  4309. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4310. args: [],
  4311. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4312. messageSends: ["removeLast", "assert:equals:", "last"],
  4313. referencedClasses: []
  4314. }),
  4315. globals.ArrayTest);
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "testReversed",
  4319. protocol: 'tests',
  4320. fn: function (){
  4321. var self=this;
  4322. var array;
  4323. return smalltalk.withContext(function($ctx1) {
  4324. array=[(5), (4), (3), (2), (1)];
  4325. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4326. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4327. args: [],
  4328. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4329. messageSends: ["assert:equals:", "reversed"],
  4330. referencedClasses: []
  4331. }),
  4332. globals.ArrayTest);
  4333. smalltalk.addMethod(
  4334. smalltalk.method({
  4335. selector: "testSort",
  4336. protocol: 'tests',
  4337. fn: function (){
  4338. var self=this;
  4339. var array;
  4340. return smalltalk.withContext(function($ctx1) {
  4341. array=[(10), (1), (5)];
  4342. _st(array)._sort();
  4343. self._assert_equals_(array,[(1), (5), (10)]);
  4344. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4345. args: [],
  4346. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4347. messageSends: ["sort", "assert:equals:"],
  4348. referencedClasses: []
  4349. }),
  4350. globals.ArrayTest);
  4351. smalltalk.addMethod(
  4352. smalltalk.method({
  4353. selector: "collectionClass",
  4354. protocol: 'fixture',
  4355. fn: function (){
  4356. var self=this;
  4357. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4358. return $Array();
  4359. },
  4360. args: [],
  4361. source: "collectionClass\x0a\x09^ Array",
  4362. messageSends: [],
  4363. referencedClasses: ["Array"]
  4364. }),
  4365. globals.ArrayTest.klass);
  4366. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4367. smalltalk.addMethod(
  4368. smalltalk.method({
  4369. selector: "collection",
  4370. protocol: 'fixture',
  4371. fn: function (){
  4372. var self=this;
  4373. return "helLo";
  4374. },
  4375. args: [],
  4376. source: "collection\x0a\x09^ 'helLo'",
  4377. messageSends: [],
  4378. referencedClasses: []
  4379. }),
  4380. globals.StringTest);
  4381. smalltalk.addMethod(
  4382. smalltalk.method({
  4383. selector: "collectionFirst",
  4384. protocol: 'fixture',
  4385. fn: function (){
  4386. var self=this;
  4387. return "h";
  4388. },
  4389. args: [],
  4390. source: "collectionFirst\x0a\x09^ 'h'",
  4391. messageSends: [],
  4392. referencedClasses: []
  4393. }),
  4394. globals.StringTest);
  4395. smalltalk.addMethod(
  4396. smalltalk.method({
  4397. selector: "collectionFirstTwo",
  4398. protocol: 'fixture',
  4399. fn: function (){
  4400. var self=this;
  4401. return "he";
  4402. },
  4403. args: [],
  4404. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4405. messageSends: [],
  4406. referencedClasses: []
  4407. }),
  4408. globals.StringTest);
  4409. smalltalk.addMethod(
  4410. smalltalk.method({
  4411. selector: "collectionLast",
  4412. protocol: 'fixture',
  4413. fn: function (){
  4414. var self=this;
  4415. return "o";
  4416. },
  4417. args: [],
  4418. source: "collectionLast\x0a\x09^ 'o'",
  4419. messageSends: [],
  4420. referencedClasses: []
  4421. }),
  4422. globals.StringTest);
  4423. smalltalk.addMethod(
  4424. smalltalk.method({
  4425. selector: "collectionLastTwo",
  4426. protocol: 'fixture',
  4427. fn: function (){
  4428. var self=this;
  4429. return "Lo";
  4430. },
  4431. args: [],
  4432. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4433. messageSends: [],
  4434. referencedClasses: []
  4435. }),
  4436. globals.StringTest);
  4437. smalltalk.addMethod(
  4438. smalltalk.method({
  4439. selector: "collectionOfPrintStrings",
  4440. protocol: 'fixture',
  4441. fn: function (){
  4442. var self=this;
  4443. return "'h''e''l''L''o'";
  4444. },
  4445. args: [],
  4446. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4447. messageSends: [],
  4448. referencedClasses: []
  4449. }),
  4450. globals.StringTest);
  4451. smalltalk.addMethod(
  4452. smalltalk.method({
  4453. selector: "collectionSize",
  4454. protocol: 'fixture',
  4455. fn: function (){
  4456. var self=this;
  4457. return (5);
  4458. },
  4459. args: [],
  4460. source: "collectionSize\x0a\x09^ 5",
  4461. messageSends: [],
  4462. referencedClasses: []
  4463. }),
  4464. globals.StringTest);
  4465. smalltalk.addMethod(
  4466. smalltalk.method({
  4467. selector: "collectionWithDuplicates",
  4468. protocol: 'fixture',
  4469. fn: function (){
  4470. var self=this;
  4471. return "abbaerte";
  4472. },
  4473. args: [],
  4474. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4475. messageSends: [],
  4476. referencedClasses: []
  4477. }),
  4478. globals.StringTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "collectionWithNewValue",
  4482. protocol: 'fixture',
  4483. fn: function (){
  4484. var self=this;
  4485. return "helLoN";
  4486. },
  4487. args: [],
  4488. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4489. messageSends: [],
  4490. referencedClasses: []
  4491. }),
  4492. globals.StringTest);
  4493. smalltalk.addMethod(
  4494. smalltalk.method({
  4495. selector: "sampleNewValueAsCollection",
  4496. protocol: 'fixture',
  4497. fn: function (){
  4498. var self=this;
  4499. return "N";
  4500. },
  4501. args: [],
  4502. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4503. messageSends: [],
  4504. referencedClasses: []
  4505. }),
  4506. globals.StringTest);
  4507. smalltalk.addMethod(
  4508. smalltalk.method({
  4509. selector: "samplesDo:",
  4510. protocol: 'fixture',
  4511. fn: function (aBlock){
  4512. var self=this;
  4513. return smalltalk.withContext(function($ctx1) {
  4514. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4515. $ctx1.supercall = false;
  4516. _st(aBlock)._value_value_((3),"l");
  4517. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4518. args: ["aBlock"],
  4519. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4520. messageSends: ["samplesDo:", "value:value:"],
  4521. referencedClasses: []
  4522. }),
  4523. globals.StringTest);
  4524. smalltalk.addMethod(
  4525. smalltalk.method({
  4526. selector: "testAddAll",
  4527. protocol: 'tests',
  4528. fn: function (){
  4529. var self=this;
  4530. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4531. return smalltalk.withContext(function($ctx1) {
  4532. var $1;
  4533. self._should_raise_((function(){
  4534. return smalltalk.withContext(function($ctx2) {
  4535. $1=self._collection();
  4536. $ctx2.sendIdx["collection"]=1;
  4537. return _st($1)._addAll_(self._collection());
  4538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4539. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4540. args: [],
  4541. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4542. messageSends: ["should:raise:", "addAll:", "collection"],
  4543. referencedClasses: ["Error"]
  4544. }),
  4545. globals.StringTest);
  4546. smalltalk.addMethod(
  4547. smalltalk.method({
  4548. selector: "testAddRemove",
  4549. protocol: 'tests',
  4550. fn: function (){
  4551. var self=this;
  4552. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4553. return smalltalk.withContext(function($ctx1) {
  4554. self._should_raise_((function(){
  4555. return smalltalk.withContext(function($ctx2) {
  4556. return "hello"._add_("a");
  4557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4558. $ctx1.sendIdx["should:raise:"]=1;
  4559. self._should_raise_((function(){
  4560. return smalltalk.withContext(function($ctx2) {
  4561. return "hello"._remove_("h");
  4562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4563. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4564. args: [],
  4565. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4566. messageSends: ["should:raise:", "add:", "remove:"],
  4567. referencedClasses: ["Error"]
  4568. }),
  4569. globals.StringTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testAsArray",
  4573. protocol: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. return smalltalk.withContext(function($ctx1) {
  4577. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4578. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4579. args: [],
  4580. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4581. messageSends: ["assert:equals:", "asArray"],
  4582. referencedClasses: []
  4583. }),
  4584. globals.StringTest);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "testAsLowerCase",
  4588. protocol: 'tests',
  4589. fn: function (){
  4590. var self=this;
  4591. return smalltalk.withContext(function($ctx1) {
  4592. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4593. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4594. args: [],
  4595. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4596. messageSends: ["assert:equals:", "asLowercase"],
  4597. referencedClasses: []
  4598. }),
  4599. globals.StringTest);
  4600. smalltalk.addMethod(
  4601. smalltalk.method({
  4602. selector: "testAsNumber",
  4603. protocol: 'tests',
  4604. fn: function (){
  4605. var self=this;
  4606. return smalltalk.withContext(function($ctx1) {
  4607. var $1,$2;
  4608. $1="3"._asNumber();
  4609. $ctx1.sendIdx["asNumber"]=1;
  4610. self._assert_equals_($1,(3));
  4611. $ctx1.sendIdx["assert:equals:"]=1;
  4612. $2="-3"._asNumber();
  4613. $ctx1.sendIdx["asNumber"]=2;
  4614. self._assert_equals_($2,(-3));
  4615. $ctx1.sendIdx["assert:equals:"]=2;
  4616. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4617. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4618. args: [],
  4619. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  4620. messageSends: ["assert:equals:", "asNumber"],
  4621. referencedClasses: []
  4622. }),
  4623. globals.StringTest);
  4624. smalltalk.addMethod(
  4625. smalltalk.method({
  4626. selector: "testAsUpperCase",
  4627. protocol: 'tests',
  4628. fn: function (){
  4629. var self=this;
  4630. return smalltalk.withContext(function($ctx1) {
  4631. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4632. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4633. args: [],
  4634. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4635. messageSends: ["assert:equals:", "asUppercase"],
  4636. referencedClasses: []
  4637. }),
  4638. globals.StringTest);
  4639. smalltalk.addMethod(
  4640. smalltalk.method({
  4641. selector: "testAsciiValue",
  4642. protocol: 'tests',
  4643. fn: function (){
  4644. var self=this;
  4645. var characterA,characterU;
  4646. return smalltalk.withContext(function($ctx1) {
  4647. var $1;
  4648. characterA="A";
  4649. characterU="U";
  4650. $1=_st(characterA)._asciiValue();
  4651. $ctx1.sendIdx["asciiValue"]=1;
  4652. self._assert_equals_($1,(65));
  4653. $ctx1.sendIdx["assert:equals:"]=1;
  4654. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4655. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4656. args: [],
  4657. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  4658. messageSends: ["assert:equals:", "asciiValue"],
  4659. referencedClasses: []
  4660. }),
  4661. globals.StringTest);
  4662. smalltalk.addMethod(
  4663. smalltalk.method({
  4664. selector: "testAtIfAbsentPut",
  4665. protocol: 'tests',
  4666. fn: function (){
  4667. var self=this;
  4668. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4669. return smalltalk.withContext(function($ctx1) {
  4670. self._should_raise_((function(){
  4671. return smalltalk.withContext(function($ctx2) {
  4672. return "hello"._at_ifAbsentPut_((6),(function(){
  4673. return "a";
  4674. }));
  4675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4676. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4677. args: [],
  4678. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4679. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4680. referencedClasses: ["Error"]
  4681. }),
  4682. globals.StringTest);
  4683. smalltalk.addMethod(
  4684. smalltalk.method({
  4685. selector: "testAtPut",
  4686. protocol: 'tests',
  4687. fn: function (){
  4688. var self=this;
  4689. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4690. return smalltalk.withContext(function($ctx1) {
  4691. self._should_raise_((function(){
  4692. return smalltalk.withContext(function($ctx2) {
  4693. return "hello"._at_put_((1),"a");
  4694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4695. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4696. args: [],
  4697. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4698. messageSends: ["should:raise:", "at:put:"],
  4699. referencedClasses: ["Error"]
  4700. }),
  4701. globals.StringTest);
  4702. smalltalk.addMethod(
  4703. smalltalk.method({
  4704. selector: "testCapitalized",
  4705. protocol: 'tests',
  4706. fn: function (){
  4707. var self=this;
  4708. return smalltalk.withContext(function($ctx1) {
  4709. var $1,$2,$3;
  4710. $1="test"._capitalized();
  4711. $ctx1.sendIdx["capitalized"]=1;
  4712. self._assert_equals_($1,"Test");
  4713. $ctx1.sendIdx["assert:equals:"]=1;
  4714. $2="Test"._capitalized();
  4715. $ctx1.sendIdx["capitalized"]=2;
  4716. self._assert_equals_($2,"Test");
  4717. $ctx1.sendIdx["assert:equals:"]=2;
  4718. self._assert_equals_(""._capitalized(),"");
  4719. $ctx1.sendIdx["assert:equals:"]=3;
  4720. $3="Test"._isCapitalized();
  4721. $ctx1.sendIdx["isCapitalized"]=1;
  4722. self._assert_equals_($3,true);
  4723. $ctx1.sendIdx["assert:equals:"]=4;
  4724. self._assert_equals_("test"._isCapitalized(),false);
  4725. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4726. args: [],
  4727. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  4728. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4729. referencedClasses: []
  4730. }),
  4731. globals.StringTest);
  4732. smalltalk.addMethod(
  4733. smalltalk.method({
  4734. selector: "testCharCodeAt",
  4735. protocol: 'tests',
  4736. fn: function (){
  4737. var self=this;
  4738. return smalltalk.withContext(function($ctx1) {
  4739. var $1,$2,$3,$4,$5;
  4740. $1="jackie"._charCodeAt_((1));
  4741. $ctx1.sendIdx["charCodeAt:"]=1;
  4742. self._assert_equals_($1,(106));
  4743. $ctx1.sendIdx["assert:equals:"]=1;
  4744. $2="jackie"._charCodeAt_((2));
  4745. $ctx1.sendIdx["charCodeAt:"]=2;
  4746. self._assert_equals_($2,(97));
  4747. $ctx1.sendIdx["assert:equals:"]=2;
  4748. $3="jackie"._charCodeAt_((3));
  4749. $ctx1.sendIdx["charCodeAt:"]=3;
  4750. self._assert_equals_($3,(99));
  4751. $ctx1.sendIdx["assert:equals:"]=3;
  4752. $4="jackie"._charCodeAt_((4));
  4753. $ctx1.sendIdx["charCodeAt:"]=4;
  4754. self._assert_equals_($4,(107));
  4755. $ctx1.sendIdx["assert:equals:"]=4;
  4756. $5="jackie"._charCodeAt_((5));
  4757. $ctx1.sendIdx["charCodeAt:"]=5;
  4758. self._assert_equals_($5,(105));
  4759. $ctx1.sendIdx["assert:equals:"]=5;
  4760. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4761. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4762. args: [],
  4763. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  4764. messageSends: ["assert:equals:", "charCodeAt:"],
  4765. referencedClasses: []
  4766. }),
  4767. globals.StringTest);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "testCopyFromTo",
  4771. protocol: 'tests',
  4772. fn: function (){
  4773. var self=this;
  4774. return smalltalk.withContext(function($ctx1) {
  4775. var $1;
  4776. $1="jackie"._copyFrom_to_((1),(3));
  4777. $ctx1.sendIdx["copyFrom:to:"]=1;
  4778. self._assert_equals_($1,"jac");
  4779. $ctx1.sendIdx["assert:equals:"]=1;
  4780. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4781. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4782. args: [],
  4783. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4784. messageSends: ["assert:equals:", "copyFrom:to:"],
  4785. referencedClasses: []
  4786. }),
  4787. globals.StringTest);
  4788. smalltalk.addMethod(
  4789. smalltalk.method({
  4790. selector: "testCopyWithoutAll",
  4791. protocol: 'tests',
  4792. fn: function (){
  4793. var self=this;
  4794. return smalltalk.withContext(function($ctx1) {
  4795. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4796. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4797. args: [],
  4798. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4799. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4800. referencedClasses: []
  4801. }),
  4802. globals.StringTest);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "testEquality",
  4806. protocol: 'tests',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. var $1,$2,$3;
  4811. self._assert_equals_("hello","hello");
  4812. $ctx1.sendIdx["assert:equals:"]=1;
  4813. $1="hello".__eq("world");
  4814. $ctx1.sendIdx["="]=1;
  4815. self._deny_($1);
  4816. $ctx1.sendIdx["deny:"]=1;
  4817. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4818. })));
  4819. $ctx1.sendIdx["="]=2;
  4820. self._deny_($2);
  4821. $ctx1.sendIdx["deny:"]=2;
  4822. $3="hello"._yourself();
  4823. $ctx1.sendIdx["yourself"]=1;
  4824. self._assert_equals_("hello",$3);
  4825. $ctx1.sendIdx["assert:equals:"]=2;
  4826. self._assert_equals_("hello"._yourself(),"hello");
  4827. self._deny_("".__eq((0)));
  4828. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4829. args: [],
  4830. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  4831. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4832. referencedClasses: []
  4833. }),
  4834. globals.StringTest);
  4835. smalltalk.addMethod(
  4836. smalltalk.method({
  4837. selector: "testIdentity",
  4838. protocol: 'tests',
  4839. fn: function (){
  4840. var self=this;
  4841. return smalltalk.withContext(function($ctx1) {
  4842. var $1,$2,$4,$3,$5;
  4843. $1="hello".__eq_eq("hello");
  4844. $ctx1.sendIdx["=="]=1;
  4845. self._assert_($1);
  4846. $ctx1.sendIdx["assert:"]=1;
  4847. $2="hello".__eq_eq("world");
  4848. $ctx1.sendIdx["=="]=2;
  4849. self._deny_($2);
  4850. $ctx1.sendIdx["deny:"]=1;
  4851. $4="hello"._yourself();
  4852. $ctx1.sendIdx["yourself"]=1;
  4853. $3="hello".__eq_eq($4);
  4854. $ctx1.sendIdx["=="]=3;
  4855. self._assert_($3);
  4856. $ctx1.sendIdx["assert:"]=2;
  4857. $5=_st("hello"._yourself()).__eq_eq("hello");
  4858. $ctx1.sendIdx["=="]=4;
  4859. self._assert_($5);
  4860. self._deny_("".__eq_eq((0)));
  4861. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4862. args: [],
  4863. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  4864. messageSends: ["assert:", "==", "deny:", "yourself"],
  4865. referencedClasses: []
  4866. }),
  4867. globals.StringTest);
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "testIdentityHash",
  4871. protocol: 'tests',
  4872. fn: function (){
  4873. var self=this;
  4874. return smalltalk.withContext(function($ctx1) {
  4875. var $1,$2,$4,$3;
  4876. $1="foo"._identityHash();
  4877. $ctx1.sendIdx["identityHash"]=1;
  4878. $2="foo"._identityHash();
  4879. $ctx1.sendIdx["identityHash"]=2;
  4880. self._assert_equals_($1,$2);
  4881. $4="foo"._identityHash();
  4882. $ctx1.sendIdx["identityHash"]=3;
  4883. $3=_st($4).__eq("bar"._identityHash());
  4884. self._deny_($3);
  4885. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4886. args: [],
  4887. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4888. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4889. referencedClasses: []
  4890. }),
  4891. globals.StringTest);
  4892. smalltalk.addMethod(
  4893. smalltalk.method({
  4894. selector: "testIncludesSubString",
  4895. protocol: 'tests',
  4896. fn: function (){
  4897. var self=this;
  4898. return smalltalk.withContext(function($ctx1) {
  4899. var $1;
  4900. $1="amber"._includesSubString_("ber");
  4901. $ctx1.sendIdx["includesSubString:"]=1;
  4902. self._assert_($1);
  4903. self._deny_("amber"._includesSubString_("zork"));
  4904. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4905. args: [],
  4906. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4907. messageSends: ["assert:", "includesSubString:", "deny:"],
  4908. referencedClasses: []
  4909. }),
  4910. globals.StringTest);
  4911. smalltalk.addMethod(
  4912. smalltalk.method({
  4913. selector: "testIndexOfStartingAtWithNull",
  4914. protocol: 'tests',
  4915. fn: function (){
  4916. var self=this;
  4917. return self},
  4918. args: [],
  4919. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4920. messageSends: [],
  4921. referencedClasses: []
  4922. }),
  4923. globals.StringTest);
  4924. smalltalk.addMethod(
  4925. smalltalk.method({
  4926. selector: "testIndexOfWithNull",
  4927. protocol: 'tests',
  4928. fn: function (){
  4929. var self=this;
  4930. return self},
  4931. args: [],
  4932. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4933. messageSends: [],
  4934. referencedClasses: []
  4935. }),
  4936. globals.StringTest);
  4937. smalltalk.addMethod(
  4938. smalltalk.method({
  4939. selector: "testIsVowel",
  4940. protocol: 'tests',
  4941. fn: function (){
  4942. var self=this;
  4943. var vowel,consonant;
  4944. return smalltalk.withContext(function($ctx1) {
  4945. var $1;
  4946. vowel="u";
  4947. consonant="z";
  4948. $1=_st(vowel)._isVowel();
  4949. $ctx1.sendIdx["isVowel"]=1;
  4950. self._assert_equals_($1,true);
  4951. $ctx1.sendIdx["assert:equals:"]=1;
  4952. self._assert_equals_(_st(consonant)._isVowel(),false);
  4953. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4954. args: [],
  4955. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  4956. messageSends: ["assert:equals:", "isVowel"],
  4957. referencedClasses: []
  4958. }),
  4959. globals.StringTest);
  4960. smalltalk.addMethod(
  4961. smalltalk.method({
  4962. selector: "testJoin",
  4963. protocol: 'tests',
  4964. fn: function (){
  4965. var self=this;
  4966. return smalltalk.withContext(function($ctx1) {
  4967. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4968. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4969. args: [],
  4970. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4971. messageSends: ["assert:equals:", "join:"],
  4972. referencedClasses: []
  4973. }),
  4974. globals.StringTest);
  4975. smalltalk.addMethod(
  4976. smalltalk.method({
  4977. selector: "testRemoveAll",
  4978. protocol: 'tests',
  4979. fn: function (){
  4980. var self=this;
  4981. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4982. return smalltalk.withContext(function($ctx1) {
  4983. self._should_raise_((function(){
  4984. return smalltalk.withContext(function($ctx2) {
  4985. return _st(self._collection())._removeAll();
  4986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4987. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4988. args: [],
  4989. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4990. messageSends: ["should:raise:", "removeAll", "collection"],
  4991. referencedClasses: ["Error"]
  4992. }),
  4993. globals.StringTest);
  4994. smalltalk.addMethod(
  4995. smalltalk.method({
  4996. selector: "testReversed",
  4997. protocol: 'tests',
  4998. fn: function (){
  4999. var self=this;
  5000. return smalltalk.withContext(function($ctx1) {
  5001. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5002. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  5003. args: [],
  5004. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5005. messageSends: ["assert:equals:", "reversed"],
  5006. referencedClasses: []
  5007. }),
  5008. globals.StringTest);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "testStreamContents",
  5012. protocol: 'tests',
  5013. fn: function (){
  5014. var self=this;
  5015. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5016. return smalltalk.withContext(function($ctx1) {
  5017. var $1;
  5018. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5019. return smalltalk.withContext(function($ctx2) {
  5020. _st(aStream)._nextPutAll_("hello");
  5021. $ctx2.sendIdx["nextPutAll:"]=1;
  5022. _st(aStream)._space();
  5023. $1=_st(aStream)._nextPutAll_("world");
  5024. return $1;
  5025. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5026. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  5027. args: [],
  5028. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  5029. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5030. referencedClasses: ["String"]
  5031. }),
  5032. globals.StringTest);
  5033. smalltalk.addMethod(
  5034. smalltalk.method({
  5035. selector: "testSubStrings",
  5036. protocol: 'tests',
  5037. fn: function (){
  5038. var self=this;
  5039. return smalltalk.withContext(function($ctx1) {
  5040. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5041. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  5042. args: [],
  5043. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5044. messageSends: ["assert:equals:", "subStrings:"],
  5045. referencedClasses: []
  5046. }),
  5047. globals.StringTest);
  5048. smalltalk.addMethod(
  5049. smalltalk.method({
  5050. selector: "testTrim",
  5051. protocol: 'tests',
  5052. fn: function (){
  5053. var self=this;
  5054. return smalltalk.withContext(function($ctx1) {
  5055. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5056. $ctx1.sendIdx["assert:equals:"]=1;
  5057. self._assert_equals_("jackie "._trimRight(),"jackie");
  5058. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5059. args: [],
  5060. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5061. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5062. referencedClasses: []
  5063. }),
  5064. globals.StringTest);
  5065. smalltalk.addMethod(
  5066. smalltalk.method({
  5067. selector: "testValue",
  5068. protocol: 'tests',
  5069. fn: function (){
  5070. var self=this;
  5071. return smalltalk.withContext(function($ctx1) {
  5072. self._assert_equals_("asString"._value_((1)),"1");
  5073. $ctx1.sendIdx["assert:equals:"]=1;
  5074. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5075. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  5076. args: [],
  5077. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  5078. messageSends: ["assert:equals:", "value:", "collect:"],
  5079. referencedClasses: []
  5080. }),
  5081. globals.StringTest);
  5082. smalltalk.addMethod(
  5083. smalltalk.method({
  5084. selector: "collectionClass",
  5085. protocol: 'fixture',
  5086. fn: function (){
  5087. var self=this;
  5088. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5089. return $String();
  5090. },
  5091. args: [],
  5092. source: "collectionClass\x0a\x09^ String",
  5093. messageSends: [],
  5094. referencedClasses: ["String"]
  5095. }),
  5096. globals.StringTest.klass);
  5097. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5098. smalltalk.addMethod(
  5099. smalltalk.method({
  5100. selector: "collection",
  5101. protocol: 'fixture',
  5102. fn: function (){
  5103. var self=this;
  5104. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5105. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5106. return smalltalk.withContext(function($ctx1) {
  5107. var $2,$3,$1;
  5108. $2=_st($Set())._new();
  5109. _st($2)._add_($Smalltalk());
  5110. $ctx1.sendIdx["add:"]=1;
  5111. _st($2)._add_(nil);
  5112. $ctx1.sendIdx["add:"]=2;
  5113. _st($2)._add_((3).__at((3)));
  5114. $ctx1.sendIdx["add:"]=3;
  5115. _st($2)._add_(false);
  5116. $3=_st($2)._yourself();
  5117. $1=$3;
  5118. return $1;
  5119. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5120. args: [],
  5121. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5122. messageSends: ["add:", "new", "@", "yourself"],
  5123. referencedClasses: ["Set", "Smalltalk"]
  5124. }),
  5125. globals.SetTest);
  5126. smalltalk.addMethod(
  5127. smalltalk.method({
  5128. selector: "collectionOfPrintStrings",
  5129. protocol: 'fixture',
  5130. fn: function (){
  5131. var self=this;
  5132. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5133. return smalltalk.withContext(function($ctx1) {
  5134. var $2,$3,$1;
  5135. $2=_st($Set())._new();
  5136. _st($2)._add_("a SmalltalkImage");
  5137. $ctx1.sendIdx["add:"]=1;
  5138. _st($2)._add_("nil");
  5139. $ctx1.sendIdx["add:"]=2;
  5140. _st($2)._add_("3@3");
  5141. $ctx1.sendIdx["add:"]=3;
  5142. _st($2)._add_("false");
  5143. $3=_st($2)._yourself();
  5144. $1=$3;
  5145. return $1;
  5146. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5147. args: [],
  5148. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5149. messageSends: ["add:", "new", "yourself"],
  5150. referencedClasses: ["Set"]
  5151. }),
  5152. globals.SetTest);
  5153. smalltalk.addMethod(
  5154. smalltalk.method({
  5155. selector: "collectionSize",
  5156. protocol: 'fixture',
  5157. fn: function (){
  5158. var self=this;
  5159. return (4);
  5160. },
  5161. args: [],
  5162. source: "collectionSize\x0a\x09^ 4",
  5163. messageSends: [],
  5164. referencedClasses: []
  5165. }),
  5166. globals.SetTest);
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "collectionWithDuplicates",
  5170. protocol: 'fixture',
  5171. fn: function (){
  5172. var self=this;
  5173. return smalltalk.withContext(function($ctx1) {
  5174. var $2,$3,$1;
  5175. $2=self._collection();
  5176. _st($2)._add_((0));
  5177. $3=_st($2)._yourself();
  5178. $1=$3;
  5179. return $1;
  5180. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5181. args: [],
  5182. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5183. messageSends: ["add:", "collection", "yourself"],
  5184. referencedClasses: []
  5185. }),
  5186. globals.SetTest);
  5187. smalltalk.addMethod(
  5188. smalltalk.method({
  5189. selector: "collectionWithNewValue",
  5190. protocol: 'fixture',
  5191. fn: function (){
  5192. var self=this;
  5193. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5194. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5195. return smalltalk.withContext(function($ctx1) {
  5196. var $2,$3,$1;
  5197. $2=_st($Set())._new();
  5198. _st($2)._add_($Smalltalk());
  5199. $ctx1.sendIdx["add:"]=1;
  5200. _st($2)._add_(nil);
  5201. $ctx1.sendIdx["add:"]=2;
  5202. _st($2)._add_((3).__at((3)));
  5203. $ctx1.sendIdx["add:"]=3;
  5204. _st($2)._add_("N");
  5205. $ctx1.sendIdx["add:"]=4;
  5206. _st($2)._add_(false);
  5207. $3=_st($2)._yourself();
  5208. $1=$3;
  5209. return $1;
  5210. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5211. args: [],
  5212. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5213. messageSends: ["add:", "new", "@", "yourself"],
  5214. referencedClasses: ["Set", "Smalltalk"]
  5215. }),
  5216. globals.SetTest);
  5217. smalltalk.addMethod(
  5218. smalltalk.method({
  5219. selector: "testAddAll",
  5220. protocol: 'tests',
  5221. fn: function (){
  5222. var self=this;
  5223. return smalltalk.withContext(function($ctx1) {
  5224. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5225. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5226. $ctx1.supercall = false;
  5227. $2=self._collection();
  5228. $ctx1.sendIdx["collection"]=1;
  5229. $3=$2;
  5230. $4=self._collection();
  5231. $ctx1.sendIdx["collection"]=2;
  5232. _st($3)._addAll_($4);
  5233. $ctx1.sendIdx["addAll:"]=1;
  5234. $5=_st($2)._yourself();
  5235. $ctx1.sendIdx["yourself"]=1;
  5236. $1=$5;
  5237. $6=self._collection();
  5238. $ctx1.sendIdx["collection"]=3;
  5239. self._assert_equals_($1,$6);
  5240. $ctx1.sendIdx["assert:equals:"]=1;
  5241. $8=self._collection();
  5242. $ctx1.sendIdx["collection"]=4;
  5243. $9=$8;
  5244. $10=self._collectionWithNewValue();
  5245. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5246. _st($9)._addAll_($10);
  5247. $ctx1.sendIdx["addAll:"]=2;
  5248. $11=_st($8)._yourself();
  5249. $ctx1.sendIdx["yourself"]=2;
  5250. $7=$11;
  5251. $12=self._collectionWithNewValue();
  5252. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5253. self._assert_equals_($7,$12);
  5254. $ctx1.sendIdx["assert:equals:"]=2;
  5255. $14=self._collectionWithNewValue();
  5256. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5257. _st($14)._addAll_(self._collection());
  5258. $15=_st($14)._yourself();
  5259. $13=$15;
  5260. self._assert_equals_($13,self._collectionWithNewValue());
  5261. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5262. args: [],
  5263. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  5264. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5265. referencedClasses: []
  5266. }),
  5267. globals.SetTest);
  5268. smalltalk.addMethod(
  5269. smalltalk.method({
  5270. selector: "testAddRemove",
  5271. protocol: 'tests',
  5272. fn: function (){
  5273. var self=this;
  5274. var set;
  5275. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5276. return smalltalk.withContext(function($ctx1) {
  5277. var $1,$2;
  5278. set=_st($Set())._new();
  5279. self._assert_(_st(set)._isEmpty());
  5280. $ctx1.sendIdx["assert:"]=1;
  5281. _st(set)._add_((3));
  5282. $ctx1.sendIdx["add:"]=1;
  5283. $1=_st(set)._includes_((3));
  5284. $ctx1.sendIdx["includes:"]=1;
  5285. self._assert_($1);
  5286. $ctx1.sendIdx["assert:"]=2;
  5287. _st(set)._add_((5));
  5288. $2=_st(set)._includes_((5));
  5289. $ctx1.sendIdx["includes:"]=2;
  5290. self._assert_($2);
  5291. _st(set)._remove_((3));
  5292. self._deny_(_st(set)._includes_((3)));
  5293. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5294. args: [],
  5295. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  5296. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5297. referencedClasses: ["Set"]
  5298. }),
  5299. globals.SetTest);
  5300. smalltalk.addMethod(
  5301. smalltalk.method({
  5302. selector: "testAt",
  5303. protocol: 'tests',
  5304. fn: function (){
  5305. var self=this;
  5306. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5307. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5308. return smalltalk.withContext(function($ctx1) {
  5309. self._should_raise_((function(){
  5310. return smalltalk.withContext(function($ctx2) {
  5311. return _st(_st($Set())._new())._at_put_((1),(2));
  5312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5313. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5314. args: [],
  5315. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5316. messageSends: ["should:raise:", "at:put:", "new"],
  5317. referencedClasses: ["Set", "Error"]
  5318. }),
  5319. globals.SetTest);
  5320. smalltalk.addMethod(
  5321. smalltalk.method({
  5322. selector: "testCollect",
  5323. protocol: 'tests',
  5324. fn: function (){
  5325. var self=this;
  5326. return smalltalk.withContext(function($ctx1) {
  5327. var $2,$1;
  5328. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5329. $ctx1.supercall = false;
  5330. $2=[(5), (6), (8)]._asSet();
  5331. $ctx1.sendIdx["asSet"]=1;
  5332. $1=_st($2)._collect_((function(x){
  5333. return smalltalk.withContext(function($ctx2) {
  5334. return _st(x).__backslash_backslash((3));
  5335. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5336. self._assert_equals_($1,[(0), (2)]._asSet());
  5337. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5338. args: [],
  5339. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5340. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5341. referencedClasses: []
  5342. }),
  5343. globals.SetTest);
  5344. smalltalk.addMethod(
  5345. smalltalk.method({
  5346. selector: "testComma",
  5347. protocol: 'tests',
  5348. fn: function (){
  5349. var self=this;
  5350. return smalltalk.withContext(function($ctx1) {
  5351. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5352. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5353. $ctx1.supercall = false;
  5354. $2=self._collection();
  5355. $ctx1.sendIdx["collection"]=1;
  5356. $3=self._collection();
  5357. $ctx1.sendIdx["collection"]=2;
  5358. $1=_st($2).__comma($3);
  5359. $ctx1.sendIdx[","]=1;
  5360. $4=self._collection();
  5361. $ctx1.sendIdx["collection"]=3;
  5362. self._assert_equals_($1,$4);
  5363. $ctx1.sendIdx["assert:equals:"]=1;
  5364. $6=self._collection();
  5365. $ctx1.sendIdx["collection"]=4;
  5366. $7=self._collectionWithNewValue();
  5367. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5368. $5=_st($6).__comma($7);
  5369. $ctx1.sendIdx[","]=2;
  5370. $8=self._collectionWithNewValue();
  5371. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5372. self._assert_equals_($5,$8);
  5373. $ctx1.sendIdx["assert:equals:"]=2;
  5374. $10=self._collectionWithNewValue();
  5375. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5376. $9=_st($10).__comma(self._collection());
  5377. self._assert_equals_($9,self._collectionWithNewValue());
  5378. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5379. args: [],
  5380. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  5381. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5382. referencedClasses: []
  5383. }),
  5384. globals.SetTest);
  5385. smalltalk.addMethod(
  5386. smalltalk.method({
  5387. selector: "testComparing",
  5388. protocol: 'tests',
  5389. fn: function (){
  5390. var self=this;
  5391. return smalltalk.withContext(function($ctx1) {
  5392. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5393. $1=[(0), (2)]._asSet();
  5394. $ctx1.sendIdx["asSet"]=1;
  5395. $2=[(0), (2)]._asSet();
  5396. $ctx1.sendIdx["asSet"]=2;
  5397. self._assert_equals_($1,$2);
  5398. $ctx1.sendIdx["assert:equals:"]=1;
  5399. $3=[(2), (0)]._asSet();
  5400. $ctx1.sendIdx["asSet"]=3;
  5401. $4=[(0), (2)]._asSet();
  5402. $ctx1.sendIdx["asSet"]=4;
  5403. self._assert_equals_($3,$4);
  5404. $6=[(0), (2), (3)]._asSet();
  5405. $ctx1.sendIdx["asSet"]=5;
  5406. $7=[(0), (2)]._asSet();
  5407. $ctx1.sendIdx["asSet"]=6;
  5408. $5=_st($6).__eq($7);
  5409. $ctx1.sendIdx["="]=1;
  5410. self._deny_($5);
  5411. $ctx1.sendIdx["deny:"]=1;
  5412. $9=[(1), (2)]._asSet();
  5413. $ctx1.sendIdx["asSet"]=7;
  5414. $8=_st($9).__eq([(0), (2)]._asSet());
  5415. self._deny_($8);
  5416. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5417. args: [],
  5418. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  5419. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5420. referencedClasses: []
  5421. }),
  5422. globals.SetTest);
  5423. smalltalk.addMethod(
  5424. smalltalk.method({
  5425. selector: "testPrintString",
  5426. protocol: 'tests',
  5427. fn: function (){
  5428. var self=this;
  5429. var set;
  5430. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5431. return smalltalk.withContext(function($ctx1) {
  5432. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5433. set=_st($Set())._new();
  5434. $1=_st(set)._printString();
  5435. $ctx1.sendIdx["printString"]=1;
  5436. self._assert_equals_($1,"a Set ()");
  5437. $ctx1.sendIdx["assert:equals:"]=1;
  5438. $2=set;
  5439. _st($2)._add_((1));
  5440. $ctx1.sendIdx["add:"]=1;
  5441. $3=_st($2)._add_((3));
  5442. $ctx1.sendIdx["add:"]=2;
  5443. $4=_st(set)._printString();
  5444. $ctx1.sendIdx["printString"]=2;
  5445. self._assert_equals_($4,"a Set (1 3)");
  5446. $ctx1.sendIdx["assert:equals:"]=2;
  5447. _st(set)._add_("foo");
  5448. $ctx1.sendIdx["add:"]=3;
  5449. $5=_st(set)._printString();
  5450. $ctx1.sendIdx["printString"]=3;
  5451. self._assert_equals_($5,"a Set (1 3 'foo')");
  5452. $ctx1.sendIdx["assert:equals:"]=3;
  5453. $6=set;
  5454. _st($6)._remove_((1));
  5455. $ctx1.sendIdx["remove:"]=1;
  5456. $7=_st($6)._remove_((3));
  5457. $8=_st(set)._printString();
  5458. $ctx1.sendIdx["printString"]=4;
  5459. self._assert_equals_($8,"a Set ('foo')");
  5460. $ctx1.sendIdx["assert:equals:"]=4;
  5461. _st(set)._add_((3));
  5462. $ctx1.sendIdx["add:"]=4;
  5463. $9=_st(set)._printString();
  5464. $ctx1.sendIdx["printString"]=5;
  5465. self._assert_equals_($9,"a Set (3 'foo')");
  5466. $ctx1.sendIdx["assert:equals:"]=5;
  5467. _st(set)._add_((3));
  5468. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5469. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5470. args: [],
  5471. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5472. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5473. referencedClasses: ["Set"]
  5474. }),
  5475. globals.SetTest);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "testUnboxedObjects",
  5479. protocol: 'tests',
  5480. fn: function (){
  5481. var self=this;
  5482. return smalltalk.withContext(function($ctx1) {
  5483. var $4,$3,$2,$1;
  5484. $4="foo"._yourself();
  5485. $ctx1.sendIdx["yourself"]=1;
  5486. $3=[$4,"foo"._yourself()];
  5487. $2=_st($3)._asSet();
  5488. $1=_st($2)._asArray();
  5489. self._assert_equals_($1,["foo"]);
  5490. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5491. args: [],
  5492. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5493. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5494. referencedClasses: []
  5495. }),
  5496. globals.SetTest);
  5497. smalltalk.addMethod(
  5498. smalltalk.method({
  5499. selector: "testUnicity",
  5500. protocol: 'tests',
  5501. fn: function (){
  5502. var self=this;
  5503. var set;
  5504. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5505. return smalltalk.withContext(function($ctx1) {
  5506. var $1;
  5507. set=_st($Set())._new();
  5508. _st(set)._add_((21));
  5509. $ctx1.sendIdx["add:"]=1;
  5510. _st(set)._add_("hello");
  5511. $ctx1.sendIdx["add:"]=2;
  5512. _st(set)._add_((21));
  5513. $ctx1.sendIdx["add:"]=3;
  5514. $1=_st(set)._size();
  5515. $ctx1.sendIdx["size"]=1;
  5516. self._assert_equals_($1,(2));
  5517. $ctx1.sendIdx["assert:equals:"]=1;
  5518. _st(set)._add_("hello");
  5519. self._assert_equals_(_st(set)._size(),(2));
  5520. $ctx1.sendIdx["assert:equals:"]=2;
  5521. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5522. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5523. args: [],
  5524. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  5525. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5526. referencedClasses: ["Set"]
  5527. }),
  5528. globals.SetTest);
  5529. smalltalk.addMethod(
  5530. smalltalk.method({
  5531. selector: "collectionClass",
  5532. protocol: 'fixture',
  5533. fn: function (){
  5534. var self=this;
  5535. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5536. return $Set();
  5537. },
  5538. args: [],
  5539. source: "collectionClass\x0a\x09^ Set",
  5540. messageSends: [],
  5541. referencedClasses: ["Set"]
  5542. }),
  5543. globals.SetTest.klass);
  5544. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5545. smalltalk.addMethod(
  5546. smalltalk.method({
  5547. selector: "testShow",
  5548. protocol: 'tests',
  5549. fn: function (){
  5550. var self=this;
  5551. var originalTranscript;
  5552. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5553. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5554. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5555. return smalltalk.withContext(function($ctx1) {
  5556. originalTranscript=_st($Transcript())._current();
  5557. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5558. $ctx1.sendIdx["register:"]=1;
  5559. self._shouldnt_raise_((function(){
  5560. return smalltalk.withContext(function($ctx2) {
  5561. return _st($Transcript())._show_("Hello console!");
  5562. $ctx2.sendIdx["show:"]=1;
  5563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5564. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5565. self._shouldnt_raise_((function(){
  5566. return smalltalk.withContext(function($ctx2) {
  5567. return _st($Transcript())._show_(console);
  5568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5569. _st($Transcript())._register_(originalTranscript);
  5570. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5571. args: [],
  5572. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  5573. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5574. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5575. }),
  5576. globals.ConsoleTranscriptTest);
  5577. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "jsNull",
  5581. protocol: 'accessing',
  5582. fn: function (){
  5583. var self=this;
  5584. return smalltalk.withContext(function($ctx1) {
  5585. return null;
  5586. return self}, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)})},
  5587. args: [],
  5588. source: "jsNull\x0a\x09<return null>",
  5589. messageSends: [],
  5590. referencedClasses: []
  5591. }),
  5592. globals.JSObjectProxyTest);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "jsObject",
  5596. protocol: 'accessing',
  5597. fn: function (){
  5598. var self=this;
  5599. return smalltalk.withContext(function($ctx1) {
  5600. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5601. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5602. args: [],
  5603. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5604. messageSends: [],
  5605. referencedClasses: []
  5606. }),
  5607. globals.JSObjectProxyTest);
  5608. smalltalk.addMethod(
  5609. smalltalk.method({
  5610. selector: "jsUndefined",
  5611. protocol: 'accessing',
  5612. fn: function (){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) {
  5615. return;
  5616. return self}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)})},
  5617. args: [],
  5618. source: "jsUndefined\x0a\x09<return>",
  5619. messageSends: [],
  5620. referencedClasses: []
  5621. }),
  5622. globals.JSObjectProxyTest);
  5623. smalltalk.addMethod(
  5624. smalltalk.method({
  5625. selector: "testAtIfAbsent",
  5626. protocol: 'tests',
  5627. fn: function (){
  5628. var self=this;
  5629. var testObject;
  5630. return smalltalk.withContext(function($ctx1) {
  5631. var $1,$2,$3;
  5632. testObject=self._jsObject();
  5633. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5634. return "Property does not exist";
  5635. }));
  5636. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5637. self._assert_equals_($1,"Property does not exist");
  5638. $ctx1.sendIdx["assert:equals:"]=1;
  5639. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5640. return "Property does not exist";
  5641. }));
  5642. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5643. self._assert_equals_($2,nil);
  5644. $ctx1.sendIdx["assert:equals:"]=2;
  5645. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5646. return "Property does not exist";
  5647. }));
  5648. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5649. self._assert_equals_($3,(1));
  5650. $ctx1.sendIdx["assert:equals:"]=3;
  5651. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5652. return "Property does not exist";
  5653. })),nil);
  5654. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5655. args: [],
  5656. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.",
  5657. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5658. referencedClasses: []
  5659. }),
  5660. globals.JSObjectProxyTest);
  5661. smalltalk.addMethod(
  5662. smalltalk.method({
  5663. selector: "testAtIfPresent",
  5664. protocol: 'tests',
  5665. fn: function (){
  5666. var self=this;
  5667. var testObject;
  5668. return smalltalk.withContext(function($ctx1) {
  5669. var $2,$1,$4,$3,$6,$5;
  5670. testObject=self._jsObject();
  5671. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5672. return smalltalk.withContext(function($ctx2) {
  5673. $2=_st(x)._asString();
  5674. $ctx2.sendIdx["asString"]=1;
  5675. return "hello ".__comma($2);
  5676. $ctx2.sendIdx[","]=1;
  5677. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5678. $ctx1.sendIdx["at:ifPresent:"]=1;
  5679. self._assert_equals_($1,nil);
  5680. $ctx1.sendIdx["assert:equals:"]=1;
  5681. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5682. return smalltalk.withContext(function($ctx2) {
  5683. $4=_st(x)._asString();
  5684. $ctx2.sendIdx["asString"]=2;
  5685. return "hello ".__comma($4);
  5686. $ctx2.sendIdx[","]=2;
  5687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5688. $ctx1.sendIdx["at:ifPresent:"]=2;
  5689. self._assert_equals_($3,"hello nil");
  5690. $ctx1.sendIdx["assert:equals:"]=2;
  5691. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5692. return smalltalk.withContext(function($ctx2) {
  5693. $6=_st(x)._asString();
  5694. $ctx2.sendIdx["asString"]=3;
  5695. return "hello ".__comma($6);
  5696. $ctx2.sendIdx[","]=3;
  5697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5698. $ctx1.sendIdx["at:ifPresent:"]=3;
  5699. self._assert_equals_($5,"hello 1");
  5700. $ctx1.sendIdx["assert:equals:"]=3;
  5701. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5702. return smalltalk.withContext(function($ctx2) {
  5703. return "hello ".__comma(_st(x)._asString());
  5704. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5705. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5706. args: [],
  5707. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.",
  5708. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5709. referencedClasses: []
  5710. }),
  5711. globals.JSObjectProxyTest);
  5712. smalltalk.addMethod(
  5713. smalltalk.method({
  5714. selector: "testAtIfPresentIfAbsent",
  5715. protocol: 'tests',
  5716. fn: function (){
  5717. var self=this;
  5718. var testObject;
  5719. return smalltalk.withContext(function($ctx1) {
  5720. var $2,$1,$4,$3,$6,$5;
  5721. testObject=self._jsObject();
  5722. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5723. return smalltalk.withContext(function($ctx2) {
  5724. $2=_st(x)._asString();
  5725. $ctx2.sendIdx["asString"]=1;
  5726. return "hello ".__comma($2);
  5727. $ctx2.sendIdx[","]=1;
  5728. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5729. return "not present";
  5730. }));
  5731. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5732. self._assert_equals_($1,"not present");
  5733. $ctx1.sendIdx["assert:equals:"]=1;
  5734. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5735. return smalltalk.withContext(function($ctx2) {
  5736. $4=_st(x)._asString();
  5737. $ctx2.sendIdx["asString"]=2;
  5738. return "hello ".__comma($4);
  5739. $ctx2.sendIdx[","]=2;
  5740. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5741. return "not present";
  5742. }));
  5743. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5744. self._assert_equals_($3,"hello nil");
  5745. $ctx1.sendIdx["assert:equals:"]=2;
  5746. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5747. return smalltalk.withContext(function($ctx2) {
  5748. $6=_st(x)._asString();
  5749. $ctx2.sendIdx["asString"]=3;
  5750. return "hello ".__comma($6);
  5751. $ctx2.sendIdx[","]=3;
  5752. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5753. return "not present";
  5754. }));
  5755. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5756. self._assert_equals_($5,"hello 1");
  5757. $ctx1.sendIdx["assert:equals:"]=3;
  5758. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5759. return smalltalk.withContext(function($ctx2) {
  5760. return "hello ".__comma(_st(x)._asString());
  5761. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5762. return "not present";
  5763. })),"hello nil");
  5764. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5765. args: [],
  5766. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.",
  5767. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5768. referencedClasses: []
  5769. }),
  5770. globals.JSObjectProxyTest);
  5771. smalltalk.addMethod(
  5772. smalltalk.method({
  5773. selector: "testAtPut",
  5774. protocol: 'tests',
  5775. fn: function (){
  5776. var self=this;
  5777. var testObject;
  5778. return smalltalk.withContext(function($ctx1) {
  5779. var $2,$1;
  5780. testObject=self._jsObject();
  5781. $2=_st(testObject)._at_("abc");
  5782. $ctx1.sendIdx["at:"]=1;
  5783. $1=_st($2).__tild_eq("xyz");
  5784. self._assert_($1);
  5785. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5786. $ctx1.sendIdx["assert:equals:"]=1;
  5787. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5788. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5789. args: [],
  5790. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  5791. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5792. referencedClasses: []
  5793. }),
  5794. globals.JSObjectProxyTest);
  5795. smalltalk.addMethod(
  5796. smalltalk.method({
  5797. selector: "testComparison",
  5798. protocol: 'tests',
  5799. fn: function (){
  5800. var self=this;
  5801. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5802. return smalltalk.withContext(function($ctx1) {
  5803. var $1,$2;
  5804. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5805. $1=_st(console).__eq(console);
  5806. $ctx1.sendIdx["="]=1;
  5807. self._assert_($1);
  5808. $2=_st(console).__eq(_st($Object())._new());
  5809. $ctx1.sendIdx["="]=2;
  5810. self._deny_($2);
  5811. $ctx1.sendIdx["deny:"]=1;
  5812. self._deny_(_st(console).__eq(self._jsObject()));
  5813. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5814. args: [],
  5815. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5816. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5817. referencedClasses: ["Object"]
  5818. }),
  5819. globals.JSObjectProxyTest);
  5820. smalltalk.addMethod(
  5821. smalltalk.method({
  5822. selector: "testDNU",
  5823. protocol: 'tests',
  5824. fn: function (){
  5825. var self=this;
  5826. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5827. return smalltalk.withContext(function($ctx1) {
  5828. self._should_raise_((function(){
  5829. return smalltalk.withContext(function($ctx2) {
  5830. return _st(self._jsObject())._foo();
  5831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5832. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5833. args: [],
  5834. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5835. messageSends: ["should:raise:", "foo", "jsObject"],
  5836. referencedClasses: ["MessageNotUnderstood"]
  5837. }),
  5838. globals.JSObjectProxyTest);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "testDNURegression1059",
  5842. protocol: 'tests',
  5843. fn: function (){
  5844. var self=this;
  5845. var jsObject;
  5846. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5847. return smalltalk.withContext(function($ctx1) {
  5848. jsObject=[];
  5849. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  5850. $ctx1.sendIdx["basicAt:put:"]=1;
  5851. _st(jsObject)._basicAt_put_("x",(3));
  5852. $ctx1.sendIdx["basicAt:put:"]=2;
  5853. _st(jsObject)._basicAt_put_("x:",(function(){
  5854. return smalltalk.withContext(function($ctx2) {
  5855. return self._error();
  5856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5857. self._shouldnt_raise_((function(){
  5858. return smalltalk.withContext(function($ctx2) {
  5859. return _st(jsObject)._x_((4));
  5860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5861. self._assert_equals_(_st(jsObject)._x(),(4));
  5862. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  5863. args: [],
  5864. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4\x0a\x09",
  5865. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"],
  5866. referencedClasses: ["Error"]
  5867. }),
  5868. globals.JSObjectProxyTest);
  5869. smalltalk.addMethod(
  5870. smalltalk.method({
  5871. selector: "testMessageSend",
  5872. protocol: 'tests',
  5873. fn: function (){
  5874. var self=this;
  5875. return smalltalk.withContext(function($ctx1) {
  5876. var $2,$1,$4,$3;
  5877. $2=self._jsObject();
  5878. $ctx1.sendIdx["jsObject"]=1;
  5879. $1=_st($2)._a();
  5880. self._assert_equals_($1,(1));
  5881. $ctx1.sendIdx["assert:equals:"]=1;
  5882. $4=self._jsObject();
  5883. $ctx1.sendIdx["jsObject"]=2;
  5884. $3=_st($4)._b();
  5885. self._assert_equals_($3,(2));
  5886. $ctx1.sendIdx["assert:equals:"]=2;
  5887. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5888. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5889. args: [],
  5890. 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",
  5891. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5892. referencedClasses: []
  5893. }),
  5894. globals.JSObjectProxyTest);
  5895. smalltalk.addMethod(
  5896. smalltalk.method({
  5897. selector: "testMethodWithArguments",
  5898. protocol: 'tests',
  5899. fn: function (){
  5900. var self=this;
  5901. return smalltalk.withContext(function($ctx1) {
  5902. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5903. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5904. args: [],
  5905. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5906. messageSends: ["assert:equals:", "c:", "jsObject"],
  5907. referencedClasses: []
  5908. }),
  5909. globals.JSObjectProxyTest);
  5910. smalltalk.addMethod(
  5911. smalltalk.method({
  5912. selector: "testPrinting",
  5913. protocol: 'tests',
  5914. fn: function (){
  5915. var self=this;
  5916. return smalltalk.withContext(function($ctx1) {
  5917. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5918. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5919. args: [],
  5920. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5921. messageSends: ["assert:equals:", "printString", "jsObject"],
  5922. referencedClasses: []
  5923. }),
  5924. globals.JSObjectProxyTest);
  5925. smalltalk.addMethod(
  5926. smalltalk.method({
  5927. selector: "testPropertyThatReturnsEmptyString",
  5928. protocol: 'tests',
  5929. fn: function (){
  5930. var self=this;
  5931. var object;
  5932. return smalltalk.withContext(function($ctx1) {
  5933. var $1;
  5934. object=self._jsObject();
  5935. $1=_st(object)._d();
  5936. $ctx1.sendIdx["d"]=1;
  5937. self._assert_equals_($1,"");
  5938. $ctx1.sendIdx["assert:equals:"]=1;
  5939. _st(object)._d_("hello");
  5940. self._assert_equals_(_st(object)._d(),"hello");
  5941. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5942. args: [],
  5943. 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'",
  5944. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5945. referencedClasses: []
  5946. }),
  5947. globals.JSObjectProxyTest);
  5948. smalltalk.addMethod(
  5949. smalltalk.method({
  5950. selector: "testPropertyThatReturnsUndefined",
  5951. protocol: 'tests',
  5952. fn: function (){
  5953. var self=this;
  5954. var object;
  5955. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5956. return smalltalk.withContext(function($ctx1) {
  5957. object=self._jsObject();
  5958. self._shouldnt_raise_((function(){
  5959. return smalltalk.withContext(function($ctx2) {
  5960. return _st(object)._e();
  5961. $ctx2.sendIdx["e"]=1;
  5962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5963. self._assert_(_st(_st(object)._e())._isNil());
  5964. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5965. args: [],
  5966. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5967. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5968. referencedClasses: ["MessageNotUnderstood"]
  5969. }),
  5970. globals.JSObjectProxyTest);
  5971. smalltalk.addMethod(
  5972. smalltalk.method({
  5973. selector: "testSetPropertyWithFalsyValue",
  5974. protocol: 'tests',
  5975. fn: function (){
  5976. var self=this;
  5977. var jsObject;
  5978. return smalltalk.withContext(function($ctx1) {
  5979. var $1,$2,$3,$4,$5;
  5980. jsObject=self._jsObject();
  5981. $1=_st(jsObject)._a();
  5982. $ctx1.sendIdx["a"]=1;
  5983. self._assert_equals_($1,(1));
  5984. $ctx1.sendIdx["assert:equals:"]=1;
  5985. _st(jsObject)._a_(self._jsNull());
  5986. $ctx1.sendIdx["a:"]=1;
  5987. $2=_st(jsObject)._a();
  5988. $ctx1.sendIdx["a"]=2;
  5989. self._assert_equals_($2,nil);
  5990. $ctx1.sendIdx["assert:equals:"]=2;
  5991. _st(jsObject)._a_((0));
  5992. $ctx1.sendIdx["a:"]=2;
  5993. $3=_st(jsObject)._a();
  5994. $ctx1.sendIdx["a"]=3;
  5995. self._assert_equals_($3,(0));
  5996. $ctx1.sendIdx["assert:equals:"]=3;
  5997. _st(jsObject)._a_(self._jsUndefined());
  5998. $ctx1.sendIdx["a:"]=3;
  5999. $4=_st(jsObject)._a();
  6000. $ctx1.sendIdx["a"]=4;
  6001. self._assert_equals_($4,nil);
  6002. $ctx1.sendIdx["assert:equals:"]=4;
  6003. _st(jsObject)._a_("");
  6004. $ctx1.sendIdx["a:"]=4;
  6005. $5=_st(jsObject)._a();
  6006. $ctx1.sendIdx["a"]=5;
  6007. self._assert_equals_($5,"");
  6008. $ctx1.sendIdx["assert:equals:"]=5;
  6009. _st(jsObject)._a_(false);
  6010. self._assert_equals_(_st(jsObject)._a(),false);
  6011. return self}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  6012. args: [],
  6013. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  6014. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"],
  6015. referencedClasses: []
  6016. }),
  6017. globals.JSObjectProxyTest);
  6018. smalltalk.addMethod(
  6019. smalltalk.method({
  6020. selector: "testValue",
  6021. protocol: 'tests',
  6022. fn: function (){
  6023. var self=this;
  6024. var testObject;
  6025. return smalltalk.withContext(function($ctx1) {
  6026. testObject=self._jsObject();
  6027. _st(testObject)._at_put_("value","aValue");
  6028. self._assert_equals_(_st(testObject)._value(),"aValue");
  6029. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  6030. args: [],
  6031. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  6032. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  6033. referencedClasses: []
  6034. }),
  6035. globals.JSObjectProxyTest);
  6036. smalltalk.addMethod(
  6037. smalltalk.method({
  6038. selector: "testYourself",
  6039. protocol: 'tests',
  6040. fn: function (){
  6041. var self=this;
  6042. var object;
  6043. return smalltalk.withContext(function($ctx1) {
  6044. var $1,$2;
  6045. $1=self._jsObject();
  6046. _st($1)._d_("test");
  6047. $2=_st($1)._yourself();
  6048. object=$2;
  6049. self._assert_equals_(_st(object)._d(),"test");
  6050. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  6051. args: [],
  6052. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  6053. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  6054. referencedClasses: []
  6055. }),
  6056. globals.JSObjectProxyTest);
  6057. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  6058. smalltalk.addMethod(
  6059. smalltalk.method({
  6060. selector: "testCatchingException",
  6061. protocol: 'tests',
  6062. fn: function (){
  6063. var self=this;
  6064. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6065. return smalltalk.withContext(function($ctx1) {
  6066. _st((function(){
  6067. return smalltalk.withContext(function($ctx2) {
  6068. return self._throwException();
  6069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  6070. return smalltalk.withContext(function($ctx2) {
  6071. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  6072. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  6073. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  6074. args: [],
  6075. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  6076. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  6077. referencedClasses: ["Error"]
  6078. }),
  6079. globals.JavaScriptExceptionTest);
  6080. smalltalk.addMethod(
  6081. smalltalk.method({
  6082. selector: "testRaisingException",
  6083. protocol: 'tests',
  6084. fn: function (){
  6085. var self=this;
  6086. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6087. return smalltalk.withContext(function($ctx1) {
  6088. self._should_raise_((function(){
  6089. return smalltalk.withContext(function($ctx2) {
  6090. return self._throwException();
  6091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  6092. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  6093. args: [],
  6094. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  6095. messageSends: ["should:raise:", "throwException"],
  6096. referencedClasses: ["JavaScriptException"]
  6097. }),
  6098. globals.JavaScriptExceptionTest);
  6099. smalltalk.addMethod(
  6100. smalltalk.method({
  6101. selector: "throwException",
  6102. protocol: 'helpers',
  6103. fn: function (){
  6104. var self=this;
  6105. return smalltalk.withContext(function($ctx1) {
  6106. throw 'test';
  6107. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  6108. args: [],
  6109. source: "throwException\x0a\x09<throw 'test'>",
  6110. messageSends: [],
  6111. referencedClasses: []
  6112. }),
  6113. globals.JavaScriptExceptionTest);
  6114. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  6115. smalltalk.addMethod(
  6116. smalltalk.method({
  6117. selector: "testValue",
  6118. protocol: 'tests',
  6119. fn: function (){
  6120. var self=this;
  6121. var messageSend;
  6122. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6123. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6124. return smalltalk.withContext(function($ctx1) {
  6125. var $1,$2;
  6126. $1=_st($MessageSend())._new();
  6127. $ctx1.sendIdx["new"]=1;
  6128. _st($1)._receiver_(_st($Object())._new());
  6129. _st($1)._selector_("asString");
  6130. $2=_st($1)._yourself();
  6131. messageSend=$2;
  6132. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6133. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  6134. args: [],
  6135. 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'",
  6136. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6137. referencedClasses: ["MessageSend", "Object"]
  6138. }),
  6139. globals.MessageSendTest);
  6140. smalltalk.addMethod(
  6141. smalltalk.method({
  6142. selector: "testValueWithArguments",
  6143. protocol: 'tests',
  6144. fn: function (){
  6145. var self=this;
  6146. var messageSend;
  6147. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6148. return smalltalk.withContext(function($ctx1) {
  6149. var $1,$2;
  6150. $1=_st($MessageSend())._new();
  6151. _st($1)._receiver_((2));
  6152. _st($1)._selector_("+");
  6153. $2=_st($1)._yourself();
  6154. messageSend=$2;
  6155. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6156. $ctx1.sendIdx["assert:equals:"]=1;
  6157. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6158. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  6159. args: [],
  6160. 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",
  6161. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6162. referencedClasses: ["MessageSend"]
  6163. }),
  6164. globals.MessageSendTest);
  6165. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6166. smalltalk.addMethod(
  6167. smalltalk.method({
  6168. selector: "codeGeneratorClass",
  6169. protocol: 'accessing',
  6170. fn: function (){
  6171. var self=this;
  6172. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6173. return $CodeGenerator();
  6174. },
  6175. args: [],
  6176. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6177. messageSends: [],
  6178. referencedClasses: ["CodeGenerator"]
  6179. }),
  6180. globals.MethodInheritanceTest);
  6181. smalltalk.addMethod(
  6182. smalltalk.method({
  6183. selector: "compiler",
  6184. protocol: 'factory',
  6185. fn: function (){
  6186. var self=this;
  6187. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6188. return smalltalk.withContext(function($ctx1) {
  6189. var $2,$3,$1;
  6190. $2=_st($Compiler())._new();
  6191. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6192. $3=_st($2)._yourself();
  6193. $1=$3;
  6194. return $1;
  6195. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6196. args: [],
  6197. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6198. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6199. referencedClasses: ["Compiler"]
  6200. }),
  6201. globals.MethodInheritanceTest);
  6202. smalltalk.addMethod(
  6203. smalltalk.method({
  6204. selector: "deinstallBottom",
  6205. protocol: 'testing',
  6206. fn: function (){
  6207. var self=this;
  6208. return smalltalk.withContext(function($ctx1) {
  6209. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6210. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6211. args: [],
  6212. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6213. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6214. referencedClasses: []
  6215. }),
  6216. globals.MethodInheritanceTest);
  6217. smalltalk.addMethod(
  6218. smalltalk.method({
  6219. selector: "deinstallMiddle",
  6220. protocol: 'testing',
  6221. fn: function (){
  6222. var self=this;
  6223. return smalltalk.withContext(function($ctx1) {
  6224. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6225. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6226. args: [],
  6227. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6228. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6229. referencedClasses: []
  6230. }),
  6231. globals.MethodInheritanceTest);
  6232. smalltalk.addMethod(
  6233. smalltalk.method({
  6234. selector: "deinstallTop",
  6235. protocol: 'testing',
  6236. fn: function (){
  6237. var self=this;
  6238. return smalltalk.withContext(function($ctx1) {
  6239. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6240. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6241. args: [],
  6242. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6243. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6244. referencedClasses: []
  6245. }),
  6246. globals.MethodInheritanceTest);
  6247. smalltalk.addMethod(
  6248. smalltalk.method({
  6249. selector: "installBottom:",
  6250. protocol: 'testing',
  6251. fn: function (aString){
  6252. var self=this;
  6253. return smalltalk.withContext(function($ctx1) {
  6254. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6255. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6256. args: ["aString"],
  6257. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6258. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6259. referencedClasses: []
  6260. }),
  6261. globals.MethodInheritanceTest);
  6262. smalltalk.addMethod(
  6263. smalltalk.method({
  6264. selector: "installMiddle:",
  6265. protocol: 'testing',
  6266. fn: function (aString){
  6267. var self=this;
  6268. return smalltalk.withContext(function($ctx1) {
  6269. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6270. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6271. args: ["aString"],
  6272. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6273. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6274. referencedClasses: []
  6275. }),
  6276. globals.MethodInheritanceTest);
  6277. smalltalk.addMethod(
  6278. smalltalk.method({
  6279. selector: "installTop:",
  6280. protocol: 'testing',
  6281. fn: function (aString){
  6282. var self=this;
  6283. return smalltalk.withContext(function($ctx1) {
  6284. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6285. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6286. args: ["aString"],
  6287. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6288. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6289. referencedClasses: []
  6290. }),
  6291. globals.MethodInheritanceTest);
  6292. smalltalk.addMethod(
  6293. smalltalk.method({
  6294. selector: "setUp",
  6295. protocol: 'initialization',
  6296. fn: function (){
  6297. var self=this;
  6298. return smalltalk.withContext(function($ctx1) {
  6299. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6300. $ctx1.sendIdx["new"]=1;
  6301. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6302. $ctx1.sendIdx["new"]=2;
  6303. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6304. self["@method"]=nil;
  6305. self["@performBlock"]=(function(){
  6306. return smalltalk.withContext(function($ctx2) {
  6307. return self._error_("performBlock not initialized");
  6308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6309. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6310. args: [],
  6311. 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' ]",
  6312. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6313. referencedClasses: []
  6314. }),
  6315. globals.MethodInheritanceTest);
  6316. smalltalk.addMethod(
  6317. smalltalk.method({
  6318. selector: "shouldMNU",
  6319. protocol: 'testing',
  6320. fn: function (){
  6321. var self=this;
  6322. return smalltalk.withContext(function($ctx1) {
  6323. self._shouldMNUTop();
  6324. self._shouldMNUMiddle();
  6325. self._shouldMNUBottom();
  6326. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6327. args: [],
  6328. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6329. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6330. referencedClasses: []
  6331. }),
  6332. globals.MethodInheritanceTest);
  6333. smalltalk.addMethod(
  6334. smalltalk.method({
  6335. selector: "shouldMNUBottom",
  6336. protocol: 'testing',
  6337. fn: function (){
  6338. var self=this;
  6339. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6340. return smalltalk.withContext(function($ctx1) {
  6341. self._should_raise_((function(){
  6342. return smalltalk.withContext(function($ctx2) {
  6343. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6345. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6346. args: [],
  6347. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6348. messageSends: ["should:raise:", "value:"],
  6349. referencedClasses: ["MessageNotUnderstood"]
  6350. }),
  6351. globals.MethodInheritanceTest);
  6352. smalltalk.addMethod(
  6353. smalltalk.method({
  6354. selector: "shouldMNUMiddle",
  6355. protocol: 'testing',
  6356. fn: function (){
  6357. var self=this;
  6358. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6359. return smalltalk.withContext(function($ctx1) {
  6360. self._should_raise_((function(){
  6361. return smalltalk.withContext(function($ctx2) {
  6362. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6364. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6365. args: [],
  6366. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6367. messageSends: ["should:raise:", "value:"],
  6368. referencedClasses: ["MessageNotUnderstood"]
  6369. }),
  6370. globals.MethodInheritanceTest);
  6371. smalltalk.addMethod(
  6372. smalltalk.method({
  6373. selector: "shouldMNUTop",
  6374. protocol: 'testing',
  6375. fn: function (){
  6376. var self=this;
  6377. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6378. return smalltalk.withContext(function($ctx1) {
  6379. self._should_raise_((function(){
  6380. return smalltalk.withContext(function($ctx2) {
  6381. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6383. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6384. args: [],
  6385. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6386. messageSends: ["should:raise:", "value:"],
  6387. referencedClasses: ["MessageNotUnderstood"]
  6388. }),
  6389. globals.MethodInheritanceTest);
  6390. smalltalk.addMethod(
  6391. smalltalk.method({
  6392. selector: "shouldReturn:",
  6393. protocol: 'testing',
  6394. fn: function (anObject){
  6395. var self=this;
  6396. var result;
  6397. return smalltalk.withContext(function($ctx1) {
  6398. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6399. $ctx1.sendIdx["value:"]=1;
  6400. self._assert_equals_(["top",anObject],["top",result]);
  6401. $ctx1.sendIdx["assert:equals:"]=1;
  6402. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6403. $ctx1.sendIdx["value:"]=2;
  6404. self._assert_equals_(["middle",anObject],["middle",result]);
  6405. $ctx1.sendIdx["assert:equals:"]=2;
  6406. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6407. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6408. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6409. args: ["anObject"],
  6410. 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 }",
  6411. messageSends: ["value:", "assert:equals:"],
  6412. referencedClasses: []
  6413. }),
  6414. globals.MethodInheritanceTest);
  6415. smalltalk.addMethod(
  6416. smalltalk.method({
  6417. selector: "shouldReturn:and:and:",
  6418. protocol: 'testing',
  6419. fn: function (anObject,anObject2,anObject3){
  6420. var self=this;
  6421. var result;
  6422. return smalltalk.withContext(function($ctx1) {
  6423. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6424. $ctx1.sendIdx["value:"]=1;
  6425. self._assert_equals_(["top",anObject],["top",result]);
  6426. $ctx1.sendIdx["assert:equals:"]=1;
  6427. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6428. $ctx1.sendIdx["value:"]=2;
  6429. self._assert_equals_(["middle",anObject2],["middle",result]);
  6430. $ctx1.sendIdx["assert:equals:"]=2;
  6431. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6432. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6433. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6434. args: ["anObject", "anObject2", "anObject3"],
  6435. 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 }",
  6436. messageSends: ["value:", "assert:equals:"],
  6437. referencedClasses: []
  6438. }),
  6439. globals.MethodInheritanceTest);
  6440. smalltalk.addMethod(
  6441. smalltalk.method({
  6442. selector: "targetClassBottom",
  6443. protocol: 'accessing',
  6444. fn: function (){
  6445. var self=this;
  6446. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6447. return $JavaScriptException();
  6448. },
  6449. args: [],
  6450. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6451. messageSends: [],
  6452. referencedClasses: ["JavaScriptException"]
  6453. }),
  6454. globals.MethodInheritanceTest);
  6455. smalltalk.addMethod(
  6456. smalltalk.method({
  6457. selector: "targetClassMiddle",
  6458. protocol: 'accessing',
  6459. fn: function (){
  6460. var self=this;
  6461. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6462. return $Error();
  6463. },
  6464. args: [],
  6465. source: "targetClassMiddle\x0a\x09^ Error",
  6466. messageSends: [],
  6467. referencedClasses: ["Error"]
  6468. }),
  6469. globals.MethodInheritanceTest);
  6470. smalltalk.addMethod(
  6471. smalltalk.method({
  6472. selector: "targetClassTop",
  6473. protocol: 'accessing',
  6474. fn: function (){
  6475. var self=this;
  6476. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6477. return $Object();
  6478. },
  6479. args: [],
  6480. source: "targetClassTop\x0a\x09^ Object",
  6481. messageSends: [],
  6482. referencedClasses: ["Object"]
  6483. }),
  6484. globals.MethodInheritanceTest);
  6485. smalltalk.addMethod(
  6486. smalltalk.method({
  6487. selector: "tearDown",
  6488. protocol: 'initialization',
  6489. fn: function (){
  6490. var self=this;
  6491. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6492. return smalltalk.withContext(function($ctx1) {
  6493. _st((function(){
  6494. return smalltalk.withContext(function($ctx2) {
  6495. return self._deinstallTop();
  6496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6497. }));
  6498. $ctx1.sendIdx["on:do:"]=1;
  6499. _st((function(){
  6500. return smalltalk.withContext(function($ctx2) {
  6501. return self._deinstallMiddle();
  6502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6503. }));
  6504. $ctx1.sendIdx["on:do:"]=2;
  6505. _st((function(){
  6506. return smalltalk.withContext(function($ctx2) {
  6507. return self._deinstallBottom();
  6508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6509. }));
  6510. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6511. args: [],
  6512. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6513. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6514. referencedClasses: ["Error"]
  6515. }),
  6516. globals.MethodInheritanceTest);
  6517. smalltalk.addMethod(
  6518. smalltalk.method({
  6519. selector: "testMNU11",
  6520. protocol: 'tests',
  6521. fn: function (){
  6522. var self=this;
  6523. return smalltalk.withContext(function($ctx1) {
  6524. self["@performBlock"]=(function(x){
  6525. return smalltalk.withContext(function($ctx2) {
  6526. return _st(x)._foo();
  6527. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6528. self._shouldMNU();
  6529. $ctx1.sendIdx["shouldMNU"]=1;
  6530. self._installTop_("foo ^ false");
  6531. $ctx1.sendIdx["installTop:"]=1;
  6532. self._installTop_("foo ^ true");
  6533. self._deinstallTop();
  6534. self._shouldMNU();
  6535. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6536. args: [],
  6537. 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",
  6538. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6539. referencedClasses: []
  6540. }),
  6541. globals.MethodInheritanceTest);
  6542. smalltalk.addMethod(
  6543. smalltalk.method({
  6544. selector: "testMNU22",
  6545. protocol: 'tests',
  6546. fn: function (){
  6547. var self=this;
  6548. return smalltalk.withContext(function($ctx1) {
  6549. self["@performBlock"]=(function(x){
  6550. return smalltalk.withContext(function($ctx2) {
  6551. return _st(x)._foo();
  6552. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6553. self._shouldMNU();
  6554. $ctx1.sendIdx["shouldMNU"]=1;
  6555. self._installMiddle_("foo ^ false");
  6556. $ctx1.sendIdx["installMiddle:"]=1;
  6557. self._installMiddle_("foo ^ true");
  6558. self._deinstallMiddle();
  6559. self._shouldMNU();
  6560. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6561. args: [],
  6562. 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",
  6563. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6564. referencedClasses: []
  6565. }),
  6566. globals.MethodInheritanceTest);
  6567. smalltalk.addMethod(
  6568. smalltalk.method({
  6569. selector: "testReturns1",
  6570. protocol: 'tests',
  6571. fn: function (){
  6572. var self=this;
  6573. return smalltalk.withContext(function($ctx1) {
  6574. self["@performBlock"]=(function(x){
  6575. return smalltalk.withContext(function($ctx2) {
  6576. return _st(x)._foo();
  6577. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6578. self._installTop_("foo ^ false");
  6579. $ctx1.sendIdx["installTop:"]=1;
  6580. self._shouldReturn_(false);
  6581. $ctx1.sendIdx["shouldReturn:"]=1;
  6582. self._installTop_("foo ^ true");
  6583. self._shouldReturn_(true);
  6584. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6585. args: [],
  6586. 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",
  6587. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6588. referencedClasses: []
  6589. }),
  6590. globals.MethodInheritanceTest);
  6591. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6592. smalltalk.addMethod(
  6593. smalltalk.method({
  6594. selector: "testAbs",
  6595. protocol: 'tests',
  6596. fn: function (){
  6597. var self=this;
  6598. return smalltalk.withContext(function($ctx1) {
  6599. var $1;
  6600. $1=(4)._abs();
  6601. $ctx1.sendIdx["abs"]=1;
  6602. self._assert_equals_($1,(4));
  6603. $ctx1.sendIdx["assert:equals:"]=1;
  6604. self._assert_equals_((-4)._abs(),(4));
  6605. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6606. args: [],
  6607. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6608. messageSends: ["assert:equals:", "abs"],
  6609. referencedClasses: []
  6610. }),
  6611. globals.NumberTest);
  6612. smalltalk.addMethod(
  6613. smalltalk.method({
  6614. selector: "testArithmetic",
  6615. protocol: 'tests',
  6616. fn: function (){
  6617. var self=this;
  6618. return smalltalk.withContext(function($ctx1) {
  6619. var $1,$2,$3,$5,$4;
  6620. $1=(1.5).__plus((1));
  6621. $ctx1.sendIdx["+"]=1;
  6622. self._assert_equals_($1,(2.5));
  6623. $ctx1.sendIdx["assert:equals:"]=1;
  6624. $2=(2).__minus((1));
  6625. $ctx1.sendIdx["-"]=1;
  6626. self._assert_equals_($2,(1));
  6627. $ctx1.sendIdx["assert:equals:"]=2;
  6628. self._assert_equals_((-2).__minus((1)),(-3));
  6629. $ctx1.sendIdx["assert:equals:"]=3;
  6630. self._assert_equals_((12).__slash((2)),(6));
  6631. $ctx1.sendIdx["assert:equals:"]=4;
  6632. $3=(3).__star((4));
  6633. $ctx1.sendIdx["*"]=1;
  6634. self._assert_equals_($3,(12));
  6635. $ctx1.sendIdx["assert:equals:"]=5;
  6636. self._assert_equals_((7).__slash_slash((2)),(3));
  6637. $ctx1.sendIdx["assert:equals:"]=6;
  6638. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6639. $ctx1.sendIdx["assert:equals:"]=7;
  6640. $5=(1).__plus((2));
  6641. $ctx1.sendIdx["+"]=2;
  6642. $4=_st($5).__star((3));
  6643. $ctx1.sendIdx["*"]=2;
  6644. self._assert_equals_($4,(9));
  6645. $ctx1.sendIdx["assert:equals:"]=8;
  6646. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6647. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6648. args: [],
  6649. 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",
  6650. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6651. referencedClasses: []
  6652. }),
  6653. globals.NumberTest);
  6654. smalltalk.addMethod(
  6655. smalltalk.method({
  6656. selector: "testAsNumber",
  6657. protocol: 'tests',
  6658. fn: function (){
  6659. var self=this;
  6660. return smalltalk.withContext(function($ctx1) {
  6661. self._assert_equals_((3)._asNumber(),(3));
  6662. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6663. args: [],
  6664. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6665. messageSends: ["assert:equals:", "asNumber"],
  6666. referencedClasses: []
  6667. }),
  6668. globals.NumberTest);
  6669. smalltalk.addMethod(
  6670. smalltalk.method({
  6671. selector: "testCeiling",
  6672. protocol: 'tests',
  6673. fn: function (){
  6674. var self=this;
  6675. return smalltalk.withContext(function($ctx1) {
  6676. var $1,$2;
  6677. $1=(1.2)._ceiling();
  6678. $ctx1.sendIdx["ceiling"]=1;
  6679. self._assert_equals_($1,(2));
  6680. $ctx1.sendIdx["assert:equals:"]=1;
  6681. $2=(-1.2)._ceiling();
  6682. $ctx1.sendIdx["ceiling"]=2;
  6683. self._assert_equals_($2,(-1));
  6684. $ctx1.sendIdx["assert:equals:"]=2;
  6685. self._assert_equals_((1)._ceiling(),(1));
  6686. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6687. args: [],
  6688. 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.",
  6689. messageSends: ["assert:equals:", "ceiling"],
  6690. referencedClasses: []
  6691. }),
  6692. globals.NumberTest);
  6693. smalltalk.addMethod(
  6694. smalltalk.method({
  6695. selector: "testComparison",
  6696. protocol: 'tests',
  6697. fn: function (){
  6698. var self=this;
  6699. return smalltalk.withContext(function($ctx1) {
  6700. var $1,$2,$3,$4;
  6701. $1=(3).__gt((2));
  6702. $ctx1.sendIdx[">"]=1;
  6703. self._assert_($1);
  6704. $ctx1.sendIdx["assert:"]=1;
  6705. $2=(2).__lt((3));
  6706. $ctx1.sendIdx["<"]=1;
  6707. self._assert_($2);
  6708. $ctx1.sendIdx["assert:"]=2;
  6709. self._deny_((3).__lt((2)));
  6710. $ctx1.sendIdx["deny:"]=1;
  6711. self._deny_((2).__gt((3)));
  6712. $3=(3).__gt_eq((3));
  6713. $ctx1.sendIdx[">="]=1;
  6714. self._assert_($3);
  6715. $ctx1.sendIdx["assert:"]=3;
  6716. self._assert_((3.1).__gt_eq((3)));
  6717. $ctx1.sendIdx["assert:"]=4;
  6718. $4=(3).__lt_eq((3));
  6719. $ctx1.sendIdx["<="]=1;
  6720. self._assert_($4);
  6721. $ctx1.sendIdx["assert:"]=5;
  6722. self._assert_((3).__lt_eq((3.1)));
  6723. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6724. args: [],
  6725. 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",
  6726. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6727. referencedClasses: []
  6728. }),
  6729. globals.NumberTest);
  6730. smalltalk.addMethod(
  6731. smalltalk.method({
  6732. selector: "testCopying",
  6733. protocol: 'tests',
  6734. fn: function (){
  6735. var self=this;
  6736. return smalltalk.withContext(function($ctx1) {
  6737. var $1;
  6738. $1=_st((1)._copy()).__eq_eq((1));
  6739. $ctx1.sendIdx["=="]=1;
  6740. self._assert_($1);
  6741. $ctx1.sendIdx["assert:"]=1;
  6742. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6743. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6744. args: [],
  6745. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6746. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6747. referencedClasses: []
  6748. }),
  6749. globals.NumberTest);
  6750. smalltalk.addMethod(
  6751. smalltalk.method({
  6752. selector: "testEquality",
  6753. protocol: 'tests',
  6754. fn: function (){
  6755. var self=this;
  6756. return smalltalk.withContext(function($ctx1) {
  6757. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6758. $1=(1).__eq((1));
  6759. $ctx1.sendIdx["="]=1;
  6760. self._assert_($1);
  6761. $ctx1.sendIdx["assert:"]=1;
  6762. $2=(0).__eq((0));
  6763. $ctx1.sendIdx["="]=2;
  6764. self._assert_($2);
  6765. $ctx1.sendIdx["assert:"]=2;
  6766. $3=(1).__eq((0));
  6767. $ctx1.sendIdx["="]=3;
  6768. self._deny_($3);
  6769. $ctx1.sendIdx["deny:"]=1;
  6770. $5=(1)._yourself();
  6771. $ctx1.sendIdx["yourself"]=1;
  6772. $4=_st($5).__eq((1));
  6773. $ctx1.sendIdx["="]=4;
  6774. self._assert_($4);
  6775. $ctx1.sendIdx["assert:"]=3;
  6776. $7=(1)._yourself();
  6777. $ctx1.sendIdx["yourself"]=2;
  6778. $6=(1).__eq($7);
  6779. $ctx1.sendIdx["="]=5;
  6780. self._assert_($6);
  6781. $ctx1.sendIdx["assert:"]=4;
  6782. $9=(1)._yourself();
  6783. $ctx1.sendIdx["yourself"]=3;
  6784. $8=_st($9).__eq((1)._yourself());
  6785. $ctx1.sendIdx["="]=6;
  6786. self._assert_($8);
  6787. $10=(0).__eq(false);
  6788. $ctx1.sendIdx["="]=7;
  6789. self._deny_($10);
  6790. $ctx1.sendIdx["deny:"]=2;
  6791. $11=false.__eq((0));
  6792. $ctx1.sendIdx["="]=8;
  6793. self._deny_($11);
  6794. $ctx1.sendIdx["deny:"]=3;
  6795. $12="".__eq((0));
  6796. $ctx1.sendIdx["="]=9;
  6797. self._deny_($12);
  6798. $ctx1.sendIdx["deny:"]=4;
  6799. self._deny_((0).__eq(""));
  6800. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6801. args: [],
  6802. 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 = ''",
  6803. messageSends: ["assert:", "=", "deny:", "yourself"],
  6804. referencedClasses: []
  6805. }),
  6806. globals.NumberTest);
  6807. smalltalk.addMethod(
  6808. smalltalk.method({
  6809. selector: "testFloor",
  6810. protocol: 'tests',
  6811. fn: function (){
  6812. var self=this;
  6813. return smalltalk.withContext(function($ctx1) {
  6814. var $1,$2;
  6815. $1=(1.2)._floor();
  6816. $ctx1.sendIdx["floor"]=1;
  6817. self._assert_equals_($1,(1));
  6818. $ctx1.sendIdx["assert:equals:"]=1;
  6819. $2=(-1.2)._floor();
  6820. $ctx1.sendIdx["floor"]=2;
  6821. self._assert_equals_($2,(-2));
  6822. $ctx1.sendIdx["assert:equals:"]=2;
  6823. self._assert_equals_((1)._floor(),(1));
  6824. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6825. args: [],
  6826. 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.",
  6827. messageSends: ["assert:equals:", "floor"],
  6828. referencedClasses: []
  6829. }),
  6830. globals.NumberTest);
  6831. smalltalk.addMethod(
  6832. smalltalk.method({
  6833. selector: "testHexNumbers",
  6834. protocol: 'tests',
  6835. fn: function (){
  6836. var self=this;
  6837. return smalltalk.withContext(function($ctx1) {
  6838. var $1,$2,$3,$4,$5;
  6839. self._assert_equals_((9),(9));
  6840. $ctx1.sendIdx["assert:equals:"]=1;
  6841. $1=(10)._truncated();
  6842. $ctx1.sendIdx["truncated"]=1;
  6843. self._assert_equals_($1,(10));
  6844. $ctx1.sendIdx["assert:equals:"]=2;
  6845. $2=(11)._truncated();
  6846. $ctx1.sendIdx["truncated"]=2;
  6847. self._assert_equals_($2,(11));
  6848. $ctx1.sendIdx["assert:equals:"]=3;
  6849. $3=(12)._truncated();
  6850. $ctx1.sendIdx["truncated"]=3;
  6851. self._assert_equals_($3,(12));
  6852. $ctx1.sendIdx["assert:equals:"]=4;
  6853. $4=(13)._truncated();
  6854. $ctx1.sendIdx["truncated"]=4;
  6855. self._assert_equals_($4,(13));
  6856. $ctx1.sendIdx["assert:equals:"]=5;
  6857. $5=(14)._truncated();
  6858. $ctx1.sendIdx["truncated"]=5;
  6859. self._assert_equals_($5,(14));
  6860. $ctx1.sendIdx["assert:equals:"]=6;
  6861. self._assert_equals_((15)._truncated(),(15));
  6862. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6863. args: [],
  6864. 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",
  6865. messageSends: ["assert:equals:", "truncated"],
  6866. referencedClasses: []
  6867. }),
  6868. globals.NumberTest);
  6869. smalltalk.addMethod(
  6870. smalltalk.method({
  6871. selector: "testIdentity",
  6872. protocol: 'tests',
  6873. fn: function (){
  6874. var self=this;
  6875. return smalltalk.withContext(function($ctx1) {
  6876. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6877. $1=(1).__eq_eq((1));
  6878. $ctx1.sendIdx["=="]=1;
  6879. self._assert_($1);
  6880. $ctx1.sendIdx["assert:"]=1;
  6881. $2=(0).__eq_eq((0));
  6882. $ctx1.sendIdx["=="]=2;
  6883. self._assert_($2);
  6884. $ctx1.sendIdx["assert:"]=2;
  6885. $3=(1).__eq_eq((0));
  6886. $ctx1.sendIdx["=="]=3;
  6887. self._deny_($3);
  6888. $ctx1.sendIdx["deny:"]=1;
  6889. $5=(1)._yourself();
  6890. $ctx1.sendIdx["yourself"]=1;
  6891. $4=_st($5).__eq_eq((1));
  6892. $ctx1.sendIdx["=="]=4;
  6893. self._assert_($4);
  6894. $ctx1.sendIdx["assert:"]=3;
  6895. $7=(1)._yourself();
  6896. $ctx1.sendIdx["yourself"]=2;
  6897. $6=(1).__eq_eq($7);
  6898. $ctx1.sendIdx["=="]=5;
  6899. self._assert_($6);
  6900. $ctx1.sendIdx["assert:"]=4;
  6901. $9=(1)._yourself();
  6902. $ctx1.sendIdx["yourself"]=3;
  6903. $8=_st($9).__eq_eq((1)._yourself());
  6904. $ctx1.sendIdx["=="]=6;
  6905. self._assert_($8);
  6906. self._deny_((1).__eq_eq((2)));
  6907. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6908. args: [],
  6909. 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",
  6910. messageSends: ["assert:", "==", "deny:", "yourself"],
  6911. referencedClasses: []
  6912. }),
  6913. globals.NumberTest);
  6914. smalltalk.addMethod(
  6915. smalltalk.method({
  6916. selector: "testInvalidHexNumbers",
  6917. protocol: 'tests',
  6918. fn: function (){
  6919. var self=this;
  6920. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6921. return smalltalk.withContext(function($ctx1) {
  6922. self._should_raise_((function(){
  6923. return smalltalk.withContext(function($ctx2) {
  6924. return (16)._rG();
  6925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6926. $ctx1.sendIdx["should:raise:"]=1;
  6927. self._should_raise_((function(){
  6928. return smalltalk.withContext(function($ctx2) {
  6929. return (16)._rg();
  6930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6931. $ctx1.sendIdx["should:raise:"]=2;
  6932. self._should_raise_((function(){
  6933. return smalltalk.withContext(function($ctx2) {
  6934. return (16)._rH();
  6935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6936. $ctx1.sendIdx["should:raise:"]=3;
  6937. self._should_raise_((function(){
  6938. return smalltalk.withContext(function($ctx2) {
  6939. return (16)._rh();
  6940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6941. $ctx1.sendIdx["should:raise:"]=4;
  6942. self._should_raise_((function(){
  6943. return smalltalk.withContext(function($ctx2) {
  6944. return (16)._rI();
  6945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6946. $ctx1.sendIdx["should:raise:"]=5;
  6947. self._should_raise_((function(){
  6948. return smalltalk.withContext(function($ctx2) {
  6949. return (16)._ri();
  6950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6951. $ctx1.sendIdx["should:raise:"]=6;
  6952. self._should_raise_((function(){
  6953. return smalltalk.withContext(function($ctx2) {
  6954. return (16)._rJ();
  6955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6956. $ctx1.sendIdx["should:raise:"]=7;
  6957. self._should_raise_((function(){
  6958. return smalltalk.withContext(function($ctx2) {
  6959. return (16)._rj();
  6960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6961. $ctx1.sendIdx["should:raise:"]=8;
  6962. self._should_raise_((function(){
  6963. return smalltalk.withContext(function($ctx2) {
  6964. return (16)._rK();
  6965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6966. $ctx1.sendIdx["should:raise:"]=9;
  6967. self._should_raise_((function(){
  6968. return smalltalk.withContext(function($ctx2) {
  6969. return (16)._rk();
  6970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6971. $ctx1.sendIdx["should:raise:"]=10;
  6972. self._should_raise_((function(){
  6973. return smalltalk.withContext(function($ctx2) {
  6974. return (16)._rL();
  6975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6976. $ctx1.sendIdx["should:raise:"]=11;
  6977. self._should_raise_((function(){
  6978. return smalltalk.withContext(function($ctx2) {
  6979. return (16)._rl();
  6980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6981. $ctx1.sendIdx["should:raise:"]=12;
  6982. self._should_raise_((function(){
  6983. return smalltalk.withContext(function($ctx2) {
  6984. return (16)._rM();
  6985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6986. $ctx1.sendIdx["should:raise:"]=13;
  6987. self._should_raise_((function(){
  6988. return smalltalk.withContext(function($ctx2) {
  6989. return (16)._rm();
  6990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6991. $ctx1.sendIdx["should:raise:"]=14;
  6992. self._should_raise_((function(){
  6993. return smalltalk.withContext(function($ctx2) {
  6994. return (16)._rN();
  6995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6996. $ctx1.sendIdx["should:raise:"]=15;
  6997. self._should_raise_((function(){
  6998. return smalltalk.withContext(function($ctx2) {
  6999. return (16)._rn();
  7000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  7001. $ctx1.sendIdx["should:raise:"]=16;
  7002. self._should_raise_((function(){
  7003. return smalltalk.withContext(function($ctx2) {
  7004. return (16)._rO();
  7005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  7006. $ctx1.sendIdx["should:raise:"]=17;
  7007. self._should_raise_((function(){
  7008. return smalltalk.withContext(function($ctx2) {
  7009. return (16)._ro();
  7010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  7011. $ctx1.sendIdx["should:raise:"]=18;
  7012. self._should_raise_((function(){
  7013. return smalltalk.withContext(function($ctx2) {
  7014. return (16)._rP();
  7015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  7016. $ctx1.sendIdx["should:raise:"]=19;
  7017. self._should_raise_((function(){
  7018. return smalltalk.withContext(function($ctx2) {
  7019. return (16)._rp();
  7020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  7021. $ctx1.sendIdx["should:raise:"]=20;
  7022. self._should_raise_((function(){
  7023. return smalltalk.withContext(function($ctx2) {
  7024. return (16)._rQ();
  7025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  7026. $ctx1.sendIdx["should:raise:"]=21;
  7027. self._should_raise_((function(){
  7028. return smalltalk.withContext(function($ctx2) {
  7029. return (16)._rq();
  7030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  7031. $ctx1.sendIdx["should:raise:"]=22;
  7032. self._should_raise_((function(){
  7033. return smalltalk.withContext(function($ctx2) {
  7034. return (16)._rR();
  7035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  7036. $ctx1.sendIdx["should:raise:"]=23;
  7037. self._should_raise_((function(){
  7038. return smalltalk.withContext(function($ctx2) {
  7039. return (16)._rr();
  7040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  7041. $ctx1.sendIdx["should:raise:"]=24;
  7042. self._should_raise_((function(){
  7043. return smalltalk.withContext(function($ctx2) {
  7044. return (16)._rS();
  7045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  7046. $ctx1.sendIdx["should:raise:"]=25;
  7047. self._should_raise_((function(){
  7048. return smalltalk.withContext(function($ctx2) {
  7049. return (16)._rs();
  7050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  7051. $ctx1.sendIdx["should:raise:"]=26;
  7052. self._should_raise_((function(){
  7053. return smalltalk.withContext(function($ctx2) {
  7054. return (16)._rT();
  7055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  7056. $ctx1.sendIdx["should:raise:"]=27;
  7057. self._should_raise_((function(){
  7058. return smalltalk.withContext(function($ctx2) {
  7059. return (16)._rt();
  7060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  7061. $ctx1.sendIdx["should:raise:"]=28;
  7062. self._should_raise_((function(){
  7063. return smalltalk.withContext(function($ctx2) {
  7064. return (16)._rU();
  7065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  7066. $ctx1.sendIdx["should:raise:"]=29;
  7067. self._should_raise_((function(){
  7068. return smalltalk.withContext(function($ctx2) {
  7069. return (16)._ru();
  7070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  7071. $ctx1.sendIdx["should:raise:"]=30;
  7072. self._should_raise_((function(){
  7073. return smalltalk.withContext(function($ctx2) {
  7074. return (16)._rV();
  7075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  7076. $ctx1.sendIdx["should:raise:"]=31;
  7077. self._should_raise_((function(){
  7078. return smalltalk.withContext(function($ctx2) {
  7079. return (16)._rv();
  7080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  7081. $ctx1.sendIdx["should:raise:"]=32;
  7082. self._should_raise_((function(){
  7083. return smalltalk.withContext(function($ctx2) {
  7084. return (16)._rW();
  7085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  7086. $ctx1.sendIdx["should:raise:"]=33;
  7087. self._should_raise_((function(){
  7088. return smalltalk.withContext(function($ctx2) {
  7089. return (16)._rw();
  7090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  7091. $ctx1.sendIdx["should:raise:"]=34;
  7092. self._should_raise_((function(){
  7093. return smalltalk.withContext(function($ctx2) {
  7094. return (16)._rX();
  7095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  7096. $ctx1.sendIdx["should:raise:"]=35;
  7097. self._should_raise_((function(){
  7098. return smalltalk.withContext(function($ctx2) {
  7099. return (16)._rx();
  7100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  7101. $ctx1.sendIdx["should:raise:"]=36;
  7102. self._should_raise_((function(){
  7103. return smalltalk.withContext(function($ctx2) {
  7104. return (16)._rY();
  7105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7106. $ctx1.sendIdx["should:raise:"]=37;
  7107. self._should_raise_((function(){
  7108. return smalltalk.withContext(function($ctx2) {
  7109. return (16)._ry();
  7110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7111. $ctx1.sendIdx["should:raise:"]=38;
  7112. self._should_raise_((function(){
  7113. return smalltalk.withContext(function($ctx2) {
  7114. return (16)._rZ();
  7115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7116. $ctx1.sendIdx["should:raise:"]=39;
  7117. self._should_raise_((function(){
  7118. return smalltalk.withContext(function($ctx2) {
  7119. return (16)._rz();
  7120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7121. $ctx1.sendIdx["should:raise:"]=40;
  7122. self._should_raise_((function(){
  7123. return smalltalk.withContext(function($ctx2) {
  7124. return (11259375)._Z();
  7125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7126. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  7127. args: [],
  7128. 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.",
  7129. 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"],
  7130. referencedClasses: ["MessageNotUnderstood"]
  7131. }),
  7132. globals.NumberTest);
  7133. smalltalk.addMethod(
  7134. smalltalk.method({
  7135. selector: "testLog",
  7136. protocol: 'tests',
  7137. fn: function (){
  7138. var self=this;
  7139. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7140. return smalltalk.withContext(function($ctx1) {
  7141. self._assert_equals_((10000)._log(),(4));
  7142. $ctx1.sendIdx["assert:equals:"]=1;
  7143. self._assert_equals_((512)._log_((2)),(9));
  7144. $ctx1.sendIdx["assert:equals:"]=2;
  7145. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7146. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  7147. args: [],
  7148. 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.",
  7149. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7150. referencedClasses: ["Number"]
  7151. }),
  7152. globals.NumberTest);
  7153. smalltalk.addMethod(
  7154. smalltalk.method({
  7155. selector: "testMinMax",
  7156. protocol: 'tests',
  7157. fn: function (){
  7158. var self=this;
  7159. return smalltalk.withContext(function($ctx1) {
  7160. self._assert_equals_((2)._max_((5)),(5));
  7161. $ctx1.sendIdx["assert:equals:"]=1;
  7162. self._assert_equals_((2)._min_((5)),(2));
  7163. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7164. args: [],
  7165. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7166. messageSends: ["assert:equals:", "max:", "min:"],
  7167. referencedClasses: []
  7168. }),
  7169. globals.NumberTest);
  7170. smalltalk.addMethod(
  7171. smalltalk.method({
  7172. selector: "testNegated",
  7173. protocol: 'tests',
  7174. fn: function (){
  7175. var self=this;
  7176. return smalltalk.withContext(function($ctx1) {
  7177. var $1;
  7178. $1=(3)._negated();
  7179. $ctx1.sendIdx["negated"]=1;
  7180. self._assert_equals_($1,(-3));
  7181. $ctx1.sendIdx["assert:equals:"]=1;
  7182. self._assert_equals_((-3)._negated(),(3));
  7183. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7184. args: [],
  7185. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7186. messageSends: ["assert:equals:", "negated"],
  7187. referencedClasses: []
  7188. }),
  7189. globals.NumberTest);
  7190. smalltalk.addMethod(
  7191. smalltalk.method({
  7192. selector: "testPrintShowingDecimalPlaces",
  7193. protocol: 'tests',
  7194. fn: function (){
  7195. var self=this;
  7196. return smalltalk.withContext(function($ctx1) {
  7197. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7198. $1=(23)._printShowingDecimalPlaces_((2));
  7199. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7200. self._assert_equals_($1,"23.00");
  7201. $ctx1.sendIdx["assert:equals:"]=1;
  7202. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7203. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7204. self._assert_equals_($2,"23.57");
  7205. $ctx1.sendIdx["assert:equals:"]=2;
  7206. $4=(234.567)._negated();
  7207. $ctx1.sendIdx["negated"]=1;
  7208. $3=_st($4)._printShowingDecimalPlaces_((5));
  7209. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7210. self._assert_equals_($3,"-234.56700");
  7211. $ctx1.sendIdx["assert:equals:"]=3;
  7212. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7213. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7214. self._assert_equals_($5,"23");
  7215. $ctx1.sendIdx["assert:equals:"]=4;
  7216. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7217. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7218. self._assert_equals_($6,"24");
  7219. $ctx1.sendIdx["assert:equals:"]=5;
  7220. $8=(23.4567)._negated();
  7221. $ctx1.sendIdx["negated"]=2;
  7222. $7=_st($8)._printShowingDecimalPlaces_((0));
  7223. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7224. self._assert_equals_($7,"-23");
  7225. $ctx1.sendIdx["assert:equals:"]=6;
  7226. $10=(23.5567)._negated();
  7227. $ctx1.sendIdx["negated"]=3;
  7228. $9=_st($10)._printShowingDecimalPlaces_((0));
  7229. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7230. self._assert_equals_($9,"-24");
  7231. $ctx1.sendIdx["assert:equals:"]=7;
  7232. $11=(100000000)._printShowingDecimalPlaces_((1));
  7233. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7234. self._assert_equals_($11,"100000000.0");
  7235. $ctx1.sendIdx["assert:equals:"]=8;
  7236. $12=(0.98)._printShowingDecimalPlaces_((5));
  7237. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7238. self._assert_equals_($12,"0.98000");
  7239. $ctx1.sendIdx["assert:equals:"]=9;
  7240. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7241. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7242. self._assert_equals_($13,"-0.98");
  7243. $ctx1.sendIdx["assert:equals:"]=10;
  7244. $14=(2.567)._printShowingDecimalPlaces_((2));
  7245. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7246. self._assert_equals_($14,"2.57");
  7247. $ctx1.sendIdx["assert:equals:"]=11;
  7248. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7249. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7250. self._assert_equals_($15,"-2.57");
  7251. $ctx1.sendIdx["assert:equals:"]=12;
  7252. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7253. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7254. args: [],
  7255. 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'.",
  7256. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7257. referencedClasses: []
  7258. }),
  7259. globals.NumberTest);
  7260. smalltalk.addMethod(
  7261. smalltalk.method({
  7262. selector: "testRaisedTo",
  7263. protocol: 'tests',
  7264. fn: function (){
  7265. var self=this;
  7266. return smalltalk.withContext(function($ctx1) {
  7267. var $1,$2,$3;
  7268. $1=(2)._raisedTo_((4));
  7269. $ctx1.sendIdx["raisedTo:"]=1;
  7270. self._assert_equals_($1,(16));
  7271. $ctx1.sendIdx["assert:equals:"]=1;
  7272. $2=(2)._raisedTo_((0));
  7273. $ctx1.sendIdx["raisedTo:"]=2;
  7274. self._assert_equals_($2,(1));
  7275. $ctx1.sendIdx["assert:equals:"]=2;
  7276. $3=(2)._raisedTo_((-3));
  7277. $ctx1.sendIdx["raisedTo:"]=3;
  7278. self._assert_equals_($3,(0.125));
  7279. $ctx1.sendIdx["assert:equals:"]=3;
  7280. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7281. $ctx1.sendIdx["assert:equals:"]=4;
  7282. self._assert_equals_((2).__star_star((4)),(16));
  7283. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7284. args: [],
  7285. 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.",
  7286. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7287. referencedClasses: []
  7288. }),
  7289. globals.NumberTest);
  7290. smalltalk.addMethod(
  7291. smalltalk.method({
  7292. selector: "testRounded",
  7293. protocol: 'tests',
  7294. fn: function (){
  7295. var self=this;
  7296. return smalltalk.withContext(function($ctx1) {
  7297. var $1,$2;
  7298. $1=(3)._rounded();
  7299. $ctx1.sendIdx["rounded"]=1;
  7300. self._assert_equals_($1,(3));
  7301. $ctx1.sendIdx["assert:equals:"]=1;
  7302. $2=(3.212)._rounded();
  7303. $ctx1.sendIdx["rounded"]=2;
  7304. self._assert_equals_($2,(3));
  7305. $ctx1.sendIdx["assert:equals:"]=2;
  7306. self._assert_equals_((3.51)._rounded(),(4));
  7307. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7308. args: [],
  7309. 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",
  7310. messageSends: ["assert:equals:", "rounded"],
  7311. referencedClasses: []
  7312. }),
  7313. globals.NumberTest);
  7314. smalltalk.addMethod(
  7315. smalltalk.method({
  7316. selector: "testSign",
  7317. protocol: 'tests',
  7318. fn: function (){
  7319. var self=this;
  7320. return smalltalk.withContext(function($ctx1) {
  7321. var $1,$2;
  7322. $1=(5)._sign();
  7323. $ctx1.sendIdx["sign"]=1;
  7324. self._assert_equals_($1,(1));
  7325. $ctx1.sendIdx["assert:equals:"]=1;
  7326. $2=(0)._sign();
  7327. $ctx1.sendIdx["sign"]=2;
  7328. self._assert_equals_($2,(0));
  7329. $ctx1.sendIdx["assert:equals:"]=2;
  7330. self._assert_equals_((-1.4)._sign(),(-1));
  7331. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7332. args: [],
  7333. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7334. messageSends: ["assert:equals:", "sign"],
  7335. referencedClasses: []
  7336. }),
  7337. globals.NumberTest);
  7338. smalltalk.addMethod(
  7339. smalltalk.method({
  7340. selector: "testSqrt",
  7341. protocol: 'tests',
  7342. fn: function (){
  7343. var self=this;
  7344. return smalltalk.withContext(function($ctx1) {
  7345. var $1;
  7346. $1=(4)._sqrt();
  7347. $ctx1.sendIdx["sqrt"]=1;
  7348. self._assert_equals_($1,(2));
  7349. $ctx1.sendIdx["assert:equals:"]=1;
  7350. self._assert_equals_((16)._sqrt(),(4));
  7351. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7352. args: [],
  7353. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7354. messageSends: ["assert:equals:", "sqrt"],
  7355. referencedClasses: []
  7356. }),
  7357. globals.NumberTest);
  7358. smalltalk.addMethod(
  7359. smalltalk.method({
  7360. selector: "testSquared",
  7361. protocol: 'tests',
  7362. fn: function (){
  7363. var self=this;
  7364. return smalltalk.withContext(function($ctx1) {
  7365. self._assert_equals_((4)._squared(),(16));
  7366. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7367. args: [],
  7368. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7369. messageSends: ["assert:equals:", "squared"],
  7370. referencedClasses: []
  7371. }),
  7372. globals.NumberTest);
  7373. smalltalk.addMethod(
  7374. smalltalk.method({
  7375. selector: "testTimesRepeat",
  7376. protocol: 'tests',
  7377. fn: function (){
  7378. var self=this;
  7379. var i;
  7380. return smalltalk.withContext(function($ctx1) {
  7381. i=(0);
  7382. (0)._timesRepeat_((function(){
  7383. return smalltalk.withContext(function($ctx2) {
  7384. i=_st(i).__plus((1));
  7385. $ctx2.sendIdx["+"]=1;
  7386. return i;
  7387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7388. $ctx1.sendIdx["timesRepeat:"]=1;
  7389. self._assert_equals_(i,(0));
  7390. $ctx1.sendIdx["assert:equals:"]=1;
  7391. (5)._timesRepeat_((function(){
  7392. return smalltalk.withContext(function($ctx2) {
  7393. i=_st(i).__plus((1));
  7394. return i;
  7395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7396. self._assert_equals_(i,(5));
  7397. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7398. args: [],
  7399. 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",
  7400. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7401. referencedClasses: []
  7402. }),
  7403. globals.NumberTest);
  7404. smalltalk.addMethod(
  7405. smalltalk.method({
  7406. selector: "testTo",
  7407. protocol: 'tests',
  7408. fn: function (){
  7409. var self=this;
  7410. return smalltalk.withContext(function($ctx1) {
  7411. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7412. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7413. args: [],
  7414. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7415. messageSends: ["assert:equals:", "to:"],
  7416. referencedClasses: []
  7417. }),
  7418. globals.NumberTest);
  7419. smalltalk.addMethod(
  7420. smalltalk.method({
  7421. selector: "testToBy",
  7422. protocol: 'tests',
  7423. fn: function (){
  7424. var self=this;
  7425. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7426. return smalltalk.withContext(function($ctx1) {
  7427. var $1;
  7428. $1=(0)._to_by_((6),(2));
  7429. $ctx1.sendIdx["to:by:"]=1;
  7430. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7431. self._should_raise_((function(){
  7432. return smalltalk.withContext(function($ctx2) {
  7433. return (1)._to_by_((4),(0));
  7434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7435. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7436. args: [],
  7437. 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",
  7438. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7439. referencedClasses: ["Error"]
  7440. }),
  7441. globals.NumberTest);
  7442. smalltalk.addMethod(
  7443. smalltalk.method({
  7444. selector: "testTrigonometry",
  7445. protocol: 'tests',
  7446. fn: function (){
  7447. var self=this;
  7448. return smalltalk.withContext(function($ctx1) {
  7449. self._assert_equals_((0)._cos(),(1));
  7450. $ctx1.sendIdx["assert:equals:"]=1;
  7451. self._assert_equals_((0)._sin(),(0));
  7452. $ctx1.sendIdx["assert:equals:"]=2;
  7453. self._assert_equals_((0)._tan(),(0));
  7454. $ctx1.sendIdx["assert:equals:"]=3;
  7455. self._assert_equals_((1)._arcCos(),(0));
  7456. $ctx1.sendIdx["assert:equals:"]=4;
  7457. self._assert_equals_((0)._arcSin(),(0));
  7458. $ctx1.sendIdx["assert:equals:"]=5;
  7459. self._assert_equals_((0)._arcTan(),(0));
  7460. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7461. args: [],
  7462. 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.",
  7463. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7464. referencedClasses: []
  7465. }),
  7466. globals.NumberTest);
  7467. smalltalk.addMethod(
  7468. smalltalk.method({
  7469. selector: "testTruncated",
  7470. protocol: 'tests',
  7471. fn: function (){
  7472. var self=this;
  7473. return smalltalk.withContext(function($ctx1) {
  7474. var $1,$2;
  7475. $1=(3)._truncated();
  7476. $ctx1.sendIdx["truncated"]=1;
  7477. self._assert_equals_($1,(3));
  7478. $ctx1.sendIdx["assert:equals:"]=1;
  7479. $2=(3.212)._truncated();
  7480. $ctx1.sendIdx["truncated"]=2;
  7481. self._assert_equals_($2,(3));
  7482. $ctx1.sendIdx["assert:equals:"]=2;
  7483. self._assert_equals_((3.51)._truncated(),(3));
  7484. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7485. args: [],
  7486. 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",
  7487. messageSends: ["assert:equals:", "truncated"],
  7488. referencedClasses: []
  7489. }),
  7490. globals.NumberTest);
  7491. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7492. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7493. smalltalk.addMethod(
  7494. smalltalk.method({
  7495. selector: "foo",
  7496. protocol: 'not yet classified',
  7497. fn: function (){
  7498. var self=this;
  7499. var $1;
  7500. $1=self["@foo"];
  7501. return $1;
  7502. },
  7503. args: [],
  7504. source: "foo\x0a\x09^ foo",
  7505. messageSends: [],
  7506. referencedClasses: []
  7507. }),
  7508. globals.ObjectMock);
  7509. smalltalk.addMethod(
  7510. smalltalk.method({
  7511. selector: "foo:",
  7512. protocol: 'not yet classified',
  7513. fn: function (anObject){
  7514. var self=this;
  7515. self["@foo"]=anObject;
  7516. return self},
  7517. args: ["anObject"],
  7518. source: "foo: anObject\x0a\x09foo := anObject",
  7519. messageSends: [],
  7520. referencedClasses: []
  7521. }),
  7522. globals.ObjectMock);
  7523. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7524. smalltalk.addMethod(
  7525. smalltalk.method({
  7526. selector: "notDefined",
  7527. protocol: 'tests',
  7528. fn: function (){
  7529. var self=this;
  7530. return smalltalk.withContext(function($ctx1) {
  7531. return void 0;;
  7532. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7533. args: [],
  7534. source: "notDefined\x0a\x09<return void 0;>",
  7535. messageSends: [],
  7536. referencedClasses: []
  7537. }),
  7538. globals.ObjectTest);
  7539. smalltalk.addMethod(
  7540. smalltalk.method({
  7541. selector: "testBasicAccess",
  7542. protocol: 'tests',
  7543. fn: function (){
  7544. var self=this;
  7545. var o;
  7546. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7547. return smalltalk.withContext(function($ctx1) {
  7548. var $1;
  7549. o=_st($Object())._new();
  7550. _st(o)._basicAt_put_("a",(1));
  7551. $1=_st(o)._basicAt_("a");
  7552. $ctx1.sendIdx["basicAt:"]=1;
  7553. self._assert_equals_($1,(1));
  7554. $ctx1.sendIdx["assert:equals:"]=1;
  7555. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7556. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7557. args: [],
  7558. 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",
  7559. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7560. referencedClasses: ["Object"]
  7561. }),
  7562. globals.ObjectTest);
  7563. smalltalk.addMethod(
  7564. smalltalk.method({
  7565. selector: "testBasicPerform",
  7566. protocol: 'tests',
  7567. fn: function (){
  7568. var self=this;
  7569. var o;
  7570. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7571. return smalltalk.withContext(function($ctx1) {
  7572. o=_st($Object())._new();
  7573. _st(o)._basicAt_put_("func",(function(){
  7574. return "hello";
  7575. }));
  7576. $ctx1.sendIdx["basicAt:put:"]=1;
  7577. _st(o)._basicAt_put_("func2",(function(a){
  7578. return smalltalk.withContext(function($ctx2) {
  7579. return _st(a).__plus((1));
  7580. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7581. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7582. $ctx1.sendIdx["assert:equals:"]=1;
  7583. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7584. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7585. args: [],
  7586. 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",
  7587. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7588. referencedClasses: ["Object"]
  7589. }),
  7590. globals.ObjectTest);
  7591. smalltalk.addMethod(
  7592. smalltalk.method({
  7593. selector: "testDNU",
  7594. protocol: 'tests',
  7595. fn: function (){
  7596. var self=this;
  7597. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7598. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7599. return smalltalk.withContext(function($ctx1) {
  7600. self._should_raise_((function(){
  7601. return smalltalk.withContext(function($ctx2) {
  7602. return _st(_st($Object())._new())._foo();
  7603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7604. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7605. args: [],
  7606. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7607. messageSends: ["should:raise:", "foo", "new"],
  7608. referencedClasses: ["Object", "MessageNotUnderstood"]
  7609. }),
  7610. globals.ObjectTest);
  7611. smalltalk.addMethod(
  7612. smalltalk.method({
  7613. selector: "testEquality",
  7614. protocol: 'tests',
  7615. fn: function (){
  7616. var self=this;
  7617. var o;
  7618. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7619. return smalltalk.withContext(function($ctx1) {
  7620. var $1,$2,$4,$3;
  7621. o=_st($Object())._new();
  7622. $ctx1.sendIdx["new"]=1;
  7623. $1=_st(o).__eq(_st($Object())._new());
  7624. $ctx1.sendIdx["="]=1;
  7625. self._deny_($1);
  7626. $2=_st(o).__eq(o);
  7627. $ctx1.sendIdx["="]=2;
  7628. self._assert_($2);
  7629. $ctx1.sendIdx["assert:"]=1;
  7630. $4=_st(o)._yourself();
  7631. $ctx1.sendIdx["yourself"]=1;
  7632. $3=_st($4).__eq(o);
  7633. $ctx1.sendIdx["="]=3;
  7634. self._assert_($3);
  7635. $ctx1.sendIdx["assert:"]=2;
  7636. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7637. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7638. args: [],
  7639. 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)",
  7640. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7641. referencedClasses: ["Object"]
  7642. }),
  7643. globals.ObjectTest);
  7644. smalltalk.addMethod(
  7645. smalltalk.method({
  7646. selector: "testHalt",
  7647. protocol: 'tests',
  7648. fn: function (){
  7649. var self=this;
  7650. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7651. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7652. return smalltalk.withContext(function($ctx1) {
  7653. self._should_raise_((function(){
  7654. return smalltalk.withContext(function($ctx2) {
  7655. return _st(_st($Object())._new())._halt();
  7656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7657. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7658. args: [],
  7659. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7660. messageSends: ["should:raise:", "halt", "new"],
  7661. referencedClasses: ["Object", "Error"]
  7662. }),
  7663. globals.ObjectTest);
  7664. smalltalk.addMethod(
  7665. smalltalk.method({
  7666. selector: "testIdentity",
  7667. protocol: 'tests',
  7668. fn: function (){
  7669. var self=this;
  7670. var o;
  7671. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7672. return smalltalk.withContext(function($ctx1) {
  7673. var $1,$2,$4,$3;
  7674. o=_st($Object())._new();
  7675. $ctx1.sendIdx["new"]=1;
  7676. $1=_st(o).__eq_eq(_st($Object())._new());
  7677. $ctx1.sendIdx["=="]=1;
  7678. self._deny_($1);
  7679. $2=_st(o).__eq_eq(o);
  7680. $ctx1.sendIdx["=="]=2;
  7681. self._assert_($2);
  7682. $ctx1.sendIdx["assert:"]=1;
  7683. $4=_st(o)._yourself();
  7684. $ctx1.sendIdx["yourself"]=1;
  7685. $3=_st($4).__eq_eq(o);
  7686. $ctx1.sendIdx["=="]=3;
  7687. self._assert_($3);
  7688. $ctx1.sendIdx["assert:"]=2;
  7689. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7690. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7691. args: [],
  7692. 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",
  7693. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7694. referencedClasses: ["Object"]
  7695. }),
  7696. globals.ObjectTest);
  7697. smalltalk.addMethod(
  7698. smalltalk.method({
  7699. selector: "testIfNil",
  7700. protocol: 'tests',
  7701. fn: function (){
  7702. var self=this;
  7703. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7704. return smalltalk.withContext(function($ctx1) {
  7705. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7706. $2=_st($Object())._new();
  7707. $ctx1.sendIdx["new"]=1;
  7708. $1=_st($2)._isNil();
  7709. self._deny_($1);
  7710. $ctx1.sendIdx["deny:"]=1;
  7711. $5=_st($Object())._new();
  7712. $ctx1.sendIdx["new"]=2;
  7713. if(($receiver = $5) == null || $receiver.isNil){
  7714. $4=true;
  7715. } else {
  7716. $4=$5;
  7717. };
  7718. $3=_st($4).__eq(true);
  7719. self._deny_($3);
  7720. $7=_st($Object())._new();
  7721. $ctx1.sendIdx["new"]=3;
  7722. if(($receiver = $7) == null || $receiver.isNil){
  7723. $6=$7;
  7724. } else {
  7725. $6=true;
  7726. };
  7727. self._assert_equals_($6,true);
  7728. $ctx1.sendIdx["assert:equals:"]=1;
  7729. $9=_st($Object())._new();
  7730. $ctx1.sendIdx["new"]=4;
  7731. if(($receiver = $9) == null || $receiver.isNil){
  7732. $8=false;
  7733. } else {
  7734. $8=true;
  7735. };
  7736. self._assert_equals_($8,true);
  7737. $ctx1.sendIdx["assert:equals:"]=2;
  7738. $11=_st($Object())._new();
  7739. if(($receiver = $11) == null || $receiver.isNil){
  7740. $10=false;
  7741. } else {
  7742. $10=true;
  7743. };
  7744. self._assert_equals_($10,true);
  7745. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7746. args: [],
  7747. 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",
  7748. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7749. referencedClasses: ["Object"]
  7750. }),
  7751. globals.ObjectTest);
  7752. smalltalk.addMethod(
  7753. smalltalk.method({
  7754. selector: "testInstVars",
  7755. protocol: 'tests',
  7756. fn: function (){
  7757. var self=this;
  7758. var o;
  7759. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7760. return smalltalk.withContext(function($ctx1) {
  7761. var $1,$2;
  7762. o=_st($ObjectMock())._new();
  7763. $1=_st(o)._instVarAt_("foo");
  7764. $ctx1.sendIdx["instVarAt:"]=1;
  7765. self._assert_equals_($1,nil);
  7766. $ctx1.sendIdx["assert:equals:"]=1;
  7767. _st(o)._instVarAt_put_("foo",(1));
  7768. $2=_st(o)._instVarAt_("foo");
  7769. $ctx1.sendIdx["instVarAt:"]=2;
  7770. self._assert_equals_($2,(1));
  7771. $ctx1.sendIdx["assert:equals:"]=2;
  7772. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7773. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7774. args: [],
  7775. 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",
  7776. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7777. referencedClasses: ["ObjectMock"]
  7778. }),
  7779. globals.ObjectTest);
  7780. smalltalk.addMethod(
  7781. smalltalk.method({
  7782. selector: "testNilUndefined",
  7783. protocol: 'tests',
  7784. fn: function (){
  7785. var self=this;
  7786. return smalltalk.withContext(function($ctx1) {
  7787. self._assert_equals_(self._notDefined(),nil);
  7788. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7789. args: [],
  7790. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7791. messageSends: ["assert:equals:", "notDefined"],
  7792. referencedClasses: []
  7793. }),
  7794. globals.ObjectTest);
  7795. smalltalk.addMethod(
  7796. smalltalk.method({
  7797. selector: "testYourself",
  7798. protocol: 'tests',
  7799. fn: function (){
  7800. var self=this;
  7801. var o;
  7802. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7803. return smalltalk.withContext(function($ctx1) {
  7804. o=_st($ObjectMock())._new();
  7805. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7806. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7807. args: [],
  7808. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7809. messageSends: ["new", "assert:", "==", "yourself"],
  7810. referencedClasses: ["ObjectMock"]
  7811. }),
  7812. globals.ObjectTest);
  7813. smalltalk.addMethod(
  7814. smalltalk.method({
  7815. selector: "testidentityHash",
  7816. protocol: 'tests',
  7817. fn: function (){
  7818. var self=this;
  7819. var o1,o2;
  7820. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7821. return smalltalk.withContext(function($ctx1) {
  7822. var $2,$3,$1,$5,$4;
  7823. o1=_st($Object())._new();
  7824. $ctx1.sendIdx["new"]=1;
  7825. o2=_st($Object())._new();
  7826. $2=_st(o1)._identityHash();
  7827. $ctx1.sendIdx["identityHash"]=1;
  7828. $3=_st(o1)._identityHash();
  7829. $ctx1.sendIdx["identityHash"]=2;
  7830. $1=_st($2).__eq_eq($3);
  7831. $ctx1.sendIdx["=="]=1;
  7832. self._assert_($1);
  7833. $5=_st(o1)._identityHash();
  7834. $ctx1.sendIdx["identityHash"]=3;
  7835. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7836. self._deny_($4);
  7837. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7838. args: [],
  7839. 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",
  7840. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7841. referencedClasses: ["Object"]
  7842. }),
  7843. globals.ObjectTest);
  7844. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7845. smalltalk.addMethod(
  7846. smalltalk.method({
  7847. selector: "testAccessing",
  7848. protocol: 'tests',
  7849. fn: function (){
  7850. var self=this;
  7851. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7852. return smalltalk.withContext(function($ctx1) {
  7853. var $2,$1,$3,$6,$5,$4;
  7854. $2=_st($Point())._x_y_((3),(4));
  7855. $ctx1.sendIdx["x:y:"]=1;
  7856. $1=_st($2)._x();
  7857. $ctx1.sendIdx["x"]=1;
  7858. self._assert_equals_($1,(3));
  7859. $ctx1.sendIdx["assert:equals:"]=1;
  7860. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7861. $ctx1.sendIdx["y"]=1;
  7862. self._assert_equals_($3,(4));
  7863. $ctx1.sendIdx["assert:equals:"]=2;
  7864. $6=_st($Point())._new();
  7865. $ctx1.sendIdx["new"]=1;
  7866. $5=_st($6)._x_((3));
  7867. $4=_st($5)._x();
  7868. self._assert_equals_($4,(3));
  7869. $ctx1.sendIdx["assert:equals:"]=3;
  7870. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7871. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7872. args: [],
  7873. 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",
  7874. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7875. referencedClasses: ["Point"]
  7876. }),
  7877. globals.PointTest);
  7878. smalltalk.addMethod(
  7879. smalltalk.method({
  7880. selector: "testArithmetic",
  7881. protocol: 'tests',
  7882. fn: function (){
  7883. var self=this;
  7884. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7885. return smalltalk.withContext(function($ctx1) {
  7886. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7887. $2=(3).__at((4));
  7888. $ctx1.sendIdx["@"]=1;
  7889. $3=(3).__at((4));
  7890. $ctx1.sendIdx["@"]=2;
  7891. $1=_st($2).__star($3);
  7892. $4=_st($Point())._x_y_((9),(16));
  7893. $ctx1.sendIdx["x:y:"]=1;
  7894. self._assert_equals_($1,$4);
  7895. $ctx1.sendIdx["assert:equals:"]=1;
  7896. $6=(3).__at((4));
  7897. $ctx1.sendIdx["@"]=3;
  7898. $7=(3).__at((4));
  7899. $ctx1.sendIdx["@"]=4;
  7900. $5=_st($6).__plus($7);
  7901. $8=_st($Point())._x_y_((6),(8));
  7902. $ctx1.sendIdx["x:y:"]=2;
  7903. self._assert_equals_($5,$8);
  7904. $ctx1.sendIdx["assert:equals:"]=2;
  7905. $10=(3).__at((4));
  7906. $ctx1.sendIdx["@"]=5;
  7907. $11=(3).__at((4));
  7908. $ctx1.sendIdx["@"]=6;
  7909. $9=_st($10).__minus($11);
  7910. $12=_st($Point())._x_y_((0),(0));
  7911. $ctx1.sendIdx["x:y:"]=3;
  7912. self._assert_equals_($9,$12);
  7913. $ctx1.sendIdx["assert:equals:"]=3;
  7914. $14=(6).__at((8));
  7915. $ctx1.sendIdx["@"]=7;
  7916. $13=_st($14).__slash((3).__at((4)));
  7917. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7918. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7919. args: [],
  7920. 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)",
  7921. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7922. referencedClasses: ["Point"]
  7923. }),
  7924. globals.PointTest);
  7925. smalltalk.addMethod(
  7926. smalltalk.method({
  7927. selector: "testAt",
  7928. protocol: 'tests',
  7929. fn: function (){
  7930. var self=this;
  7931. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7932. return smalltalk.withContext(function($ctx1) {
  7933. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7934. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7935. args: [],
  7936. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7937. messageSends: ["assert:equals:", "@", "x:y:"],
  7938. referencedClasses: ["Point"]
  7939. }),
  7940. globals.PointTest);
  7941. smalltalk.addMethod(
  7942. smalltalk.method({
  7943. selector: "testComparison",
  7944. protocol: 'tests',
  7945. fn: function (){
  7946. var self=this;
  7947. return smalltalk.withContext(function($ctx1) {
  7948. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7949. $2=(3).__at((4));
  7950. $ctx1.sendIdx["@"]=1;
  7951. $3=(4).__at((5));
  7952. $ctx1.sendIdx["@"]=2;
  7953. $1=_st($2).__lt($3);
  7954. $ctx1.sendIdx["<"]=1;
  7955. self._assert_($1);
  7956. $ctx1.sendIdx["assert:"]=1;
  7957. $5=(3).__at((4));
  7958. $ctx1.sendIdx["@"]=3;
  7959. $6=(4).__at((4));
  7960. $ctx1.sendIdx["@"]=4;
  7961. $4=_st($5).__lt($6);
  7962. self._deny_($4);
  7963. $ctx1.sendIdx["deny:"]=1;
  7964. $8=(4).__at((5));
  7965. $ctx1.sendIdx["@"]=5;
  7966. $9=(4).__at((5));
  7967. $ctx1.sendIdx["@"]=6;
  7968. $7=_st($8).__lt_eq($9);
  7969. $ctx1.sendIdx["<="]=1;
  7970. self._assert_($7);
  7971. $ctx1.sendIdx["assert:"]=2;
  7972. $11=(4).__at((5));
  7973. $ctx1.sendIdx["@"]=7;
  7974. $12=(3).__at((5));
  7975. $ctx1.sendIdx["@"]=8;
  7976. $10=_st($11).__lt_eq($12);
  7977. self._deny_($10);
  7978. $ctx1.sendIdx["deny:"]=2;
  7979. $14=(5).__at((6));
  7980. $ctx1.sendIdx["@"]=9;
  7981. $15=(4).__at((5));
  7982. $ctx1.sendIdx["@"]=10;
  7983. $13=_st($14).__gt($15);
  7984. $ctx1.sendIdx[">"]=1;
  7985. self._assert_($13);
  7986. $ctx1.sendIdx["assert:"]=3;
  7987. $17=(5).__at((6));
  7988. $ctx1.sendIdx["@"]=11;
  7989. $18=(6).__at((6));
  7990. $ctx1.sendIdx["@"]=12;
  7991. $16=_st($17).__gt($18);
  7992. self._deny_($16);
  7993. $ctx1.sendIdx["deny:"]=3;
  7994. $20=(4).__at((5));
  7995. $ctx1.sendIdx["@"]=13;
  7996. $21=(4).__at((5));
  7997. $ctx1.sendIdx["@"]=14;
  7998. $19=_st($20).__gt_eq($21);
  7999. $ctx1.sendIdx[">="]=1;
  8000. self._assert_($19);
  8001. $23=(4).__at((5));
  8002. $ctx1.sendIdx["@"]=15;
  8003. $22=_st($23).__gt_eq((5).__at((5)));
  8004. self._deny_($22);
  8005. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  8006. args: [],
  8007. 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)",
  8008. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  8009. referencedClasses: []
  8010. }),
  8011. globals.PointTest);
  8012. smalltalk.addMethod(
  8013. smalltalk.method({
  8014. selector: "testEgality",
  8015. protocol: 'tests',
  8016. fn: function (){
  8017. var self=this;
  8018. return smalltalk.withContext(function($ctx1) {
  8019. var $2,$3,$1,$5,$4;
  8020. $2=(3).__at((4));
  8021. $ctx1.sendIdx["@"]=1;
  8022. $3=(3).__at((4));
  8023. $ctx1.sendIdx["@"]=2;
  8024. $1=_st($2).__eq($3);
  8025. $ctx1.sendIdx["="]=1;
  8026. self._assert_($1);
  8027. $5=(3).__at((5));
  8028. $ctx1.sendIdx["@"]=3;
  8029. $4=_st($5).__eq((3).__at((6)));
  8030. self._deny_($4);
  8031. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  8032. args: [],
  8033. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  8034. messageSends: ["assert:", "=", "@", "deny:"],
  8035. referencedClasses: []
  8036. }),
  8037. globals.PointTest);
  8038. smalltalk.addMethod(
  8039. smalltalk.method({
  8040. selector: "testNew",
  8041. protocol: 'tests',
  8042. fn: function (){
  8043. var self=this;
  8044. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8045. return smalltalk.withContext(function($ctx1) {
  8046. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  8047. $3=_st($Point())._new();
  8048. $ctx1.sendIdx["new"]=1;
  8049. $2=_st($3)._x_((3));
  8050. $ctx1.sendIdx["x:"]=1;
  8051. $1=_st($2)._y();
  8052. $ctx1.sendIdx["y"]=1;
  8053. self._assert_equals_($1,nil);
  8054. $ctx1.sendIdx["assert:equals:"]=1;
  8055. $7=_st($Point())._new();
  8056. $ctx1.sendIdx["new"]=2;
  8057. $6=_st($7)._x_((3));
  8058. $5=_st($6)._x();
  8059. $ctx1.sendIdx["x"]=1;
  8060. $4=_st($5).__eq((0));
  8061. $ctx1.sendIdx["="]=1;
  8062. self._deny_($4);
  8063. $ctx1.sendIdx["deny:"]=1;
  8064. $10=_st($Point())._new();
  8065. $ctx1.sendIdx["new"]=3;
  8066. $9=_st($10)._y_((4));
  8067. $ctx1.sendIdx["y:"]=1;
  8068. $8=_st($9)._x();
  8069. self._assert_equals_($8,nil);
  8070. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  8071. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  8072. args: [],
  8073. 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",
  8074. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  8075. referencedClasses: ["Point"]
  8076. }),
  8077. globals.PointTest);
  8078. smalltalk.addMethod(
  8079. smalltalk.method({
  8080. selector: "testTranslateBy",
  8081. protocol: 'tests',
  8082. fn: function (){
  8083. var self=this;
  8084. return smalltalk.withContext(function($ctx1) {
  8085. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  8086. $2=(3).__at((3));
  8087. $ctx1.sendIdx["@"]=1;
  8088. $3=(0).__at((1));
  8089. $ctx1.sendIdx["@"]=2;
  8090. $1=_st($2)._translateBy_($3);
  8091. $ctx1.sendIdx["translateBy:"]=1;
  8092. $4=(3).__at((4));
  8093. $ctx1.sendIdx["@"]=3;
  8094. self._assert_equals_($1,$4);
  8095. $ctx1.sendIdx["assert:equals:"]=1;
  8096. $6=(3).__at((3));
  8097. $ctx1.sendIdx["@"]=4;
  8098. $8=(1)._negated();
  8099. $ctx1.sendIdx["negated"]=1;
  8100. $7=(0).__at($8);
  8101. $ctx1.sendIdx["@"]=5;
  8102. $5=_st($6)._translateBy_($7);
  8103. $ctx1.sendIdx["translateBy:"]=2;
  8104. $9=(3).__at((2));
  8105. $ctx1.sendIdx["@"]=6;
  8106. self._assert_equals_($5,$9);
  8107. $ctx1.sendIdx["assert:equals:"]=2;
  8108. $11=(3).__at((3));
  8109. $ctx1.sendIdx["@"]=7;
  8110. $12=(2).__at((3));
  8111. $ctx1.sendIdx["@"]=8;
  8112. $10=_st($11)._translateBy_($12);
  8113. $ctx1.sendIdx["translateBy:"]=3;
  8114. $13=(5).__at((6));
  8115. $ctx1.sendIdx["@"]=9;
  8116. self._assert_equals_($10,$13);
  8117. $ctx1.sendIdx["assert:equals:"]=3;
  8118. $15=(3).__at((3));
  8119. $ctx1.sendIdx["@"]=10;
  8120. $16=_st((3)._negated()).__at((0));
  8121. $ctx1.sendIdx["@"]=11;
  8122. $14=_st($15)._translateBy_($16);
  8123. self._assert_equals_($14,(0).__at((3)));
  8124. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  8125. args: [],
  8126. 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.",
  8127. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  8128. referencedClasses: []
  8129. }),
  8130. globals.PointTest);
  8131. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  8132. smalltalk.addMethod(
  8133. smalltalk.method({
  8134. selector: "testNextIfAbsent",
  8135. protocol: 'tests',
  8136. fn: function (){
  8137. var self=this;
  8138. var queue;
  8139. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8140. return smalltalk.withContext(function($ctx1) {
  8141. var $2,$1;
  8142. queue=_st($Queue())._new();
  8143. _st(queue)._nextPut_("index1");
  8144. $2=_st(queue)._nextIfAbsent_("empty");
  8145. $ctx1.sendIdx["nextIfAbsent:"]=1;
  8146. $1=_st($2).__eq("index1");
  8147. $ctx1.sendIdx["="]=1;
  8148. self._assert_($1);
  8149. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  8150. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  8151. args: [],
  8152. 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'",
  8153. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  8154. referencedClasses: ["Queue"]
  8155. }),
  8156. globals.QueueTest);
  8157. smalltalk.addMethod(
  8158. smalltalk.method({
  8159. selector: "testQueueNext",
  8160. protocol: 'tests',
  8161. fn: function (){
  8162. var self=this;
  8163. var queue;
  8164. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8165. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8166. return smalltalk.withContext(function($ctx1) {
  8167. var $1,$2,$4,$3,$6,$5;
  8168. queue=_st($Queue())._new();
  8169. $1=queue;
  8170. _st($1)._nextPut_("index1");
  8171. $ctx1.sendIdx["nextPut:"]=1;
  8172. $2=_st($1)._nextPut_("index2");
  8173. $4=_st(queue)._next();
  8174. $ctx1.sendIdx["next"]=1;
  8175. $3=_st($4).__eq("index1");
  8176. $ctx1.sendIdx["="]=1;
  8177. self._assert_($3);
  8178. $6=_st(queue)._next();
  8179. $ctx1.sendIdx["next"]=2;
  8180. $5=_st($6).__eq("index");
  8181. self._deny_($5);
  8182. self._should_raise_((function(){
  8183. return smalltalk.withContext(function($ctx2) {
  8184. return _st(queue)._next();
  8185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8186. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  8187. args: [],
  8188. 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",
  8189. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8190. referencedClasses: ["Queue", "Error"]
  8191. }),
  8192. globals.QueueTest);
  8193. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8194. smalltalk.addMethod(
  8195. smalltalk.method({
  8196. selector: "testAtRandomNumber",
  8197. protocol: 'tests',
  8198. fn: function (){
  8199. var self=this;
  8200. var val;
  8201. return smalltalk.withContext(function($ctx1) {
  8202. (100)._timesRepeat_((function(){
  8203. return smalltalk.withContext(function($ctx2) {
  8204. val=(10)._atRandom();
  8205. val;
  8206. self._assert_(_st(val).__gt((0)));
  8207. $ctx2.sendIdx["assert:"]=1;
  8208. return self._assert_(_st(val).__lt((11)));
  8209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8210. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8211. args: [],
  8212. 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]",
  8213. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8214. referencedClasses: []
  8215. }),
  8216. globals.RandomTest);
  8217. smalltalk.addMethod(
  8218. smalltalk.method({
  8219. selector: "testAtRandomSequenceableCollection",
  8220. protocol: 'tests',
  8221. fn: function (){
  8222. var self=this;
  8223. var val;
  8224. return smalltalk.withContext(function($ctx1) {
  8225. var $3,$4,$2,$1;
  8226. (100)._timesRepeat_((function(){
  8227. return smalltalk.withContext(function($ctx2) {
  8228. val="abc"._atRandom();
  8229. val;
  8230. $3=_st(val).__eq("a");
  8231. $ctx2.sendIdx["="]=1;
  8232. $4=_st(val).__eq("b");
  8233. $ctx2.sendIdx["="]=2;
  8234. $2=_st($3).__or($4);
  8235. $1=_st($2).__or(_st(val).__eq("c"));
  8236. $ctx2.sendIdx["|"]=1;
  8237. return self._assert_($1);
  8238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8239. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8240. args: [],
  8241. 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].",
  8242. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8243. referencedClasses: []
  8244. }),
  8245. globals.RandomTest);
  8246. smalltalk.addMethod(
  8247. smalltalk.method({
  8248. selector: "textNext",
  8249. protocol: 'tests',
  8250. fn: function (){
  8251. var self=this;
  8252. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8253. return smalltalk.withContext(function($ctx1) {
  8254. var $1;
  8255. (10000)._timesRepeat_((function(){
  8256. var current,next;
  8257. return smalltalk.withContext(function($ctx2) {
  8258. next=_st(_st($Random())._new())._next();
  8259. next;
  8260. self._assert_(_st(next).__gt_eq((0)));
  8261. $ctx2.sendIdx["assert:"]=1;
  8262. self._assert_(_st(next).__lt((1)));
  8263. $1=_st(current).__eq(next);
  8264. $ctx2.sendIdx["="]=1;
  8265. self._deny_($1);
  8266. return _st(next).__eq(current);
  8267. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8268. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8269. args: [],
  8270. 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 ]",
  8271. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8272. referencedClasses: ["Random"]
  8273. }),
  8274. globals.RandomTest);
  8275. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8276. smalltalk.addMethod(
  8277. smalltalk.method({
  8278. selector: "collectionClass",
  8279. protocol: 'accessing',
  8280. fn: function (){
  8281. var self=this;
  8282. return smalltalk.withContext(function($ctx1) {
  8283. var $1;
  8284. $1=_st(self._class())._collectionClass();
  8285. return $1;
  8286. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8287. args: [],
  8288. source: "collectionClass\x0a\x09^ self class collectionClass",
  8289. messageSends: ["collectionClass", "class"],
  8290. referencedClasses: []
  8291. }),
  8292. globals.StreamTest);
  8293. smalltalk.addMethod(
  8294. smalltalk.method({
  8295. selector: "newCollection",
  8296. protocol: 'accessing',
  8297. fn: function (){
  8298. var self=this;
  8299. return smalltalk.withContext(function($ctx1) {
  8300. var $1;
  8301. $1=_st(self._collectionClass())._new();
  8302. return $1;
  8303. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8304. args: [],
  8305. source: "newCollection\x0a\x09^ self collectionClass new",
  8306. messageSends: ["new", "collectionClass"],
  8307. referencedClasses: []
  8308. }),
  8309. globals.StreamTest);
  8310. smalltalk.addMethod(
  8311. smalltalk.method({
  8312. selector: "newStream",
  8313. protocol: 'accessing',
  8314. fn: function (){
  8315. var self=this;
  8316. return smalltalk.withContext(function($ctx1) {
  8317. var $1;
  8318. $1=_st(_st(self._collectionClass())._new())._stream();
  8319. return $1;
  8320. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8321. args: [],
  8322. source: "newStream\x0a\x09^ self collectionClass new stream",
  8323. messageSends: ["stream", "new", "collectionClass"],
  8324. referencedClasses: []
  8325. }),
  8326. globals.StreamTest);
  8327. smalltalk.addMethod(
  8328. smalltalk.method({
  8329. selector: "testAtStartAtEnd",
  8330. protocol: 'tests',
  8331. fn: function (){
  8332. var self=this;
  8333. var stream;
  8334. return smalltalk.withContext(function($ctx1) {
  8335. var $1,$2,$3,$4;
  8336. stream=self._newStream();
  8337. $1=_st(stream)._atStart();
  8338. $ctx1.sendIdx["atStart"]=1;
  8339. self._assert_($1);
  8340. $ctx1.sendIdx["assert:"]=1;
  8341. $2=_st(stream)._atEnd();
  8342. $ctx1.sendIdx["atEnd"]=1;
  8343. self._assert_($2);
  8344. $ctx1.sendIdx["assert:"]=2;
  8345. _st(stream)._nextPutAll_(self._newCollection());
  8346. $3=_st(stream)._atEnd();
  8347. $ctx1.sendIdx["atEnd"]=2;
  8348. self._assert_($3);
  8349. $4=_st(stream)._atStart();
  8350. $ctx1.sendIdx["atStart"]=2;
  8351. self._deny_($4);
  8352. $ctx1.sendIdx["deny:"]=1;
  8353. _st(stream)._position_((1));
  8354. self._deny_(_st(stream)._atEnd());
  8355. $ctx1.sendIdx["deny:"]=2;
  8356. self._deny_(_st(stream)._atStart());
  8357. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8358. args: [],
  8359. 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",
  8360. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8361. referencedClasses: []
  8362. }),
  8363. globals.StreamTest);
  8364. smalltalk.addMethod(
  8365. smalltalk.method({
  8366. selector: "testContents",
  8367. protocol: 'tests',
  8368. fn: function (){
  8369. var self=this;
  8370. var stream;
  8371. return smalltalk.withContext(function($ctx1) {
  8372. var $1,$2;
  8373. stream=self._newStream();
  8374. $1=stream;
  8375. $2=self._newCollection();
  8376. $ctx1.sendIdx["newCollection"]=1;
  8377. _st($1)._nextPutAll_($2);
  8378. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8379. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8380. args: [],
  8381. 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",
  8382. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8383. referencedClasses: []
  8384. }),
  8385. globals.StreamTest);
  8386. smalltalk.addMethod(
  8387. smalltalk.method({
  8388. selector: "testIsEmpty",
  8389. protocol: 'tests',
  8390. fn: function (){
  8391. var self=this;
  8392. var stream;
  8393. return smalltalk.withContext(function($ctx1) {
  8394. var $1;
  8395. stream=self._newStream();
  8396. $1=_st(stream)._isEmpty();
  8397. $ctx1.sendIdx["isEmpty"]=1;
  8398. self._assert_($1);
  8399. _st(stream)._nextPutAll_(self._newCollection());
  8400. self._deny_(_st(stream)._isEmpty());
  8401. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8402. args: [],
  8403. 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",
  8404. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8405. referencedClasses: []
  8406. }),
  8407. globals.StreamTest);
  8408. smalltalk.addMethod(
  8409. smalltalk.method({
  8410. selector: "testPosition",
  8411. protocol: 'tests',
  8412. fn: function (){
  8413. var self=this;
  8414. var collection,stream;
  8415. return smalltalk.withContext(function($ctx1) {
  8416. var $1,$2,$3;
  8417. collection=self._newCollection();
  8418. stream=self._newStream();
  8419. _st(stream)._nextPutAll_(collection);
  8420. $1=_st(stream)._position();
  8421. $ctx1.sendIdx["position"]=1;
  8422. self._assert_equals_($1,_st(collection)._size());
  8423. $ctx1.sendIdx["assert:equals:"]=1;
  8424. _st(stream)._position_((0));
  8425. $2=_st(stream)._position();
  8426. $ctx1.sendIdx["position"]=2;
  8427. self._assert_equals_($2,(0));
  8428. $ctx1.sendIdx["assert:equals:"]=2;
  8429. _st(stream)._next();
  8430. $ctx1.sendIdx["next"]=1;
  8431. $3=_st(stream)._position();
  8432. $ctx1.sendIdx["position"]=3;
  8433. self._assert_equals_($3,(1));
  8434. $ctx1.sendIdx["assert:equals:"]=3;
  8435. _st(stream)._next();
  8436. self._assert_equals_(_st(stream)._position(),(2));
  8437. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8438. args: [],
  8439. 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",
  8440. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8441. referencedClasses: []
  8442. }),
  8443. globals.StreamTest);
  8444. smalltalk.addMethod(
  8445. smalltalk.method({
  8446. selector: "testReading",
  8447. protocol: 'tests',
  8448. fn: function (){
  8449. var self=this;
  8450. var stream,collection;
  8451. return smalltalk.withContext(function($ctx1) {
  8452. var $1,$2,$3;
  8453. collection=self._newCollection();
  8454. stream=self._newStream();
  8455. $1=stream;
  8456. _st($1)._nextPutAll_(collection);
  8457. $2=_st($1)._position_((0));
  8458. _st(collection)._do_((function(each){
  8459. return smalltalk.withContext(function($ctx2) {
  8460. $3=_st(stream)._next();
  8461. $ctx2.sendIdx["next"]=1;
  8462. return self._assert_equals_($3,each);
  8463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8464. self._assert_(_st(_st(stream)._next())._isNil());
  8465. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8466. args: [],
  8467. 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",
  8468. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8469. referencedClasses: []
  8470. }),
  8471. globals.StreamTest);
  8472. smalltalk.addMethod(
  8473. smalltalk.method({
  8474. selector: "testStreamContents",
  8475. protocol: 'tests',
  8476. fn: function (){
  8477. var self=this;
  8478. return self},
  8479. args: [],
  8480. source: "testStreamContents",
  8481. messageSends: [],
  8482. referencedClasses: []
  8483. }),
  8484. globals.StreamTest);
  8485. smalltalk.addMethod(
  8486. smalltalk.method({
  8487. selector: "testWrite",
  8488. protocol: 'tests',
  8489. fn: function (){
  8490. var self=this;
  8491. var stream,collection;
  8492. return smalltalk.withContext(function($ctx1) {
  8493. collection=self._newCollection();
  8494. stream=self._newStream();
  8495. _st(collection)._do_((function(each){
  8496. return smalltalk.withContext(function($ctx2) {
  8497. return _st(stream).__lt_lt(each);
  8498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8499. self._assert_equals_(_st(stream)._contents(),collection);
  8500. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8501. args: [],
  8502. 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",
  8503. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8504. referencedClasses: []
  8505. }),
  8506. globals.StreamTest);
  8507. smalltalk.addMethod(
  8508. smalltalk.method({
  8509. selector: "testWriting",
  8510. protocol: 'tests',
  8511. fn: function (){
  8512. var self=this;
  8513. var stream,collection;
  8514. return smalltalk.withContext(function($ctx1) {
  8515. var $1;
  8516. collection=self._newCollection();
  8517. stream=self._newStream();
  8518. $ctx1.sendIdx["newStream"]=1;
  8519. _st(collection)._do_((function(each){
  8520. return smalltalk.withContext(function($ctx2) {
  8521. return _st(stream)._nextPut_(each);
  8522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8523. $1=_st(stream)._contents();
  8524. $ctx1.sendIdx["contents"]=1;
  8525. self._assert_equals_($1,collection);
  8526. $ctx1.sendIdx["assert:equals:"]=1;
  8527. stream=self._newStream();
  8528. _st(stream)._nextPutAll_(collection);
  8529. self._assert_equals_(_st(stream)._contents(),collection);
  8530. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8531. args: [],
  8532. 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",
  8533. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8534. referencedClasses: []
  8535. }),
  8536. globals.StreamTest);
  8537. smalltalk.addMethod(
  8538. smalltalk.method({
  8539. selector: "collectionClass",
  8540. protocol: 'accessing',
  8541. fn: function (){
  8542. var self=this;
  8543. return nil;
  8544. },
  8545. args: [],
  8546. source: "collectionClass\x0a\x09^ nil",
  8547. messageSends: [],
  8548. referencedClasses: []
  8549. }),
  8550. globals.StreamTest.klass);
  8551. smalltalk.addMethod(
  8552. smalltalk.method({
  8553. selector: "isAbstract",
  8554. protocol: 'testing',
  8555. fn: function (){
  8556. var self=this;
  8557. return smalltalk.withContext(function($ctx1) {
  8558. var $1;
  8559. $1=_st(self._collectionClass())._isNil();
  8560. return $1;
  8561. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8562. args: [],
  8563. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8564. messageSends: ["isNil", "collectionClass"],
  8565. referencedClasses: []
  8566. }),
  8567. globals.StreamTest.klass);
  8568. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8569. smalltalk.addMethod(
  8570. smalltalk.method({
  8571. selector: "newCollection",
  8572. protocol: 'accessing',
  8573. fn: function (){
  8574. var self=this;
  8575. return smalltalk.withContext(function($ctx1) {
  8576. var $1;
  8577. $1=[true,(1),(3).__at((4)),"foo"];
  8578. return $1;
  8579. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8580. args: [],
  8581. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8582. messageSends: ["@"],
  8583. referencedClasses: []
  8584. }),
  8585. globals.ArrayStreamTest);
  8586. smalltalk.addMethod(
  8587. smalltalk.method({
  8588. selector: "collectionClass",
  8589. protocol: 'accessing',
  8590. fn: function (){
  8591. var self=this;
  8592. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8593. return $Array();
  8594. },
  8595. args: [],
  8596. source: "collectionClass\x0a\x09^ Array",
  8597. messageSends: [],
  8598. referencedClasses: ["Array"]
  8599. }),
  8600. globals.ArrayStreamTest.klass);
  8601. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8602. smalltalk.addMethod(
  8603. smalltalk.method({
  8604. selector: "newCollection",
  8605. protocol: 'accessing',
  8606. fn: function (){
  8607. var self=this;
  8608. return "hello world";
  8609. },
  8610. args: [],
  8611. source: "newCollection\x0a\x09^ 'hello world'",
  8612. messageSends: [],
  8613. referencedClasses: []
  8614. }),
  8615. globals.StringStreamTest);
  8616. smalltalk.addMethod(
  8617. smalltalk.method({
  8618. selector: "collectionClass",
  8619. protocol: 'accessing',
  8620. fn: function (){
  8621. var self=this;
  8622. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8623. return $String();
  8624. },
  8625. args: [],
  8626. source: "collectionClass\x0a\x09^ String",
  8627. messageSends: [],
  8628. referencedClasses: ["String"]
  8629. }),
  8630. globals.StringStreamTest.klass);
  8631. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8632. smalltalk.addMethod(
  8633. smalltalk.method({
  8634. selector: "testCopying",
  8635. protocol: 'tests',
  8636. fn: function (){
  8637. var self=this;
  8638. return smalltalk.withContext(function($ctx1) {
  8639. self._assert_equals_(nil._copy(),nil);
  8640. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8641. args: [],
  8642. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8643. messageSends: ["assert:equals:", "copy"],
  8644. referencedClasses: []
  8645. }),
  8646. globals.UndefinedTest);
  8647. smalltalk.addMethod(
  8648. smalltalk.method({
  8649. selector: "testDeepCopy",
  8650. protocol: 'tests',
  8651. fn: function (){
  8652. var self=this;
  8653. return smalltalk.withContext(function($ctx1) {
  8654. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8655. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8656. args: [],
  8657. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8658. messageSends: ["assert:", "=", "deepCopy"],
  8659. referencedClasses: []
  8660. }),
  8661. globals.UndefinedTest);
  8662. smalltalk.addMethod(
  8663. smalltalk.method({
  8664. selector: "testIfNil",
  8665. protocol: 'tests',
  8666. fn: function (){
  8667. var self=this;
  8668. return smalltalk.withContext(function($ctx1) {
  8669. var $1,$3,$2,$4,$6,$5,$receiver;
  8670. if(($receiver = nil) == null || $receiver.isNil){
  8671. $1=true;
  8672. } else {
  8673. $1=nil;
  8674. };
  8675. self._assert_equals_($1,true);
  8676. $ctx1.sendIdx["assert:equals:"]=1;
  8677. if(($receiver = nil) == null || $receiver.isNil){
  8678. $3=nil;
  8679. } else {
  8680. $3=true;
  8681. };
  8682. $2=_st($3).__eq(true);
  8683. $ctx1.sendIdx["="]=1;
  8684. self._deny_($2);
  8685. $ctx1.sendIdx["deny:"]=1;
  8686. if(($receiver = nil) == null || $receiver.isNil){
  8687. $4=true;
  8688. } else {
  8689. $4=false;
  8690. };
  8691. self._assert_equals_($4,true);
  8692. if(($receiver = nil) == null || $receiver.isNil){
  8693. $6=false;
  8694. } else {
  8695. $6=true;
  8696. };
  8697. $5=_st($6).__eq(true);
  8698. self._deny_($5);
  8699. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8700. args: [],
  8701. 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",
  8702. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8703. referencedClasses: []
  8704. }),
  8705. globals.UndefinedTest);
  8706. smalltalk.addMethod(
  8707. smalltalk.method({
  8708. selector: "testIsNil",
  8709. protocol: 'tests',
  8710. fn: function (){
  8711. var self=this;
  8712. return smalltalk.withContext(function($ctx1) {
  8713. self._assert_(nil._isNil());
  8714. self._deny_(nil._notNil());
  8715. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8716. args: [],
  8717. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8718. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8719. referencedClasses: []
  8720. }),
  8721. globals.UndefinedTest);
  8722. });