Kernel-Tests.js 319 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current 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 current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. 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 current 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 current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. 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 current 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 current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. 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)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. 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",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "isCollectionReadOnly",
  1305. protocol: 'testing',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. return false;
  1310. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. source: "isCollectionReadOnly\x0a\x09^ false",
  1313. messageSends: [],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "sampleNewValue",
  1320. protocol: 'fixture',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return "N";
  1325. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. 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'",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValueAsCollection",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. var $1;
  1340. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1341. return $1;
  1342. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1343. args: [],
  1344. source: "sampleNewValueAsCollection\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection,\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1345. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1346. referencedClasses: []
  1347. }),
  1348. smalltalk.CollectionTest);
  1349. smalltalk.addMethod(
  1350. smalltalk.method({
  1351. selector: "testAddAll",
  1352. protocol: 'tests',
  1353. fn: function (){
  1354. var self=this;
  1355. return smalltalk.withContext(function($ctx1) {
  1356. 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;
  1357. $2=self._collection();
  1358. $ctx1.sendIdx["collection"]=1;
  1359. $3=$2;
  1360. $5=self._collectionClass();
  1361. $ctx1.sendIdx["collectionClass"]=1;
  1362. $4=_st($5)._new();
  1363. $ctx1.sendIdx["new"]=1;
  1364. _st($3)._addAll_($4);
  1365. $ctx1.sendIdx["addAll:"]=1;
  1366. $6=_st($2)._yourself();
  1367. $ctx1.sendIdx["yourself"]=1;
  1368. $1=$6;
  1369. $7=self._collection();
  1370. $ctx1.sendIdx["collection"]=2;
  1371. self._assert_equals_($1,$7);
  1372. $ctx1.sendIdx["assert:equals:"]=1;
  1373. $10=self._collectionClass();
  1374. $ctx1.sendIdx["collectionClass"]=2;
  1375. $9=_st($10)._new();
  1376. $ctx1.sendIdx["new"]=2;
  1377. $11=$9;
  1378. $12=self._collection();
  1379. $ctx1.sendIdx["collection"]=3;
  1380. _st($11)._addAll_($12);
  1381. $ctx1.sendIdx["addAll:"]=2;
  1382. $13=_st($9)._yourself();
  1383. $ctx1.sendIdx["yourself"]=2;
  1384. $8=$13;
  1385. $14=self._collection();
  1386. $ctx1.sendIdx["collection"]=4;
  1387. self._assert_equals_($8,$14);
  1388. $ctx1.sendIdx["assert:equals:"]=2;
  1389. $17=self._collectionClass();
  1390. $ctx1.sendIdx["collectionClass"]=3;
  1391. $16=_st($17)._new();
  1392. $ctx1.sendIdx["new"]=3;
  1393. $18=$16;
  1394. $20=self._collectionClass();
  1395. $ctx1.sendIdx["collectionClass"]=4;
  1396. $19=_st($20)._new();
  1397. $ctx1.sendIdx["new"]=4;
  1398. _st($18)._addAll_($19);
  1399. $ctx1.sendIdx["addAll:"]=3;
  1400. $21=_st($16)._yourself();
  1401. $ctx1.sendIdx["yourself"]=3;
  1402. $15=$21;
  1403. self._assert_equals_($15,_st(self._collectionClass())._new());
  1404. $ctx1.sendIdx["assert:equals:"]=3;
  1405. $23=self._collection();
  1406. $ctx1.sendIdx["collection"]=5;
  1407. $24=$23;
  1408. $25=self._sampleNewValueAsCollection();
  1409. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1410. _st($24)._addAll_($25);
  1411. $ctx1.sendIdx["addAll:"]=4;
  1412. $26=_st($23)._yourself();
  1413. $ctx1.sendIdx["yourself"]=4;
  1414. $22=$26;
  1415. $27=self._collectionWithNewValue();
  1416. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1417. self._assert_equals_($22,$27);
  1418. $28=self._sampleNewValueAsCollection();
  1419. _st($28)._addAll_(self._collection());
  1420. $29=_st($28)._yourself();
  1421. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1422. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1423. args: [],
  1424. 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",
  1425. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1426. referencedClasses: []
  1427. }),
  1428. smalltalk.CollectionTest);
  1429. smalltalk.addMethod(
  1430. smalltalk.method({
  1431. selector: "testAllSatisfy",
  1432. protocol: 'tests',
  1433. fn: function (){
  1434. var self=this;
  1435. var collection,anyOne;
  1436. return smalltalk.withContext(function($ctx1) {
  1437. var $1;
  1438. collection=self._collection();
  1439. anyOne=_st(collection)._anyOne();
  1440. $1=_st(collection)._allSatisfy_((function(each){
  1441. return smalltalk.withContext(function($ctx2) {
  1442. return _st(collection)._includes_(each);
  1443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1444. $ctx1.sendIdx["allSatisfy:"]=1;
  1445. self._assert_($1);
  1446. self._deny_(_st(collection)._allSatisfy_((function(each){
  1447. return smalltalk.withContext(function($ctx2) {
  1448. return _st(each).__tild_eq(anyOne);
  1449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1450. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1451. args: [],
  1452. 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 ])",
  1453. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1454. referencedClasses: []
  1455. }),
  1456. smalltalk.CollectionTest);
  1457. smalltalk.addMethod(
  1458. smalltalk.method({
  1459. selector: "testAnyOne",
  1460. protocol: 'tests',
  1461. fn: function (){
  1462. var self=this;
  1463. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1464. return smalltalk.withContext(function($ctx1) {
  1465. var $2,$1;
  1466. self._should_raise_((function(){
  1467. return smalltalk.withContext(function($ctx2) {
  1468. return _st(_st(self._collectionClass())._new())._anyOne();
  1469. $ctx2.sendIdx["anyOne"]=1;
  1470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1471. $2=self._collection();
  1472. $ctx1.sendIdx["collection"]=1;
  1473. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1474. self._assert_($1);
  1475. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1476. args: [],
  1477. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1478. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1479. referencedClasses: ["Error"]
  1480. }),
  1481. smalltalk.CollectionTest);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "testAnySatisfy",
  1485. protocol: 'tests',
  1486. fn: function (){
  1487. var self=this;
  1488. var anyOne;
  1489. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1490. return smalltalk.withContext(function($ctx1) {
  1491. var $1,$3,$2;
  1492. $1=self._collection();
  1493. $ctx1.sendIdx["collection"]=1;
  1494. anyOne=_st($1)._anyOne();
  1495. $3=self._collection();
  1496. $ctx1.sendIdx["collection"]=2;
  1497. $2=_st($3)._anySatisfy_((function(each){
  1498. return smalltalk.withContext(function($ctx2) {
  1499. return _st(each).__eq(anyOne);
  1500. $ctx2.sendIdx["="]=1;
  1501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1502. $ctx1.sendIdx["anySatisfy:"]=1;
  1503. self._assert_($2);
  1504. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1505. return smalltalk.withContext(function($ctx2) {
  1506. return _st(each).__eq(_st($Object())._new());
  1507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1508. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1509. args: [],
  1510. 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 ])",
  1511. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1512. referencedClasses: ["Object"]
  1513. }),
  1514. smalltalk.CollectionTest);
  1515. smalltalk.addMethod(
  1516. smalltalk.method({
  1517. selector: "testAsArray",
  1518. protocol: 'tests',
  1519. fn: function (){
  1520. var self=this;
  1521. return smalltalk.withContext(function($ctx1) {
  1522. var $1;
  1523. $1=self._collection();
  1524. $ctx1.sendIdx["collection"]=1;
  1525. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1526. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1527. args: [],
  1528. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1529. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1530. referencedClasses: []
  1531. }),
  1532. smalltalk.CollectionTest);
  1533. smalltalk.addMethod(
  1534. smalltalk.method({
  1535. selector: "testAsOrderedCollection",
  1536. protocol: 'tests',
  1537. fn: function (){
  1538. var self=this;
  1539. return smalltalk.withContext(function($ctx1) {
  1540. var $1;
  1541. $1=self._collection();
  1542. $ctx1.sendIdx["collection"]=1;
  1543. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1544. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1545. args: [],
  1546. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1547. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.CollectionTest);
  1551. smalltalk.addMethod(
  1552. smalltalk.method({
  1553. selector: "testAsSet",
  1554. protocol: 'tests',
  1555. fn: function (){
  1556. var self=this;
  1557. var c,set;
  1558. return smalltalk.withContext(function($ctx1) {
  1559. c=self._collectionWithDuplicates();
  1560. set=_st(c)._asSet();
  1561. self._assert_equals_(_st(set)._size(),(5));
  1562. _st(c)._do_((function(each){
  1563. return smalltalk.withContext(function($ctx2) {
  1564. return self._assert_(_st(set)._includes_(each));
  1565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1566. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1567. args: [],
  1568. 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) ]",
  1569. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1570. referencedClasses: []
  1571. }),
  1572. smalltalk.CollectionTest);
  1573. smalltalk.addMethod(
  1574. smalltalk.method({
  1575. selector: "testCollect",
  1576. protocol: 'tests',
  1577. fn: function (){
  1578. var self=this;
  1579. return smalltalk.withContext(function($ctx1) {
  1580. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1581. $2=self._collection();
  1582. $ctx1.sendIdx["collection"]=1;
  1583. $1=_st($2)._collect_((function(each){
  1584. return smalltalk.withContext(function($ctx2) {
  1585. return each;
  1586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1587. $ctx1.sendIdx["collect:"]=1;
  1588. $3=self._collection();
  1589. $ctx1.sendIdx["collection"]=2;
  1590. self._assert_equals_($1,$3);
  1591. $ctx1.sendIdx["assert:equals:"]=1;
  1592. $5=self._collectionWithNewValue();
  1593. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1594. $4=_st($5)._collect_((function(each){
  1595. return smalltalk.withContext(function($ctx2) {
  1596. return each;
  1597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1598. $ctx1.sendIdx["collect:"]=2;
  1599. self._assert_equals_($4,self._collectionWithNewValue());
  1600. $ctx1.sendIdx["assert:equals:"]=2;
  1601. $8=self._collectionClass();
  1602. $ctx1.sendIdx["collectionClass"]=1;
  1603. $7=_st($8)._new();
  1604. $ctx1.sendIdx["new"]=1;
  1605. $6=_st($7)._collect_((function(each){
  1606. return smalltalk.withContext(function($ctx2) {
  1607. return _st(each)._printString();
  1608. $ctx2.sendIdx["printString"]=1;
  1609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1610. $ctx1.sendIdx["collect:"]=3;
  1611. self._assert_equals_($6,_st(self._collectionClass())._new());
  1612. $ctx1.sendIdx["assert:equals:"]=3;
  1613. $11=self._collection();
  1614. $ctx1.sendIdx["collection"]=3;
  1615. $10=_st($11)._collect_((function(){
  1616. return smalltalk.withContext(function($ctx2) {
  1617. return self._sampleNewValue();
  1618. $ctx2.sendIdx["sampleNewValue"]=1;
  1619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1620. $ctx1.sendIdx["collect:"]=4;
  1621. $9=_st($10)._detect_((function(){
  1622. return smalltalk.withContext(function($ctx2) {
  1623. return true;
  1624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1625. self._assert_equals_($9,self._sampleNewValue());
  1626. $ctx1.sendIdx["assert:equals:"]=4;
  1627. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1628. return smalltalk.withContext(function($ctx2) {
  1629. return _st(each)._printString();
  1630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1631. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1632. args: [],
  1633. 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",
  1634. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1635. referencedClasses: []
  1636. }),
  1637. smalltalk.CollectionTest);
  1638. smalltalk.addMethod(
  1639. smalltalk.method({
  1640. selector: "testComma",
  1641. protocol: 'tests',
  1642. fn: function (){
  1643. var self=this;
  1644. return smalltalk.withContext(function($ctx1) {
  1645. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1646. $2=self._collection();
  1647. $ctx1.sendIdx["collection"]=1;
  1648. $4=self._collectionClass();
  1649. $ctx1.sendIdx["collectionClass"]=1;
  1650. $3=_st($4)._new();
  1651. $ctx1.sendIdx["new"]=1;
  1652. $1=_st($2).__comma($3);
  1653. $ctx1.sendIdx[","]=1;
  1654. $5=self._collection();
  1655. $ctx1.sendIdx["collection"]=2;
  1656. self._assert_equals_($1,$5);
  1657. $ctx1.sendIdx["assert:equals:"]=1;
  1658. $8=self._collectionClass();
  1659. $ctx1.sendIdx["collectionClass"]=2;
  1660. $7=_st($8)._new();
  1661. $ctx1.sendIdx["new"]=2;
  1662. $9=self._collection();
  1663. $ctx1.sendIdx["collection"]=3;
  1664. $6=_st($7).__comma($9);
  1665. $ctx1.sendIdx[","]=2;
  1666. $10=self._collection();
  1667. $ctx1.sendIdx["collection"]=4;
  1668. self._assert_equals_($6,$10);
  1669. $ctx1.sendIdx["assert:equals:"]=2;
  1670. $13=self._collectionClass();
  1671. $ctx1.sendIdx["collectionClass"]=3;
  1672. $12=_st($13)._new();
  1673. $ctx1.sendIdx["new"]=3;
  1674. $15=self._collectionClass();
  1675. $ctx1.sendIdx["collectionClass"]=4;
  1676. $14=_st($15)._new();
  1677. $ctx1.sendIdx["new"]=4;
  1678. $11=_st($12).__comma($14);
  1679. $ctx1.sendIdx[","]=3;
  1680. self._assert_equals_($11,_st(self._collectionClass())._new());
  1681. $ctx1.sendIdx["assert:equals:"]=3;
  1682. $17=self._collection();
  1683. $ctx1.sendIdx["collection"]=5;
  1684. $18=self._sampleNewValueAsCollection();
  1685. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1686. $16=_st($17).__comma($18);
  1687. $ctx1.sendIdx[","]=4;
  1688. $19=self._collectionWithNewValue();
  1689. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1690. self._assert_equals_($16,$19);
  1691. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1692. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1693. args: [],
  1694. 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",
  1695. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1696. referencedClasses: []
  1697. }),
  1698. smalltalk.CollectionTest);
  1699. smalltalk.addMethod(
  1700. smalltalk.method({
  1701. selector: "testDetect",
  1702. protocol: 'tests',
  1703. fn: function (){
  1704. var self=this;
  1705. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1706. return smalltalk.withContext(function($ctx1) {
  1707. var $1,$2,$3,$4,$6,$5,$7;
  1708. self._shouldnt_raise_((function(){
  1709. return smalltalk.withContext(function($ctx2) {
  1710. $1=self._collection();
  1711. $ctx2.sendIdx["collection"]=1;
  1712. return _st($1)._detect_((function(){
  1713. return smalltalk.withContext(function($ctx3) {
  1714. return true;
  1715. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1716. $ctx2.sendIdx["detect:"]=1;
  1717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1718. self._should_raise_((function(){
  1719. return smalltalk.withContext(function($ctx2) {
  1720. $2=self._collection();
  1721. $ctx2.sendIdx["collection"]=2;
  1722. return _st($2)._detect_((function(){
  1723. return smalltalk.withContext(function($ctx3) {
  1724. return false;
  1725. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1726. $ctx2.sendIdx["detect:"]=2;
  1727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1728. $ctx1.sendIdx["should:raise:"]=1;
  1729. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1730. return smalltalk.withContext(function($ctx2) {
  1731. return true;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1733. $ctx1.sendIdx["detect:"]=3;
  1734. $4=self._sampleNewValue();
  1735. $ctx1.sendIdx["sampleNewValue"]=1;
  1736. self._assert_equals_($3,$4);
  1737. $ctx1.sendIdx["assert:equals:"]=1;
  1738. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1739. return smalltalk.withContext(function($ctx2) {
  1740. $6=self._sampleNewValue();
  1741. $ctx2.sendIdx["sampleNewValue"]=2;
  1742. return _st(each).__eq($6);
  1743. $ctx2.sendIdx["="]=1;
  1744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1745. $ctx1.sendIdx["detect:"]=4;
  1746. $7=self._sampleNewValue();
  1747. $ctx1.sendIdx["sampleNewValue"]=3;
  1748. self._assert_equals_($5,$7);
  1749. self._should_raise_((function(){
  1750. return smalltalk.withContext(function($ctx2) {
  1751. return _st(self._collection())._detect_((function(each){
  1752. return smalltalk.withContext(function($ctx3) {
  1753. return _st(each).__eq(self._sampleNewValue());
  1754. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1756. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1757. args: [],
  1758. 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",
  1759. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1760. referencedClasses: ["Error"]
  1761. }),
  1762. smalltalk.CollectionTest);
  1763. smalltalk.addMethod(
  1764. smalltalk.method({
  1765. selector: "testDetectIfNone",
  1766. protocol: 'tests',
  1767. fn: function (){
  1768. var self=this;
  1769. var sentinel;
  1770. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1771. return smalltalk.withContext(function($ctx1) {
  1772. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1773. sentinel=_st($Object())._new();
  1774. $3=self._collection();
  1775. $ctx1.sendIdx["collection"]=1;
  1776. $2=_st($3)._detect_ifNone_((function(){
  1777. return smalltalk.withContext(function($ctx2) {
  1778. return true;
  1779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1780. return smalltalk.withContext(function($ctx2) {
  1781. return sentinel;
  1782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1783. $ctx1.sendIdx["detect:ifNone:"]=1;
  1784. $1=_st($2).__tild_eq(sentinel);
  1785. self._assert_($1);
  1786. $5=self._collection();
  1787. $ctx1.sendIdx["collection"]=2;
  1788. $4=_st($5)._detect_ifNone_((function(){
  1789. return smalltalk.withContext(function($ctx2) {
  1790. return false;
  1791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return sentinel;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1795. $ctx1.sendIdx["detect:ifNone:"]=2;
  1796. self._assert_equals_($4,sentinel);
  1797. $ctx1.sendIdx["assert:equals:"]=1;
  1798. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1799. return smalltalk.withContext(function($ctx2) {
  1800. return true;
  1801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1802. return smalltalk.withContext(function($ctx2) {
  1803. return sentinel;
  1804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1805. $ctx1.sendIdx["detect:ifNone:"]=3;
  1806. $7=self._sampleNewValue();
  1807. $ctx1.sendIdx["sampleNewValue"]=1;
  1808. self._assert_equals_($6,$7);
  1809. $ctx1.sendIdx["assert:equals:"]=2;
  1810. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1811. return smalltalk.withContext(function($ctx2) {
  1812. $9=self._sampleNewValue();
  1813. $ctx2.sendIdx["sampleNewValue"]=2;
  1814. return _st(each).__eq($9);
  1815. $ctx2.sendIdx["="]=1;
  1816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=4;
  1821. $10=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=3;
  1823. self._assert_equals_($8,$10);
  1824. $ctx1.sendIdx["assert:equals:"]=3;
  1825. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. return _st(each).__eq(self._sampleNewValue());
  1828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1829. return smalltalk.withContext(function($ctx2) {
  1830. return sentinel;
  1831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1832. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1833. args: [],
  1834. 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",
  1835. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1836. referencedClasses: ["Object"]
  1837. }),
  1838. smalltalk.CollectionTest);
  1839. smalltalk.addMethod(
  1840. smalltalk.method({
  1841. selector: "testDo",
  1842. protocol: 'tests',
  1843. fn: function (){
  1844. var self=this;
  1845. var newCollection;
  1846. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1847. return smalltalk.withContext(function($ctx1) {
  1848. var $1,$2;
  1849. newCollection=_st($OrderedCollection())._new();
  1850. $ctx1.sendIdx["new"]=1;
  1851. $1=self._collection();
  1852. $ctx1.sendIdx["collection"]=1;
  1853. _st($1)._do_((function(each){
  1854. return smalltalk.withContext(function($ctx2) {
  1855. return _st(newCollection)._add_(each);
  1856. $ctx2.sendIdx["add:"]=1;
  1857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1858. $ctx1.sendIdx["do:"]=1;
  1859. self._assertSameContents_as_(self._collection(),newCollection);
  1860. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1861. newCollection=_st($OrderedCollection())._new();
  1862. $2=self._collectionWithDuplicates();
  1863. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1864. _st($2)._do_((function(each){
  1865. return smalltalk.withContext(function($ctx2) {
  1866. return _st(newCollection)._add_(each);
  1867. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1868. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1869. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1870. args: [],
  1871. 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",
  1872. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1873. referencedClasses: ["OrderedCollection"]
  1874. }),
  1875. smalltalk.CollectionTest);
  1876. smalltalk.addMethod(
  1877. smalltalk.method({
  1878. selector: "testIfEmptyFamily",
  1879. protocol: 'tests',
  1880. fn: function (){
  1881. var self=this;
  1882. return smalltalk.withContext(function($ctx1) {
  1883. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1884. $3=self._collectionClass();
  1885. $ctx1.sendIdx["collectionClass"]=1;
  1886. $2=_st($3)._new();
  1887. $ctx1.sendIdx["new"]=1;
  1888. $1=_st($2)._ifEmpty_((function(){
  1889. return smalltalk.withContext(function($ctx2) {
  1890. return (42);
  1891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1892. $ctx1.sendIdx["ifEmpty:"]=1;
  1893. self._assert_equals_($1,(42));
  1894. $ctx1.sendIdx["assert:equals:"]=1;
  1895. $5=self._collection();
  1896. $ctx1.sendIdx["collection"]=1;
  1897. $4=_st($5)._ifEmpty_((function(){
  1898. return smalltalk.withContext(function($ctx2) {
  1899. return (42);
  1900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1901. $6=self._collection();
  1902. $ctx1.sendIdx["collection"]=2;
  1903. self._assert_equals_($4,$6);
  1904. $ctx1.sendIdx["assert:equals:"]=2;
  1905. $9=self._collectionClass();
  1906. $ctx1.sendIdx["collectionClass"]=2;
  1907. $8=_st($9)._new();
  1908. $ctx1.sendIdx["new"]=2;
  1909. $7=_st($8)._ifNotEmpty_((function(){
  1910. return smalltalk.withContext(function($ctx2) {
  1911. return (42);
  1912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1913. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1914. $11=self._collectionClass();
  1915. $ctx1.sendIdx["collectionClass"]=3;
  1916. $10=_st($11)._new();
  1917. $ctx1.sendIdx["new"]=3;
  1918. self._assert_equals_($7,$10);
  1919. $ctx1.sendIdx["assert:equals:"]=3;
  1920. $13=self._collection();
  1921. $ctx1.sendIdx["collection"]=3;
  1922. $12=_st($13)._ifNotEmpty_((function(){
  1923. return smalltalk.withContext(function($ctx2) {
  1924. return (42);
  1925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1926. self._assert_equals_($12,(42));
  1927. $ctx1.sendIdx["assert:equals:"]=4;
  1928. $16=self._collectionClass();
  1929. $ctx1.sendIdx["collectionClass"]=4;
  1930. $15=_st($16)._new();
  1931. $ctx1.sendIdx["new"]=4;
  1932. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1933. return smalltalk.withContext(function($ctx2) {
  1934. return (42);
  1935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1936. return smalltalk.withContext(function($ctx2) {
  1937. return (999);
  1938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1939. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1940. self._assert_equals_($14,(42));
  1941. $ctx1.sendIdx["assert:equals:"]=5;
  1942. $18=self._collection();
  1943. $ctx1.sendIdx["collection"]=4;
  1944. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1945. return smalltalk.withContext(function($ctx2) {
  1946. return (42);
  1947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (999);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1951. self._assert_equals_($17,(999));
  1952. $ctx1.sendIdx["assert:equals:"]=6;
  1953. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1954. return smalltalk.withContext(function($ctx2) {
  1955. return (42);
  1956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1957. return smalltalk.withContext(function($ctx2) {
  1958. return (999);
  1959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1960. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1961. self._assert_equals_($19,(999));
  1962. $ctx1.sendIdx["assert:equals:"]=7;
  1963. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1964. return smalltalk.withContext(function($ctx2) {
  1965. return (42);
  1966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1967. return smalltalk.withContext(function($ctx2) {
  1968. return (999);
  1969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1970. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1971. args: [],
  1972. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1973. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1974. referencedClasses: []
  1975. }),
  1976. smalltalk.CollectionTest);
  1977. smalltalk.addMethod(
  1978. smalltalk.method({
  1979. selector: "testIsEmpty",
  1980. protocol: 'tests',
  1981. fn: function (){
  1982. var self=this;
  1983. return smalltalk.withContext(function($ctx1) {
  1984. var $1;
  1985. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1986. $ctx1.sendIdx["isEmpty"]=1;
  1987. self._assert_($1);
  1988. self._deny_(_st(self._collection())._isEmpty());
  1989. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1990. args: [],
  1991. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1992. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.CollectionTest);
  1996. smalltalk.addMethod(
  1997. smalltalk.method({
  1998. selector: "testNoneSatisfy",
  1999. protocol: 'tests',
  2000. fn: function (){
  2001. var self=this;
  2002. var anyOne;
  2003. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2004. return smalltalk.withContext(function($ctx1) {
  2005. var $1,$3,$2;
  2006. $1=self._collection();
  2007. $ctx1.sendIdx["collection"]=1;
  2008. anyOne=_st($1)._anyOne();
  2009. $3=self._collection();
  2010. $ctx1.sendIdx["collection"]=2;
  2011. $2=_st($3)._noneSatisfy_((function(each){
  2012. return smalltalk.withContext(function($ctx2) {
  2013. return _st(each).__eq(anyOne);
  2014. $ctx2.sendIdx["="]=1;
  2015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2016. $ctx1.sendIdx["noneSatisfy:"]=1;
  2017. self._deny_($2);
  2018. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2019. return smalltalk.withContext(function($ctx2) {
  2020. return _st(each).__eq(_st($Object())._new());
  2021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2022. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2023. args: [],
  2024. 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 ])",
  2025. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2026. referencedClasses: ["Object"]
  2027. }),
  2028. smalltalk.CollectionTest);
  2029. smalltalk.addMethod(
  2030. smalltalk.method({
  2031. selector: "testRemoveAll",
  2032. protocol: 'tests',
  2033. fn: function (){
  2034. var self=this;
  2035. return smalltalk.withContext(function($ctx1) {
  2036. var $1,$2;
  2037. $1=self._collection();
  2038. _st($1)._removeAll();
  2039. $2=_st($1)._yourself();
  2040. self._assert_equals_($2,_st(self._collectionClass())._new());
  2041. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2042. args: [],
  2043. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2044. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2045. referencedClasses: []
  2046. }),
  2047. smalltalk.CollectionTest);
  2048. smalltalk.addMethod(
  2049. smalltalk.method({
  2050. selector: "testSelect",
  2051. protocol: 'tests',
  2052. fn: function (){
  2053. var self=this;
  2054. return smalltalk.withContext(function($ctx1) {
  2055. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2056. $2=self._collection();
  2057. $ctx1.sendIdx["collection"]=1;
  2058. $1=_st($2)._select_((function(){
  2059. return smalltalk.withContext(function($ctx2) {
  2060. return false;
  2061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2062. $ctx1.sendIdx["select:"]=1;
  2063. $4=self._collectionClass();
  2064. $ctx1.sendIdx["collectionClass"]=1;
  2065. $3=_st($4)._new();
  2066. $ctx1.sendIdx["new"]=1;
  2067. self._assert_equals_($1,$3);
  2068. $ctx1.sendIdx["assert:equals:"]=1;
  2069. $6=self._collection();
  2070. $ctx1.sendIdx["collection"]=2;
  2071. $5=_st($6)._select_((function(){
  2072. return smalltalk.withContext(function($ctx2) {
  2073. return true;
  2074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2075. $ctx1.sendIdx["select:"]=2;
  2076. $7=self._collection();
  2077. $ctx1.sendIdx["collection"]=3;
  2078. self._assert_equals_($5,$7);
  2079. $ctx1.sendIdx["assert:equals:"]=2;
  2080. $9=self._collectionWithNewValue();
  2081. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2082. $8=_st($9)._select_((function(each){
  2083. return smalltalk.withContext(function($ctx2) {
  2084. $10=self._sampleNewValue();
  2085. $ctx2.sendIdx["sampleNewValue"]=1;
  2086. return _st(each).__eq($10);
  2087. $ctx2.sendIdx["="]=1;
  2088. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2089. $ctx1.sendIdx["select:"]=3;
  2090. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2091. $ctx1.sendIdx["assert:equals:"]=3;
  2092. $12=self._collectionWithNewValue();
  2093. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2094. $11=_st($12)._select_((function(each){
  2095. return smalltalk.withContext(function($ctx2) {
  2096. $13=self._sampleNewValue();
  2097. $ctx2.sendIdx["sampleNewValue"]=2;
  2098. return _st(each).__tild_eq($13);
  2099. $ctx2.sendIdx["~="]=1;
  2100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2101. $ctx1.sendIdx["select:"]=4;
  2102. $14=self._collection();
  2103. $ctx1.sendIdx["collection"]=4;
  2104. self._assert_equals_($11,$14);
  2105. $ctx1.sendIdx["assert:equals:"]=4;
  2106. $16=self._collection();
  2107. $ctx1.sendIdx["collection"]=5;
  2108. $15=_st($16)._select_((function(each){
  2109. return smalltalk.withContext(function($ctx2) {
  2110. $17=self._sampleNewValue();
  2111. $ctx2.sendIdx["sampleNewValue"]=3;
  2112. return _st(each).__eq($17);
  2113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2114. $ctx1.sendIdx["select:"]=5;
  2115. self._assert_equals_($15,_st(self._collectionClass())._new());
  2116. $ctx1.sendIdx["assert:equals:"]=5;
  2117. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2118. return smalltalk.withContext(function($ctx2) {
  2119. return _st(each).__tild_eq(self._sampleNewValue());
  2120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2121. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2122. args: [],
  2123. 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",
  2124. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2125. referencedClasses: []
  2126. }),
  2127. smalltalk.CollectionTest);
  2128. smalltalk.addMethod(
  2129. smalltalk.method({
  2130. selector: "testSize",
  2131. protocol: 'tests',
  2132. fn: function (){
  2133. var self=this;
  2134. return smalltalk.withContext(function($ctx1) {
  2135. var $1,$2;
  2136. $1=_st(_st(self._collectionClass())._new())._size();
  2137. $ctx1.sendIdx["size"]=1;
  2138. self._assert_equals_($1,(0));
  2139. $ctx1.sendIdx["assert:equals:"]=1;
  2140. $2=_st(self._sampleNewValueAsCollection())._size();
  2141. $ctx1.sendIdx["size"]=2;
  2142. self._assert_equals_($2,(1));
  2143. $ctx1.sendIdx["assert:equals:"]=2;
  2144. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2145. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2146. args: [],
  2147. 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",
  2148. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2149. referencedClasses: []
  2150. }),
  2151. smalltalk.CollectionTest);
  2152. smalltalk.addMethod(
  2153. smalltalk.method({
  2154. selector: "collectionClass",
  2155. protocol: 'fixture',
  2156. fn: function (){
  2157. var self=this;
  2158. return smalltalk.withContext(function($ctx1) {
  2159. return nil;
  2160. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2161. args: [],
  2162. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2163. messageSends: [],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest.klass);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "isAbstract",
  2170. protocol: 'testing',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. var $1;
  2175. $1=_st(self._collectionClass())._isNil();
  2176. return $1;
  2177. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2178. args: [],
  2179. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2180. messageSends: ["isNil", "collectionClass"],
  2181. referencedClasses: []
  2182. }),
  2183. smalltalk.CollectionTest.klass);
  2184. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2185. smalltalk.addMethod(
  2186. smalltalk.method({
  2187. selector: "collectionWithNewValue",
  2188. protocol: 'fixture',
  2189. fn: function (){
  2190. var self=this;
  2191. return smalltalk.withContext(function($ctx1) {
  2192. self._subclassResponsibility();
  2193. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2194. args: [],
  2195. 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",
  2196. messageSends: ["subclassResponsibility"],
  2197. referencedClasses: []
  2198. }),
  2199. smalltalk.IndexableCollectionTest);
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "sampleNewIndex",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. 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",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNonIndexesDo:",
  2218. protocol: 'fixture',
  2219. fn: function (aBlock){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2224. args: ["aBlock"],
  2225. 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",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "samplesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. 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",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "testAt",
  2248. protocol: 'tests',
  2249. fn: function (){
  2250. var self=this;
  2251. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2252. return smalltalk.withContext(function($ctx1) {
  2253. var $1;
  2254. self._nonIndexesDo_((function(each){
  2255. return smalltalk.withContext(function($ctx2) {
  2256. return self._should_raise_((function(){
  2257. return smalltalk.withContext(function($ctx3) {
  2258. $1=self._collection();
  2259. $ctx3.sendIdx["collection"]=1;
  2260. return _st($1)._at_(each);
  2261. $ctx3.sendIdx["at:"]=1;
  2262. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2263. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2264. self._samplesDo_((function(index,value){
  2265. return smalltalk.withContext(function($ctx2) {
  2266. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2267. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2268. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2269. args: [],
  2270. 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 ]",
  2271. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2272. referencedClasses: ["Error"]
  2273. }),
  2274. smalltalk.IndexableCollectionTest);
  2275. smalltalk.addMethod(
  2276. smalltalk.method({
  2277. selector: "testAtIfAbsent",
  2278. protocol: 'tests',
  2279. fn: function (){
  2280. var self=this;
  2281. return smalltalk.withContext(function($ctx1) {
  2282. var $2,$1,$3;
  2283. self._nonIndexesDo_((function(each){
  2284. return smalltalk.withContext(function($ctx2) {
  2285. $2=self._collection();
  2286. $ctx2.sendIdx["collection"]=1;
  2287. $1=_st($2)._at_ifAbsent_(each,(function(){
  2288. return smalltalk.withContext(function($ctx3) {
  2289. return self._sampleNewValue();
  2290. $ctx3.sendIdx["sampleNewValue"]=1;
  2291. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2292. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2293. $3=self._sampleNewValue();
  2294. $ctx2.sendIdx["sampleNewValue"]=2;
  2295. return self._assert_equals_($1,$3);
  2296. $ctx2.sendIdx["assert:equals:"]=1;
  2297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2298. self._samplesDo_((function(index,value){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2301. return smalltalk.withContext(function($ctx3) {
  2302. return self._sampleNewValue();
  2303. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2304. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2305. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2306. args: [],
  2307. 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 ].",
  2308. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2309. referencedClasses: []
  2310. }),
  2311. smalltalk.IndexableCollectionTest);
  2312. smalltalk.addMethod(
  2313. smalltalk.method({
  2314. selector: "testAtIfPresent",
  2315. protocol: 'tests',
  2316. fn: function (){
  2317. var self=this;
  2318. var visited,sentinel;
  2319. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2320. return smalltalk.withContext(function($ctx1) {
  2321. var $2,$1,$4,$3;
  2322. sentinel=_st($Object())._new();
  2323. self._nonIndexesDo_((function(each){
  2324. return smalltalk.withContext(function($ctx2) {
  2325. visited=nil;
  2326. visited;
  2327. $2=self._collection();
  2328. $ctx2.sendIdx["collection"]=1;
  2329. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2330. return smalltalk.withContext(function($ctx3) {
  2331. visited=value1;
  2332. visited;
  2333. return sentinel;
  2334. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2335. $ctx2.sendIdx["at:ifPresent:"]=1;
  2336. self._assert_equals_($1,nil);
  2337. $ctx2.sendIdx["assert:equals:"]=1;
  2338. return self._assert_(_st(visited)._isNil());
  2339. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2340. self._samplesDo_((function(index,value){
  2341. return smalltalk.withContext(function($ctx2) {
  2342. visited=nil;
  2343. visited;
  2344. $4=self._collection();
  2345. $ctx2.sendIdx["collection"]=2;
  2346. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2347. return smalltalk.withContext(function($ctx3) {
  2348. visited=value2;
  2349. visited;
  2350. return sentinel;
  2351. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2352. self._assert_equals_($3,sentinel);
  2353. $ctx2.sendIdx["assert:equals:"]=2;
  2354. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2355. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2356. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2357. args: [],
  2358. 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) ]",
  2359. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2360. referencedClasses: ["Object"]
  2361. }),
  2362. smalltalk.IndexableCollectionTest);
  2363. smalltalk.addMethod(
  2364. smalltalk.method({
  2365. selector: "testAtIfPresentIfAbsent",
  2366. protocol: 'tests',
  2367. fn: function (){
  2368. var self=this;
  2369. var visited,sentinel;
  2370. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2371. return smalltalk.withContext(function($ctx1) {
  2372. var $2,$1,$3,$5,$4;
  2373. sentinel=_st($Object())._new();
  2374. self._nonIndexesDo_((function(each){
  2375. return smalltalk.withContext(function($ctx2) {
  2376. visited=nil;
  2377. visited;
  2378. $2=self._collection();
  2379. $ctx2.sendIdx["collection"]=1;
  2380. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2381. return smalltalk.withContext(function($ctx3) {
  2382. visited=value1;
  2383. visited;
  2384. return sentinel;
  2385. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2386. return smalltalk.withContext(function($ctx3) {
  2387. return self._sampleNewValue();
  2388. $ctx3.sendIdx["sampleNewValue"]=1;
  2389. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2390. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2391. $3=self._sampleNewValue();
  2392. $ctx2.sendIdx["sampleNewValue"]=2;
  2393. self._assert_equals_($1,$3);
  2394. $ctx2.sendIdx["assert:equals:"]=1;
  2395. return self._assert_(_st(visited)._isNil());
  2396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2397. self._samplesDo_((function(index,value){
  2398. return smalltalk.withContext(function($ctx2) {
  2399. visited=nil;
  2400. visited;
  2401. $5=self._collection();
  2402. $ctx2.sendIdx["collection"]=2;
  2403. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2404. return smalltalk.withContext(function($ctx3) {
  2405. visited=value2;
  2406. visited;
  2407. return sentinel;
  2408. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2409. return smalltalk.withContext(function($ctx3) {
  2410. return self._sampleNewValue();
  2411. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2412. self._assert_equals_($4,sentinel);
  2413. $ctx2.sendIdx["assert:equals:"]=2;
  2414. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2415. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2416. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2417. args: [],
  2418. 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) ]",
  2419. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2420. referencedClasses: ["Object"]
  2421. }),
  2422. smalltalk.IndexableCollectionTest);
  2423. smalltalk.addMethod(
  2424. smalltalk.method({
  2425. selector: "testAtPut",
  2426. protocol: 'tests',
  2427. fn: function (){
  2428. var self=this;
  2429. var newCollection;
  2430. return smalltalk.withContext(function($ctx1) {
  2431. newCollection=self._collection();
  2432. $ctx1.sendIdx["collection"]=1;
  2433. self._samplesDo_((function(index,value){
  2434. return smalltalk.withContext(function($ctx2) {
  2435. return _st(newCollection)._at_put_(index,value);
  2436. $ctx2.sendIdx["at:put:"]=1;
  2437. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2438. self._assert_equals_(newCollection,self._collection());
  2439. $ctx1.sendIdx["assert:equals:"]=1;
  2440. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2441. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2442. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2443. args: [],
  2444. 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",
  2445. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2446. referencedClasses: []
  2447. }),
  2448. smalltalk.IndexableCollectionTest);
  2449. smalltalk.addMethod(
  2450. smalltalk.method({
  2451. selector: "testIndexOf",
  2452. protocol: 'tests',
  2453. fn: function (){
  2454. var self=this;
  2455. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2456. return smalltalk.withContext(function($ctx1) {
  2457. var $1;
  2458. self._should_raise_((function(){
  2459. return smalltalk.withContext(function($ctx2) {
  2460. $1=self._collection();
  2461. $ctx2.sendIdx["collection"]=1;
  2462. return _st($1)._indexOf_(self._sampleNewValue());
  2463. $ctx2.sendIdx["indexOf:"]=1;
  2464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2465. self._samplesDo_((function(index,value){
  2466. return smalltalk.withContext(function($ctx2) {
  2467. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2468. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2470. args: [],
  2471. 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 ]",
  2472. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2473. referencedClasses: ["Error"]
  2474. }),
  2475. smalltalk.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testWithIndexDo",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var collection;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. collection=self._collection();
  2485. $ctx1.sendIdx["collection"]=1;
  2486. _st(self._collection())._withIndexDo_((function(each,index){
  2487. return smalltalk.withContext(function($ctx2) {
  2488. return self._assert_equals_(_st(collection)._at_(index),each);
  2489. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2490. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2491. args: [],
  2492. 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 ]",
  2493. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2494. referencedClasses: []
  2495. }),
  2496. smalltalk.IndexableCollectionTest);
  2497. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2498. smalltalk.addMethod(
  2499. smalltalk.method({
  2500. selector: "collection",
  2501. protocol: 'fixture',
  2502. fn: function (){
  2503. var self=this;
  2504. return smalltalk.withContext(function($ctx1) {
  2505. var $2,$3,$4,$1;
  2506. $2="b".__minus_gt((1));
  2507. $ctx1.sendIdx["->"]=1;
  2508. $3="a".__minus_gt((2));
  2509. $ctx1.sendIdx["->"]=2;
  2510. $4="c".__minus_gt((3));
  2511. $ctx1.sendIdx["->"]=3;
  2512. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2513. return $1;
  2514. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2515. args: [],
  2516. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2517. messageSends: ["->"],
  2518. referencedClasses: []
  2519. }),
  2520. smalltalk.HashedCollectionTest);
  2521. smalltalk.addMethod(
  2522. smalltalk.method({
  2523. selector: "collectionOfPrintStrings",
  2524. protocol: 'fixture',
  2525. fn: function (){
  2526. var self=this;
  2527. return smalltalk.withContext(function($ctx1) {
  2528. var $2,$3,$4,$1;
  2529. $2="b".__minus_gt("1");
  2530. $ctx1.sendIdx["->"]=1;
  2531. $3="a".__minus_gt("2");
  2532. $ctx1.sendIdx["->"]=2;
  2533. $4="c".__minus_gt("3");
  2534. $ctx1.sendIdx["->"]=3;
  2535. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2536. return $1;
  2537. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2538. args: [],
  2539. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2540. messageSends: ["->"],
  2541. referencedClasses: []
  2542. }),
  2543. smalltalk.HashedCollectionTest);
  2544. smalltalk.addMethod(
  2545. smalltalk.method({
  2546. selector: "collectionSize",
  2547. protocol: 'fixture',
  2548. fn: function (){
  2549. var self=this;
  2550. return smalltalk.withContext(function($ctx1) {
  2551. return (4);
  2552. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2553. args: [],
  2554. source: "collectionSize\x0a\x09^ 4",
  2555. messageSends: [],
  2556. referencedClasses: []
  2557. }),
  2558. smalltalk.HashedCollectionTest);
  2559. smalltalk.addMethod(
  2560. smalltalk.method({
  2561. selector: "collectionWithDuplicates",
  2562. protocol: 'fixture',
  2563. fn: function (){
  2564. var self=this;
  2565. return smalltalk.withContext(function($ctx1) {
  2566. var $2,$3,$4,$5,$6,$7,$1;
  2567. $2="b".__minus_gt((1));
  2568. $ctx1.sendIdx["->"]=1;
  2569. $3="a".__minus_gt((2));
  2570. $ctx1.sendIdx["->"]=2;
  2571. $4="c".__minus_gt((3));
  2572. $ctx1.sendIdx["->"]=3;
  2573. $5="d".__minus_gt((-4));
  2574. $ctx1.sendIdx["->"]=4;
  2575. $6="e".__minus_gt((1));
  2576. $ctx1.sendIdx["->"]=5;
  2577. $7="f".__minus_gt((2));
  2578. $ctx1.sendIdx["->"]=6;
  2579. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2580. return $1;
  2581. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2582. args: [],
  2583. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2584. messageSends: ["->"],
  2585. referencedClasses: []
  2586. }),
  2587. smalltalk.HashedCollectionTest);
  2588. smalltalk.addMethod(
  2589. smalltalk.method({
  2590. selector: "collectionWithNewValue",
  2591. protocol: 'fixture',
  2592. fn: function (){
  2593. var self=this;
  2594. return smalltalk.withContext(function($ctx1) {
  2595. var $2,$3,$4,$5,$1;
  2596. $2="b".__minus_gt((1));
  2597. $ctx1.sendIdx["->"]=1;
  2598. $3="a".__minus_gt((2));
  2599. $ctx1.sendIdx["->"]=2;
  2600. $4="c".__minus_gt((3));
  2601. $ctx1.sendIdx["->"]=3;
  2602. $5="d".__minus_gt((-4));
  2603. $ctx1.sendIdx["->"]=4;
  2604. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2605. return $1;
  2606. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2607. args: [],
  2608. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2609. messageSends: ["->"],
  2610. referencedClasses: []
  2611. }),
  2612. smalltalk.HashedCollectionTest);
  2613. smalltalk.addMethod(
  2614. smalltalk.method({
  2615. selector: "nonIndexesDo:",
  2616. protocol: 'fixture',
  2617. fn: function (aBlock){
  2618. var self=this;
  2619. return smalltalk.withContext(function($ctx1) {
  2620. _st(aBlock)._value_((5));
  2621. $ctx1.sendIdx["value:"]=1;
  2622. _st(aBlock)._value_("z");
  2623. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2624. args: ["aBlock"],
  2625. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2626. messageSends: ["value:"],
  2627. referencedClasses: []
  2628. }),
  2629. smalltalk.HashedCollectionTest);
  2630. smalltalk.addMethod(
  2631. smalltalk.method({
  2632. selector: "sampleNewIndex",
  2633. protocol: 'fixture',
  2634. fn: function (){
  2635. var self=this;
  2636. return smalltalk.withContext(function($ctx1) {
  2637. return "new";
  2638. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2639. args: [],
  2640. source: "sampleNewIndex\x0a\x09^ 'new'",
  2641. messageSends: [],
  2642. referencedClasses: []
  2643. }),
  2644. smalltalk.HashedCollectionTest);
  2645. smalltalk.addMethod(
  2646. smalltalk.method({
  2647. selector: "sampleNewValueAsCollection",
  2648. protocol: 'fixture',
  2649. fn: function (){
  2650. var self=this;
  2651. return smalltalk.withContext(function($ctx1) {
  2652. var $1;
  2653. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2654. return $1;
  2655. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2656. args: [],
  2657. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2658. messageSends: ["->"],
  2659. referencedClasses: []
  2660. }),
  2661. smalltalk.HashedCollectionTest);
  2662. smalltalk.addMethod(
  2663. smalltalk.method({
  2664. selector: "samplesDo:",
  2665. protocol: 'fixture',
  2666. fn: function (aBlock){
  2667. var self=this;
  2668. return smalltalk.withContext(function($ctx1) {
  2669. _st(aBlock)._value_value_("a",(2));
  2670. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2671. args: ["aBlock"],
  2672. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2673. messageSends: ["value:value:"],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.HashedCollectionTest);
  2677. smalltalk.addMethod(
  2678. smalltalk.method({
  2679. selector: "testAddAll",
  2680. protocol: 'tests',
  2681. fn: function (){
  2682. var self=this;
  2683. return smalltalk.withContext(function($ctx1) {
  2684. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2685. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2686. $2=self._collection();
  2687. $ctx1.sendIdx["collection"]=1;
  2688. $3=$2;
  2689. $4=self._collection();
  2690. $ctx1.sendIdx["collection"]=2;
  2691. _st($3)._addAll_($4);
  2692. $ctx1.sendIdx["addAll:"]=1;
  2693. $5=_st($2)._yourself();
  2694. $ctx1.sendIdx["yourself"]=1;
  2695. $1=$5;
  2696. $6=self._collection();
  2697. $ctx1.sendIdx["collection"]=3;
  2698. self._assert_equals_($1,$6);
  2699. $ctx1.sendIdx["assert:equals:"]=1;
  2700. $8=self._collection();
  2701. $ctx1.sendIdx["collection"]=4;
  2702. $9=$8;
  2703. $10=self._collectionWithNewValue();
  2704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2705. _st($9)._addAll_($10);
  2706. $ctx1.sendIdx["addAll:"]=2;
  2707. $11=_st($8)._yourself();
  2708. $ctx1.sendIdx["yourself"]=2;
  2709. $7=$11;
  2710. $12=self._collectionWithNewValue();
  2711. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2712. self._assert_equals_($7,$12);
  2713. $ctx1.sendIdx["assert:equals:"]=2;
  2714. $14=self._collectionWithNewValue();
  2715. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2716. _st($14)._addAll_(self._collection());
  2717. $15=_st($14)._yourself();
  2718. $13=$15;
  2719. self._assert_equals_($13,self._collectionWithNewValue());
  2720. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2721. args: [],
  2722. 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",
  2723. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2724. referencedClasses: []
  2725. }),
  2726. smalltalk.HashedCollectionTest);
  2727. smalltalk.addMethod(
  2728. smalltalk.method({
  2729. selector: "testAsDictionary",
  2730. protocol: 'tests',
  2731. fn: function (){
  2732. var self=this;
  2733. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2734. return smalltalk.withContext(function($ctx1) {
  2735. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2736. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2737. args: [],
  2738. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2739. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2740. referencedClasses: ["Dictionary"]
  2741. }),
  2742. smalltalk.HashedCollectionTest);
  2743. smalltalk.addMethod(
  2744. smalltalk.method({
  2745. selector: "testComma",
  2746. protocol: 'tests',
  2747. fn: function (){
  2748. var self=this;
  2749. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2750. return smalltalk.withContext(function($ctx1) {
  2751. var $1;
  2752. self._should_raise_((function(){
  2753. return smalltalk.withContext(function($ctx2) {
  2754. $1=self._collection();
  2755. $ctx2.sendIdx["collection"]=1;
  2756. return _st($1).__comma(self._collection());
  2757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2758. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2759. args: [],
  2760. source: "testComma\x0a\x09self should: [ self collection, self collection ] raise: Error",
  2761. messageSends: ["should:raise:", ",", "collection"],
  2762. referencedClasses: ["Error"]
  2763. }),
  2764. smalltalk.HashedCollectionTest);
  2765. smalltalk.addMethod(
  2766. smalltalk.method({
  2767. selector: "testFrom",
  2768. protocol: 'tests',
  2769. fn: function (){
  2770. var self=this;
  2771. var associations;
  2772. return smalltalk.withContext(function($ctx1) {
  2773. var $1,$2,$3,$5,$4;
  2774. $1="a".__minus_gt((1));
  2775. $ctx1.sendIdx["->"]=1;
  2776. $2="b".__minus_gt((2));
  2777. $ctx1.sendIdx["->"]=2;
  2778. associations=[$1,$2];
  2779. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2780. $5="a".__minus_gt((1));
  2781. $ctx1.sendIdx["->"]=3;
  2782. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2783. self._assertSameContents_as_($3,$4);
  2784. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2785. args: [],
  2786. 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 }.",
  2787. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2788. referencedClasses: []
  2789. }),
  2790. smalltalk.HashedCollectionTest);
  2791. smalltalk.addMethod(
  2792. smalltalk.method({
  2793. selector: "testNewFromPairs",
  2794. protocol: 'tests',
  2795. fn: function (){
  2796. var self=this;
  2797. var flattenedAssociations;
  2798. return smalltalk.withContext(function($ctx1) {
  2799. var $1,$3,$2;
  2800. flattenedAssociations=["a",(1),"b",(2)];
  2801. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2802. $3="a".__minus_gt((1));
  2803. $ctx1.sendIdx["->"]=1;
  2804. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2805. self._assertSameContents_as_($1,$2);
  2806. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2807. args: [],
  2808. 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 }.",
  2809. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2810. referencedClasses: []
  2811. }),
  2812. smalltalk.HashedCollectionTest);
  2813. smalltalk.addMethod(
  2814. smalltalk.method({
  2815. selector: "collectionClass",
  2816. protocol: 'fixture',
  2817. fn: function (){
  2818. var self=this;
  2819. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2820. return smalltalk.withContext(function($ctx1) {
  2821. return $HashedCollection();
  2822. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2823. args: [],
  2824. source: "collectionClass\x0a\x09^ HashedCollection",
  2825. messageSends: [],
  2826. referencedClasses: ["HashedCollection"]
  2827. }),
  2828. smalltalk.HashedCollectionTest.klass);
  2829. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2830. smalltalk.addMethod(
  2831. smalltalk.method({
  2832. selector: "collection",
  2833. protocol: 'fixture',
  2834. fn: function (){
  2835. var self=this;
  2836. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2837. return smalltalk.withContext(function($ctx1) {
  2838. var $2,$3,$1;
  2839. $2=_st($Dictionary())._new();
  2840. _st($2)._at_put_((1),(1));
  2841. $ctx1.sendIdx["at:put:"]=1;
  2842. _st($2)._at_put_("a",(2));
  2843. $ctx1.sendIdx["at:put:"]=2;
  2844. _st($2)._at_put_(true,(3));
  2845. $ctx1.sendIdx["at:put:"]=3;
  2846. _st($2)._at_put_((1).__at((3)),(-4));
  2847. $3=_st($2)._yourself();
  2848. $1=$3;
  2849. return $1;
  2850. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2851. args: [],
  2852. 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",
  2853. messageSends: ["at:put:", "new", "@", "yourself"],
  2854. referencedClasses: ["Dictionary"]
  2855. }),
  2856. smalltalk.DictionaryTest);
  2857. smalltalk.addMethod(
  2858. smalltalk.method({
  2859. selector: "collectionOfPrintStrings",
  2860. protocol: 'fixture',
  2861. fn: function (){
  2862. var self=this;
  2863. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2864. return smalltalk.withContext(function($ctx1) {
  2865. var $2,$3,$1;
  2866. $2=_st($Dictionary())._new();
  2867. _st($2)._at_put_((1),"1");
  2868. $ctx1.sendIdx["at:put:"]=1;
  2869. _st($2)._at_put_("a","2");
  2870. $ctx1.sendIdx["at:put:"]=2;
  2871. _st($2)._at_put_(true,"3");
  2872. $ctx1.sendIdx["at:put:"]=3;
  2873. _st($2)._at_put_((1).__at((3)),"-4");
  2874. $3=_st($2)._yourself();
  2875. $1=$3;
  2876. return $1;
  2877. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2878. args: [],
  2879. 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",
  2880. messageSends: ["at:put:", "new", "@", "yourself"],
  2881. referencedClasses: ["Dictionary"]
  2882. }),
  2883. smalltalk.DictionaryTest);
  2884. smalltalk.addMethod(
  2885. smalltalk.method({
  2886. selector: "collectionSize",
  2887. protocol: 'fixture',
  2888. fn: function (){
  2889. var self=this;
  2890. return smalltalk.withContext(function($ctx1) {
  2891. return (4);
  2892. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2893. args: [],
  2894. source: "collectionSize\x0a\x09^ 4",
  2895. messageSends: [],
  2896. referencedClasses: []
  2897. }),
  2898. smalltalk.DictionaryTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "collectionWithDuplicates",
  2902. protocol: 'fixture',
  2903. fn: function (){
  2904. var self=this;
  2905. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2906. return smalltalk.withContext(function($ctx1) {
  2907. var $2,$3,$1;
  2908. $2=_st($Dictionary())._new();
  2909. _st($2)._at_put_((1),(1));
  2910. $ctx1.sendIdx["at:put:"]=1;
  2911. _st($2)._at_put_("a",(2));
  2912. $ctx1.sendIdx["at:put:"]=2;
  2913. _st($2)._at_put_(true,(3));
  2914. $ctx1.sendIdx["at:put:"]=3;
  2915. _st($2)._at_put_((4),(-4));
  2916. $ctx1.sendIdx["at:put:"]=4;
  2917. _st($2)._at_put_("b",(1));
  2918. $ctx1.sendIdx["at:put:"]=5;
  2919. _st($2)._at_put_((3),(3));
  2920. $ctx1.sendIdx["at:put:"]=6;
  2921. _st($2)._at_put_(false,(12));
  2922. $3=_st($2)._yourself();
  2923. $1=$3;
  2924. return $1;
  2925. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2926. args: [],
  2927. 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",
  2928. messageSends: ["at:put:", "new", "yourself"],
  2929. referencedClasses: ["Dictionary"]
  2930. }),
  2931. smalltalk.DictionaryTest);
  2932. smalltalk.addMethod(
  2933. smalltalk.method({
  2934. selector: "collectionWithNewValue",
  2935. protocol: 'fixture',
  2936. fn: function (){
  2937. var self=this;
  2938. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2939. return smalltalk.withContext(function($ctx1) {
  2940. var $2,$3,$1;
  2941. $2=_st($Dictionary())._new();
  2942. _st($2)._at_put_((1),(1));
  2943. $ctx1.sendIdx["at:put:"]=1;
  2944. _st($2)._at_put_("a",(2));
  2945. $ctx1.sendIdx["at:put:"]=2;
  2946. _st($2)._at_put_(true,(3));
  2947. $ctx1.sendIdx["at:put:"]=3;
  2948. _st($2)._at_put_((1).__at((3)),(-4));
  2949. $ctx1.sendIdx["at:put:"]=4;
  2950. _st($2)._at_put_("new","N");
  2951. $3=_st($2)._yourself();
  2952. $1=$3;
  2953. return $1;
  2954. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2955. args: [],
  2956. 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",
  2957. messageSends: ["at:put:", "new", "@", "yourself"],
  2958. referencedClasses: ["Dictionary"]
  2959. }),
  2960. smalltalk.DictionaryTest);
  2961. smalltalk.addMethod(
  2962. smalltalk.method({
  2963. selector: "sampleNewValueAsCollection",
  2964. protocol: 'fixture',
  2965. fn: function (){
  2966. var self=this;
  2967. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2968. return smalltalk.withContext(function($ctx1) {
  2969. var $2,$3,$1;
  2970. $2=_st($Dictionary())._new();
  2971. _st($2)._at_put_("new","N");
  2972. $3=_st($2)._yourself();
  2973. $1=$3;
  2974. return $1;
  2975. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  2976. args: [],
  2977. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  2978. messageSends: ["at:put:", "new", "yourself"],
  2979. referencedClasses: ["Dictionary"]
  2980. }),
  2981. smalltalk.DictionaryTest);
  2982. smalltalk.addMethod(
  2983. smalltalk.method({
  2984. selector: "samplesDo:",
  2985. protocol: 'fixture',
  2986. fn: function (aBlock){
  2987. var self=this;
  2988. return smalltalk.withContext(function($ctx1) {
  2989. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  2990. _st(aBlock)._value_value_(true,(3));
  2991. $ctx1.sendIdx["value:value:"]=1;
  2992. _st(aBlock)._value_value_((1).__at((3)),(-4));
  2993. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  2994. args: ["aBlock"],
  2995. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  2996. messageSends: ["samplesDo:", "value:value:", "@"],
  2997. referencedClasses: []
  2998. }),
  2999. smalltalk.DictionaryTest);
  3000. smalltalk.addMethod(
  3001. smalltalk.method({
  3002. selector: "testAccessing",
  3003. protocol: 'tests',
  3004. fn: function (){
  3005. var self=this;
  3006. var d;
  3007. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3008. return smalltalk.withContext(function($ctx1) {
  3009. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3010. d=_st($Dictionary())._new();
  3011. _st(d)._at_put_("hello","world");
  3012. $ctx1.sendIdx["at:put:"]=1;
  3013. $1=_st(d)._at_("hello");
  3014. $ctx1.sendIdx["at:"]=1;
  3015. self._assert_equals_($1,"world");
  3016. $ctx1.sendIdx["assert:equals:"]=1;
  3017. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3018. return smalltalk.withContext(function($ctx2) {
  3019. return nil;
  3020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3021. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3022. self._assert_equals_($2,"world");
  3023. $ctx1.sendIdx["assert:equals:"]=2;
  3024. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3025. return smalltalk.withContext(function($ctx2) {
  3026. return nil;
  3027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3028. $ctx1.sendIdx["deny:"]=1;
  3029. $3=_st(d)._includesKey_("hello");
  3030. $ctx1.sendIdx["includesKey:"]=1;
  3031. self._assert_($3);
  3032. $ctx1.sendIdx["assert:"]=1;
  3033. $4=_st(d)._includesKey_("foo");
  3034. $ctx1.sendIdx["includesKey:"]=2;
  3035. self._deny_($4);
  3036. $ctx1.sendIdx["deny:"]=2;
  3037. _st(d)._at_put_((1),(2));
  3038. $ctx1.sendIdx["at:put:"]=2;
  3039. $5=_st(d)._at_((1));
  3040. $ctx1.sendIdx["at:"]=2;
  3041. self._assert_equals_($5,(2));
  3042. $ctx1.sendIdx["assert:equals:"]=3;
  3043. $6=d;
  3044. $7=(1).__at((3));
  3045. $ctx1.sendIdx["@"]=1;
  3046. _st($6)._at_put_($7,(3));
  3047. $9=d;
  3048. $10=(1).__at((3));
  3049. $ctx1.sendIdx["@"]=2;
  3050. $8=_st($9)._at_($10);
  3051. self._assert_equals_($8,(3));
  3052. $12=d;
  3053. $13=(1).__at((3));
  3054. $ctx1.sendIdx["@"]=3;
  3055. $11=_st($12)._includesKey_($13);
  3056. $ctx1.sendIdx["includesKey:"]=3;
  3057. self._assert_($11);
  3058. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3059. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3060. args: [],
  3061. 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)",
  3062. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3063. referencedClasses: ["Dictionary"]
  3064. }),
  3065. smalltalk.DictionaryTest);
  3066. smalltalk.addMethod(
  3067. smalltalk.method({
  3068. selector: "testAsHashedCollection",
  3069. protocol: 'tests',
  3070. fn: function (){
  3071. var self=this;
  3072. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3073. return smalltalk.withContext(function($ctx1) {
  3074. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  3075. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3076. args: [],
  3077. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3078. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3079. referencedClasses: ["HashedCollection"]
  3080. }),
  3081. smalltalk.DictionaryTest);
  3082. smalltalk.addMethod(
  3083. smalltalk.method({
  3084. selector: "testDynamicDictionaries",
  3085. protocol: 'tests',
  3086. fn: function (){
  3087. var self=this;
  3088. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3089. return smalltalk.withContext(function($ctx1) {
  3090. var $3,$2,$1;
  3091. $3="hello".__minus_gt((1));
  3092. $ctx1.sendIdx["->"]=1;
  3093. $2=smalltalk.HashedCollection._from_([$3]);
  3094. $1=_st($2)._asDictionary();
  3095. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3096. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3097. args: [],
  3098. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3099. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3100. referencedClasses: ["Dictionary"]
  3101. }),
  3102. smalltalk.DictionaryTest);
  3103. smalltalk.addMethod(
  3104. smalltalk.method({
  3105. selector: "testEquality",
  3106. protocol: 'tests',
  3107. fn: function (){
  3108. var self=this;
  3109. var d1,d2;
  3110. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3111. return smalltalk.withContext(function($ctx1) {
  3112. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3113. $2=_st($Dictionary())._new();
  3114. $ctx1.sendIdx["new"]=1;
  3115. $3=_st($Dictionary())._new();
  3116. $ctx1.sendIdx["new"]=2;
  3117. $1=_st($2).__eq($3);
  3118. $ctx1.sendIdx["="]=1;
  3119. self._assert_($1);
  3120. $ctx1.sendIdx["assert:"]=1;
  3121. $4=_st($Dictionary())._new();
  3122. $ctx1.sendIdx["new"]=3;
  3123. _st($4)._at_put_((1),(2));
  3124. $ctx1.sendIdx["at:put:"]=1;
  3125. $5=_st($4)._yourself();
  3126. $ctx1.sendIdx["yourself"]=1;
  3127. d1=$5;
  3128. $6=_st($Dictionary())._new();
  3129. $ctx1.sendIdx["new"]=4;
  3130. _st($6)._at_put_((1),(2));
  3131. $ctx1.sendIdx["at:put:"]=2;
  3132. $7=_st($6)._yourself();
  3133. $ctx1.sendIdx["yourself"]=2;
  3134. d2=$7;
  3135. $8=_st(d1).__eq(d2);
  3136. $ctx1.sendIdx["="]=2;
  3137. self._assert_($8);
  3138. $9=_st($Dictionary())._new();
  3139. $ctx1.sendIdx["new"]=5;
  3140. _st($9)._at_put_((1),(3));
  3141. $ctx1.sendIdx["at:put:"]=3;
  3142. $10=_st($9)._yourself();
  3143. $ctx1.sendIdx["yourself"]=3;
  3144. d2=$10;
  3145. $11=_st(d1).__eq(d2);
  3146. $ctx1.sendIdx["="]=3;
  3147. self._deny_($11);
  3148. $ctx1.sendIdx["deny:"]=1;
  3149. $12=_st($Dictionary())._new();
  3150. $ctx1.sendIdx["new"]=6;
  3151. _st($12)._at_put_((2),(2));
  3152. $ctx1.sendIdx["at:put:"]=4;
  3153. $13=_st($12)._yourself();
  3154. $ctx1.sendIdx["yourself"]=4;
  3155. d2=$13;
  3156. $14=_st(d1).__eq(d2);
  3157. $ctx1.sendIdx["="]=4;
  3158. self._deny_($14);
  3159. $ctx1.sendIdx["deny:"]=2;
  3160. $15=_st($Dictionary())._new();
  3161. _st($15)._at_put_((1),(2));
  3162. $ctx1.sendIdx["at:put:"]=5;
  3163. _st($15)._at_put_((3),(4));
  3164. $16=_st($15)._yourself();
  3165. d2=$16;
  3166. self._deny_(_st(d1).__eq(d2));
  3167. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3168. args: [],
  3169. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  3170. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3171. referencedClasses: ["Dictionary"]
  3172. }),
  3173. smalltalk.DictionaryTest);
  3174. smalltalk.addMethod(
  3175. smalltalk.method({
  3176. selector: "testKeys",
  3177. protocol: 'tests',
  3178. fn: function (){
  3179. var self=this;
  3180. var d;
  3181. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3182. return smalltalk.withContext(function($ctx1) {
  3183. d=_st($Dictionary())._new();
  3184. _st(d)._at_put_((1),(2));
  3185. $ctx1.sendIdx["at:put:"]=1;
  3186. _st(d)._at_put_((2),(3));
  3187. $ctx1.sendIdx["at:put:"]=2;
  3188. _st(d)._at_put_((3),(4));
  3189. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3190. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3191. args: [],
  3192. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  3193. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3194. referencedClasses: ["Dictionary"]
  3195. }),
  3196. smalltalk.DictionaryTest);
  3197. smalltalk.addMethod(
  3198. smalltalk.method({
  3199. selector: "testPointKey",
  3200. protocol: 'tests',
  3201. fn: function (){
  3202. var self=this;
  3203. var d;
  3204. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3205. return smalltalk.withContext(function($ctx1) {
  3206. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3207. d=_st($Dictionary())._new();
  3208. $1=d;
  3209. $2=(1).__at((1));
  3210. $ctx1.sendIdx["@"]=1;
  3211. _st($1)._at_put_($2,"foo");
  3212. $ctx1.sendIdx["at:put:"]=1;
  3213. $4=d;
  3214. $5=(1).__at((1));
  3215. $ctx1.sendIdx["@"]=2;
  3216. $3=_st($4)._at_($5);
  3217. $ctx1.sendIdx["at:"]=1;
  3218. self._assert_equals_($3,"foo");
  3219. $ctx1.sendIdx["assert:equals:"]=1;
  3220. $6=d;
  3221. $7=(1).__at((1));
  3222. $ctx1.sendIdx["@"]=3;
  3223. _st($6)._at_put_($7,"bar");
  3224. $9=d;
  3225. $10=(1).__at((1));
  3226. $ctx1.sendIdx["@"]=4;
  3227. $8=_st($9)._at_($10);
  3228. self._assert_equals_($8,"bar");
  3229. $ctx1.sendIdx["assert:equals:"]=2;
  3230. $11=d;
  3231. $12=(1).__at((1));
  3232. $ctx1.sendIdx["@"]=5;
  3233. _st($11)._removeKey_($12);
  3234. $14=d;
  3235. $15=(1).__at((1));
  3236. $ctx1.sendIdx["@"]=6;
  3237. $13=_st($14)._at_ifAbsent_($15,(function(){
  3238. return smalltalk.withContext(function($ctx2) {
  3239. return "baz";
  3240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3241. self._assert_equals_($13,"baz");
  3242. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3243. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3244. args: [],
  3245. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  3246. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3247. referencedClasses: ["Dictionary"]
  3248. }),
  3249. smalltalk.DictionaryTest);
  3250. smalltalk.addMethod(
  3251. smalltalk.method({
  3252. selector: "testPrintString",
  3253. protocol: 'tests',
  3254. fn: function (){
  3255. var self=this;
  3256. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3257. return smalltalk.withContext(function($ctx1) {
  3258. var $2,$3,$1;
  3259. $2=_st($Dictionary())._new();
  3260. _st($2)._at_put_("firstname","James");
  3261. $ctx1.sendIdx["at:put:"]=1;
  3262. _st($2)._at_put_("lastname","Bond");
  3263. $3=_st($2)._printString();
  3264. $1=$3;
  3265. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3266. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3267. args: [],
  3268. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary 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 Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  3269. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3270. referencedClasses: ["Dictionary"]
  3271. }),
  3272. smalltalk.DictionaryTest);
  3273. smalltalk.addMethod(
  3274. smalltalk.method({
  3275. selector: "testRemoveKey",
  3276. protocol: 'tests',
  3277. fn: function (){
  3278. var self=this;
  3279. var d,key;
  3280. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3281. return smalltalk.withContext(function($ctx1) {
  3282. var $1;
  3283. d=_st($Dictionary())._new();
  3284. _st(d)._at_put_((1),(2));
  3285. $ctx1.sendIdx["at:put:"]=1;
  3286. _st(d)._at_put_((2),(3));
  3287. $ctx1.sendIdx["at:put:"]=2;
  3288. _st(d)._at_put_((3),(4));
  3289. key=(2);
  3290. $1=_st(d)._keys();
  3291. $ctx1.sendIdx["keys"]=1;
  3292. self._assert_equals_($1,[(1), (2), (3)]);
  3293. $ctx1.sendIdx["assert:equals:"]=1;
  3294. _st(d)._removeKey_(key);
  3295. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3296. $ctx1.sendIdx["assert:equals:"]=2;
  3297. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3298. self._deny_(_st(d)._includesKey_((2)));
  3299. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3300. args: [],
  3301. source: "testRemoveKey\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  3302. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3303. referencedClasses: ["Dictionary"]
  3304. }),
  3305. smalltalk.DictionaryTest);
  3306. smalltalk.addMethod(
  3307. smalltalk.method({
  3308. selector: "testRemoveKeyIfAbsent",
  3309. protocol: 'tests',
  3310. fn: function (){
  3311. var self=this;
  3312. var d,key;
  3313. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3314. return smalltalk.withContext(function($ctx1) {
  3315. var $1;
  3316. d=_st($Dictionary())._new();
  3317. _st(d)._at_put_((1),(2));
  3318. $ctx1.sendIdx["at:put:"]=1;
  3319. _st(d)._at_put_((2),(3));
  3320. $ctx1.sendIdx["at:put:"]=2;
  3321. _st(d)._at_put_((3),(4));
  3322. key=(2);
  3323. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3324. $ctx1.sendIdx["assert:equals:"]=1;
  3325. key=(3);
  3326. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3327. return smalltalk.withContext(function($ctx2) {
  3328. return (42);
  3329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3330. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3331. self._assert_equals_($1,(4));
  3332. $ctx1.sendIdx["assert:equals:"]=2;
  3333. key="why";
  3334. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3335. return smalltalk.withContext(function($ctx2) {
  3336. return (42);
  3337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3338. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3339. args: [],
  3340. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ] ) equals: 42.",
  3341. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3342. referencedClasses: ["Dictionary"]
  3343. }),
  3344. smalltalk.DictionaryTest);
  3345. smalltalk.addMethod(
  3346. smalltalk.method({
  3347. selector: "testValues",
  3348. protocol: 'tests',
  3349. fn: function (){
  3350. var self=this;
  3351. var d;
  3352. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3353. return smalltalk.withContext(function($ctx1) {
  3354. d=_st($Dictionary())._new();
  3355. _st(d)._at_put_((1),(2));
  3356. $ctx1.sendIdx["at:put:"]=1;
  3357. _st(d)._at_put_((2),(3));
  3358. $ctx1.sendIdx["at:put:"]=2;
  3359. _st(d)._at_put_((3),(4));
  3360. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3361. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3362. args: [],
  3363. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  3364. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3365. referencedClasses: ["Dictionary"]
  3366. }),
  3367. smalltalk.DictionaryTest);
  3368. smalltalk.addMethod(
  3369. smalltalk.method({
  3370. selector: "collectionClass",
  3371. protocol: 'fixture',
  3372. fn: function (){
  3373. var self=this;
  3374. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3375. return smalltalk.withContext(function($ctx1) {
  3376. return $Dictionary();
  3377. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3378. args: [],
  3379. source: "collectionClass\x0a\x09^ Dictionary",
  3380. messageSends: [],
  3381. referencedClasses: ["Dictionary"]
  3382. }),
  3383. smalltalk.DictionaryTest.klass);
  3384. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3385. smalltalk.addMethod(
  3386. smalltalk.method({
  3387. selector: "collectionFirst",
  3388. protocol: 'fixture',
  3389. fn: function (){
  3390. var self=this;
  3391. return smalltalk.withContext(function($ctx1) {
  3392. self._subclassResponsibility();
  3393. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3394. args: [],
  3395. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3396. messageSends: ["subclassResponsibility"],
  3397. referencedClasses: []
  3398. }),
  3399. smalltalk.SequenceableCollectionTest);
  3400. smalltalk.addMethod(
  3401. smalltalk.method({
  3402. selector: "collectionFirstTwo",
  3403. protocol: 'fixture',
  3404. fn: function (){
  3405. var self=this;
  3406. return smalltalk.withContext(function($ctx1) {
  3407. self._subclassResponsibility();
  3408. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3409. args: [],
  3410. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3411. messageSends: ["subclassResponsibility"],
  3412. referencedClasses: []
  3413. }),
  3414. smalltalk.SequenceableCollectionTest);
  3415. smalltalk.addMethod(
  3416. smalltalk.method({
  3417. selector: "collectionLast",
  3418. protocol: 'fixture',
  3419. fn: function (){
  3420. var self=this;
  3421. return smalltalk.withContext(function($ctx1) {
  3422. self._subclassResponsibility();
  3423. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3424. args: [],
  3425. source: "collectionLast\x0a\x09self subclassResponsibility",
  3426. messageSends: ["subclassResponsibility"],
  3427. referencedClasses: []
  3428. }),
  3429. smalltalk.SequenceableCollectionTest);
  3430. smalltalk.addMethod(
  3431. smalltalk.method({
  3432. selector: "collectionLastTwo",
  3433. protocol: 'fixture',
  3434. fn: function (){
  3435. var self=this;
  3436. return smalltalk.withContext(function($ctx1) {
  3437. self._subclassResponsibility();
  3438. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3439. args: [],
  3440. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3441. messageSends: ["subclassResponsibility"],
  3442. referencedClasses: []
  3443. }),
  3444. smalltalk.SequenceableCollectionTest);
  3445. smalltalk.addMethod(
  3446. smalltalk.method({
  3447. selector: "nonIndexesDo:",
  3448. protocol: 'fixture',
  3449. fn: function (aBlock){
  3450. var self=this;
  3451. return smalltalk.withContext(function($ctx1) {
  3452. _st(aBlock)._value_((0));
  3453. $ctx1.sendIdx["value:"]=1;
  3454. _st(aBlock)._value_(_st(_st(self._collection())._size()).__plus((1)));
  3455. $ctx1.sendIdx["value:"]=2;
  3456. _st(aBlock)._value_("z");
  3457. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3458. args: ["aBlock"],
  3459. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collection size + 1.\x0a\x09aBlock value: 'z'",
  3460. messageSends: ["value:", "+", "size", "collection"],
  3461. referencedClasses: []
  3462. }),
  3463. smalltalk.SequenceableCollectionTest);
  3464. smalltalk.addMethod(
  3465. smalltalk.method({
  3466. selector: "samplesDo:",
  3467. protocol: 'fixture',
  3468. fn: function (aBlock){
  3469. var self=this;
  3470. return smalltalk.withContext(function($ctx1) {
  3471. _st(aBlock)._value_value_((1),self._collectionFirst());
  3472. $ctx1.sendIdx["value:value:"]=1;
  3473. _st(aBlock)._value_value_(_st(self._collection())._size(),self._collectionLast());
  3474. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3475. args: ["aBlock"],
  3476. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collection size value: self collectionLast",
  3477. messageSends: ["value:value:", "collectionFirst", "size", "collection", "collectionLast"],
  3478. referencedClasses: []
  3479. }),
  3480. smalltalk.SequenceableCollectionTest);
  3481. smalltalk.addMethod(
  3482. smalltalk.method({
  3483. selector: "testBeginsWith",
  3484. protocol: 'tests',
  3485. fn: function (){
  3486. var self=this;
  3487. return smalltalk.withContext(function($ctx1) {
  3488. var $2,$1,$4,$5,$3,$7,$6;
  3489. $2=self._collection();
  3490. $ctx1.sendIdx["collection"]=1;
  3491. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3492. $ctx1.sendIdx["beginsWith:"]=1;
  3493. self._assert_($1);
  3494. $ctx1.sendIdx["assert:"]=1;
  3495. $4=self._collection();
  3496. $ctx1.sendIdx["collection"]=2;
  3497. $5=self._collection();
  3498. $ctx1.sendIdx["collection"]=3;
  3499. $3=_st($4)._beginsWith_($5);
  3500. $ctx1.sendIdx["beginsWith:"]=2;
  3501. self._assert_($3);
  3502. $ctx1.sendIdx["assert:"]=2;
  3503. $7=self._collection();
  3504. $ctx1.sendIdx["collection"]=4;
  3505. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3506. $ctx1.sendIdx["beginsWith:"]=3;
  3507. self._assert_($6);
  3508. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3509. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3510. args: [],
  3511. 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)",
  3512. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3513. referencedClasses: []
  3514. }),
  3515. smalltalk.SequenceableCollectionTest);
  3516. smalltalk.addMethod(
  3517. smalltalk.method({
  3518. selector: "testEndsWith",
  3519. protocol: 'tests',
  3520. fn: function (){
  3521. var self=this;
  3522. return smalltalk.withContext(function($ctx1) {
  3523. var $2,$1,$4,$5,$3,$7,$6;
  3524. $2=self._collection();
  3525. $ctx1.sendIdx["collection"]=1;
  3526. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3527. $ctx1.sendIdx["endsWith:"]=1;
  3528. self._assert_($1);
  3529. $ctx1.sendIdx["assert:"]=1;
  3530. $4=self._collection();
  3531. $ctx1.sendIdx["collection"]=2;
  3532. $5=self._collection();
  3533. $ctx1.sendIdx["collection"]=3;
  3534. $3=_st($4)._endsWith_($5);
  3535. $ctx1.sendIdx["endsWith:"]=2;
  3536. self._assert_($3);
  3537. $ctx1.sendIdx["assert:"]=2;
  3538. $7=self._collection();
  3539. $ctx1.sendIdx["collection"]=4;
  3540. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3541. $ctx1.sendIdx["endsWith:"]=3;
  3542. self._assert_($6);
  3543. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3544. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3545. args: [],
  3546. 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)",
  3547. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3548. referencedClasses: []
  3549. }),
  3550. smalltalk.SequenceableCollectionTest);
  3551. smalltalk.addMethod(
  3552. smalltalk.method({
  3553. selector: "testFirst",
  3554. protocol: 'tests',
  3555. fn: function (){
  3556. var self=this;
  3557. return smalltalk.withContext(function($ctx1) {
  3558. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3559. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3560. args: [],
  3561. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3562. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3563. referencedClasses: []
  3564. }),
  3565. smalltalk.SequenceableCollectionTest);
  3566. smalltalk.addMethod(
  3567. smalltalk.method({
  3568. selector: "testFirstN",
  3569. protocol: 'tests',
  3570. fn: function (){
  3571. var self=this;
  3572. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3573. return smalltalk.withContext(function($ctx1) {
  3574. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3575. $2=self._collection();
  3576. $ctx1.sendIdx["collection"]=1;
  3577. $1=_st($2)._first_((2));
  3578. $ctx1.sendIdx["first:"]=1;
  3579. self._assert_equals_($1,self._collectionFirstTwo());
  3580. $ctx1.sendIdx["assert:equals:"]=1;
  3581. $4=self._collection();
  3582. $ctx1.sendIdx["collection"]=2;
  3583. $3=_st($4)._first_((0));
  3584. $ctx1.sendIdx["first:"]=2;
  3585. self._assert_equals_($3,_st(self._collectionClass())._new());
  3586. $ctx1.sendIdx["assert:equals:"]=2;
  3587. $6=self._collection();
  3588. $ctx1.sendIdx["collection"]=3;
  3589. $8=self._collection();
  3590. $ctx1.sendIdx["collection"]=4;
  3591. $7=_st($8)._size();
  3592. $5=_st($6)._first_($7);
  3593. $ctx1.sendIdx["first:"]=3;
  3594. $9=self._collection();
  3595. $ctx1.sendIdx["collection"]=5;
  3596. self._assert_equals_($5,$9);
  3597. self._should_raise_((function(){
  3598. return smalltalk.withContext(function($ctx2) {
  3599. return _st(self._collection())._first_((33));
  3600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3601. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3602. args: [],
  3603. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3604. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "size", "should:raise:"],
  3605. referencedClasses: ["Error"]
  3606. }),
  3607. smalltalk.SequenceableCollectionTest);
  3608. smalltalk.addMethod(
  3609. smalltalk.method({
  3610. selector: "testFourth",
  3611. protocol: 'tests',
  3612. fn: function (){
  3613. var self=this;
  3614. return smalltalk.withContext(function($ctx1) {
  3615. var $2,$1;
  3616. $2=self._collection();
  3617. $ctx1.sendIdx["collection"]=1;
  3618. $1=_st($2)._fourth();
  3619. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3620. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3621. args: [],
  3622. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3623. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3624. referencedClasses: []
  3625. }),
  3626. smalltalk.SequenceableCollectionTest);
  3627. smalltalk.addMethod(
  3628. smalltalk.method({
  3629. selector: "testLast",
  3630. protocol: 'tests',
  3631. fn: function (){
  3632. var self=this;
  3633. return smalltalk.withContext(function($ctx1) {
  3634. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3635. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3636. args: [],
  3637. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3638. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3639. referencedClasses: []
  3640. }),
  3641. smalltalk.SequenceableCollectionTest);
  3642. smalltalk.addMethod(
  3643. smalltalk.method({
  3644. selector: "testLastN",
  3645. protocol: 'tests',
  3646. fn: function (){
  3647. var self=this;
  3648. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3649. return smalltalk.withContext(function($ctx1) {
  3650. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3651. $2=self._collection();
  3652. $ctx1.sendIdx["collection"]=1;
  3653. $1=_st($2)._last_((2));
  3654. $ctx1.sendIdx["last:"]=1;
  3655. self._assert_equals_($1,self._collectionLastTwo());
  3656. $ctx1.sendIdx["assert:equals:"]=1;
  3657. $4=self._collection();
  3658. $ctx1.sendIdx["collection"]=2;
  3659. $3=_st($4)._last_((0));
  3660. $ctx1.sendIdx["last:"]=2;
  3661. self._assert_equals_($3,_st(self._collectionClass())._new());
  3662. $ctx1.sendIdx["assert:equals:"]=2;
  3663. $6=self._collection();
  3664. $ctx1.sendIdx["collection"]=3;
  3665. $8=self._collection();
  3666. $ctx1.sendIdx["collection"]=4;
  3667. $7=_st($8)._size();
  3668. $5=_st($6)._last_($7);
  3669. $ctx1.sendIdx["last:"]=3;
  3670. $9=self._collection();
  3671. $ctx1.sendIdx["collection"]=5;
  3672. self._assert_equals_($5,$9);
  3673. self._should_raise_((function(){
  3674. return smalltalk.withContext(function($ctx2) {
  3675. return _st(self._collection())._last_((33));
  3676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3677. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3678. args: [],
  3679. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3680. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "size", "should:raise:"],
  3681. referencedClasses: ["Error"]
  3682. }),
  3683. smalltalk.SequenceableCollectionTest);
  3684. smalltalk.addMethod(
  3685. smalltalk.method({
  3686. selector: "testSecond",
  3687. protocol: 'tests',
  3688. fn: function (){
  3689. var self=this;
  3690. return smalltalk.withContext(function($ctx1) {
  3691. var $2,$1;
  3692. $2=self._collection();
  3693. $ctx1.sendIdx["collection"]=1;
  3694. $1=_st($2)._second();
  3695. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3696. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3697. args: [],
  3698. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3699. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3700. referencedClasses: []
  3701. }),
  3702. smalltalk.SequenceableCollectionTest);
  3703. smalltalk.addMethod(
  3704. smalltalk.method({
  3705. selector: "testThird",
  3706. protocol: 'tests',
  3707. fn: function (){
  3708. var self=this;
  3709. return smalltalk.withContext(function($ctx1) {
  3710. var $2,$1;
  3711. $2=self._collection();
  3712. $ctx1.sendIdx["collection"]=1;
  3713. $1=_st($2)._third();
  3714. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3715. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3716. args: [],
  3717. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3718. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3719. referencedClasses: []
  3720. }),
  3721. smalltalk.SequenceableCollectionTest);
  3722. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3723. smalltalk.addMethod(
  3724. smalltalk.method({
  3725. selector: "collection",
  3726. protocol: 'fixture',
  3727. fn: function (){
  3728. var self=this;
  3729. return smalltalk.withContext(function($ctx1) {
  3730. var $1;
  3731. $1=[(1), (2), (3), (-4)];
  3732. return $1;
  3733. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3734. args: [],
  3735. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3736. messageSends: [],
  3737. referencedClasses: []
  3738. }),
  3739. smalltalk.ArrayTest);
  3740. smalltalk.addMethod(
  3741. smalltalk.method({
  3742. selector: "collectionFirst",
  3743. protocol: 'fixture',
  3744. fn: function (){
  3745. var self=this;
  3746. return smalltalk.withContext(function($ctx1) {
  3747. return (1);
  3748. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3749. args: [],
  3750. source: "collectionFirst\x0a\x09^ 1",
  3751. messageSends: [],
  3752. referencedClasses: []
  3753. }),
  3754. smalltalk.ArrayTest);
  3755. smalltalk.addMethod(
  3756. smalltalk.method({
  3757. selector: "collectionFirstTwo",
  3758. protocol: 'fixture',
  3759. fn: function (){
  3760. var self=this;
  3761. return smalltalk.withContext(function($ctx1) {
  3762. var $1;
  3763. $1=[(1), (2)];
  3764. return $1;
  3765. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3766. args: [],
  3767. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3768. messageSends: [],
  3769. referencedClasses: []
  3770. }),
  3771. smalltalk.ArrayTest);
  3772. smalltalk.addMethod(
  3773. smalltalk.method({
  3774. selector: "collectionLast",
  3775. protocol: 'fixture',
  3776. fn: function (){
  3777. var self=this;
  3778. return smalltalk.withContext(function($ctx1) {
  3779. return (-4);
  3780. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3781. args: [],
  3782. source: "collectionLast\x0a\x09^ -4",
  3783. messageSends: [],
  3784. referencedClasses: []
  3785. }),
  3786. smalltalk.ArrayTest);
  3787. smalltalk.addMethod(
  3788. smalltalk.method({
  3789. selector: "collectionLastTwo",
  3790. protocol: 'fixture',
  3791. fn: function (){
  3792. var self=this;
  3793. return smalltalk.withContext(function($ctx1) {
  3794. var $1;
  3795. $1=[(3), (-4)];
  3796. return $1;
  3797. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3798. args: [],
  3799. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3800. messageSends: [],
  3801. referencedClasses: []
  3802. }),
  3803. smalltalk.ArrayTest);
  3804. smalltalk.addMethod(
  3805. smalltalk.method({
  3806. selector: "collectionOfPrintStrings",
  3807. protocol: 'fixture',
  3808. fn: function (){
  3809. var self=this;
  3810. return smalltalk.withContext(function($ctx1) {
  3811. var $1;
  3812. $1=["1", "2", "3", "-4"];
  3813. return $1;
  3814. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3815. args: [],
  3816. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3817. messageSends: [],
  3818. referencedClasses: []
  3819. }),
  3820. smalltalk.ArrayTest);
  3821. smalltalk.addMethod(
  3822. smalltalk.method({
  3823. selector: "collectionSize",
  3824. protocol: 'fixture',
  3825. fn: function (){
  3826. var self=this;
  3827. return smalltalk.withContext(function($ctx1) {
  3828. return (4);
  3829. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3830. args: [],
  3831. source: "collectionSize\x0a\x09^ 4",
  3832. messageSends: [],
  3833. referencedClasses: []
  3834. }),
  3835. smalltalk.ArrayTest);
  3836. smalltalk.addMethod(
  3837. smalltalk.method({
  3838. selector: "collectionWithDuplicates",
  3839. protocol: 'fixture',
  3840. fn: function (){
  3841. var self=this;
  3842. return smalltalk.withContext(function($ctx1) {
  3843. var $1;
  3844. $1=["a", "b", "c", (1), (2), (1), "a"];
  3845. return $1;
  3846. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3847. args: [],
  3848. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3849. messageSends: [],
  3850. referencedClasses: []
  3851. }),
  3852. smalltalk.ArrayTest);
  3853. smalltalk.addMethod(
  3854. smalltalk.method({
  3855. selector: "collectionWithNewValue",
  3856. protocol: 'fixture',
  3857. fn: function (){
  3858. var self=this;
  3859. return smalltalk.withContext(function($ctx1) {
  3860. var $1;
  3861. $1=[(1), (2), (3), (-4), "N"];
  3862. return $1;
  3863. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3864. args: [],
  3865. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3866. messageSends: [],
  3867. referencedClasses: []
  3868. }),
  3869. smalltalk.ArrayTest);
  3870. smalltalk.addMethod(
  3871. smalltalk.method({
  3872. selector: "sampleNewIndex",
  3873. protocol: 'fixture',
  3874. fn: function (){
  3875. var self=this;
  3876. return smalltalk.withContext(function($ctx1) {
  3877. return (5);
  3878. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3879. args: [],
  3880. source: "sampleNewIndex\x0a\x09^ 5",
  3881. messageSends: [],
  3882. referencedClasses: []
  3883. }),
  3884. smalltalk.ArrayTest);
  3885. smalltalk.addMethod(
  3886. smalltalk.method({
  3887. selector: "samplesDo:",
  3888. protocol: 'fixture',
  3889. fn: function (aBlock){
  3890. var self=this;
  3891. return smalltalk.withContext(function($ctx1) {
  3892. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3893. _st(aBlock)._value_value_((3),(3));
  3894. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3895. args: ["aBlock"],
  3896. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3897. messageSends: ["samplesDo:", "value:value:"],
  3898. referencedClasses: []
  3899. }),
  3900. smalltalk.ArrayTest);
  3901. smalltalk.addMethod(
  3902. smalltalk.method({
  3903. selector: "testAdd",
  3904. protocol: 'tests',
  3905. fn: function (){
  3906. var self=this;
  3907. var array;
  3908. return smalltalk.withContext(function($ctx1) {
  3909. array=self._collection();
  3910. _st(array)._add_((6));
  3911. self._assert_equals_(_st(array)._last(),(6));
  3912. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3913. args: [],
  3914. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3915. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3916. referencedClasses: []
  3917. }),
  3918. smalltalk.ArrayTest);
  3919. smalltalk.addMethod(
  3920. smalltalk.method({
  3921. selector: "testAddFirst",
  3922. protocol: 'tests',
  3923. fn: function (){
  3924. var self=this;
  3925. return smalltalk.withContext(function($ctx1) {
  3926. var $1,$2;
  3927. $1=self._collection();
  3928. _st($1)._addFirst_((0));
  3929. $2=_st($1)._yourself();
  3930. self._assert_equals_(_st($2)._first(),(0));
  3931. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3932. args: [],
  3933. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3934. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3935. referencedClasses: []
  3936. }),
  3937. smalltalk.ArrayTest);
  3938. smalltalk.addMethod(
  3939. smalltalk.method({
  3940. selector: "testPrintString",
  3941. protocol: 'tests',
  3942. fn: function (){
  3943. var self=this;
  3944. var array;
  3945. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3946. return smalltalk.withContext(function($ctx1) {
  3947. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3948. array=_st($Array())._new();
  3949. $1=_st(array)._printString();
  3950. $ctx1.sendIdx["printString"]=1;
  3951. self._assert_equals_($1,"an Array ()");
  3952. $ctx1.sendIdx["assert:equals:"]=1;
  3953. $2=array;
  3954. _st($2)._add_((1));
  3955. $ctx1.sendIdx["add:"]=1;
  3956. $3=_st($2)._add_((3));
  3957. $ctx1.sendIdx["add:"]=2;
  3958. $4=_st(array)._printString();
  3959. $ctx1.sendIdx["printString"]=2;
  3960. self._assert_equals_($4,"an Array (1 3)");
  3961. $ctx1.sendIdx["assert:equals:"]=2;
  3962. _st(array)._add_("foo");
  3963. $5=_st(array)._printString();
  3964. $ctx1.sendIdx["printString"]=3;
  3965. self._assert_equals_($5,"an Array (1 3 'foo')");
  3966. $ctx1.sendIdx["assert:equals:"]=3;
  3967. $6=array;
  3968. _st($6)._remove_((1));
  3969. $ctx1.sendIdx["remove:"]=1;
  3970. $7=_st($6)._remove_((3));
  3971. $8=_st(array)._printString();
  3972. $ctx1.sendIdx["printString"]=4;
  3973. self._assert_equals_($8,"an Array ('foo')");
  3974. $ctx1.sendIdx["assert:equals:"]=4;
  3975. _st(array)._addLast_((3));
  3976. $ctx1.sendIdx["addLast:"]=1;
  3977. $9=_st(array)._printString();
  3978. $ctx1.sendIdx["printString"]=5;
  3979. self._assert_equals_($9,"an Array ('foo' 3)");
  3980. $ctx1.sendIdx["assert:equals:"]=5;
  3981. _st(array)._addLast_((3));
  3982. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3983. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3984. args: [],
  3985. 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)'.",
  3986. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3987. referencedClasses: ["Array"]
  3988. }),
  3989. smalltalk.ArrayTest);
  3990. smalltalk.addMethod(
  3991. smalltalk.method({
  3992. selector: "testRemove",
  3993. protocol: 'tests',
  3994. fn: function (){
  3995. var self=this;
  3996. var array;
  3997. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3998. return smalltalk.withContext(function($ctx1) {
  3999. array=[(1), (2), (3), (4), (5)];
  4000. _st(array)._remove_((3));
  4001. $ctx1.sendIdx["remove:"]=1;
  4002. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4003. self._should_raise_((function(){
  4004. return smalltalk.withContext(function($ctx2) {
  4005. return _st(array)._remove_((3));
  4006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4007. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4008. args: [],
  4009. 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",
  4010. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4011. referencedClasses: ["Error"]
  4012. }),
  4013. smalltalk.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "testRemoveFromTo",
  4017. protocol: 'tests',
  4018. fn: function (){
  4019. var self=this;
  4020. return smalltalk.withContext(function($ctx1) {
  4021. var $1,$2;
  4022. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4023. $ctx1.sendIdx["removeFrom:to:"]=1;
  4024. self._assert_equals_($1,[(4)]);
  4025. $ctx1.sendIdx["assert:equals:"]=1;
  4026. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4027. $ctx1.sendIdx["removeFrom:to:"]=2;
  4028. self._assert_equals_($2,[(1), (4)]);
  4029. $ctx1.sendIdx["assert:equals:"]=2;
  4030. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4031. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4032. args: [],
  4033. 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)",
  4034. messageSends: ["assert:equals:", "removeFrom:to:"],
  4035. referencedClasses: []
  4036. }),
  4037. smalltalk.ArrayTest);
  4038. smalltalk.addMethod(
  4039. smalltalk.method({
  4040. selector: "testRemoveIndex",
  4041. protocol: 'tests',
  4042. fn: function (){
  4043. var self=this;
  4044. return smalltalk.withContext(function($ctx1) {
  4045. var $1,$2;
  4046. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4047. $ctx1.sendIdx["removeIndex:"]=1;
  4048. self._assert_equals_($1,[(1), (3), (4)]);
  4049. $ctx1.sendIdx["assert:equals:"]=1;
  4050. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4051. $ctx1.sendIdx["removeIndex:"]=2;
  4052. self._assert_equals_($2,[(2), (3), (4)]);
  4053. $ctx1.sendIdx["assert:equals:"]=2;
  4054. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4055. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4056. args: [],
  4057. 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: #()",
  4058. messageSends: ["assert:equals:", "removeIndex:"],
  4059. referencedClasses: []
  4060. }),
  4061. smalltalk.ArrayTest);
  4062. smalltalk.addMethod(
  4063. smalltalk.method({
  4064. selector: "testRemoveLast",
  4065. protocol: 'tests',
  4066. fn: function (){
  4067. var self=this;
  4068. var array;
  4069. return smalltalk.withContext(function($ctx1) {
  4070. array=[(1), (2)];
  4071. _st(array)._removeLast();
  4072. self._assert_equals_(_st(array)._last(),(1));
  4073. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4074. args: [],
  4075. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4076. messageSends: ["removeLast", "assert:equals:", "last"],
  4077. referencedClasses: []
  4078. }),
  4079. smalltalk.ArrayTest);
  4080. smalltalk.addMethod(
  4081. smalltalk.method({
  4082. selector: "testReversed",
  4083. protocol: 'tests',
  4084. fn: function (){
  4085. var self=this;
  4086. var array;
  4087. return smalltalk.withContext(function($ctx1) {
  4088. array=[(5), (4), (3), (2), (1)];
  4089. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4090. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4091. args: [],
  4092. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4093. messageSends: ["assert:equals:", "reversed"],
  4094. referencedClasses: []
  4095. }),
  4096. smalltalk.ArrayTest);
  4097. smalltalk.addMethod(
  4098. smalltalk.method({
  4099. selector: "testSort",
  4100. protocol: 'tests',
  4101. fn: function (){
  4102. var self=this;
  4103. var array;
  4104. return smalltalk.withContext(function($ctx1) {
  4105. array=[(3), (1), (4), (5), (2)];
  4106. _st(array)._sort();
  4107. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4108. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4109. args: [],
  4110. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4111. messageSends: ["sort", "assert:equals:"],
  4112. referencedClasses: []
  4113. }),
  4114. smalltalk.ArrayTest);
  4115. smalltalk.addMethod(
  4116. smalltalk.method({
  4117. selector: "collectionClass",
  4118. protocol: 'fixture',
  4119. fn: function (){
  4120. var self=this;
  4121. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4122. return smalltalk.withContext(function($ctx1) {
  4123. return $Array();
  4124. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4125. args: [],
  4126. source: "collectionClass\x0a\x09^ Array",
  4127. messageSends: [],
  4128. referencedClasses: ["Array"]
  4129. }),
  4130. smalltalk.ArrayTest.klass);
  4131. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4132. smalltalk.addMethod(
  4133. smalltalk.method({
  4134. selector: "collection",
  4135. protocol: 'fixture',
  4136. fn: function (){
  4137. var self=this;
  4138. return smalltalk.withContext(function($ctx1) {
  4139. return "hello";
  4140. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4141. args: [],
  4142. source: "collection\x0a\x09^ 'hello'",
  4143. messageSends: [],
  4144. referencedClasses: []
  4145. }),
  4146. smalltalk.StringTest);
  4147. smalltalk.addMethod(
  4148. smalltalk.method({
  4149. selector: "collectionFirst",
  4150. protocol: 'fixture',
  4151. fn: function (){
  4152. var self=this;
  4153. return smalltalk.withContext(function($ctx1) {
  4154. return "h";
  4155. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4156. args: [],
  4157. source: "collectionFirst\x0a\x09^ 'h'",
  4158. messageSends: [],
  4159. referencedClasses: []
  4160. }),
  4161. smalltalk.StringTest);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "collectionFirstTwo",
  4165. protocol: 'fixture',
  4166. fn: function (){
  4167. var self=this;
  4168. return smalltalk.withContext(function($ctx1) {
  4169. return "he";
  4170. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4171. args: [],
  4172. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4173. messageSends: [],
  4174. referencedClasses: []
  4175. }),
  4176. smalltalk.StringTest);
  4177. smalltalk.addMethod(
  4178. smalltalk.method({
  4179. selector: "collectionLast",
  4180. protocol: 'fixture',
  4181. fn: function (){
  4182. var self=this;
  4183. return smalltalk.withContext(function($ctx1) {
  4184. return "o";
  4185. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4186. args: [],
  4187. source: "collectionLast\x0a\x09^ 'o'",
  4188. messageSends: [],
  4189. referencedClasses: []
  4190. }),
  4191. smalltalk.StringTest);
  4192. smalltalk.addMethod(
  4193. smalltalk.method({
  4194. selector: "collectionLastTwo",
  4195. protocol: 'fixture',
  4196. fn: function (){
  4197. var self=this;
  4198. return smalltalk.withContext(function($ctx1) {
  4199. return "lo";
  4200. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4201. args: [],
  4202. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4203. messageSends: [],
  4204. referencedClasses: []
  4205. }),
  4206. smalltalk.StringTest);
  4207. smalltalk.addMethod(
  4208. smalltalk.method({
  4209. selector: "collectionOfPrintStrings",
  4210. protocol: 'fixture',
  4211. fn: function (){
  4212. var self=this;
  4213. return smalltalk.withContext(function($ctx1) {
  4214. return "'h''e''l''l''o'";
  4215. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4216. args: [],
  4217. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4218. messageSends: [],
  4219. referencedClasses: []
  4220. }),
  4221. smalltalk.StringTest);
  4222. smalltalk.addMethod(
  4223. smalltalk.method({
  4224. selector: "collectionSize",
  4225. protocol: 'fixture',
  4226. fn: function (){
  4227. var self=this;
  4228. return smalltalk.withContext(function($ctx1) {
  4229. return (5);
  4230. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4231. args: [],
  4232. source: "collectionSize\x0a\x09^ 5",
  4233. messageSends: [],
  4234. referencedClasses: []
  4235. }),
  4236. smalltalk.StringTest);
  4237. smalltalk.addMethod(
  4238. smalltalk.method({
  4239. selector: "collectionWithDuplicates",
  4240. protocol: 'fixture',
  4241. fn: function (){
  4242. var self=this;
  4243. return smalltalk.withContext(function($ctx1) {
  4244. return "abbaerte";
  4245. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4246. args: [],
  4247. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4248. messageSends: [],
  4249. referencedClasses: []
  4250. }),
  4251. smalltalk.StringTest);
  4252. smalltalk.addMethod(
  4253. smalltalk.method({
  4254. selector: "collectionWithNewValue",
  4255. protocol: 'fixture',
  4256. fn: function (){
  4257. var self=this;
  4258. return smalltalk.withContext(function($ctx1) {
  4259. return "helloN";
  4260. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4261. args: [],
  4262. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4263. messageSends: [],
  4264. referencedClasses: []
  4265. }),
  4266. smalltalk.StringTest);
  4267. smalltalk.addMethod(
  4268. smalltalk.method({
  4269. selector: "sampleNewValueAsCollection",
  4270. protocol: 'fixture',
  4271. fn: function (){
  4272. var self=this;
  4273. return smalltalk.withContext(function($ctx1) {
  4274. return "N";
  4275. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4276. args: [],
  4277. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4278. messageSends: [],
  4279. referencedClasses: []
  4280. }),
  4281. smalltalk.StringTest);
  4282. smalltalk.addMethod(
  4283. smalltalk.method({
  4284. selector: "samplesDo:",
  4285. protocol: 'fixture',
  4286. fn: function (aBlock){
  4287. var self=this;
  4288. return smalltalk.withContext(function($ctx1) {
  4289. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4290. _st(aBlock)._value_value_((3),"l");
  4291. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4292. args: ["aBlock"],
  4293. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4294. messageSends: ["samplesDo:", "value:value:"],
  4295. referencedClasses: []
  4296. }),
  4297. smalltalk.StringTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "testAddAll",
  4301. protocol: 'tests',
  4302. fn: function (){
  4303. var self=this;
  4304. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4305. return smalltalk.withContext(function($ctx1) {
  4306. var $1;
  4307. self._should_raise_((function(){
  4308. return smalltalk.withContext(function($ctx2) {
  4309. $1=self._collection();
  4310. $ctx2.sendIdx["collection"]=1;
  4311. return _st($1)._addAll_(self._collection());
  4312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4313. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4314. args: [],
  4315. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4316. messageSends: ["should:raise:", "addAll:", "collection"],
  4317. referencedClasses: ["Error"]
  4318. }),
  4319. smalltalk.StringTest);
  4320. smalltalk.addMethod(
  4321. smalltalk.method({
  4322. selector: "testAddRemove",
  4323. protocol: 'tests',
  4324. fn: function (){
  4325. var self=this;
  4326. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4327. return smalltalk.withContext(function($ctx1) {
  4328. self._should_raise_((function(){
  4329. return smalltalk.withContext(function($ctx2) {
  4330. return "hello"._add_("a");
  4331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4332. $ctx1.sendIdx["should:raise:"]=1;
  4333. self._should_raise_((function(){
  4334. return smalltalk.withContext(function($ctx2) {
  4335. return "hello"._remove_("h");
  4336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4337. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4338. args: [],
  4339. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4340. messageSends: ["should:raise:", "add:", "remove:"],
  4341. referencedClasses: ["Error"]
  4342. }),
  4343. smalltalk.StringTest);
  4344. smalltalk.addMethod(
  4345. smalltalk.method({
  4346. selector: "testAsArray",
  4347. protocol: 'tests',
  4348. fn: function (){
  4349. var self=this;
  4350. return smalltalk.withContext(function($ctx1) {
  4351. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4352. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4353. args: [],
  4354. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4355. messageSends: ["assert:equals:", "asArray"],
  4356. referencedClasses: []
  4357. }),
  4358. smalltalk.StringTest);
  4359. smalltalk.addMethod(
  4360. smalltalk.method({
  4361. selector: "testAsLowerCase",
  4362. protocol: 'tests',
  4363. fn: function (){
  4364. var self=this;
  4365. return smalltalk.withContext(function($ctx1) {
  4366. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4367. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4368. args: [],
  4369. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4370. messageSends: ["assert:equals:", "asLowercase"],
  4371. referencedClasses: []
  4372. }),
  4373. smalltalk.StringTest);
  4374. smalltalk.addMethod(
  4375. smalltalk.method({
  4376. selector: "testAsNumber",
  4377. protocol: 'tests',
  4378. fn: function (){
  4379. var self=this;
  4380. return smalltalk.withContext(function($ctx1) {
  4381. var $1,$2;
  4382. $1="3"._asNumber();
  4383. $ctx1.sendIdx["asNumber"]=1;
  4384. self._assert_equals_($1,(3));
  4385. $ctx1.sendIdx["assert:equals:"]=1;
  4386. $2="-3"._asNumber();
  4387. $ctx1.sendIdx["asNumber"]=2;
  4388. self._assert_equals_($2,(-3));
  4389. $ctx1.sendIdx["assert:equals:"]=2;
  4390. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4391. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4392. args: [],
  4393. 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.",
  4394. messageSends: ["assert:equals:", "asNumber"],
  4395. referencedClasses: []
  4396. }),
  4397. smalltalk.StringTest);
  4398. smalltalk.addMethod(
  4399. smalltalk.method({
  4400. selector: "testAsUpperCase",
  4401. protocol: 'tests',
  4402. fn: function (){
  4403. var self=this;
  4404. return smalltalk.withContext(function($ctx1) {
  4405. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4406. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4407. args: [],
  4408. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4409. messageSends: ["assert:equals:", "asUppercase"],
  4410. referencedClasses: []
  4411. }),
  4412. smalltalk.StringTest);
  4413. smalltalk.addMethod(
  4414. smalltalk.method({
  4415. selector: "testAsciiValue",
  4416. protocol: 'tests',
  4417. fn: function (){
  4418. var self=this;
  4419. var characterA,characterU;
  4420. return smalltalk.withContext(function($ctx1) {
  4421. var $1;
  4422. characterA="A";
  4423. characterU="U";
  4424. $1=_st(characterA)._asciiValue();
  4425. $ctx1.sendIdx["asciiValue"]=1;
  4426. self._assert_equals_($1,(65));
  4427. $ctx1.sendIdx["assert:equals:"]=1;
  4428. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4429. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4430. args: [],
  4431. 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",
  4432. messageSends: ["assert:equals:", "asciiValue"],
  4433. referencedClasses: []
  4434. }),
  4435. smalltalk.StringTest);
  4436. smalltalk.addMethod(
  4437. smalltalk.method({
  4438. selector: "testAtPut",
  4439. protocol: 'tests',
  4440. fn: function (){
  4441. var self=this;
  4442. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4443. return smalltalk.withContext(function($ctx1) {
  4444. self._should_raise_((function(){
  4445. return smalltalk.withContext(function($ctx2) {
  4446. return "hello"._at_put_((1),"a");
  4447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4448. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4449. args: [],
  4450. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4451. messageSends: ["should:raise:", "at:put:"],
  4452. referencedClasses: ["Error"]
  4453. }),
  4454. smalltalk.StringTest);
  4455. smalltalk.addMethod(
  4456. smalltalk.method({
  4457. selector: "testCapitalized",
  4458. protocol: 'tests',
  4459. fn: function (){
  4460. var self=this;
  4461. return smalltalk.withContext(function($ctx1) {
  4462. var $1,$2,$3;
  4463. $1="test"._capitalized();
  4464. $ctx1.sendIdx["capitalized"]=1;
  4465. self._assert_equals_($1,"Test");
  4466. $ctx1.sendIdx["assert:equals:"]=1;
  4467. $2="Test"._capitalized();
  4468. $ctx1.sendIdx["capitalized"]=2;
  4469. self._assert_equals_($2,"Test");
  4470. $ctx1.sendIdx["assert:equals:"]=2;
  4471. self._assert_equals_(""._capitalized(),"");
  4472. $ctx1.sendIdx["assert:equals:"]=3;
  4473. $3="Test"._isCapitalized();
  4474. $ctx1.sendIdx["isCapitalized"]=1;
  4475. self._assert_equals_($3,true);
  4476. $ctx1.sendIdx["assert:equals:"]=4;
  4477. self._assert_equals_("test"._isCapitalized(),false);
  4478. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4479. args: [],
  4480. 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.",
  4481. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4482. referencedClasses: []
  4483. }),
  4484. smalltalk.StringTest);
  4485. smalltalk.addMethod(
  4486. smalltalk.method({
  4487. selector: "testCharCodeAt",
  4488. protocol: 'tests',
  4489. fn: function (){
  4490. var self=this;
  4491. return smalltalk.withContext(function($ctx1) {
  4492. var $1,$2,$3,$4,$5;
  4493. $1="jackie"._charCodeAt_((1));
  4494. $ctx1.sendIdx["charCodeAt:"]=1;
  4495. self._assert_equals_($1,(106));
  4496. $ctx1.sendIdx["assert:equals:"]=1;
  4497. $2="jackie"._charCodeAt_((2));
  4498. $ctx1.sendIdx["charCodeAt:"]=2;
  4499. self._assert_equals_($2,(97));
  4500. $ctx1.sendIdx["assert:equals:"]=2;
  4501. $3="jackie"._charCodeAt_((3));
  4502. $ctx1.sendIdx["charCodeAt:"]=3;
  4503. self._assert_equals_($3,(99));
  4504. $ctx1.sendIdx["assert:equals:"]=3;
  4505. $4="jackie"._charCodeAt_((4));
  4506. $ctx1.sendIdx["charCodeAt:"]=4;
  4507. self._assert_equals_($4,(107));
  4508. $ctx1.sendIdx["assert:equals:"]=4;
  4509. $5="jackie"._charCodeAt_((5));
  4510. $ctx1.sendIdx["charCodeAt:"]=5;
  4511. self._assert_equals_($5,(105));
  4512. $ctx1.sendIdx["assert:equals:"]=5;
  4513. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4514. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4515. args: [],
  4516. 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",
  4517. messageSends: ["assert:equals:", "charCodeAt:"],
  4518. referencedClasses: []
  4519. }),
  4520. smalltalk.StringTest);
  4521. smalltalk.addMethod(
  4522. smalltalk.method({
  4523. selector: "testCopyFromTo",
  4524. protocol: 'tests',
  4525. fn: function (){
  4526. var self=this;
  4527. return smalltalk.withContext(function($ctx1) {
  4528. var $1;
  4529. $1="jackie"._copyFrom_to_((1),(3));
  4530. $ctx1.sendIdx["copyFrom:to:"]=1;
  4531. self._assert_equals_($1,"jac");
  4532. $ctx1.sendIdx["assert:equals:"]=1;
  4533. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4534. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4535. args: [],
  4536. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4537. messageSends: ["assert:equals:", "copyFrom:to:"],
  4538. referencedClasses: []
  4539. }),
  4540. smalltalk.StringTest);
  4541. smalltalk.addMethod(
  4542. smalltalk.method({
  4543. selector: "testCopyWithoutAll",
  4544. protocol: 'tests',
  4545. fn: function (){
  4546. var self=this;
  4547. return smalltalk.withContext(function($ctx1) {
  4548. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4549. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4550. args: [],
  4551. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4552. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4553. referencedClasses: []
  4554. }),
  4555. smalltalk.StringTest);
  4556. smalltalk.addMethod(
  4557. smalltalk.method({
  4558. selector: "testEquality",
  4559. protocol: 'tests',
  4560. fn: function (){
  4561. var self=this;
  4562. return smalltalk.withContext(function($ctx1) {
  4563. var $1,$2,$3;
  4564. self._assert_equals_("hello","hello");
  4565. $ctx1.sendIdx["assert:equals:"]=1;
  4566. $1="hello".__eq("world");
  4567. $ctx1.sendIdx["="]=1;
  4568. self._deny_($1);
  4569. $ctx1.sendIdx["deny:"]=1;
  4570. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4571. return smalltalk.withContext(function($ctx2) {
  4572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4573. $ctx1.sendIdx["="]=2;
  4574. self._deny_($2);
  4575. $ctx1.sendIdx["deny:"]=2;
  4576. $3="hello"._yourself();
  4577. $ctx1.sendIdx["yourself"]=1;
  4578. self._assert_equals_("hello",$3);
  4579. $ctx1.sendIdx["assert:equals:"]=2;
  4580. self._assert_equals_("hello"._yourself(),"hello");
  4581. self._deny_("".__eq((0)));
  4582. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4583. args: [],
  4584. 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",
  4585. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4586. referencedClasses: []
  4587. }),
  4588. smalltalk.StringTest);
  4589. smalltalk.addMethod(
  4590. smalltalk.method({
  4591. selector: "testIdentity",
  4592. protocol: 'tests',
  4593. fn: function (){
  4594. var self=this;
  4595. return smalltalk.withContext(function($ctx1) {
  4596. var $1,$2,$4,$3,$5;
  4597. $1="hello".__eq_eq("hello");
  4598. $ctx1.sendIdx["=="]=1;
  4599. self._assert_($1);
  4600. $ctx1.sendIdx["assert:"]=1;
  4601. $2="hello".__eq_eq("world");
  4602. $ctx1.sendIdx["=="]=2;
  4603. self._deny_($2);
  4604. $ctx1.sendIdx["deny:"]=1;
  4605. $4="hello"._yourself();
  4606. $ctx1.sendIdx["yourself"]=1;
  4607. $3="hello".__eq_eq($4);
  4608. $ctx1.sendIdx["=="]=3;
  4609. self._assert_($3);
  4610. $ctx1.sendIdx["assert:"]=2;
  4611. $5=_st("hello"._yourself()).__eq_eq("hello");
  4612. $ctx1.sendIdx["=="]=4;
  4613. self._assert_($5);
  4614. self._deny_("".__eq_eq((0)));
  4615. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4616. args: [],
  4617. 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",
  4618. messageSends: ["assert:", "==", "deny:", "yourself"],
  4619. referencedClasses: []
  4620. }),
  4621. smalltalk.StringTest);
  4622. smalltalk.addMethod(
  4623. smalltalk.method({
  4624. selector: "testIdentityHash",
  4625. protocol: 'tests',
  4626. fn: function (){
  4627. var self=this;
  4628. return smalltalk.withContext(function($ctx1) {
  4629. var $1,$2,$4,$3;
  4630. $1="foo"._identityHash();
  4631. $ctx1.sendIdx["identityHash"]=1;
  4632. $2="foo"._identityHash();
  4633. $ctx1.sendIdx["identityHash"]=2;
  4634. self._assert_equals_($1,$2);
  4635. $4="foo"._identityHash();
  4636. $ctx1.sendIdx["identityHash"]=3;
  4637. $3=_st($4).__eq("bar"._identityHash());
  4638. self._deny_($3);
  4639. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4640. args: [],
  4641. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4642. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4643. referencedClasses: []
  4644. }),
  4645. smalltalk.StringTest);
  4646. smalltalk.addMethod(
  4647. smalltalk.method({
  4648. selector: "testIncludesSubString",
  4649. protocol: 'tests',
  4650. fn: function (){
  4651. var self=this;
  4652. return smalltalk.withContext(function($ctx1) {
  4653. var $1;
  4654. $1="amber"._includesSubString_("ber");
  4655. $ctx1.sendIdx["includesSubString:"]=1;
  4656. self._assert_($1);
  4657. self._deny_("amber"._includesSubString_("zork"));
  4658. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4659. args: [],
  4660. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4661. messageSends: ["assert:", "includesSubString:", "deny:"],
  4662. referencedClasses: []
  4663. }),
  4664. smalltalk.StringTest);
  4665. smalltalk.addMethod(
  4666. smalltalk.method({
  4667. selector: "testIsVowel",
  4668. protocol: 'tests',
  4669. fn: function (){
  4670. var self=this;
  4671. var vowel,consonant;
  4672. return smalltalk.withContext(function($ctx1) {
  4673. var $1;
  4674. vowel="u";
  4675. consonant="z";
  4676. $1=_st(vowel)._isVowel();
  4677. $ctx1.sendIdx["isVowel"]=1;
  4678. self._assert_equals_($1,true);
  4679. $ctx1.sendIdx["assert:equals:"]=1;
  4680. self._assert_equals_(_st(consonant)._isVowel(),false);
  4681. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4682. args: [],
  4683. 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",
  4684. messageSends: ["assert:equals:", "isVowel"],
  4685. referencedClasses: []
  4686. }),
  4687. smalltalk.StringTest);
  4688. smalltalk.addMethod(
  4689. smalltalk.method({
  4690. selector: "testJoin",
  4691. protocol: 'tests',
  4692. fn: function (){
  4693. var self=this;
  4694. return smalltalk.withContext(function($ctx1) {
  4695. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4696. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4697. args: [],
  4698. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4699. messageSends: ["assert:equals:", "join:"],
  4700. referencedClasses: []
  4701. }),
  4702. smalltalk.StringTest);
  4703. smalltalk.addMethod(
  4704. smalltalk.method({
  4705. selector: "testRemoveAll",
  4706. protocol: 'tests',
  4707. fn: function (){
  4708. var self=this;
  4709. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4710. return smalltalk.withContext(function($ctx1) {
  4711. self._should_raise_((function(){
  4712. return smalltalk.withContext(function($ctx2) {
  4713. return _st(self._collection())._removeAll();
  4714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4715. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4716. args: [],
  4717. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4718. messageSends: ["should:raise:", "removeAll", "collection"],
  4719. referencedClasses: ["Error"]
  4720. }),
  4721. smalltalk.StringTest);
  4722. smalltalk.addMethod(
  4723. smalltalk.method({
  4724. selector: "testReversed",
  4725. protocol: 'tests',
  4726. fn: function (){
  4727. var self=this;
  4728. return smalltalk.withContext(function($ctx1) {
  4729. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4730. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4731. args: [],
  4732. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4733. messageSends: ["assert:equals:", "reversed"],
  4734. referencedClasses: []
  4735. }),
  4736. smalltalk.StringTest);
  4737. smalltalk.addMethod(
  4738. smalltalk.method({
  4739. selector: "testStreamContents",
  4740. protocol: 'tests',
  4741. fn: function (){
  4742. var self=this;
  4743. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4744. return smalltalk.withContext(function($ctx1) {
  4745. var $1;
  4746. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4747. return smalltalk.withContext(function($ctx2) {
  4748. _st(aStream)._nextPutAll_("hello");
  4749. $ctx2.sendIdx["nextPutAll:"]=1;
  4750. _st(aStream)._space();
  4751. $1=_st(aStream)._nextPutAll_("world");
  4752. return $1;
  4753. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4754. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4755. args: [],
  4756. 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'",
  4757. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4758. referencedClasses: ["String"]
  4759. }),
  4760. smalltalk.StringTest);
  4761. smalltalk.addMethod(
  4762. smalltalk.method({
  4763. selector: "testSubStrings",
  4764. protocol: 'tests',
  4765. fn: function (){
  4766. var self=this;
  4767. return smalltalk.withContext(function($ctx1) {
  4768. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4769. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4770. args: [],
  4771. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4772. messageSends: ["assert:equals:", "subStrings:"],
  4773. referencedClasses: []
  4774. }),
  4775. smalltalk.StringTest);
  4776. smalltalk.addMethod(
  4777. smalltalk.method({
  4778. selector: "testTrim",
  4779. protocol: 'tests',
  4780. fn: function (){
  4781. var self=this;
  4782. return smalltalk.withContext(function($ctx1) {
  4783. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4784. $ctx1.sendIdx["assert:equals:"]=1;
  4785. self._assert_equals_("jackie "._trimRight(),"jackie");
  4786. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4787. args: [],
  4788. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4789. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4790. referencedClasses: []
  4791. }),
  4792. smalltalk.StringTest);
  4793. smalltalk.addMethod(
  4794. smalltalk.method({
  4795. selector: "collectionClass",
  4796. protocol: 'fixture',
  4797. fn: function (){
  4798. var self=this;
  4799. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4800. return smalltalk.withContext(function($ctx1) {
  4801. return $String();
  4802. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4803. args: [],
  4804. source: "collectionClass\x0a\x09^ String",
  4805. messageSends: [],
  4806. referencedClasses: ["String"]
  4807. }),
  4808. smalltalk.StringTest.klass);
  4809. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  4810. smalltalk.addMethod(
  4811. smalltalk.method({
  4812. selector: "collection",
  4813. protocol: 'fixture',
  4814. fn: function (){
  4815. var self=this;
  4816. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4817. return smalltalk.withContext(function($ctx1) {
  4818. var $2,$3,$1;
  4819. $2=_st($Set())._new();
  4820. _st($2)._add_((1));
  4821. $ctx1.sendIdx["add:"]=1;
  4822. _st($2)._add_((2));
  4823. $ctx1.sendIdx["add:"]=2;
  4824. _st($2)._add_((3));
  4825. $ctx1.sendIdx["add:"]=3;
  4826. _st($2)._add_((-4));
  4827. $3=_st($2)._yourself();
  4828. $1=$3;
  4829. return $1;
  4830. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  4831. args: [],
  4832. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4833. messageSends: ["add:", "new", "yourself"],
  4834. referencedClasses: ["Set"]
  4835. }),
  4836. smalltalk.SetTest);
  4837. smalltalk.addMethod(
  4838. smalltalk.method({
  4839. selector: "collectionOfPrintStrings",
  4840. protocol: 'fixture',
  4841. fn: function (){
  4842. var self=this;
  4843. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4844. return smalltalk.withContext(function($ctx1) {
  4845. var $2,$3,$1;
  4846. $2=_st($Set())._new();
  4847. _st($2)._add_("1");
  4848. $ctx1.sendIdx["add:"]=1;
  4849. _st($2)._add_("2");
  4850. $ctx1.sendIdx["add:"]=2;
  4851. _st($2)._add_("3");
  4852. $ctx1.sendIdx["add:"]=3;
  4853. _st($2)._add_("-4");
  4854. $3=_st($2)._yourself();
  4855. $1=$3;
  4856. return $1;
  4857. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  4858. args: [],
  4859. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: '1';\x0a\x09\x09add: '2';\x0a\x09\x09add: '3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
  4860. messageSends: ["add:", "new", "yourself"],
  4861. referencedClasses: ["Set"]
  4862. }),
  4863. smalltalk.SetTest);
  4864. smalltalk.addMethod(
  4865. smalltalk.method({
  4866. selector: "collectionSize",
  4867. protocol: 'fixture',
  4868. fn: function (){
  4869. var self=this;
  4870. return smalltalk.withContext(function($ctx1) {
  4871. return (4);
  4872. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  4873. args: [],
  4874. source: "collectionSize\x0a\x09^ 4",
  4875. messageSends: [],
  4876. referencedClasses: []
  4877. }),
  4878. smalltalk.SetTest);
  4879. smalltalk.addMethod(
  4880. smalltalk.method({
  4881. selector: "collectionWithDuplicates",
  4882. protocol: 'fixture',
  4883. fn: function (){
  4884. var self=this;
  4885. return smalltalk.withContext(function($ctx1) {
  4886. var $2,$3,$1;
  4887. $2=self._collection();
  4888. _st($2)._add_("yet another");
  4889. $3=_st($2)._yourself();
  4890. $1=$3;
  4891. return $1;
  4892. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  4893. args: [],
  4894. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  4895. messageSends: ["add:", "collection", "yourself"],
  4896. referencedClasses: []
  4897. }),
  4898. smalltalk.SetTest);
  4899. smalltalk.addMethod(
  4900. smalltalk.method({
  4901. selector: "collectionWithNewValue",
  4902. protocol: 'fixture',
  4903. fn: function (){
  4904. var self=this;
  4905. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4906. return smalltalk.withContext(function($ctx1) {
  4907. var $2,$3,$1;
  4908. $2=_st($Set())._new();
  4909. _st($2)._add_((1));
  4910. $ctx1.sendIdx["add:"]=1;
  4911. _st($2)._add_((2));
  4912. $ctx1.sendIdx["add:"]=2;
  4913. _st($2)._add_((3));
  4914. $ctx1.sendIdx["add:"]=3;
  4915. _st($2)._add_("N");
  4916. $ctx1.sendIdx["add:"]=4;
  4917. _st($2)._add_((-4));
  4918. $3=_st($2)._yourself();
  4919. $1=$3;
  4920. return $1;
  4921. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  4922. args: [],
  4923. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4924. messageSends: ["add:", "new", "yourself"],
  4925. referencedClasses: ["Set"]
  4926. }),
  4927. smalltalk.SetTest);
  4928. smalltalk.addMethod(
  4929. smalltalk.method({
  4930. selector: "testAddRemove",
  4931. protocol: 'tests',
  4932. fn: function (){
  4933. var self=this;
  4934. var set;
  4935. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4936. return smalltalk.withContext(function($ctx1) {
  4937. var $1,$2;
  4938. set=_st($Set())._new();
  4939. self._assert_(_st(set)._isEmpty());
  4940. $ctx1.sendIdx["assert:"]=1;
  4941. _st(set)._add_((3));
  4942. $ctx1.sendIdx["add:"]=1;
  4943. $1=_st(set)._includes_((3));
  4944. $ctx1.sendIdx["includes:"]=1;
  4945. self._assert_($1);
  4946. $ctx1.sendIdx["assert:"]=2;
  4947. _st(set)._add_((5));
  4948. $2=_st(set)._includes_((5));
  4949. $ctx1.sendIdx["includes:"]=2;
  4950. self._assert_($2);
  4951. _st(set)._remove_((3));
  4952. self._deny_(_st(set)._includes_((3)));
  4953. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  4954. args: [],
  4955. 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)",
  4956. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  4957. referencedClasses: ["Set"]
  4958. }),
  4959. smalltalk.SetTest);
  4960. smalltalk.addMethod(
  4961. smalltalk.method({
  4962. selector: "testAt",
  4963. protocol: 'tests',
  4964. fn: function (){
  4965. var self=this;
  4966. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4967. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4968. return smalltalk.withContext(function($ctx1) {
  4969. self._should_raise_((function(){
  4970. return smalltalk.withContext(function($ctx2) {
  4971. return _st(_st($Set())._new())._at_put_((1),(2));
  4972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4973. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  4974. args: [],
  4975. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  4976. messageSends: ["should:raise:", "at:put:", "new"],
  4977. referencedClasses: ["Set", "Error"]
  4978. }),
  4979. smalltalk.SetTest);
  4980. smalltalk.addMethod(
  4981. smalltalk.method({
  4982. selector: "testCollect",
  4983. protocol: 'tests',
  4984. fn: function (){
  4985. var self=this;
  4986. return smalltalk.withContext(function($ctx1) {
  4987. var $2,$1;
  4988. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  4989. $2=[(5), (6), (8)]._asSet();
  4990. $ctx1.sendIdx["asSet"]=1;
  4991. $1=_st($2)._collect_((function(x){
  4992. return smalltalk.withContext(function($ctx2) {
  4993. return _st(x).__backslash_backslash((3));
  4994. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  4995. self._assert_equals_($1,[(0), (2)]._asSet());
  4996. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  4997. args: [],
  4998. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  4999. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5000. referencedClasses: []
  5001. }),
  5002. smalltalk.SetTest);
  5003. smalltalk.addMethod(
  5004. smalltalk.method({
  5005. selector: "testComparing",
  5006. protocol: 'tests',
  5007. fn: function (){
  5008. var self=this;
  5009. return smalltalk.withContext(function($ctx1) {
  5010. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5011. $1=[(0), (2)]._asSet();
  5012. $ctx1.sendIdx["asSet"]=1;
  5013. $2=[(0), (2)]._asSet();
  5014. $ctx1.sendIdx["asSet"]=2;
  5015. self._assert_equals_($1,$2);
  5016. $ctx1.sendIdx["assert:equals:"]=1;
  5017. $3=[(2), (0)]._asSet();
  5018. $ctx1.sendIdx["asSet"]=3;
  5019. $4=[(0), (2)]._asSet();
  5020. $ctx1.sendIdx["asSet"]=4;
  5021. self._assert_equals_($3,$4);
  5022. $6=[(0), (2), (3)]._asSet();
  5023. $ctx1.sendIdx["asSet"]=5;
  5024. $7=[(0), (2)]._asSet();
  5025. $ctx1.sendIdx["asSet"]=6;
  5026. $5=_st($6).__eq($7);
  5027. $ctx1.sendIdx["="]=1;
  5028. self._deny_($5);
  5029. $ctx1.sendIdx["deny:"]=1;
  5030. $9=[(1), (2)]._asSet();
  5031. $ctx1.sendIdx["asSet"]=7;
  5032. $8=_st($9).__eq([(0), (2)]._asSet());
  5033. self._deny_($8);
  5034. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5035. args: [],
  5036. 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",
  5037. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5038. referencedClasses: []
  5039. }),
  5040. smalltalk.SetTest);
  5041. smalltalk.addMethod(
  5042. smalltalk.method({
  5043. selector: "testPrintString",
  5044. protocol: 'tests',
  5045. fn: function (){
  5046. var self=this;
  5047. var set;
  5048. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5049. return smalltalk.withContext(function($ctx1) {
  5050. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5051. set=_st($Set())._new();
  5052. $1=_st(set)._printString();
  5053. $ctx1.sendIdx["printString"]=1;
  5054. self._assert_equals_($1,"a Set ()");
  5055. $ctx1.sendIdx["assert:equals:"]=1;
  5056. $2=set;
  5057. _st($2)._add_((1));
  5058. $ctx1.sendIdx["add:"]=1;
  5059. $3=_st($2)._add_((3));
  5060. $ctx1.sendIdx["add:"]=2;
  5061. $4=_st(set)._printString();
  5062. $ctx1.sendIdx["printString"]=2;
  5063. self._assert_equals_($4,"a Set (1 3)");
  5064. $ctx1.sendIdx["assert:equals:"]=2;
  5065. _st(set)._add_("foo");
  5066. $ctx1.sendIdx["add:"]=3;
  5067. $5=_st(set)._printString();
  5068. $ctx1.sendIdx["printString"]=3;
  5069. self._assert_equals_($5,"a Set (1 3 'foo')");
  5070. $ctx1.sendIdx["assert:equals:"]=3;
  5071. $6=set;
  5072. _st($6)._remove_((1));
  5073. $ctx1.sendIdx["remove:"]=1;
  5074. $7=_st($6)._remove_((3));
  5075. $8=_st(set)._printString();
  5076. $ctx1.sendIdx["printString"]=4;
  5077. self._assert_equals_($8,"a Set ('foo')");
  5078. $ctx1.sendIdx["assert:equals:"]=4;
  5079. _st(set)._add_((3));
  5080. $ctx1.sendIdx["add:"]=4;
  5081. $9=_st(set)._printString();
  5082. $ctx1.sendIdx["printString"]=5;
  5083. self._assert_equals_($9,"a Set ('foo' 3)");
  5084. $ctx1.sendIdx["assert:equals:"]=5;
  5085. _st(set)._add_((3));
  5086. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5087. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5088. args: [],
  5089. 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 (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  5090. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5091. referencedClasses: ["Set"]
  5092. }),
  5093. smalltalk.SetTest);
  5094. smalltalk.addMethod(
  5095. smalltalk.method({
  5096. selector: "testUnboxedObjects",
  5097. protocol: 'tests',
  5098. fn: function (){
  5099. var self=this;
  5100. return smalltalk.withContext(function($ctx1) {
  5101. var $4,$3,$2,$1;
  5102. $4="foo"._yourself();
  5103. $ctx1.sendIdx["yourself"]=1;
  5104. $3=[$4,"foo"._yourself()];
  5105. $2=_st($3)._asSet();
  5106. $1=_st($2)._asArray();
  5107. self._assert_equals_($1,["foo"]);
  5108. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5109. args: [],
  5110. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5111. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5112. referencedClasses: []
  5113. }),
  5114. smalltalk.SetTest);
  5115. smalltalk.addMethod(
  5116. smalltalk.method({
  5117. selector: "testUnicity",
  5118. protocol: 'tests',
  5119. fn: function (){
  5120. var self=this;
  5121. var set;
  5122. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5123. return smalltalk.withContext(function($ctx1) {
  5124. var $1;
  5125. set=_st($Set())._new();
  5126. _st(set)._add_((21));
  5127. $ctx1.sendIdx["add:"]=1;
  5128. _st(set)._add_("hello");
  5129. $ctx1.sendIdx["add:"]=2;
  5130. _st(set)._add_((21));
  5131. $ctx1.sendIdx["add:"]=3;
  5132. $1=_st(set)._size();
  5133. $ctx1.sendIdx["size"]=1;
  5134. self._assert_equals_($1,(2));
  5135. $ctx1.sendIdx["assert:equals:"]=1;
  5136. _st(set)._add_("hello");
  5137. self._assert_equals_(_st(set)._size(),(2));
  5138. $ctx1.sendIdx["assert:equals:"]=2;
  5139. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5140. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5141. args: [],
  5142. 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')",
  5143. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5144. referencedClasses: ["Set"]
  5145. }),
  5146. smalltalk.SetTest);
  5147. smalltalk.addMethod(
  5148. smalltalk.method({
  5149. selector: "collectionClass",
  5150. protocol: 'fixture',
  5151. fn: function (){
  5152. var self=this;
  5153. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5154. return smalltalk.withContext(function($ctx1) {
  5155. return $Set();
  5156. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5157. args: [],
  5158. source: "collectionClass\x0a\x09^ Set",
  5159. messageSends: [],
  5160. referencedClasses: ["Set"]
  5161. }),
  5162. smalltalk.SetTest.klass);
  5163. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5164. smalltalk.addMethod(
  5165. smalltalk.method({
  5166. selector: "testShow",
  5167. protocol: 'tests',
  5168. fn: function (){
  5169. var self=this;
  5170. var originalTranscript;
  5171. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5172. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5173. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5174. return smalltalk.withContext(function($ctx1) {
  5175. originalTranscript=_st($Transcript())._current();
  5176. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5177. $ctx1.sendIdx["register:"]=1;
  5178. self._shouldnt_raise_((function(){
  5179. return smalltalk.withContext(function($ctx2) {
  5180. return _st($Transcript())._show_("Hello console!");
  5181. $ctx2.sendIdx["show:"]=1;
  5182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5183. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5184. self._shouldnt_raise_((function(){
  5185. return smalltalk.withContext(function($ctx2) {
  5186. return _st($Transcript())._show_(console);
  5187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5188. _st($Transcript())._register_(originalTranscript);
  5189. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5190. args: [],
  5191. 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.",
  5192. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5193. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5194. }),
  5195. smalltalk.ConsoleTranscriptTest);
  5196. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5197. smalltalk.addMethod(
  5198. smalltalk.method({
  5199. selector: "jsObject",
  5200. protocol: 'accessing',
  5201. fn: function (){
  5202. var self=this;
  5203. return smalltalk.withContext(function($ctx1) {
  5204. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5205. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5206. args: [],
  5207. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5208. messageSends: [],
  5209. referencedClasses: []
  5210. }),
  5211. smalltalk.JSObjectProxyTest);
  5212. smalltalk.addMethod(
  5213. smalltalk.method({
  5214. selector: "testAtIfAbsent",
  5215. protocol: 'tests',
  5216. fn: function (){
  5217. var self=this;
  5218. var testObject;
  5219. return smalltalk.withContext(function($ctx1) {
  5220. var $1,$2,$3;
  5221. testObject=self._jsObject();
  5222. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5223. return smalltalk.withContext(function($ctx2) {
  5224. return "Property does not exist";
  5225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5226. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5227. self._assert_equals_($1,"Property does not exist");
  5228. $ctx1.sendIdx["assert:equals:"]=1;
  5229. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5230. return smalltalk.withContext(function($ctx2) {
  5231. return "Property does not exist";
  5232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5233. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5234. self._assert_equals_($2,nil);
  5235. $ctx1.sendIdx["assert:equals:"]=2;
  5236. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5237. return smalltalk.withContext(function($ctx2) {
  5238. return "Property does not exist";
  5239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5240. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5241. self._assert_equals_($3,(1));
  5242. $ctx1.sendIdx["assert:equals:"]=3;
  5243. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5244. return smalltalk.withContext(function($ctx2) {
  5245. return "Property does not exist";
  5246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5247. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5248. args: [],
  5249. 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.",
  5250. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5251. referencedClasses: []
  5252. }),
  5253. smalltalk.JSObjectProxyTest);
  5254. smalltalk.addMethod(
  5255. smalltalk.method({
  5256. selector: "testAtIfPresent",
  5257. protocol: 'tests',
  5258. fn: function (){
  5259. var self=this;
  5260. var testObject;
  5261. return smalltalk.withContext(function($ctx1) {
  5262. var $2,$1,$4,$3,$6,$5;
  5263. testObject=self._jsObject();
  5264. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5265. return smalltalk.withContext(function($ctx2) {
  5266. $2=_st(x)._asString();
  5267. $ctx2.sendIdx["asString"]=1;
  5268. return "hello ".__comma($2);
  5269. $ctx2.sendIdx[","]=1;
  5270. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5271. $ctx1.sendIdx["at:ifPresent:"]=1;
  5272. self._assert_equals_($1,nil);
  5273. $ctx1.sendIdx["assert:equals:"]=1;
  5274. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5275. return smalltalk.withContext(function($ctx2) {
  5276. $4=_st(x)._asString();
  5277. $ctx2.sendIdx["asString"]=2;
  5278. return "hello ".__comma($4);
  5279. $ctx2.sendIdx[","]=2;
  5280. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5281. $ctx1.sendIdx["at:ifPresent:"]=2;
  5282. self._assert_equals_($3,"hello nil");
  5283. $ctx1.sendIdx["assert:equals:"]=2;
  5284. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5285. return smalltalk.withContext(function($ctx2) {
  5286. $6=_st(x)._asString();
  5287. $ctx2.sendIdx["asString"]=3;
  5288. return "hello ".__comma($6);
  5289. $ctx2.sendIdx[","]=3;
  5290. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5291. $ctx1.sendIdx["at:ifPresent:"]=3;
  5292. self._assert_equals_($5,"hello 1");
  5293. $ctx1.sendIdx["assert:equals:"]=3;
  5294. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5295. return smalltalk.withContext(function($ctx2) {
  5296. return "hello ".__comma(_st(x)._asString());
  5297. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5298. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5299. args: [],
  5300. 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'.",
  5301. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5302. referencedClasses: []
  5303. }),
  5304. smalltalk.JSObjectProxyTest);
  5305. smalltalk.addMethod(
  5306. smalltalk.method({
  5307. selector: "testAtIfPresentIfAbsent",
  5308. protocol: 'tests',
  5309. fn: function (){
  5310. var self=this;
  5311. var testObject;
  5312. return smalltalk.withContext(function($ctx1) {
  5313. var $2,$1,$4,$3,$6,$5;
  5314. testObject=self._jsObject();
  5315. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5316. return smalltalk.withContext(function($ctx2) {
  5317. $2=_st(x)._asString();
  5318. $ctx2.sendIdx["asString"]=1;
  5319. return "hello ".__comma($2);
  5320. $ctx2.sendIdx[","]=1;
  5321. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5322. return smalltalk.withContext(function($ctx2) {
  5323. return "not present";
  5324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5325. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5326. self._assert_equals_($1,"not present");
  5327. $ctx1.sendIdx["assert:equals:"]=1;
  5328. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5329. return smalltalk.withContext(function($ctx2) {
  5330. $4=_st(x)._asString();
  5331. $ctx2.sendIdx["asString"]=2;
  5332. return "hello ".__comma($4);
  5333. $ctx2.sendIdx[","]=2;
  5334. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5335. return smalltalk.withContext(function($ctx2) {
  5336. return "not present";
  5337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5338. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5339. self._assert_equals_($3,"hello nil");
  5340. $ctx1.sendIdx["assert:equals:"]=2;
  5341. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5342. return smalltalk.withContext(function($ctx2) {
  5343. $6=_st(x)._asString();
  5344. $ctx2.sendIdx["asString"]=3;
  5345. return "hello ".__comma($6);
  5346. $ctx2.sendIdx[","]=3;
  5347. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5348. return smalltalk.withContext(function($ctx2) {
  5349. return "not present";
  5350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5351. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5352. self._assert_equals_($5,"hello 1");
  5353. $ctx1.sendIdx["assert:equals:"]=3;
  5354. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5355. return smalltalk.withContext(function($ctx2) {
  5356. return "hello ".__comma(_st(x)._asString());
  5357. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5358. return smalltalk.withContext(function($ctx2) {
  5359. return "not present";
  5360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5361. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5362. args: [],
  5363. 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'.",
  5364. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5365. referencedClasses: []
  5366. }),
  5367. smalltalk.JSObjectProxyTest);
  5368. smalltalk.addMethod(
  5369. smalltalk.method({
  5370. selector: "testAtPut",
  5371. protocol: 'tests',
  5372. fn: function (){
  5373. var self=this;
  5374. var testObject;
  5375. return smalltalk.withContext(function($ctx1) {
  5376. var $2,$1;
  5377. testObject=self._jsObject();
  5378. $2=_st(testObject)._at_("abc");
  5379. $ctx1.sendIdx["at:"]=1;
  5380. $1=_st($2).__tild_eq("xyz");
  5381. self._assert_($1);
  5382. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5383. $ctx1.sendIdx["assert:equals:"]=1;
  5384. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5385. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5386. args: [],
  5387. 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'",
  5388. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5389. referencedClasses: []
  5390. }),
  5391. smalltalk.JSObjectProxyTest);
  5392. smalltalk.addMethod(
  5393. smalltalk.method({
  5394. selector: "testDNU",
  5395. protocol: 'tests',
  5396. fn: function (){
  5397. var self=this;
  5398. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5399. return smalltalk.withContext(function($ctx1) {
  5400. self._should_raise_((function(){
  5401. return smalltalk.withContext(function($ctx2) {
  5402. return _st(self._jsObject())._foo();
  5403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5404. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5405. args: [],
  5406. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5407. messageSends: ["should:raise:", "foo", "jsObject"],
  5408. referencedClasses: ["MessageNotUnderstood"]
  5409. }),
  5410. smalltalk.JSObjectProxyTest);
  5411. smalltalk.addMethod(
  5412. smalltalk.method({
  5413. selector: "testMessageSend",
  5414. protocol: 'tests',
  5415. fn: function (){
  5416. var self=this;
  5417. return smalltalk.withContext(function($ctx1) {
  5418. var $2,$1,$4,$3;
  5419. $2=self._jsObject();
  5420. $ctx1.sendIdx["jsObject"]=1;
  5421. $1=_st($2)._a();
  5422. self._assert_equals_($1,(1));
  5423. $ctx1.sendIdx["assert:equals:"]=1;
  5424. $4=self._jsObject();
  5425. $ctx1.sendIdx["jsObject"]=2;
  5426. $3=_st($4)._b();
  5427. self._assert_equals_($3,(2));
  5428. $ctx1.sendIdx["assert:equals:"]=2;
  5429. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5430. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5431. args: [],
  5432. 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",
  5433. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5434. referencedClasses: []
  5435. }),
  5436. smalltalk.JSObjectProxyTest);
  5437. smalltalk.addMethod(
  5438. smalltalk.method({
  5439. selector: "testMethodWithArguments",
  5440. protocol: 'tests',
  5441. fn: function (){
  5442. var self=this;
  5443. return smalltalk.withContext(function($ctx1) {
  5444. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5445. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5446. args: [],
  5447. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5448. messageSends: ["assert:equals:", "c:", "jsObject"],
  5449. referencedClasses: []
  5450. }),
  5451. smalltalk.JSObjectProxyTest);
  5452. smalltalk.addMethod(
  5453. smalltalk.method({
  5454. selector: "testPrinting",
  5455. protocol: 'tests',
  5456. fn: function (){
  5457. var self=this;
  5458. return smalltalk.withContext(function($ctx1) {
  5459. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5460. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5461. args: [],
  5462. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5463. messageSends: ["assert:equals:", "printString", "jsObject"],
  5464. referencedClasses: []
  5465. }),
  5466. smalltalk.JSObjectProxyTest);
  5467. smalltalk.addMethod(
  5468. smalltalk.method({
  5469. selector: "testPropertyThatReturnsEmptyString",
  5470. protocol: 'tests',
  5471. fn: function (){
  5472. var self=this;
  5473. var object;
  5474. return smalltalk.withContext(function($ctx1) {
  5475. var $1;
  5476. object=self._jsObject();
  5477. $1=_st(object)._d();
  5478. $ctx1.sendIdx["d"]=1;
  5479. self._assert_equals_($1,"");
  5480. $ctx1.sendIdx["assert:equals:"]=1;
  5481. _st(object)._d_("hello");
  5482. self._assert_equals_(_st(object)._d(),"hello");
  5483. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5484. args: [],
  5485. 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'",
  5486. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5487. referencedClasses: []
  5488. }),
  5489. smalltalk.JSObjectProxyTest);
  5490. smalltalk.addMethod(
  5491. smalltalk.method({
  5492. selector: "testPropertyThatReturnsUndefined",
  5493. protocol: 'tests',
  5494. fn: function (){
  5495. var self=this;
  5496. var object;
  5497. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5498. return smalltalk.withContext(function($ctx1) {
  5499. object=self._jsObject();
  5500. self._shouldnt_raise_((function(){
  5501. return smalltalk.withContext(function($ctx2) {
  5502. return _st(object)._e();
  5503. $ctx2.sendIdx["e"]=1;
  5504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5505. self._assert_(_st(_st(object)._e())._isNil());
  5506. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5507. args: [],
  5508. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5509. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5510. referencedClasses: ["MessageNotUnderstood"]
  5511. }),
  5512. smalltalk.JSObjectProxyTest);
  5513. smalltalk.addMethod(
  5514. smalltalk.method({
  5515. selector: "testValue",
  5516. protocol: 'tests',
  5517. fn: function (){
  5518. var self=this;
  5519. var testObject;
  5520. return smalltalk.withContext(function($ctx1) {
  5521. testObject=self._jsObject();
  5522. _st(testObject)._at_put_("value","aValue");
  5523. self._assert_equals_(_st(testObject)._value(),"aValue");
  5524. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5525. args: [],
  5526. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5527. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5528. referencedClasses: []
  5529. }),
  5530. smalltalk.JSObjectProxyTest);
  5531. smalltalk.addMethod(
  5532. smalltalk.method({
  5533. selector: "testYourself",
  5534. protocol: 'tests',
  5535. fn: function (){
  5536. var self=this;
  5537. var object;
  5538. return smalltalk.withContext(function($ctx1) {
  5539. var $1,$2;
  5540. $1=self._jsObject();
  5541. _st($1)._d_("test");
  5542. $2=_st($1)._yourself();
  5543. object=$2;
  5544. self._assert_equals_(_st(object)._d(),"test");
  5545. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5546. args: [],
  5547. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5548. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5549. referencedClasses: []
  5550. }),
  5551. smalltalk.JSObjectProxyTest);
  5552. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5553. smalltalk.addMethod(
  5554. smalltalk.method({
  5555. selector: "testCatchingException",
  5556. protocol: 'tests',
  5557. fn: function (){
  5558. var self=this;
  5559. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5560. return smalltalk.withContext(function($ctx1) {
  5561. _st((function(){
  5562. return smalltalk.withContext(function($ctx2) {
  5563. return self._throwException();
  5564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5565. return smalltalk.withContext(function($ctx2) {
  5566. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5567. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5568. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5569. args: [],
  5570. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5571. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5572. referencedClasses: ["Error"]
  5573. }),
  5574. smalltalk.JavaScriptExceptionTest);
  5575. smalltalk.addMethod(
  5576. smalltalk.method({
  5577. selector: "testRaisingException",
  5578. protocol: 'tests',
  5579. fn: function (){
  5580. var self=this;
  5581. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5582. return smalltalk.withContext(function($ctx1) {
  5583. self._should_raise_((function(){
  5584. return smalltalk.withContext(function($ctx2) {
  5585. return self._throwException();
  5586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5587. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5588. args: [],
  5589. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5590. messageSends: ["should:raise:", "throwException"],
  5591. referencedClasses: ["JavaScriptException"]
  5592. }),
  5593. smalltalk.JavaScriptExceptionTest);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "throwException",
  5597. protocol: 'helpers',
  5598. fn: function (){
  5599. var self=this;
  5600. return smalltalk.withContext(function($ctx1) {
  5601. throw 'test';
  5602. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5603. args: [],
  5604. source: "throwException\x0a\x09<throw 'test'>",
  5605. messageSends: [],
  5606. referencedClasses: []
  5607. }),
  5608. smalltalk.JavaScriptExceptionTest);
  5609. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5610. smalltalk.addMethod(
  5611. smalltalk.method({
  5612. selector: "testValue",
  5613. protocol: 'tests',
  5614. fn: function (){
  5615. var self=this;
  5616. var messageSend;
  5617. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5618. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5619. return smalltalk.withContext(function($ctx1) {
  5620. var $1,$2;
  5621. $1=_st($MessageSend())._new();
  5622. $ctx1.sendIdx["new"]=1;
  5623. _st($1)._receiver_(_st($Object())._new());
  5624. _st($1)._selector_("asString");
  5625. $2=_st($1)._yourself();
  5626. messageSend=$2;
  5627. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5628. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5629. args: [],
  5630. 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'",
  5631. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5632. referencedClasses: ["MessageSend", "Object"]
  5633. }),
  5634. smalltalk.MessageSendTest);
  5635. smalltalk.addMethod(
  5636. smalltalk.method({
  5637. selector: "testValueWithArguments",
  5638. protocol: 'tests',
  5639. fn: function (){
  5640. var self=this;
  5641. var messageSend;
  5642. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5643. return smalltalk.withContext(function($ctx1) {
  5644. var $1,$2;
  5645. $1=_st($MessageSend())._new();
  5646. _st($1)._receiver_((2));
  5647. _st($1)._selector_("+");
  5648. $2=_st($1)._yourself();
  5649. messageSend=$2;
  5650. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5651. $ctx1.sendIdx["assert:equals:"]=1;
  5652. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5653. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5654. args: [],
  5655. 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",
  5656. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5657. referencedClasses: ["MessageSend"]
  5658. }),
  5659. smalltalk.MessageSendTest);
  5660. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5661. smalltalk.addMethod(
  5662. smalltalk.method({
  5663. selector: "codeGeneratorClass",
  5664. protocol: 'accessing',
  5665. fn: function (){
  5666. var self=this;
  5667. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5668. return smalltalk.withContext(function($ctx1) {
  5669. return $CodeGenerator();
  5670. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5671. args: [],
  5672. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5673. messageSends: [],
  5674. referencedClasses: ["CodeGenerator"]
  5675. }),
  5676. smalltalk.MethodInheritanceTest);
  5677. smalltalk.addMethod(
  5678. smalltalk.method({
  5679. selector: "compiler",
  5680. protocol: 'factory',
  5681. fn: function (){
  5682. var self=this;
  5683. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5684. return smalltalk.withContext(function($ctx1) {
  5685. var $2,$3,$1;
  5686. $2=_st($Compiler())._new();
  5687. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5688. $3=_st($2)._yourself();
  5689. $1=$3;
  5690. return $1;
  5691. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5692. args: [],
  5693. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5694. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5695. referencedClasses: ["Compiler"]
  5696. }),
  5697. smalltalk.MethodInheritanceTest);
  5698. smalltalk.addMethod(
  5699. smalltalk.method({
  5700. selector: "deinstallBottom",
  5701. protocol: 'testing',
  5702. fn: function (){
  5703. var self=this;
  5704. return smalltalk.withContext(function($ctx1) {
  5705. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5706. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5707. args: [],
  5708. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5709. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5710. referencedClasses: []
  5711. }),
  5712. smalltalk.MethodInheritanceTest);
  5713. smalltalk.addMethod(
  5714. smalltalk.method({
  5715. selector: "deinstallMiddle",
  5716. protocol: 'testing',
  5717. fn: function (){
  5718. var self=this;
  5719. return smalltalk.withContext(function($ctx1) {
  5720. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5721. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5722. args: [],
  5723. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5724. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5725. referencedClasses: []
  5726. }),
  5727. smalltalk.MethodInheritanceTest);
  5728. smalltalk.addMethod(
  5729. smalltalk.method({
  5730. selector: "deinstallTop",
  5731. protocol: 'testing',
  5732. fn: function (){
  5733. var self=this;
  5734. return smalltalk.withContext(function($ctx1) {
  5735. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5736. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5737. args: [],
  5738. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5739. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5740. referencedClasses: []
  5741. }),
  5742. smalltalk.MethodInheritanceTest);
  5743. smalltalk.addMethod(
  5744. smalltalk.method({
  5745. selector: "installBottom:",
  5746. protocol: 'testing',
  5747. fn: function (aString){
  5748. var self=this;
  5749. return smalltalk.withContext(function($ctx1) {
  5750. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5751. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5752. args: ["aString"],
  5753. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5754. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5755. referencedClasses: []
  5756. }),
  5757. smalltalk.MethodInheritanceTest);
  5758. smalltalk.addMethod(
  5759. smalltalk.method({
  5760. selector: "installMiddle:",
  5761. protocol: 'testing',
  5762. fn: function (aString){
  5763. var self=this;
  5764. return smalltalk.withContext(function($ctx1) {
  5765. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5766. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5767. args: ["aString"],
  5768. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5769. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5770. referencedClasses: []
  5771. }),
  5772. smalltalk.MethodInheritanceTest);
  5773. smalltalk.addMethod(
  5774. smalltalk.method({
  5775. selector: "installTop:",
  5776. protocol: 'testing',
  5777. fn: function (aString){
  5778. var self=this;
  5779. return smalltalk.withContext(function($ctx1) {
  5780. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5781. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5782. args: ["aString"],
  5783. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5784. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5785. referencedClasses: []
  5786. }),
  5787. smalltalk.MethodInheritanceTest);
  5788. smalltalk.addMethod(
  5789. smalltalk.method({
  5790. selector: "setUp",
  5791. protocol: 'initialization',
  5792. fn: function (){
  5793. var self=this;
  5794. return smalltalk.withContext(function($ctx1) {
  5795. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5796. $ctx1.sendIdx["new"]=1;
  5797. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5798. $ctx1.sendIdx["new"]=2;
  5799. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5800. self["@method"]=nil;
  5801. self["@performBlock"]=(function(){
  5802. return smalltalk.withContext(function($ctx2) {
  5803. return self._error_("performBlock not initialized");
  5804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5805. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5806. args: [],
  5807. 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' ]",
  5808. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5809. referencedClasses: []
  5810. }),
  5811. smalltalk.MethodInheritanceTest);
  5812. smalltalk.addMethod(
  5813. smalltalk.method({
  5814. selector: "shouldMNU",
  5815. protocol: 'testing',
  5816. fn: function (){
  5817. var self=this;
  5818. return smalltalk.withContext(function($ctx1) {
  5819. self._shouldMNUTop();
  5820. self._shouldMNUMiddle();
  5821. self._shouldMNUBottom();
  5822. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  5823. args: [],
  5824. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  5825. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  5826. referencedClasses: []
  5827. }),
  5828. smalltalk.MethodInheritanceTest);
  5829. smalltalk.addMethod(
  5830. smalltalk.method({
  5831. selector: "shouldMNUBottom",
  5832. protocol: 'testing',
  5833. fn: function (){
  5834. var self=this;
  5835. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5836. return smalltalk.withContext(function($ctx1) {
  5837. self._should_raise_((function(){
  5838. return smalltalk.withContext(function($ctx2) {
  5839. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5841. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  5842. args: [],
  5843. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  5844. messageSends: ["should:raise:", "value:"],
  5845. referencedClasses: ["MessageNotUnderstood"]
  5846. }),
  5847. smalltalk.MethodInheritanceTest);
  5848. smalltalk.addMethod(
  5849. smalltalk.method({
  5850. selector: "shouldMNUMiddle",
  5851. protocol: 'testing',
  5852. fn: function (){
  5853. var self=this;
  5854. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5855. return smalltalk.withContext(function($ctx1) {
  5856. self._should_raise_((function(){
  5857. return smalltalk.withContext(function($ctx2) {
  5858. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5860. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  5861. args: [],
  5862. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  5863. messageSends: ["should:raise:", "value:"],
  5864. referencedClasses: ["MessageNotUnderstood"]
  5865. }),
  5866. smalltalk.MethodInheritanceTest);
  5867. smalltalk.addMethod(
  5868. smalltalk.method({
  5869. selector: "shouldMNUTop",
  5870. protocol: 'testing',
  5871. fn: function (){
  5872. var self=this;
  5873. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5874. return smalltalk.withContext(function($ctx1) {
  5875. self._should_raise_((function(){
  5876. return smalltalk.withContext(function($ctx2) {
  5877. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  5878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5879. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  5880. args: [],
  5881. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  5882. messageSends: ["should:raise:", "value:"],
  5883. referencedClasses: ["MessageNotUnderstood"]
  5884. }),
  5885. smalltalk.MethodInheritanceTest);
  5886. smalltalk.addMethod(
  5887. smalltalk.method({
  5888. selector: "shouldReturn:",
  5889. protocol: 'testing',
  5890. fn: function (anObject){
  5891. var self=this;
  5892. var result;
  5893. return smalltalk.withContext(function($ctx1) {
  5894. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5895. $ctx1.sendIdx["value:"]=1;
  5896. self._assert_equals_(["top",anObject],["top",result]);
  5897. $ctx1.sendIdx["assert:equals:"]=1;
  5898. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5899. $ctx1.sendIdx["value:"]=2;
  5900. self._assert_equals_(["middle",anObject],["middle",result]);
  5901. $ctx1.sendIdx["assert:equals:"]=2;
  5902. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5903. self._assert_equals_(["bottom",anObject],["bottom",result]);
  5904. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  5905. args: ["anObject"],
  5906. 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 }",
  5907. messageSends: ["value:", "assert:equals:"],
  5908. referencedClasses: []
  5909. }),
  5910. smalltalk.MethodInheritanceTest);
  5911. smalltalk.addMethod(
  5912. smalltalk.method({
  5913. selector: "shouldReturn:and:and:",
  5914. protocol: 'testing',
  5915. fn: function (anObject,anObject2,anObject3){
  5916. var self=this;
  5917. var result;
  5918. return smalltalk.withContext(function($ctx1) {
  5919. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5920. $ctx1.sendIdx["value:"]=1;
  5921. self._assert_equals_(["top",anObject],["top",result]);
  5922. $ctx1.sendIdx["assert:equals:"]=1;
  5923. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5924. $ctx1.sendIdx["value:"]=2;
  5925. self._assert_equals_(["middle",anObject2],["middle",result]);
  5926. $ctx1.sendIdx["assert:equals:"]=2;
  5927. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5928. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  5929. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  5930. args: ["anObject", "anObject2", "anObject3"],
  5931. 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 }",
  5932. messageSends: ["value:", "assert:equals:"],
  5933. referencedClasses: []
  5934. }),
  5935. smalltalk.MethodInheritanceTest);
  5936. smalltalk.addMethod(
  5937. smalltalk.method({
  5938. selector: "targetClassBottom",
  5939. protocol: 'accessing',
  5940. fn: function (){
  5941. var self=this;
  5942. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5943. return smalltalk.withContext(function($ctx1) {
  5944. return $JavaScriptException();
  5945. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  5946. args: [],
  5947. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  5948. messageSends: [],
  5949. referencedClasses: ["JavaScriptException"]
  5950. }),
  5951. smalltalk.MethodInheritanceTest);
  5952. smalltalk.addMethod(
  5953. smalltalk.method({
  5954. selector: "targetClassMiddle",
  5955. protocol: 'accessing',
  5956. fn: function (){
  5957. var self=this;
  5958. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5959. return smalltalk.withContext(function($ctx1) {
  5960. return $Error();
  5961. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  5962. args: [],
  5963. source: "targetClassMiddle\x0a\x09^ Error",
  5964. messageSends: [],
  5965. referencedClasses: ["Error"]
  5966. }),
  5967. smalltalk.MethodInheritanceTest);
  5968. smalltalk.addMethod(
  5969. smalltalk.method({
  5970. selector: "targetClassTop",
  5971. protocol: 'accessing',
  5972. fn: function (){
  5973. var self=this;
  5974. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5975. return smalltalk.withContext(function($ctx1) {
  5976. return $Object();
  5977. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  5978. args: [],
  5979. source: "targetClassTop\x0a\x09^ Object",
  5980. messageSends: [],
  5981. referencedClasses: ["Object"]
  5982. }),
  5983. smalltalk.MethodInheritanceTest);
  5984. smalltalk.addMethod(
  5985. smalltalk.method({
  5986. selector: "tearDown",
  5987. protocol: 'initialization',
  5988. fn: function (){
  5989. var self=this;
  5990. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5991. return smalltalk.withContext(function($ctx1) {
  5992. _st((function(){
  5993. return smalltalk.withContext(function($ctx2) {
  5994. return self._deinstallTop();
  5995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  5996. return smalltalk.withContext(function($ctx2) {
  5997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5998. $ctx1.sendIdx["on:do:"]=1;
  5999. _st((function(){
  6000. return smalltalk.withContext(function($ctx2) {
  6001. return self._deinstallMiddle();
  6002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6003. return smalltalk.withContext(function($ctx2) {
  6004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6005. $ctx1.sendIdx["on:do:"]=2;
  6006. _st((function(){
  6007. return smalltalk.withContext(function($ctx2) {
  6008. return self._deinstallBottom();
  6009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6010. return smalltalk.withContext(function($ctx2) {
  6011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6012. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6013. args: [],
  6014. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6015. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6016. referencedClasses: ["Error"]
  6017. }),
  6018. smalltalk.MethodInheritanceTest);
  6019. smalltalk.addMethod(
  6020. smalltalk.method({
  6021. selector: "testMNU11",
  6022. protocol: 'tests',
  6023. fn: function (){
  6024. var self=this;
  6025. return smalltalk.withContext(function($ctx1) {
  6026. self["@performBlock"]=(function(x){
  6027. return smalltalk.withContext(function($ctx2) {
  6028. return _st(x)._foo();
  6029. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6030. self._shouldMNU();
  6031. $ctx1.sendIdx["shouldMNU"]=1;
  6032. self._installTop_("foo ^ false");
  6033. $ctx1.sendIdx["installTop:"]=1;
  6034. self._installTop_("foo ^ true");
  6035. self._deinstallTop();
  6036. self._shouldMNU();
  6037. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6038. args: [],
  6039. 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",
  6040. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6041. referencedClasses: []
  6042. }),
  6043. smalltalk.MethodInheritanceTest);
  6044. smalltalk.addMethod(
  6045. smalltalk.method({
  6046. selector: "testMNU22",
  6047. protocol: 'tests',
  6048. fn: function (){
  6049. var self=this;
  6050. return smalltalk.withContext(function($ctx1) {
  6051. self["@performBlock"]=(function(x){
  6052. return smalltalk.withContext(function($ctx2) {
  6053. return _st(x)._foo();
  6054. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6055. self._shouldMNU();
  6056. $ctx1.sendIdx["shouldMNU"]=1;
  6057. self._installMiddle_("foo ^ false");
  6058. $ctx1.sendIdx["installMiddle:"]=1;
  6059. self._installMiddle_("foo ^ true");
  6060. self._deinstallMiddle();
  6061. self._shouldMNU();
  6062. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6063. args: [],
  6064. 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",
  6065. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6066. referencedClasses: []
  6067. }),
  6068. smalltalk.MethodInheritanceTest);
  6069. smalltalk.addMethod(
  6070. smalltalk.method({
  6071. selector: "testReturns1",
  6072. protocol: 'tests',
  6073. fn: function (){
  6074. var self=this;
  6075. return smalltalk.withContext(function($ctx1) {
  6076. self["@performBlock"]=(function(x){
  6077. return smalltalk.withContext(function($ctx2) {
  6078. return _st(x)._foo();
  6079. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6080. self._installTop_("foo ^ false");
  6081. $ctx1.sendIdx["installTop:"]=1;
  6082. self._shouldReturn_(false);
  6083. $ctx1.sendIdx["shouldReturn:"]=1;
  6084. self._installTop_("foo ^ true");
  6085. self._shouldReturn_(true);
  6086. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6087. args: [],
  6088. 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",
  6089. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6090. referencedClasses: []
  6091. }),
  6092. smalltalk.MethodInheritanceTest);
  6093. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6094. smalltalk.addMethod(
  6095. smalltalk.method({
  6096. selector: "testAbs",
  6097. protocol: 'tests',
  6098. fn: function (){
  6099. var self=this;
  6100. return smalltalk.withContext(function($ctx1) {
  6101. var $1;
  6102. $1=(4)._abs();
  6103. $ctx1.sendIdx["abs"]=1;
  6104. self._assert_equals_($1,(4));
  6105. $ctx1.sendIdx["assert:equals:"]=1;
  6106. self._assert_equals_((-4)._abs(),(4));
  6107. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6108. args: [],
  6109. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6110. messageSends: ["assert:equals:", "abs"],
  6111. referencedClasses: []
  6112. }),
  6113. smalltalk.NumberTest);
  6114. smalltalk.addMethod(
  6115. smalltalk.method({
  6116. selector: "testArithmetic",
  6117. protocol: 'tests',
  6118. fn: function (){
  6119. var self=this;
  6120. return smalltalk.withContext(function($ctx1) {
  6121. var $1,$2,$3,$5,$4;
  6122. $1=(1.5).__plus((1));
  6123. $ctx1.sendIdx["+"]=1;
  6124. self._assert_equals_($1,(2.5));
  6125. $ctx1.sendIdx["assert:equals:"]=1;
  6126. $2=(2).__minus((1));
  6127. $ctx1.sendIdx["-"]=1;
  6128. self._assert_equals_($2,(1));
  6129. $ctx1.sendIdx["assert:equals:"]=2;
  6130. self._assert_equals_((-2).__minus((1)),(-3));
  6131. $ctx1.sendIdx["assert:equals:"]=3;
  6132. self._assert_equals_((12).__slash((2)),(6));
  6133. $ctx1.sendIdx["assert:equals:"]=4;
  6134. $3=(3).__star((4));
  6135. $ctx1.sendIdx["*"]=1;
  6136. self._assert_equals_($3,(12));
  6137. $ctx1.sendIdx["assert:equals:"]=5;
  6138. self._assert_equals_((7).__slash_slash((2)),(3));
  6139. $ctx1.sendIdx["assert:equals:"]=6;
  6140. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6141. $ctx1.sendIdx["assert:equals:"]=7;
  6142. $5=(1).__plus((2));
  6143. $ctx1.sendIdx["+"]=2;
  6144. $4=_st($5).__star((3));
  6145. $ctx1.sendIdx["*"]=2;
  6146. self._assert_equals_($4,(9));
  6147. $ctx1.sendIdx["assert:equals:"]=8;
  6148. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6149. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6150. args: [],
  6151. 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",
  6152. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6153. referencedClasses: []
  6154. }),
  6155. smalltalk.NumberTest);
  6156. smalltalk.addMethod(
  6157. smalltalk.method({
  6158. selector: "testAsNumber",
  6159. protocol: 'tests',
  6160. fn: function (){
  6161. var self=this;
  6162. return smalltalk.withContext(function($ctx1) {
  6163. self._assert_equals_((3)._asNumber(),(3));
  6164. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6165. args: [],
  6166. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6167. messageSends: ["assert:equals:", "asNumber"],
  6168. referencedClasses: []
  6169. }),
  6170. smalltalk.NumberTest);
  6171. smalltalk.addMethod(
  6172. smalltalk.method({
  6173. selector: "testCeiling",
  6174. protocol: 'tests',
  6175. fn: function (){
  6176. var self=this;
  6177. return smalltalk.withContext(function($ctx1) {
  6178. var $1,$2;
  6179. $1=(1.2)._ceiling();
  6180. $ctx1.sendIdx["ceiling"]=1;
  6181. self._assert_equals_($1,(2));
  6182. $ctx1.sendIdx["assert:equals:"]=1;
  6183. $2=(-1.2)._ceiling();
  6184. $ctx1.sendIdx["ceiling"]=2;
  6185. self._assert_equals_($2,(-1));
  6186. $ctx1.sendIdx["assert:equals:"]=2;
  6187. self._assert_equals_((1)._ceiling(),(1));
  6188. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6189. args: [],
  6190. 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.",
  6191. messageSends: ["assert:equals:", "ceiling"],
  6192. referencedClasses: []
  6193. }),
  6194. smalltalk.NumberTest);
  6195. smalltalk.addMethod(
  6196. smalltalk.method({
  6197. selector: "testComparison",
  6198. protocol: 'tests',
  6199. fn: function (){
  6200. var self=this;
  6201. return smalltalk.withContext(function($ctx1) {
  6202. var $1,$2,$3,$4;
  6203. $1=(3).__gt((2));
  6204. $ctx1.sendIdx[">"]=1;
  6205. self._assert_($1);
  6206. $ctx1.sendIdx["assert:"]=1;
  6207. $2=(2).__lt((3));
  6208. $ctx1.sendIdx["<"]=1;
  6209. self._assert_($2);
  6210. $ctx1.sendIdx["assert:"]=2;
  6211. self._deny_((3).__lt((2)));
  6212. $ctx1.sendIdx["deny:"]=1;
  6213. self._deny_((2).__gt((3)));
  6214. $3=(3).__gt_eq((3));
  6215. $ctx1.sendIdx[">="]=1;
  6216. self._assert_($3);
  6217. $ctx1.sendIdx["assert:"]=3;
  6218. self._assert_((3.1).__gt_eq((3)));
  6219. $ctx1.sendIdx["assert:"]=4;
  6220. $4=(3).__lt_eq((3));
  6221. $ctx1.sendIdx["<="]=1;
  6222. self._assert_($4);
  6223. $ctx1.sendIdx["assert:"]=5;
  6224. self._assert_((3).__lt_eq((3.1)));
  6225. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6226. args: [],
  6227. 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",
  6228. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6229. referencedClasses: []
  6230. }),
  6231. smalltalk.NumberTest);
  6232. smalltalk.addMethod(
  6233. smalltalk.method({
  6234. selector: "testCopying",
  6235. protocol: 'tests',
  6236. fn: function (){
  6237. var self=this;
  6238. return smalltalk.withContext(function($ctx1) {
  6239. var $1;
  6240. $1=_st((1)._copy()).__eq_eq((1));
  6241. $ctx1.sendIdx["=="]=1;
  6242. self._assert_($1);
  6243. $ctx1.sendIdx["assert:"]=1;
  6244. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6245. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6246. args: [],
  6247. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6248. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6249. referencedClasses: []
  6250. }),
  6251. smalltalk.NumberTest);
  6252. smalltalk.addMethod(
  6253. smalltalk.method({
  6254. selector: "testEquality",
  6255. protocol: 'tests',
  6256. fn: function (){
  6257. var self=this;
  6258. return smalltalk.withContext(function($ctx1) {
  6259. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6260. $1=(1).__eq((1));
  6261. $ctx1.sendIdx["="]=1;
  6262. self._assert_($1);
  6263. $ctx1.sendIdx["assert:"]=1;
  6264. $2=(0).__eq((0));
  6265. $ctx1.sendIdx["="]=2;
  6266. self._assert_($2);
  6267. $ctx1.sendIdx["assert:"]=2;
  6268. $3=(1).__eq((0));
  6269. $ctx1.sendIdx["="]=3;
  6270. self._deny_($3);
  6271. $ctx1.sendIdx["deny:"]=1;
  6272. $5=(1)._yourself();
  6273. $ctx1.sendIdx["yourself"]=1;
  6274. $4=_st($5).__eq((1));
  6275. $ctx1.sendIdx["="]=4;
  6276. self._assert_($4);
  6277. $ctx1.sendIdx["assert:"]=3;
  6278. $7=(1)._yourself();
  6279. $ctx1.sendIdx["yourself"]=2;
  6280. $6=(1).__eq($7);
  6281. $ctx1.sendIdx["="]=5;
  6282. self._assert_($6);
  6283. $ctx1.sendIdx["assert:"]=4;
  6284. $9=(1)._yourself();
  6285. $ctx1.sendIdx["yourself"]=3;
  6286. $8=_st($9).__eq((1)._yourself());
  6287. $ctx1.sendIdx["="]=6;
  6288. self._assert_($8);
  6289. $10=(0).__eq(false);
  6290. $ctx1.sendIdx["="]=7;
  6291. self._deny_($10);
  6292. $ctx1.sendIdx["deny:"]=2;
  6293. $11=false.__eq((0));
  6294. $ctx1.sendIdx["="]=8;
  6295. self._deny_($11);
  6296. $ctx1.sendIdx["deny:"]=3;
  6297. $12="".__eq((0));
  6298. $ctx1.sendIdx["="]=9;
  6299. self._deny_($12);
  6300. $ctx1.sendIdx["deny:"]=4;
  6301. self._deny_((0).__eq(""));
  6302. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6303. args: [],
  6304. 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 = ''",
  6305. messageSends: ["assert:", "=", "deny:", "yourself"],
  6306. referencedClasses: []
  6307. }),
  6308. smalltalk.NumberTest);
  6309. smalltalk.addMethod(
  6310. smalltalk.method({
  6311. selector: "testFloor",
  6312. protocol: 'tests',
  6313. fn: function (){
  6314. var self=this;
  6315. return smalltalk.withContext(function($ctx1) {
  6316. var $1,$2;
  6317. $1=(1.2)._floor();
  6318. $ctx1.sendIdx["floor"]=1;
  6319. self._assert_equals_($1,(1));
  6320. $ctx1.sendIdx["assert:equals:"]=1;
  6321. $2=(-1.2)._floor();
  6322. $ctx1.sendIdx["floor"]=2;
  6323. self._assert_equals_($2,(-2));
  6324. $ctx1.sendIdx["assert:equals:"]=2;
  6325. self._assert_equals_((1)._floor(),(1));
  6326. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6327. args: [],
  6328. 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.",
  6329. messageSends: ["assert:equals:", "floor"],
  6330. referencedClasses: []
  6331. }),
  6332. smalltalk.NumberTest);
  6333. smalltalk.addMethod(
  6334. smalltalk.method({
  6335. selector: "testHexNumbers",
  6336. protocol: 'tests',
  6337. fn: function (){
  6338. var self=this;
  6339. return smalltalk.withContext(function($ctx1) {
  6340. var $1,$2,$3,$4,$5;
  6341. self._assert_equals_((9),(9));
  6342. $ctx1.sendIdx["assert:equals:"]=1;
  6343. $1=(10)._truncated();
  6344. $ctx1.sendIdx["truncated"]=1;
  6345. self._assert_equals_($1,(10));
  6346. $ctx1.sendIdx["assert:equals:"]=2;
  6347. $2=(11)._truncated();
  6348. $ctx1.sendIdx["truncated"]=2;
  6349. self._assert_equals_($2,(11));
  6350. $ctx1.sendIdx["assert:equals:"]=3;
  6351. $3=(12)._truncated();
  6352. $ctx1.sendIdx["truncated"]=3;
  6353. self._assert_equals_($3,(12));
  6354. $ctx1.sendIdx["assert:equals:"]=4;
  6355. $4=(13)._truncated();
  6356. $ctx1.sendIdx["truncated"]=4;
  6357. self._assert_equals_($4,(13));
  6358. $ctx1.sendIdx["assert:equals:"]=5;
  6359. $5=(14)._truncated();
  6360. $ctx1.sendIdx["truncated"]=5;
  6361. self._assert_equals_($5,(14));
  6362. $ctx1.sendIdx["assert:equals:"]=6;
  6363. self._assert_equals_((15)._truncated(),(15));
  6364. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6365. args: [],
  6366. 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",
  6367. messageSends: ["assert:equals:", "truncated"],
  6368. referencedClasses: []
  6369. }),
  6370. smalltalk.NumberTest);
  6371. smalltalk.addMethod(
  6372. smalltalk.method({
  6373. selector: "testIdentity",
  6374. protocol: 'tests',
  6375. fn: function (){
  6376. var self=this;
  6377. return smalltalk.withContext(function($ctx1) {
  6378. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6379. $1=(1).__eq_eq((1));
  6380. $ctx1.sendIdx["=="]=1;
  6381. self._assert_($1);
  6382. $ctx1.sendIdx["assert:"]=1;
  6383. $2=(0).__eq_eq((0));
  6384. $ctx1.sendIdx["=="]=2;
  6385. self._assert_($2);
  6386. $ctx1.sendIdx["assert:"]=2;
  6387. $3=(1).__eq_eq((0));
  6388. $ctx1.sendIdx["=="]=3;
  6389. self._deny_($3);
  6390. $ctx1.sendIdx["deny:"]=1;
  6391. $5=(1)._yourself();
  6392. $ctx1.sendIdx["yourself"]=1;
  6393. $4=_st($5).__eq_eq((1));
  6394. $ctx1.sendIdx["=="]=4;
  6395. self._assert_($4);
  6396. $ctx1.sendIdx["assert:"]=3;
  6397. $7=(1)._yourself();
  6398. $ctx1.sendIdx["yourself"]=2;
  6399. $6=(1).__eq_eq($7);
  6400. $ctx1.sendIdx["=="]=5;
  6401. self._assert_($6);
  6402. $ctx1.sendIdx["assert:"]=4;
  6403. $9=(1)._yourself();
  6404. $ctx1.sendIdx["yourself"]=3;
  6405. $8=_st($9).__eq_eq((1)._yourself());
  6406. $ctx1.sendIdx["=="]=6;
  6407. self._assert_($8);
  6408. self._deny_((1).__eq_eq((2)));
  6409. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6410. args: [],
  6411. 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",
  6412. messageSends: ["assert:", "==", "deny:", "yourself"],
  6413. referencedClasses: []
  6414. }),
  6415. smalltalk.NumberTest);
  6416. smalltalk.addMethod(
  6417. smalltalk.method({
  6418. selector: "testInvalidHexNumbers",
  6419. protocol: 'tests',
  6420. fn: function (){
  6421. var self=this;
  6422. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6423. return smalltalk.withContext(function($ctx1) {
  6424. self._should_raise_((function(){
  6425. return smalltalk.withContext(function($ctx2) {
  6426. return (16)._rG();
  6427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6428. $ctx1.sendIdx["should:raise:"]=1;
  6429. self._should_raise_((function(){
  6430. return smalltalk.withContext(function($ctx2) {
  6431. return (16)._rg();
  6432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6433. $ctx1.sendIdx["should:raise:"]=2;
  6434. self._should_raise_((function(){
  6435. return smalltalk.withContext(function($ctx2) {
  6436. return (16)._rH();
  6437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6438. $ctx1.sendIdx["should:raise:"]=3;
  6439. self._should_raise_((function(){
  6440. return smalltalk.withContext(function($ctx2) {
  6441. return (16)._rh();
  6442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6443. $ctx1.sendIdx["should:raise:"]=4;
  6444. self._should_raise_((function(){
  6445. return smalltalk.withContext(function($ctx2) {
  6446. return (16)._rI();
  6447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6448. $ctx1.sendIdx["should:raise:"]=5;
  6449. self._should_raise_((function(){
  6450. return smalltalk.withContext(function($ctx2) {
  6451. return (16)._ri();
  6452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6453. $ctx1.sendIdx["should:raise:"]=6;
  6454. self._should_raise_((function(){
  6455. return smalltalk.withContext(function($ctx2) {
  6456. return (16)._rJ();
  6457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6458. $ctx1.sendIdx["should:raise:"]=7;
  6459. self._should_raise_((function(){
  6460. return smalltalk.withContext(function($ctx2) {
  6461. return (16)._rj();
  6462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6463. $ctx1.sendIdx["should:raise:"]=8;
  6464. self._should_raise_((function(){
  6465. return smalltalk.withContext(function($ctx2) {
  6466. return (16)._rK();
  6467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6468. $ctx1.sendIdx["should:raise:"]=9;
  6469. self._should_raise_((function(){
  6470. return smalltalk.withContext(function($ctx2) {
  6471. return (16)._rk();
  6472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6473. $ctx1.sendIdx["should:raise:"]=10;
  6474. self._should_raise_((function(){
  6475. return smalltalk.withContext(function($ctx2) {
  6476. return (16)._rL();
  6477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6478. $ctx1.sendIdx["should:raise:"]=11;
  6479. self._should_raise_((function(){
  6480. return smalltalk.withContext(function($ctx2) {
  6481. return (16)._rl();
  6482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6483. $ctx1.sendIdx["should:raise:"]=12;
  6484. self._should_raise_((function(){
  6485. return smalltalk.withContext(function($ctx2) {
  6486. return (16)._rM();
  6487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6488. $ctx1.sendIdx["should:raise:"]=13;
  6489. self._should_raise_((function(){
  6490. return smalltalk.withContext(function($ctx2) {
  6491. return (16)._rm();
  6492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6493. $ctx1.sendIdx["should:raise:"]=14;
  6494. self._should_raise_((function(){
  6495. return smalltalk.withContext(function($ctx2) {
  6496. return (16)._rN();
  6497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6498. $ctx1.sendIdx["should:raise:"]=15;
  6499. self._should_raise_((function(){
  6500. return smalltalk.withContext(function($ctx2) {
  6501. return (16)._rn();
  6502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6503. $ctx1.sendIdx["should:raise:"]=16;
  6504. self._should_raise_((function(){
  6505. return smalltalk.withContext(function($ctx2) {
  6506. return (16)._rO();
  6507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6508. $ctx1.sendIdx["should:raise:"]=17;
  6509. self._should_raise_((function(){
  6510. return smalltalk.withContext(function($ctx2) {
  6511. return (16)._ro();
  6512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6513. $ctx1.sendIdx["should:raise:"]=18;
  6514. self._should_raise_((function(){
  6515. return smalltalk.withContext(function($ctx2) {
  6516. return (16)._rP();
  6517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6518. $ctx1.sendIdx["should:raise:"]=19;
  6519. self._should_raise_((function(){
  6520. return smalltalk.withContext(function($ctx2) {
  6521. return (16)._rp();
  6522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6523. $ctx1.sendIdx["should:raise:"]=20;
  6524. self._should_raise_((function(){
  6525. return smalltalk.withContext(function($ctx2) {
  6526. return (16)._rQ();
  6527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6528. $ctx1.sendIdx["should:raise:"]=21;
  6529. self._should_raise_((function(){
  6530. return smalltalk.withContext(function($ctx2) {
  6531. return (16)._rq();
  6532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6533. $ctx1.sendIdx["should:raise:"]=22;
  6534. self._should_raise_((function(){
  6535. return smalltalk.withContext(function($ctx2) {
  6536. return (16)._rR();
  6537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6538. $ctx1.sendIdx["should:raise:"]=23;
  6539. self._should_raise_((function(){
  6540. return smalltalk.withContext(function($ctx2) {
  6541. return (16)._rr();
  6542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6543. $ctx1.sendIdx["should:raise:"]=24;
  6544. self._should_raise_((function(){
  6545. return smalltalk.withContext(function($ctx2) {
  6546. return (16)._rS();
  6547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6548. $ctx1.sendIdx["should:raise:"]=25;
  6549. self._should_raise_((function(){
  6550. return smalltalk.withContext(function($ctx2) {
  6551. return (16)._rs();
  6552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6553. $ctx1.sendIdx["should:raise:"]=26;
  6554. self._should_raise_((function(){
  6555. return smalltalk.withContext(function($ctx2) {
  6556. return (16)._rT();
  6557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6558. $ctx1.sendIdx["should:raise:"]=27;
  6559. self._should_raise_((function(){
  6560. return smalltalk.withContext(function($ctx2) {
  6561. return (16)._rt();
  6562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6563. $ctx1.sendIdx["should:raise:"]=28;
  6564. self._should_raise_((function(){
  6565. return smalltalk.withContext(function($ctx2) {
  6566. return (16)._rU();
  6567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6568. $ctx1.sendIdx["should:raise:"]=29;
  6569. self._should_raise_((function(){
  6570. return smalltalk.withContext(function($ctx2) {
  6571. return (16)._ru();
  6572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6573. $ctx1.sendIdx["should:raise:"]=30;
  6574. self._should_raise_((function(){
  6575. return smalltalk.withContext(function($ctx2) {
  6576. return (16)._rV();
  6577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6578. $ctx1.sendIdx["should:raise:"]=31;
  6579. self._should_raise_((function(){
  6580. return smalltalk.withContext(function($ctx2) {
  6581. return (16)._rv();
  6582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6583. $ctx1.sendIdx["should:raise:"]=32;
  6584. self._should_raise_((function(){
  6585. return smalltalk.withContext(function($ctx2) {
  6586. return (16)._rW();
  6587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6588. $ctx1.sendIdx["should:raise:"]=33;
  6589. self._should_raise_((function(){
  6590. return smalltalk.withContext(function($ctx2) {
  6591. return (16)._rw();
  6592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6593. $ctx1.sendIdx["should:raise:"]=34;
  6594. self._should_raise_((function(){
  6595. return smalltalk.withContext(function($ctx2) {
  6596. return (16)._rX();
  6597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6598. $ctx1.sendIdx["should:raise:"]=35;
  6599. self._should_raise_((function(){
  6600. return smalltalk.withContext(function($ctx2) {
  6601. return (16)._rx();
  6602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6603. $ctx1.sendIdx["should:raise:"]=36;
  6604. self._should_raise_((function(){
  6605. return smalltalk.withContext(function($ctx2) {
  6606. return (16)._rY();
  6607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6608. $ctx1.sendIdx["should:raise:"]=37;
  6609. self._should_raise_((function(){
  6610. return smalltalk.withContext(function($ctx2) {
  6611. return (16)._ry();
  6612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6613. $ctx1.sendIdx["should:raise:"]=38;
  6614. self._should_raise_((function(){
  6615. return smalltalk.withContext(function($ctx2) {
  6616. return (16)._rZ();
  6617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6618. $ctx1.sendIdx["should:raise:"]=39;
  6619. self._should_raise_((function(){
  6620. return smalltalk.withContext(function($ctx2) {
  6621. return (16)._rz();
  6622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6623. $ctx1.sendIdx["should:raise:"]=40;
  6624. self._should_raise_((function(){
  6625. return smalltalk.withContext(function($ctx2) {
  6626. return (11259375)._Z();
  6627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6628. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6629. args: [],
  6630. 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.",
  6631. 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"],
  6632. referencedClasses: ["MessageNotUnderstood"]
  6633. }),
  6634. smalltalk.NumberTest);
  6635. smalltalk.addMethod(
  6636. smalltalk.method({
  6637. selector: "testLog",
  6638. protocol: 'tests',
  6639. fn: function (){
  6640. var self=this;
  6641. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6642. return smalltalk.withContext(function($ctx1) {
  6643. self._assert_equals_((10000)._log(),(4));
  6644. $ctx1.sendIdx["assert:equals:"]=1;
  6645. self._assert_equals_((512)._log_((2)),(9));
  6646. $ctx1.sendIdx["assert:equals:"]=2;
  6647. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6648. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6649. args: [],
  6650. 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.",
  6651. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6652. referencedClasses: ["Number"]
  6653. }),
  6654. smalltalk.NumberTest);
  6655. smalltalk.addMethod(
  6656. smalltalk.method({
  6657. selector: "testMinMax",
  6658. protocol: 'tests',
  6659. fn: function (){
  6660. var self=this;
  6661. return smalltalk.withContext(function($ctx1) {
  6662. self._assert_equals_((2)._max_((5)),(5));
  6663. $ctx1.sendIdx["assert:equals:"]=1;
  6664. self._assert_equals_((2)._min_((5)),(2));
  6665. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6666. args: [],
  6667. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6668. messageSends: ["assert:equals:", "max:", "min:"],
  6669. referencedClasses: []
  6670. }),
  6671. smalltalk.NumberTest);
  6672. smalltalk.addMethod(
  6673. smalltalk.method({
  6674. selector: "testNegated",
  6675. protocol: 'tests',
  6676. fn: function (){
  6677. var self=this;
  6678. return smalltalk.withContext(function($ctx1) {
  6679. var $1;
  6680. $1=(3)._negated();
  6681. $ctx1.sendIdx["negated"]=1;
  6682. self._assert_equals_($1,(-3));
  6683. $ctx1.sendIdx["assert:equals:"]=1;
  6684. self._assert_equals_((-3)._negated(),(3));
  6685. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6686. args: [],
  6687. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6688. messageSends: ["assert:equals:", "negated"],
  6689. referencedClasses: []
  6690. }),
  6691. smalltalk.NumberTest);
  6692. smalltalk.addMethod(
  6693. smalltalk.method({
  6694. selector: "testPrintShowingDecimalPlaces",
  6695. protocol: 'tests',
  6696. fn: function (){
  6697. var self=this;
  6698. return smalltalk.withContext(function($ctx1) {
  6699. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6700. $1=(23)._printShowingDecimalPlaces_((2));
  6701. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6702. self._assert_equals_($1,"23.00");
  6703. $ctx1.sendIdx["assert:equals:"]=1;
  6704. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6705. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6706. self._assert_equals_($2,"23.57");
  6707. $ctx1.sendIdx["assert:equals:"]=2;
  6708. $4=(234.567)._negated();
  6709. $ctx1.sendIdx["negated"]=1;
  6710. $3=_st($4)._printShowingDecimalPlaces_((5));
  6711. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6712. self._assert_equals_($3,"-234.56700");
  6713. $ctx1.sendIdx["assert:equals:"]=3;
  6714. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6715. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6716. self._assert_equals_($5,"23");
  6717. $ctx1.sendIdx["assert:equals:"]=4;
  6718. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6719. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6720. self._assert_equals_($6,"24");
  6721. $ctx1.sendIdx["assert:equals:"]=5;
  6722. $8=(23.4567)._negated();
  6723. $ctx1.sendIdx["negated"]=2;
  6724. $7=_st($8)._printShowingDecimalPlaces_((0));
  6725. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6726. self._assert_equals_($7,"-23");
  6727. $ctx1.sendIdx["assert:equals:"]=6;
  6728. $10=(23.5567)._negated();
  6729. $ctx1.sendIdx["negated"]=3;
  6730. $9=_st($10)._printShowingDecimalPlaces_((0));
  6731. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6732. self._assert_equals_($9,"-24");
  6733. $ctx1.sendIdx["assert:equals:"]=7;
  6734. $11=(100000000)._printShowingDecimalPlaces_((1));
  6735. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6736. self._assert_equals_($11,"100000000.0");
  6737. $ctx1.sendIdx["assert:equals:"]=8;
  6738. $12=(0.98)._printShowingDecimalPlaces_((5));
  6739. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6740. self._assert_equals_($12,"0.98000");
  6741. $ctx1.sendIdx["assert:equals:"]=9;
  6742. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6743. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6744. self._assert_equals_($13,"-0.98");
  6745. $ctx1.sendIdx["assert:equals:"]=10;
  6746. $14=(2.567)._printShowingDecimalPlaces_((2));
  6747. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6748. self._assert_equals_($14,"2.57");
  6749. $ctx1.sendIdx["assert:equals:"]=11;
  6750. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6751. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6752. self._assert_equals_($15,"-2.57");
  6753. $ctx1.sendIdx["assert:equals:"]=12;
  6754. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6755. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6756. args: [],
  6757. 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'.",
  6758. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6759. referencedClasses: []
  6760. }),
  6761. smalltalk.NumberTest);
  6762. smalltalk.addMethod(
  6763. smalltalk.method({
  6764. selector: "testRaisedTo",
  6765. protocol: 'tests',
  6766. fn: function (){
  6767. var self=this;
  6768. return smalltalk.withContext(function($ctx1) {
  6769. var $1,$2,$3;
  6770. $1=(2)._raisedTo_((4));
  6771. $ctx1.sendIdx["raisedTo:"]=1;
  6772. self._assert_equals_($1,(16));
  6773. $ctx1.sendIdx["assert:equals:"]=1;
  6774. $2=(2)._raisedTo_((0));
  6775. $ctx1.sendIdx["raisedTo:"]=2;
  6776. self._assert_equals_($2,(1));
  6777. $ctx1.sendIdx["assert:equals:"]=2;
  6778. $3=(2)._raisedTo_((-3));
  6779. $ctx1.sendIdx["raisedTo:"]=3;
  6780. self._assert_equals_($3,(0.125));
  6781. $ctx1.sendIdx["assert:equals:"]=3;
  6782. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6783. $ctx1.sendIdx["assert:equals:"]=4;
  6784. self._assert_equals_((2).__star_star((4)),(16));
  6785. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6786. args: [],
  6787. 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.",
  6788. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6789. referencedClasses: []
  6790. }),
  6791. smalltalk.NumberTest);
  6792. smalltalk.addMethod(
  6793. smalltalk.method({
  6794. selector: "testRounded",
  6795. protocol: 'tests',
  6796. fn: function (){
  6797. var self=this;
  6798. return smalltalk.withContext(function($ctx1) {
  6799. var $1,$2;
  6800. $1=(3)._rounded();
  6801. $ctx1.sendIdx["rounded"]=1;
  6802. self._assert_equals_($1,(3));
  6803. $ctx1.sendIdx["assert:equals:"]=1;
  6804. $2=(3.212)._rounded();
  6805. $ctx1.sendIdx["rounded"]=2;
  6806. self._assert_equals_($2,(3));
  6807. $ctx1.sendIdx["assert:equals:"]=2;
  6808. self._assert_equals_((3.51)._rounded(),(4));
  6809. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6810. args: [],
  6811. 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",
  6812. messageSends: ["assert:equals:", "rounded"],
  6813. referencedClasses: []
  6814. }),
  6815. smalltalk.NumberTest);
  6816. smalltalk.addMethod(
  6817. smalltalk.method({
  6818. selector: "testSign",
  6819. protocol: 'tests',
  6820. fn: function (){
  6821. var self=this;
  6822. return smalltalk.withContext(function($ctx1) {
  6823. var $1,$2;
  6824. $1=(5)._sign();
  6825. $ctx1.sendIdx["sign"]=1;
  6826. self._assert_equals_($1,(1));
  6827. $ctx1.sendIdx["assert:equals:"]=1;
  6828. $2=(0)._sign();
  6829. $ctx1.sendIdx["sign"]=2;
  6830. self._assert_equals_($2,(0));
  6831. $ctx1.sendIdx["assert:equals:"]=2;
  6832. self._assert_equals_((-1.4)._sign(),(-1));
  6833. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  6834. args: [],
  6835. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  6836. messageSends: ["assert:equals:", "sign"],
  6837. referencedClasses: []
  6838. }),
  6839. smalltalk.NumberTest);
  6840. smalltalk.addMethod(
  6841. smalltalk.method({
  6842. selector: "testSqrt",
  6843. protocol: 'tests',
  6844. fn: function (){
  6845. var self=this;
  6846. return smalltalk.withContext(function($ctx1) {
  6847. var $1;
  6848. $1=(4)._sqrt();
  6849. $ctx1.sendIdx["sqrt"]=1;
  6850. self._assert_equals_($1,(2));
  6851. $ctx1.sendIdx["assert:equals:"]=1;
  6852. self._assert_equals_((16)._sqrt(),(4));
  6853. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  6854. args: [],
  6855. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  6856. messageSends: ["assert:equals:", "sqrt"],
  6857. referencedClasses: []
  6858. }),
  6859. smalltalk.NumberTest);
  6860. smalltalk.addMethod(
  6861. smalltalk.method({
  6862. selector: "testSquared",
  6863. protocol: 'tests',
  6864. fn: function (){
  6865. var self=this;
  6866. return smalltalk.withContext(function($ctx1) {
  6867. self._assert_equals_((4)._squared(),(16));
  6868. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  6869. args: [],
  6870. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  6871. messageSends: ["assert:equals:", "squared"],
  6872. referencedClasses: []
  6873. }),
  6874. smalltalk.NumberTest);
  6875. smalltalk.addMethod(
  6876. smalltalk.method({
  6877. selector: "testTimesRepeat",
  6878. protocol: 'tests',
  6879. fn: function (){
  6880. var self=this;
  6881. var i;
  6882. return smalltalk.withContext(function($ctx1) {
  6883. i=(0);
  6884. (0)._timesRepeat_((function(){
  6885. return smalltalk.withContext(function($ctx2) {
  6886. i=_st(i).__plus((1));
  6887. $ctx2.sendIdx["+"]=1;
  6888. return i;
  6889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6890. $ctx1.sendIdx["timesRepeat:"]=1;
  6891. self._assert_equals_(i,(0));
  6892. $ctx1.sendIdx["assert:equals:"]=1;
  6893. (5)._timesRepeat_((function(){
  6894. return smalltalk.withContext(function($ctx2) {
  6895. i=_st(i).__plus((1));
  6896. return i;
  6897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6898. self._assert_equals_(i,(5));
  6899. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  6900. args: [],
  6901. 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",
  6902. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  6903. referencedClasses: []
  6904. }),
  6905. smalltalk.NumberTest);
  6906. smalltalk.addMethod(
  6907. smalltalk.method({
  6908. selector: "testTo",
  6909. protocol: 'tests',
  6910. fn: function (){
  6911. var self=this;
  6912. return smalltalk.withContext(function($ctx1) {
  6913. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  6914. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  6915. args: [],
  6916. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  6917. messageSends: ["assert:equals:", "to:"],
  6918. referencedClasses: []
  6919. }),
  6920. smalltalk.NumberTest);
  6921. smalltalk.addMethod(
  6922. smalltalk.method({
  6923. selector: "testToBy",
  6924. protocol: 'tests',
  6925. fn: function (){
  6926. var self=this;
  6927. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6928. return smalltalk.withContext(function($ctx1) {
  6929. var $1;
  6930. $1=(0)._to_by_((6),(2));
  6931. $ctx1.sendIdx["to:by:"]=1;
  6932. self._assert_equals_($1,[(0), (2), (4), (6)]);
  6933. self._should_raise_((function(){
  6934. return smalltalk.withContext(function($ctx2) {
  6935. return (1)._to_by_((4),(0));
  6936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6937. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  6938. args: [],
  6939. 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",
  6940. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  6941. referencedClasses: ["Error"]
  6942. }),
  6943. smalltalk.NumberTest);
  6944. smalltalk.addMethod(
  6945. smalltalk.method({
  6946. selector: "testTrigonometry",
  6947. protocol: 'tests',
  6948. fn: function (){
  6949. var self=this;
  6950. return smalltalk.withContext(function($ctx1) {
  6951. self._assert_equals_((0)._cos(),(1));
  6952. $ctx1.sendIdx["assert:equals:"]=1;
  6953. self._assert_equals_((0)._sin(),(0));
  6954. $ctx1.sendIdx["assert:equals:"]=2;
  6955. self._assert_equals_((0)._tan(),(0));
  6956. $ctx1.sendIdx["assert:equals:"]=3;
  6957. self._assert_equals_((1)._arcCos(),(0));
  6958. $ctx1.sendIdx["assert:equals:"]=4;
  6959. self._assert_equals_((0)._arcSin(),(0));
  6960. $ctx1.sendIdx["assert:equals:"]=5;
  6961. self._assert_equals_((0)._arcTan(),(0));
  6962. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  6963. args: [],
  6964. 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.",
  6965. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  6966. referencedClasses: []
  6967. }),
  6968. smalltalk.NumberTest);
  6969. smalltalk.addMethod(
  6970. smalltalk.method({
  6971. selector: "testTruncated",
  6972. protocol: 'tests',
  6973. fn: function (){
  6974. var self=this;
  6975. return smalltalk.withContext(function($ctx1) {
  6976. var $1,$2;
  6977. $1=(3)._truncated();
  6978. $ctx1.sendIdx["truncated"]=1;
  6979. self._assert_equals_($1,(3));
  6980. $ctx1.sendIdx["assert:equals:"]=1;
  6981. $2=(3.212)._truncated();
  6982. $ctx1.sendIdx["truncated"]=2;
  6983. self._assert_equals_($2,(3));
  6984. $ctx1.sendIdx["assert:equals:"]=2;
  6985. self._assert_equals_((3.51)._truncated(),(3));
  6986. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  6987. args: [],
  6988. 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",
  6989. messageSends: ["assert:equals:", "truncated"],
  6990. referencedClasses: []
  6991. }),
  6992. smalltalk.NumberTest);
  6993. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  6994. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  6995. smalltalk.addMethod(
  6996. smalltalk.method({
  6997. selector: "foo",
  6998. protocol: 'not yet classified',
  6999. fn: function (){
  7000. var self=this;
  7001. return smalltalk.withContext(function($ctx1) {
  7002. var $1;
  7003. $1=self["@foo"];
  7004. return $1;
  7005. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7006. args: [],
  7007. source: "foo\x0a\x09^ foo",
  7008. messageSends: [],
  7009. referencedClasses: []
  7010. }),
  7011. smalltalk.ObjectMock);
  7012. smalltalk.addMethod(
  7013. smalltalk.method({
  7014. selector: "foo:",
  7015. protocol: 'not yet classified',
  7016. fn: function (anObject){
  7017. var self=this;
  7018. return smalltalk.withContext(function($ctx1) {
  7019. self["@foo"]=anObject;
  7020. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7021. args: ["anObject"],
  7022. source: "foo: anObject\x0a\x09foo := anObject",
  7023. messageSends: [],
  7024. referencedClasses: []
  7025. }),
  7026. smalltalk.ObjectMock);
  7027. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7028. smalltalk.addMethod(
  7029. smalltalk.method({
  7030. selector: "notDefined",
  7031. protocol: 'tests',
  7032. fn: function (){
  7033. var self=this;
  7034. return smalltalk.withContext(function($ctx1) {
  7035. return void 0;;
  7036. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7037. args: [],
  7038. source: "notDefined\x0a\x09<return void 0;>",
  7039. messageSends: [],
  7040. referencedClasses: []
  7041. }),
  7042. smalltalk.ObjectTest);
  7043. smalltalk.addMethod(
  7044. smalltalk.method({
  7045. selector: "testBasicAccess",
  7046. protocol: 'tests',
  7047. fn: function (){
  7048. var self=this;
  7049. var o;
  7050. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7051. return smalltalk.withContext(function($ctx1) {
  7052. var $1;
  7053. o=_st($Object())._new();
  7054. _st(o)._basicAt_put_("a",(1));
  7055. $1=_st(o)._basicAt_("a");
  7056. $ctx1.sendIdx["basicAt:"]=1;
  7057. self._assert_equals_($1,(1));
  7058. $ctx1.sendIdx["assert:equals:"]=1;
  7059. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7060. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7061. args: [],
  7062. 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",
  7063. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7064. referencedClasses: ["Object"]
  7065. }),
  7066. smalltalk.ObjectTest);
  7067. smalltalk.addMethod(
  7068. smalltalk.method({
  7069. selector: "testBasicPerform",
  7070. protocol: 'tests',
  7071. fn: function (){
  7072. var self=this;
  7073. var o;
  7074. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7075. return smalltalk.withContext(function($ctx1) {
  7076. o=_st($Object())._new();
  7077. _st(o)._basicAt_put_("func",(function(){
  7078. return smalltalk.withContext(function($ctx2) {
  7079. return "hello";
  7080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7081. $ctx1.sendIdx["basicAt:put:"]=1;
  7082. _st(o)._basicAt_put_("func2",(function(a){
  7083. return smalltalk.withContext(function($ctx2) {
  7084. return _st(a).__plus((1));
  7085. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7086. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7087. $ctx1.sendIdx["assert:equals:"]=1;
  7088. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7089. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7090. args: [],
  7091. 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",
  7092. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7093. referencedClasses: ["Object"]
  7094. }),
  7095. smalltalk.ObjectTest);
  7096. smalltalk.addMethod(
  7097. smalltalk.method({
  7098. selector: "testDNU",
  7099. protocol: 'tests',
  7100. fn: function (){
  7101. var self=this;
  7102. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7103. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7104. return smalltalk.withContext(function($ctx1) {
  7105. self._should_raise_((function(){
  7106. return smalltalk.withContext(function($ctx2) {
  7107. return _st(_st($Object())._new())._foo();
  7108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7109. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7110. args: [],
  7111. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7112. messageSends: ["should:raise:", "foo", "new"],
  7113. referencedClasses: ["Object", "MessageNotUnderstood"]
  7114. }),
  7115. smalltalk.ObjectTest);
  7116. smalltalk.addMethod(
  7117. smalltalk.method({
  7118. selector: "testEquality",
  7119. protocol: 'tests',
  7120. fn: function (){
  7121. var self=this;
  7122. var o;
  7123. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7124. return smalltalk.withContext(function($ctx1) {
  7125. var $1,$2,$4,$3;
  7126. o=_st($Object())._new();
  7127. $ctx1.sendIdx["new"]=1;
  7128. $1=_st(o).__eq(_st($Object())._new());
  7129. $ctx1.sendIdx["="]=1;
  7130. self._deny_($1);
  7131. $2=_st(o).__eq(o);
  7132. $ctx1.sendIdx["="]=2;
  7133. self._assert_($2);
  7134. $ctx1.sendIdx["assert:"]=1;
  7135. $4=_st(o)._yourself();
  7136. $ctx1.sendIdx["yourself"]=1;
  7137. $3=_st($4).__eq(o);
  7138. $ctx1.sendIdx["="]=3;
  7139. self._assert_($3);
  7140. $ctx1.sendIdx["assert:"]=2;
  7141. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7142. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7143. args: [],
  7144. 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)",
  7145. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7146. referencedClasses: ["Object"]
  7147. }),
  7148. smalltalk.ObjectTest);
  7149. smalltalk.addMethod(
  7150. smalltalk.method({
  7151. selector: "testHalt",
  7152. protocol: 'tests',
  7153. fn: function (){
  7154. var self=this;
  7155. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7156. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7157. return smalltalk.withContext(function($ctx1) {
  7158. self._should_raise_((function(){
  7159. return smalltalk.withContext(function($ctx2) {
  7160. return _st(_st($Object())._new())._halt();
  7161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7162. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7163. args: [],
  7164. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7165. messageSends: ["should:raise:", "halt", "new"],
  7166. referencedClasses: ["Object", "Error"]
  7167. }),
  7168. smalltalk.ObjectTest);
  7169. smalltalk.addMethod(
  7170. smalltalk.method({
  7171. selector: "testIdentity",
  7172. protocol: 'tests',
  7173. fn: function (){
  7174. var self=this;
  7175. var o;
  7176. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7177. return smalltalk.withContext(function($ctx1) {
  7178. var $1,$2,$4,$3;
  7179. o=_st($Object())._new();
  7180. $ctx1.sendIdx["new"]=1;
  7181. $1=_st(o).__eq_eq(_st($Object())._new());
  7182. $ctx1.sendIdx["=="]=1;
  7183. self._deny_($1);
  7184. $2=_st(o).__eq_eq(o);
  7185. $ctx1.sendIdx["=="]=2;
  7186. self._assert_($2);
  7187. $ctx1.sendIdx["assert:"]=1;
  7188. $4=_st(o)._yourself();
  7189. $ctx1.sendIdx["yourself"]=1;
  7190. $3=_st($4).__eq_eq(o);
  7191. $ctx1.sendIdx["=="]=3;
  7192. self._assert_($3);
  7193. $ctx1.sendIdx["assert:"]=2;
  7194. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7195. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7196. args: [],
  7197. 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",
  7198. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7199. referencedClasses: ["Object"]
  7200. }),
  7201. smalltalk.ObjectTest);
  7202. smalltalk.addMethod(
  7203. smalltalk.method({
  7204. selector: "testIfNil",
  7205. protocol: 'tests',
  7206. fn: function (){
  7207. var self=this;
  7208. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7209. return smalltalk.withContext(function($ctx1) {
  7210. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7211. $2=_st($Object())._new();
  7212. $ctx1.sendIdx["new"]=1;
  7213. $1=_st($2)._isNil();
  7214. self._deny_($1);
  7215. $ctx1.sendIdx["deny:"]=1;
  7216. $5=_st($Object())._new();
  7217. $ctx1.sendIdx["new"]=2;
  7218. if(($receiver = $5) == nil || $receiver == null){
  7219. $4=true;
  7220. } else {
  7221. $4=$5;
  7222. };
  7223. $3=_st($4).__eq(true);
  7224. self._deny_($3);
  7225. $7=_st($Object())._new();
  7226. $ctx1.sendIdx["new"]=3;
  7227. if(($receiver = $7) == nil || $receiver == null){
  7228. $6=$7;
  7229. } else {
  7230. $6=true;
  7231. };
  7232. self._assert_equals_($6,true);
  7233. $ctx1.sendIdx["assert:equals:"]=1;
  7234. $9=_st($Object())._new();
  7235. $ctx1.sendIdx["new"]=4;
  7236. if(($receiver = $9) == nil || $receiver == null){
  7237. $8=false;
  7238. } else {
  7239. $8=true;
  7240. };
  7241. self._assert_equals_($8,true);
  7242. $ctx1.sendIdx["assert:equals:"]=2;
  7243. $11=_st($Object())._new();
  7244. if(($receiver = $11) == nil || $receiver == null){
  7245. $10=false;
  7246. } else {
  7247. $10=true;
  7248. };
  7249. self._assert_equals_($10,true);
  7250. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7251. args: [],
  7252. 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",
  7253. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7254. referencedClasses: ["Object"]
  7255. }),
  7256. smalltalk.ObjectTest);
  7257. smalltalk.addMethod(
  7258. smalltalk.method({
  7259. selector: "testInstVars",
  7260. protocol: 'tests',
  7261. fn: function (){
  7262. var self=this;
  7263. var o;
  7264. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7265. return smalltalk.withContext(function($ctx1) {
  7266. var $1,$2;
  7267. o=_st($ObjectMock())._new();
  7268. $1=_st(o)._instVarAt_("foo");
  7269. $ctx1.sendIdx["instVarAt:"]=1;
  7270. self._assert_equals_($1,nil);
  7271. $ctx1.sendIdx["assert:equals:"]=1;
  7272. _st(o)._instVarAt_put_("foo",(1));
  7273. $2=_st(o)._instVarAt_("foo");
  7274. $ctx1.sendIdx["instVarAt:"]=2;
  7275. self._assert_equals_($2,(1));
  7276. $ctx1.sendIdx["assert:equals:"]=2;
  7277. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7278. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7279. args: [],
  7280. 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",
  7281. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7282. referencedClasses: ["ObjectMock"]
  7283. }),
  7284. smalltalk.ObjectTest);
  7285. smalltalk.addMethod(
  7286. smalltalk.method({
  7287. selector: "testNilUndefined",
  7288. protocol: 'tests',
  7289. fn: function (){
  7290. var self=this;
  7291. return smalltalk.withContext(function($ctx1) {
  7292. self._assert_equals_(self._notDefined(),nil);
  7293. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7294. args: [],
  7295. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7296. messageSends: ["assert:equals:", "notDefined"],
  7297. referencedClasses: []
  7298. }),
  7299. smalltalk.ObjectTest);
  7300. smalltalk.addMethod(
  7301. smalltalk.method({
  7302. selector: "testYourself",
  7303. protocol: 'tests',
  7304. fn: function (){
  7305. var self=this;
  7306. var o;
  7307. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7308. return smalltalk.withContext(function($ctx1) {
  7309. o=_st($ObjectMock())._new();
  7310. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7311. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7312. args: [],
  7313. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7314. messageSends: ["new", "assert:", "==", "yourself"],
  7315. referencedClasses: ["ObjectMock"]
  7316. }),
  7317. smalltalk.ObjectTest);
  7318. smalltalk.addMethod(
  7319. smalltalk.method({
  7320. selector: "testidentityHash",
  7321. protocol: 'tests',
  7322. fn: function (){
  7323. var self=this;
  7324. var o1,o2;
  7325. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7326. return smalltalk.withContext(function($ctx1) {
  7327. var $2,$3,$1,$5,$4;
  7328. o1=_st($Object())._new();
  7329. $ctx1.sendIdx["new"]=1;
  7330. o2=_st($Object())._new();
  7331. $2=_st(o1)._identityHash();
  7332. $ctx1.sendIdx["identityHash"]=1;
  7333. $3=_st(o1)._identityHash();
  7334. $ctx1.sendIdx["identityHash"]=2;
  7335. $1=_st($2).__eq_eq($3);
  7336. $ctx1.sendIdx["=="]=1;
  7337. self._assert_($1);
  7338. $5=_st(o1)._identityHash();
  7339. $ctx1.sendIdx["identityHash"]=3;
  7340. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7341. self._deny_($4);
  7342. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7343. args: [],
  7344. 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",
  7345. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7346. referencedClasses: ["Object"]
  7347. }),
  7348. smalltalk.ObjectTest);
  7349. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7350. smalltalk.addMethod(
  7351. smalltalk.method({
  7352. selector: "testAccessing",
  7353. protocol: 'tests',
  7354. fn: function (){
  7355. var self=this;
  7356. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7357. return smalltalk.withContext(function($ctx1) {
  7358. var $2,$1,$3,$6,$5,$4;
  7359. $2=_st($Point())._x_y_((3),(4));
  7360. $ctx1.sendIdx["x:y:"]=1;
  7361. $1=_st($2)._x();
  7362. $ctx1.sendIdx["x"]=1;
  7363. self._assert_equals_($1,(3));
  7364. $ctx1.sendIdx["assert:equals:"]=1;
  7365. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7366. $ctx1.sendIdx["y"]=1;
  7367. self._assert_equals_($3,(4));
  7368. $ctx1.sendIdx["assert:equals:"]=2;
  7369. $6=_st($Point())._new();
  7370. $ctx1.sendIdx["new"]=1;
  7371. $5=_st($6)._x_((3));
  7372. $4=_st($5)._x();
  7373. self._assert_equals_($4,(3));
  7374. $ctx1.sendIdx["assert:equals:"]=3;
  7375. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7376. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7377. args: [],
  7378. 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",
  7379. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7380. referencedClasses: ["Point"]
  7381. }),
  7382. smalltalk.PointTest);
  7383. smalltalk.addMethod(
  7384. smalltalk.method({
  7385. selector: "testArithmetic",
  7386. protocol: 'tests',
  7387. fn: function (){
  7388. var self=this;
  7389. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7390. return smalltalk.withContext(function($ctx1) {
  7391. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7392. $2=(3).__at((4));
  7393. $ctx1.sendIdx["@"]=1;
  7394. $3=(3).__at((4));
  7395. $ctx1.sendIdx["@"]=2;
  7396. $1=_st($2).__star($3);
  7397. $4=_st($Point())._x_y_((9),(16));
  7398. $ctx1.sendIdx["x:y:"]=1;
  7399. self._assert_equals_($1,$4);
  7400. $ctx1.sendIdx["assert:equals:"]=1;
  7401. $6=(3).__at((4));
  7402. $ctx1.sendIdx["@"]=3;
  7403. $7=(3).__at((4));
  7404. $ctx1.sendIdx["@"]=4;
  7405. $5=_st($6).__plus($7);
  7406. $8=_st($Point())._x_y_((6),(8));
  7407. $ctx1.sendIdx["x:y:"]=2;
  7408. self._assert_equals_($5,$8);
  7409. $ctx1.sendIdx["assert:equals:"]=2;
  7410. $10=(3).__at((4));
  7411. $ctx1.sendIdx["@"]=5;
  7412. $11=(3).__at((4));
  7413. $ctx1.sendIdx["@"]=6;
  7414. $9=_st($10).__minus($11);
  7415. $12=_st($Point())._x_y_((0),(0));
  7416. $ctx1.sendIdx["x:y:"]=3;
  7417. self._assert_equals_($9,$12);
  7418. $ctx1.sendIdx["assert:equals:"]=3;
  7419. $14=(6).__at((8));
  7420. $ctx1.sendIdx["@"]=7;
  7421. $13=_st($14).__slash((3).__at((4)));
  7422. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7423. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7424. args: [],
  7425. 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)",
  7426. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7427. referencedClasses: ["Point"]
  7428. }),
  7429. smalltalk.PointTest);
  7430. smalltalk.addMethod(
  7431. smalltalk.method({
  7432. selector: "testAt",
  7433. protocol: 'tests',
  7434. fn: function (){
  7435. var self=this;
  7436. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7437. return smalltalk.withContext(function($ctx1) {
  7438. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7439. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7440. args: [],
  7441. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7442. messageSends: ["assert:equals:", "@", "x:y:"],
  7443. referencedClasses: ["Point"]
  7444. }),
  7445. smalltalk.PointTest);
  7446. smalltalk.addMethod(
  7447. smalltalk.method({
  7448. selector: "testEgality",
  7449. protocol: 'tests',
  7450. fn: function (){
  7451. var self=this;
  7452. return smalltalk.withContext(function($ctx1) {
  7453. var $2,$3,$1,$5,$4;
  7454. $2=(3).__at((4));
  7455. $ctx1.sendIdx["@"]=1;
  7456. $3=(3).__at((4));
  7457. $ctx1.sendIdx["@"]=2;
  7458. $1=_st($2).__eq($3);
  7459. $ctx1.sendIdx["="]=1;
  7460. self._assert_($1);
  7461. $5=(3).__at((5));
  7462. $ctx1.sendIdx["@"]=3;
  7463. $4=_st($5).__eq((3).__at((6)));
  7464. self._deny_($4);
  7465. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7466. args: [],
  7467. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7468. messageSends: ["assert:", "=", "@", "deny:"],
  7469. referencedClasses: []
  7470. }),
  7471. smalltalk.PointTest);
  7472. smalltalk.addMethod(
  7473. smalltalk.method({
  7474. selector: "testNew",
  7475. protocol: 'tests',
  7476. fn: function (){
  7477. var self=this;
  7478. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7479. return smalltalk.withContext(function($ctx1) {
  7480. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7481. $3=_st($Point())._new();
  7482. $ctx1.sendIdx["new"]=1;
  7483. $2=_st($3)._x_((3));
  7484. $ctx1.sendIdx["x:"]=1;
  7485. $1=_st($2)._y();
  7486. $ctx1.sendIdx["y"]=1;
  7487. self._assert_equals_($1,nil);
  7488. $ctx1.sendIdx["assert:equals:"]=1;
  7489. $7=_st($Point())._new();
  7490. $ctx1.sendIdx["new"]=2;
  7491. $6=_st($7)._x_((3));
  7492. $5=_st($6)._x();
  7493. $ctx1.sendIdx["x"]=1;
  7494. $4=_st($5).__eq((0));
  7495. $ctx1.sendIdx["="]=1;
  7496. self._deny_($4);
  7497. $ctx1.sendIdx["deny:"]=1;
  7498. $10=_st($Point())._new();
  7499. $ctx1.sendIdx["new"]=3;
  7500. $9=_st($10)._y_((4));
  7501. $ctx1.sendIdx["y:"]=1;
  7502. $8=_st($9)._x();
  7503. self._assert_equals_($8,nil);
  7504. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7505. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7506. args: [],
  7507. 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",
  7508. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7509. referencedClasses: ["Point"]
  7510. }),
  7511. smalltalk.PointTest);
  7512. smalltalk.addMethod(
  7513. smalltalk.method({
  7514. selector: "testTranslateBy",
  7515. protocol: 'tests',
  7516. fn: function (){
  7517. var self=this;
  7518. return smalltalk.withContext(function($ctx1) {
  7519. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7520. $2=(3).__at((3));
  7521. $ctx1.sendIdx["@"]=1;
  7522. $3=(0).__at((1));
  7523. $ctx1.sendIdx["@"]=2;
  7524. $1=_st($2)._translateBy_($3);
  7525. $ctx1.sendIdx["translateBy:"]=1;
  7526. $4=(3).__at((4));
  7527. $ctx1.sendIdx["@"]=3;
  7528. self._assert_equals_($1,$4);
  7529. $ctx1.sendIdx["assert:equals:"]=1;
  7530. $6=(3).__at((3));
  7531. $ctx1.sendIdx["@"]=4;
  7532. $8=(1)._negated();
  7533. $ctx1.sendIdx["negated"]=1;
  7534. $7=(0).__at($8);
  7535. $ctx1.sendIdx["@"]=5;
  7536. $5=_st($6)._translateBy_($7);
  7537. $ctx1.sendIdx["translateBy:"]=2;
  7538. $9=(3).__at((2));
  7539. $ctx1.sendIdx["@"]=6;
  7540. self._assert_equals_($5,$9);
  7541. $ctx1.sendIdx["assert:equals:"]=2;
  7542. $11=(3).__at((3));
  7543. $ctx1.sendIdx["@"]=7;
  7544. $12=(2).__at((3));
  7545. $ctx1.sendIdx["@"]=8;
  7546. $10=_st($11)._translateBy_($12);
  7547. $ctx1.sendIdx["translateBy:"]=3;
  7548. $13=(5).__at((6));
  7549. $ctx1.sendIdx["@"]=9;
  7550. self._assert_equals_($10,$13);
  7551. $ctx1.sendIdx["assert:equals:"]=3;
  7552. $15=(3).__at((3));
  7553. $ctx1.sendIdx["@"]=10;
  7554. $16=_st((3)._negated()).__at((0));
  7555. $ctx1.sendIdx["@"]=11;
  7556. $14=_st($15)._translateBy_($16);
  7557. self._assert_equals_($14,(0).__at((3)));
  7558. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7559. args: [],
  7560. 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.",
  7561. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7562. referencedClasses: []
  7563. }),
  7564. smalltalk.PointTest);
  7565. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7566. smalltalk.addMethod(
  7567. smalltalk.method({
  7568. selector: "testNextIfAbsent",
  7569. protocol: 'tests',
  7570. fn: function (){
  7571. var self=this;
  7572. var queue;
  7573. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7574. return smalltalk.withContext(function($ctx1) {
  7575. var $2,$1;
  7576. queue=_st($Queue())._new();
  7577. _st(queue)._nextPut_("index1");
  7578. $2=_st(queue)._nextIfAbsent_("empty");
  7579. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7580. $1=_st($2).__eq("index1");
  7581. $ctx1.sendIdx["="]=1;
  7582. self._assert_($1);
  7583. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7584. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7585. args: [],
  7586. 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'",
  7587. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7588. referencedClasses: ["Queue"]
  7589. }),
  7590. smalltalk.QueueTest);
  7591. smalltalk.addMethod(
  7592. smalltalk.method({
  7593. selector: "testQueueNext",
  7594. protocol: 'tests',
  7595. fn: function (){
  7596. var self=this;
  7597. var queue;
  7598. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7599. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7600. return smalltalk.withContext(function($ctx1) {
  7601. var $1,$2,$4,$3,$6,$5;
  7602. queue=_st($Queue())._new();
  7603. $1=queue;
  7604. _st($1)._nextPut_("index1");
  7605. $ctx1.sendIdx["nextPut:"]=1;
  7606. $2=_st($1)._nextPut_("index2");
  7607. $4=_st(queue)._next();
  7608. $ctx1.sendIdx["next"]=1;
  7609. $3=_st($4).__eq("index1");
  7610. $ctx1.sendIdx["="]=1;
  7611. self._assert_($3);
  7612. $6=_st(queue)._next();
  7613. $ctx1.sendIdx["next"]=2;
  7614. $5=_st($6).__eq("index");
  7615. self._deny_($5);
  7616. self._should_raise_((function(){
  7617. return smalltalk.withContext(function($ctx2) {
  7618. return _st(queue)._next();
  7619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7620. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7621. args: [],
  7622. 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",
  7623. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7624. referencedClasses: ["Queue", "Error"]
  7625. }),
  7626. smalltalk.QueueTest);
  7627. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7628. smalltalk.addMethod(
  7629. smalltalk.method({
  7630. selector: "testAtRandomNumber",
  7631. protocol: 'tests',
  7632. fn: function (){
  7633. var self=this;
  7634. var val;
  7635. return smalltalk.withContext(function($ctx1) {
  7636. (100)._timesRepeat_((function(){
  7637. return smalltalk.withContext(function($ctx2) {
  7638. val=(10)._atRandom();
  7639. val;
  7640. self._assert_(_st(val).__gt((0)));
  7641. $ctx2.sendIdx["assert:"]=1;
  7642. return self._assert_(_st(val).__lt((11)));
  7643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7644. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7645. args: [],
  7646. 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]",
  7647. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7648. referencedClasses: []
  7649. }),
  7650. smalltalk.RandomTest);
  7651. smalltalk.addMethod(
  7652. smalltalk.method({
  7653. selector: "testAtRandomSequenceableCollection",
  7654. protocol: 'tests',
  7655. fn: function (){
  7656. var self=this;
  7657. var val;
  7658. return smalltalk.withContext(function($ctx1) {
  7659. var $3,$4,$2,$1;
  7660. (100)._timesRepeat_((function(){
  7661. return smalltalk.withContext(function($ctx2) {
  7662. val="abc"._atRandom();
  7663. val;
  7664. $3=_st(val).__eq("a");
  7665. $ctx2.sendIdx["="]=1;
  7666. $4=_st(val).__eq("b");
  7667. $ctx2.sendIdx["="]=2;
  7668. $2=_st($3).__or($4);
  7669. $1=_st($2).__or(_st(val).__eq("c"));
  7670. $ctx2.sendIdx["|"]=1;
  7671. return self._assert_($1);
  7672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7673. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7674. args: [],
  7675. 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].",
  7676. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7677. referencedClasses: []
  7678. }),
  7679. smalltalk.RandomTest);
  7680. smalltalk.addMethod(
  7681. smalltalk.method({
  7682. selector: "textNext",
  7683. protocol: 'tests',
  7684. fn: function (){
  7685. var self=this;
  7686. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7687. return smalltalk.withContext(function($ctx1) {
  7688. var $1;
  7689. (10000)._timesRepeat_((function(){
  7690. var current,next;
  7691. return smalltalk.withContext(function($ctx2) {
  7692. next=_st(_st($Random())._new())._next();
  7693. next;
  7694. self._assert_(_st(next).__gt_eq((0)));
  7695. $ctx2.sendIdx["assert:"]=1;
  7696. self._assert_(_st(next).__lt((1)));
  7697. $1=_st(current).__eq(next);
  7698. $ctx2.sendIdx["="]=1;
  7699. self._deny_($1);
  7700. return _st(next).__eq(current);
  7701. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7702. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7703. args: [],
  7704. 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 ]",
  7705. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7706. referencedClasses: ["Random"]
  7707. }),
  7708. smalltalk.RandomTest);
  7709. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7710. smalltalk.addMethod(
  7711. smalltalk.method({
  7712. selector: "collectionClass",
  7713. protocol: 'accessing',
  7714. fn: function (){
  7715. var self=this;
  7716. return smalltalk.withContext(function($ctx1) {
  7717. var $1;
  7718. $1=_st(self._class())._collectionClass();
  7719. return $1;
  7720. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7721. args: [],
  7722. source: "collectionClass\x0a\x09^ self class collectionClass",
  7723. messageSends: ["collectionClass", "class"],
  7724. referencedClasses: []
  7725. }),
  7726. smalltalk.StreamTest);
  7727. smalltalk.addMethod(
  7728. smalltalk.method({
  7729. selector: "newCollection",
  7730. protocol: 'accessing',
  7731. fn: function (){
  7732. var self=this;
  7733. return smalltalk.withContext(function($ctx1) {
  7734. var $1;
  7735. $1=_st(self._collectionClass())._new();
  7736. return $1;
  7737. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7738. args: [],
  7739. source: "newCollection\x0a\x09^ self collectionClass new",
  7740. messageSends: ["new", "collectionClass"],
  7741. referencedClasses: []
  7742. }),
  7743. smalltalk.StreamTest);
  7744. smalltalk.addMethod(
  7745. smalltalk.method({
  7746. selector: "newStream",
  7747. protocol: 'accessing',
  7748. fn: function (){
  7749. var self=this;
  7750. return smalltalk.withContext(function($ctx1) {
  7751. var $1;
  7752. $1=_st(_st(self._collectionClass())._new())._stream();
  7753. return $1;
  7754. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7755. args: [],
  7756. source: "newStream\x0a\x09^ self collectionClass new stream",
  7757. messageSends: ["stream", "new", "collectionClass"],
  7758. referencedClasses: []
  7759. }),
  7760. smalltalk.StreamTest);
  7761. smalltalk.addMethod(
  7762. smalltalk.method({
  7763. selector: "testAtStartAtEnd",
  7764. protocol: 'tests',
  7765. fn: function (){
  7766. var self=this;
  7767. var stream;
  7768. return smalltalk.withContext(function($ctx1) {
  7769. var $1,$2,$3,$4;
  7770. stream=self._newStream();
  7771. $1=_st(stream)._atStart();
  7772. $ctx1.sendIdx["atStart"]=1;
  7773. self._assert_($1);
  7774. $ctx1.sendIdx["assert:"]=1;
  7775. $2=_st(stream)._atEnd();
  7776. $ctx1.sendIdx["atEnd"]=1;
  7777. self._assert_($2);
  7778. $ctx1.sendIdx["assert:"]=2;
  7779. _st(stream)._nextPutAll_(self._newCollection());
  7780. $3=_st(stream)._atEnd();
  7781. $ctx1.sendIdx["atEnd"]=2;
  7782. self._assert_($3);
  7783. $4=_st(stream)._atStart();
  7784. $ctx1.sendIdx["atStart"]=2;
  7785. self._deny_($4);
  7786. $ctx1.sendIdx["deny:"]=1;
  7787. _st(stream)._position_((1));
  7788. self._deny_(_st(stream)._atEnd());
  7789. $ctx1.sendIdx["deny:"]=2;
  7790. self._deny_(_st(stream)._atStart());
  7791. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7792. args: [],
  7793. 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",
  7794. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7795. referencedClasses: []
  7796. }),
  7797. smalltalk.StreamTest);
  7798. smalltalk.addMethod(
  7799. smalltalk.method({
  7800. selector: "testContents",
  7801. protocol: 'tests',
  7802. fn: function (){
  7803. var self=this;
  7804. var stream;
  7805. return smalltalk.withContext(function($ctx1) {
  7806. var $1,$2;
  7807. stream=self._newStream();
  7808. $1=stream;
  7809. $2=self._newCollection();
  7810. $ctx1.sendIdx["newCollection"]=1;
  7811. _st($1)._nextPutAll_($2);
  7812. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7813. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7814. args: [],
  7815. 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",
  7816. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7817. referencedClasses: []
  7818. }),
  7819. smalltalk.StreamTest);
  7820. smalltalk.addMethod(
  7821. smalltalk.method({
  7822. selector: "testIsEmpty",
  7823. protocol: 'tests',
  7824. fn: function (){
  7825. var self=this;
  7826. var stream;
  7827. return smalltalk.withContext(function($ctx1) {
  7828. var $1;
  7829. stream=self._newStream();
  7830. $1=_st(stream)._isEmpty();
  7831. $ctx1.sendIdx["isEmpty"]=1;
  7832. self._assert_($1);
  7833. _st(stream)._nextPutAll_(self._newCollection());
  7834. self._deny_(_st(stream)._isEmpty());
  7835. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7836. args: [],
  7837. 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",
  7838. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7839. referencedClasses: []
  7840. }),
  7841. smalltalk.StreamTest);
  7842. smalltalk.addMethod(
  7843. smalltalk.method({
  7844. selector: "testPosition",
  7845. protocol: 'tests',
  7846. fn: function (){
  7847. var self=this;
  7848. var collection,stream;
  7849. return smalltalk.withContext(function($ctx1) {
  7850. var $1,$2,$3;
  7851. collection=self._newCollection();
  7852. stream=self._newStream();
  7853. _st(stream)._nextPutAll_(collection);
  7854. $1=_st(stream)._position();
  7855. $ctx1.sendIdx["position"]=1;
  7856. self._assert_equals_($1,_st(collection)._size());
  7857. $ctx1.sendIdx["assert:equals:"]=1;
  7858. _st(stream)._position_((0));
  7859. $2=_st(stream)._position();
  7860. $ctx1.sendIdx["position"]=2;
  7861. self._assert_equals_($2,(0));
  7862. $ctx1.sendIdx["assert:equals:"]=2;
  7863. _st(stream)._next();
  7864. $ctx1.sendIdx["next"]=1;
  7865. $3=_st(stream)._position();
  7866. $ctx1.sendIdx["position"]=3;
  7867. self._assert_equals_($3,(1));
  7868. $ctx1.sendIdx["assert:equals:"]=3;
  7869. _st(stream)._next();
  7870. self._assert_equals_(_st(stream)._position(),(2));
  7871. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7872. args: [],
  7873. 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",
  7874. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7875. referencedClasses: []
  7876. }),
  7877. smalltalk.StreamTest);
  7878. smalltalk.addMethod(
  7879. smalltalk.method({
  7880. selector: "testReading",
  7881. protocol: 'tests',
  7882. fn: function (){
  7883. var self=this;
  7884. var stream,collection;
  7885. return smalltalk.withContext(function($ctx1) {
  7886. var $1,$2,$3;
  7887. collection=self._newCollection();
  7888. stream=self._newStream();
  7889. $1=stream;
  7890. _st($1)._nextPutAll_(collection);
  7891. $2=_st($1)._position_((0));
  7892. _st(collection)._do_((function(each){
  7893. return smalltalk.withContext(function($ctx2) {
  7894. $3=_st(stream)._next();
  7895. $ctx2.sendIdx["next"]=1;
  7896. return self._assert_equals_($3,each);
  7897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7898. self._assert_(_st(_st(stream)._next())._isNil());
  7899. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7900. args: [],
  7901. 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",
  7902. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  7903. referencedClasses: []
  7904. }),
  7905. smalltalk.StreamTest);
  7906. smalltalk.addMethod(
  7907. smalltalk.method({
  7908. selector: "testStreamContents",
  7909. protocol: 'tests',
  7910. fn: function (){
  7911. var self=this;
  7912. return smalltalk.withContext(function($ctx1) {
  7913. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  7914. args: [],
  7915. source: "testStreamContents",
  7916. messageSends: [],
  7917. referencedClasses: []
  7918. }),
  7919. smalltalk.StreamTest);
  7920. smalltalk.addMethod(
  7921. smalltalk.method({
  7922. selector: "testWrite",
  7923. protocol: 'tests',
  7924. fn: function (){
  7925. var self=this;
  7926. var stream,collection;
  7927. return smalltalk.withContext(function($ctx1) {
  7928. collection=self._newCollection();
  7929. stream=self._newStream();
  7930. _st(collection)._do_((function(each){
  7931. return smalltalk.withContext(function($ctx2) {
  7932. return _st(stream).__lt_lt(each);
  7933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7934. self._assert_equals_(_st(stream)._contents(),collection);
  7935. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7936. args: [],
  7937. 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",
  7938. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7939. referencedClasses: []
  7940. }),
  7941. smalltalk.StreamTest);
  7942. smalltalk.addMethod(
  7943. smalltalk.method({
  7944. selector: "testWriting",
  7945. protocol: 'tests',
  7946. fn: function (){
  7947. var self=this;
  7948. var stream,collection;
  7949. return smalltalk.withContext(function($ctx1) {
  7950. var $1;
  7951. collection=self._newCollection();
  7952. stream=self._newStream();
  7953. $ctx1.sendIdx["newStream"]=1;
  7954. _st(collection)._do_((function(each){
  7955. return smalltalk.withContext(function($ctx2) {
  7956. return _st(stream)._nextPut_(each);
  7957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7958. $1=_st(stream)._contents();
  7959. $ctx1.sendIdx["contents"]=1;
  7960. self._assert_equals_($1,collection);
  7961. $ctx1.sendIdx["assert:equals:"]=1;
  7962. stream=self._newStream();
  7963. _st(stream)._nextPutAll_(collection);
  7964. self._assert_equals_(_st(stream)._contents(),collection);
  7965. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7966. args: [],
  7967. 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",
  7968. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7969. referencedClasses: []
  7970. }),
  7971. smalltalk.StreamTest);
  7972. smalltalk.addMethod(
  7973. smalltalk.method({
  7974. selector: "collectionClass",
  7975. protocol: 'accessing',
  7976. fn: function (){
  7977. var self=this;
  7978. return smalltalk.withContext(function($ctx1) {
  7979. return nil;
  7980. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  7981. args: [],
  7982. source: "collectionClass\x0a\x09^ nil",
  7983. messageSends: [],
  7984. referencedClasses: []
  7985. }),
  7986. smalltalk.StreamTest.klass);
  7987. smalltalk.addMethod(
  7988. smalltalk.method({
  7989. selector: "isAbstract",
  7990. protocol: 'testing',
  7991. fn: function (){
  7992. var self=this;
  7993. return smalltalk.withContext(function($ctx1) {
  7994. var $1;
  7995. $1=_st(self._collectionClass())._isNil();
  7996. return $1;
  7997. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  7998. args: [],
  7999. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8000. messageSends: ["isNil", "collectionClass"],
  8001. referencedClasses: []
  8002. }),
  8003. smalltalk.StreamTest.klass);
  8004. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8005. smalltalk.addMethod(
  8006. smalltalk.method({
  8007. selector: "newCollection",
  8008. protocol: 'accessing',
  8009. fn: function (){
  8010. var self=this;
  8011. return smalltalk.withContext(function($ctx1) {
  8012. var $1;
  8013. $1=[true,(1),(3).__at((4)),"foo"];
  8014. return $1;
  8015. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8016. args: [],
  8017. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8018. messageSends: ["@"],
  8019. referencedClasses: []
  8020. }),
  8021. smalltalk.ArrayStreamTest);
  8022. smalltalk.addMethod(
  8023. smalltalk.method({
  8024. selector: "collectionClass",
  8025. protocol: 'accessing',
  8026. fn: function (){
  8027. var self=this;
  8028. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8029. return smalltalk.withContext(function($ctx1) {
  8030. return $Array();
  8031. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8032. args: [],
  8033. source: "collectionClass\x0a\x09^ Array",
  8034. messageSends: [],
  8035. referencedClasses: ["Array"]
  8036. }),
  8037. smalltalk.ArrayStreamTest.klass);
  8038. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8039. smalltalk.addMethod(
  8040. smalltalk.method({
  8041. selector: "newCollection",
  8042. protocol: 'accessing',
  8043. fn: function (){
  8044. var self=this;
  8045. return smalltalk.withContext(function($ctx1) {
  8046. return "hello world";
  8047. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8048. args: [],
  8049. source: "newCollection\x0a\x09^ 'hello world'",
  8050. messageSends: [],
  8051. referencedClasses: []
  8052. }),
  8053. smalltalk.StringStreamTest);
  8054. smalltalk.addMethod(
  8055. smalltalk.method({
  8056. selector: "collectionClass",
  8057. protocol: 'accessing',
  8058. fn: function (){
  8059. var self=this;
  8060. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8061. return smalltalk.withContext(function($ctx1) {
  8062. return $String();
  8063. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8064. args: [],
  8065. source: "collectionClass\x0a\x09^ String",
  8066. messageSends: [],
  8067. referencedClasses: ["String"]
  8068. }),
  8069. smalltalk.StringStreamTest.klass);
  8070. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8071. smalltalk.addMethod(
  8072. smalltalk.method({
  8073. selector: "testCopying",
  8074. protocol: 'tests',
  8075. fn: function (){
  8076. var self=this;
  8077. return smalltalk.withContext(function($ctx1) {
  8078. self._assert_equals_(nil._copy(),nil);
  8079. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8080. args: [],
  8081. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8082. messageSends: ["assert:equals:", "copy"],
  8083. referencedClasses: []
  8084. }),
  8085. smalltalk.UndefinedTest);
  8086. smalltalk.addMethod(
  8087. smalltalk.method({
  8088. selector: "testDeepCopy",
  8089. protocol: 'tests',
  8090. fn: function (){
  8091. var self=this;
  8092. return smalltalk.withContext(function($ctx1) {
  8093. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8094. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8095. args: [],
  8096. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8097. messageSends: ["assert:", "=", "deepCopy"],
  8098. referencedClasses: []
  8099. }),
  8100. smalltalk.UndefinedTest);
  8101. smalltalk.addMethod(
  8102. smalltalk.method({
  8103. selector: "testIfNil",
  8104. protocol: 'tests',
  8105. fn: function (){
  8106. var self=this;
  8107. return smalltalk.withContext(function($ctx1) {
  8108. var $1,$3,$2,$4,$6,$5;
  8109. if(($receiver = nil) == nil || $receiver == null){
  8110. $1=true;
  8111. } else {
  8112. $1=nil;
  8113. };
  8114. self._assert_equals_($1,true);
  8115. $ctx1.sendIdx["assert:equals:"]=1;
  8116. if(($receiver = nil) == nil || $receiver == null){
  8117. $3=nil;
  8118. } else {
  8119. $3=true;
  8120. };
  8121. $2=_st($3).__eq(true);
  8122. $ctx1.sendIdx["="]=1;
  8123. self._deny_($2);
  8124. $ctx1.sendIdx["deny:"]=1;
  8125. if(($receiver = nil) == nil || $receiver == null){
  8126. $4=true;
  8127. } else {
  8128. $4=false;
  8129. };
  8130. self._assert_equals_($4,true);
  8131. if(($receiver = nil) == nil || $receiver == null){
  8132. $6=false;
  8133. } else {
  8134. $6=true;
  8135. };
  8136. $5=_st($6).__eq(true);
  8137. self._deny_($5);
  8138. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8139. args: [],
  8140. 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",
  8141. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8142. referencedClasses: []
  8143. }),
  8144. smalltalk.UndefinedTest);
  8145. smalltalk.addMethod(
  8146. smalltalk.method({
  8147. selector: "testIsNil",
  8148. protocol: 'tests',
  8149. fn: function (){
  8150. var self=this;
  8151. return smalltalk.withContext(function($ctx1) {
  8152. self._assert_(nil._isNil());
  8153. self._deny_(nil._notNil());
  8154. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8155. args: [],
  8156. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8157. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8158. referencedClasses: []
  8159. }),
  8160. smalltalk.UndefinedTest);
  8161. });