Kernel-Tests.js 323 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622
  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: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. 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'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. 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;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. 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",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. 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 ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. 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 ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. 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) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. 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",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. 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",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. 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",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. 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",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. 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",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. 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",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. 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 ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. 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",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. 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",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  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,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. 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",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. 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",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  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,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. 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",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. 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",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. 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 ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. 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 ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfPresent",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var visited,sentinel;
  2334. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2335. return smalltalk.withContext(function($ctx1) {
  2336. var $2,$1,$4,$3;
  2337. sentinel=_st($Object())._new();
  2338. self._nonIndexesDo_((function(each){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. visited=nil;
  2341. visited;
  2342. $2=self._collection();
  2343. $ctx2.sendIdx["collection"]=1;
  2344. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2345. return smalltalk.withContext(function($ctx3) {
  2346. visited=value1;
  2347. visited;
  2348. return sentinel;
  2349. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2350. $ctx2.sendIdx["at:ifPresent:"]=1;
  2351. self._assert_equals_($1,nil);
  2352. $ctx2.sendIdx["assert:equals:"]=1;
  2353. return self._assert_(_st(visited)._isNil());
  2354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2355. self._samplesDo_((function(index,value){
  2356. return smalltalk.withContext(function($ctx2) {
  2357. visited=nil;
  2358. visited;
  2359. $4=self._collection();
  2360. $ctx2.sendIdx["collection"]=2;
  2361. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2362. return smalltalk.withContext(function($ctx3) {
  2363. visited=value2;
  2364. visited;
  2365. return sentinel;
  2366. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2367. self._assert_equals_($3,sentinel);
  2368. $ctx2.sendIdx["assert:equals:"]=2;
  2369. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2370. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2371. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2372. args: [],
  2373. 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) ]",
  2374. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2375. referencedClasses: ["Object"]
  2376. }),
  2377. smalltalk.IndexableCollectionTest);
  2378. smalltalk.addMethod(
  2379. smalltalk.method({
  2380. selector: "testAtIfPresentIfAbsent",
  2381. protocol: 'tests',
  2382. fn: function (){
  2383. var self=this;
  2384. var visited,sentinel;
  2385. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2386. return smalltalk.withContext(function($ctx1) {
  2387. var $2,$1,$3,$5,$4;
  2388. sentinel=_st($Object())._new();
  2389. self._nonIndexesDo_((function(each){
  2390. return smalltalk.withContext(function($ctx2) {
  2391. visited=nil;
  2392. visited;
  2393. $2=self._collection();
  2394. $ctx2.sendIdx["collection"]=1;
  2395. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2396. return smalltalk.withContext(function($ctx3) {
  2397. visited=value1;
  2398. visited;
  2399. return sentinel;
  2400. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2401. return smalltalk.withContext(function($ctx3) {
  2402. return self._sampleNewValue();
  2403. $ctx3.sendIdx["sampleNewValue"]=1;
  2404. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2405. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2406. $3=self._sampleNewValue();
  2407. $ctx2.sendIdx["sampleNewValue"]=2;
  2408. self._assert_equals_($1,$3);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. return self._assert_(_st(visited)._isNil());
  2411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2412. self._samplesDo_((function(index,value){
  2413. return smalltalk.withContext(function($ctx2) {
  2414. visited=nil;
  2415. visited;
  2416. $5=self._collection();
  2417. $ctx2.sendIdx["collection"]=2;
  2418. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2419. return smalltalk.withContext(function($ctx3) {
  2420. visited=value2;
  2421. visited;
  2422. return sentinel;
  2423. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2424. return smalltalk.withContext(function($ctx3) {
  2425. return self._sampleNewValue();
  2426. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2427. self._assert_equals_($4,sentinel);
  2428. $ctx2.sendIdx["assert:equals:"]=2;
  2429. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2430. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2431. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2432. args: [],
  2433. 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) ]",
  2434. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2435. referencedClasses: ["Object"]
  2436. }),
  2437. smalltalk.IndexableCollectionTest);
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "testAtPut",
  2441. protocol: 'tests',
  2442. fn: function (){
  2443. var self=this;
  2444. var newCollection;
  2445. return smalltalk.withContext(function($ctx1) {
  2446. newCollection=self._collection();
  2447. $ctx1.sendIdx["collection"]=1;
  2448. self._samplesDo_((function(index,value){
  2449. return smalltalk.withContext(function($ctx2) {
  2450. return _st(newCollection)._at_put_(index,value);
  2451. $ctx2.sendIdx["at:put:"]=1;
  2452. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2453. self._assert_equals_(newCollection,self._collection());
  2454. $ctx1.sendIdx["assert:equals:"]=1;
  2455. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2456. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2457. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2458. args: [],
  2459. 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",
  2460. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2461. referencedClasses: []
  2462. }),
  2463. smalltalk.IndexableCollectionTest);
  2464. smalltalk.addMethod(
  2465. smalltalk.method({
  2466. selector: "testIndexOf",
  2467. protocol: 'tests',
  2468. fn: function (){
  2469. var self=this;
  2470. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2471. return smalltalk.withContext(function($ctx1) {
  2472. var $1;
  2473. self._should_raise_((function(){
  2474. return smalltalk.withContext(function($ctx2) {
  2475. $1=self._collection();
  2476. $ctx2.sendIdx["collection"]=1;
  2477. return _st($1)._indexOf_(self._sampleNewValue());
  2478. $ctx2.sendIdx["indexOf:"]=1;
  2479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2480. self._samplesDo_((function(index,value){
  2481. return smalltalk.withContext(function($ctx2) {
  2482. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2483. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2484. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2485. args: [],
  2486. 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 ]",
  2487. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2488. referencedClasses: ["Error"]
  2489. }),
  2490. smalltalk.IndexableCollectionTest);
  2491. smalltalk.addMethod(
  2492. smalltalk.method({
  2493. selector: "testWithIndexDo",
  2494. protocol: 'tests',
  2495. fn: function (){
  2496. var self=this;
  2497. var collection;
  2498. return smalltalk.withContext(function($ctx1) {
  2499. collection=self._collection();
  2500. $ctx1.sendIdx["collection"]=1;
  2501. _st(self._collection())._withIndexDo_((function(each,index){
  2502. return smalltalk.withContext(function($ctx2) {
  2503. return self._assert_equals_(_st(collection)._at_(index),each);
  2504. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2505. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2506. args: [],
  2507. 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 ]",
  2508. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2509. referencedClasses: []
  2510. }),
  2511. smalltalk.IndexableCollectionTest);
  2512. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2513. smalltalk.addMethod(
  2514. smalltalk.method({
  2515. selector: "collection",
  2516. protocol: 'fixture',
  2517. fn: function (){
  2518. var self=this;
  2519. return smalltalk.withContext(function($ctx1) {
  2520. var $2,$3,$4,$1;
  2521. $2="b".__minus_gt((1));
  2522. $ctx1.sendIdx["->"]=1;
  2523. $3="a".__minus_gt((2));
  2524. $ctx1.sendIdx["->"]=2;
  2525. $4="c".__minus_gt((3));
  2526. $ctx1.sendIdx["->"]=3;
  2527. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2528. return $1;
  2529. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2530. args: [],
  2531. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2532. messageSends: ["->"],
  2533. referencedClasses: []
  2534. }),
  2535. smalltalk.HashedCollectionTest);
  2536. smalltalk.addMethod(
  2537. smalltalk.method({
  2538. selector: "collectionOfPrintStrings",
  2539. protocol: 'fixture',
  2540. fn: function (){
  2541. var self=this;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. var $2,$3,$4,$1;
  2544. $2="b".__minus_gt("1");
  2545. $ctx1.sendIdx["->"]=1;
  2546. $3="a".__minus_gt("2");
  2547. $ctx1.sendIdx["->"]=2;
  2548. $4="c".__minus_gt("3");
  2549. $ctx1.sendIdx["->"]=3;
  2550. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2551. return $1;
  2552. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2553. args: [],
  2554. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2555. messageSends: ["->"],
  2556. referencedClasses: []
  2557. }),
  2558. smalltalk.HashedCollectionTest);
  2559. smalltalk.addMethod(
  2560. smalltalk.method({
  2561. selector: "collectionSize",
  2562. protocol: 'fixture',
  2563. fn: function (){
  2564. var self=this;
  2565. return smalltalk.withContext(function($ctx1) {
  2566. return (4);
  2567. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2568. args: [],
  2569. source: "collectionSize\x0a\x09^ 4",
  2570. messageSends: [],
  2571. referencedClasses: []
  2572. }),
  2573. smalltalk.HashedCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "collectionWithDuplicates",
  2577. protocol: 'fixture',
  2578. fn: function (){
  2579. var self=this;
  2580. return smalltalk.withContext(function($ctx1) {
  2581. var $2,$3,$4,$5,$6,$7,$1;
  2582. $2="b".__minus_gt((1));
  2583. $ctx1.sendIdx["->"]=1;
  2584. $3="a".__minus_gt((2));
  2585. $ctx1.sendIdx["->"]=2;
  2586. $4="c".__minus_gt((3));
  2587. $ctx1.sendIdx["->"]=3;
  2588. $5="d".__minus_gt((-4));
  2589. $ctx1.sendIdx["->"]=4;
  2590. $6="e".__minus_gt((1));
  2591. $ctx1.sendIdx["->"]=5;
  2592. $7="f".__minus_gt((2));
  2593. $ctx1.sendIdx["->"]=6;
  2594. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2595. return $1;
  2596. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2597. args: [],
  2598. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2599. messageSends: ["->"],
  2600. referencedClasses: []
  2601. }),
  2602. smalltalk.HashedCollectionTest);
  2603. smalltalk.addMethod(
  2604. smalltalk.method({
  2605. selector: "collectionWithNewValue",
  2606. protocol: 'fixture',
  2607. fn: function (){
  2608. var self=this;
  2609. return smalltalk.withContext(function($ctx1) {
  2610. var $2,$3,$4,$5,$1;
  2611. $2="b".__minus_gt((1));
  2612. $ctx1.sendIdx["->"]=1;
  2613. $3="a".__minus_gt((2));
  2614. $ctx1.sendIdx["->"]=2;
  2615. $4="c".__minus_gt((3));
  2616. $ctx1.sendIdx["->"]=3;
  2617. $5="d".__minus_gt((-4));
  2618. $ctx1.sendIdx["->"]=4;
  2619. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2620. return $1;
  2621. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2622. args: [],
  2623. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2624. messageSends: ["->"],
  2625. referencedClasses: []
  2626. }),
  2627. smalltalk.HashedCollectionTest);
  2628. smalltalk.addMethod(
  2629. smalltalk.method({
  2630. selector: "nonIndexesDo:",
  2631. protocol: 'fixture',
  2632. fn: function (aBlock){
  2633. var self=this;
  2634. return smalltalk.withContext(function($ctx1) {
  2635. _st(aBlock)._value_((5));
  2636. $ctx1.sendIdx["value:"]=1;
  2637. _st(aBlock)._value_("z");
  2638. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2639. args: ["aBlock"],
  2640. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2641. messageSends: ["value:"],
  2642. referencedClasses: []
  2643. }),
  2644. smalltalk.HashedCollectionTest);
  2645. smalltalk.addMethod(
  2646. smalltalk.method({
  2647. selector: "sampleNewIndex",
  2648. protocol: 'fixture',
  2649. fn: function (){
  2650. var self=this;
  2651. return smalltalk.withContext(function($ctx1) {
  2652. return "new";
  2653. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2654. args: [],
  2655. source: "sampleNewIndex\x0a\x09^ 'new'",
  2656. messageSends: [],
  2657. referencedClasses: []
  2658. }),
  2659. smalltalk.HashedCollectionTest);
  2660. smalltalk.addMethod(
  2661. smalltalk.method({
  2662. selector: "sampleNewValueAsCollection",
  2663. protocol: 'fixture',
  2664. fn: function (){
  2665. var self=this;
  2666. return smalltalk.withContext(function($ctx1) {
  2667. var $1;
  2668. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2669. return $1;
  2670. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2671. args: [],
  2672. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2673. messageSends: ["->"],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.HashedCollectionTest);
  2677. smalltalk.addMethod(
  2678. smalltalk.method({
  2679. selector: "samplesDo:",
  2680. protocol: 'fixture',
  2681. fn: function (aBlock){
  2682. var self=this;
  2683. return smalltalk.withContext(function($ctx1) {
  2684. _st(aBlock)._value_value_("a",(2));
  2685. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2686. args: ["aBlock"],
  2687. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2688. messageSends: ["value:value:"],
  2689. referencedClasses: []
  2690. }),
  2691. smalltalk.HashedCollectionTest);
  2692. smalltalk.addMethod(
  2693. smalltalk.method({
  2694. selector: "testAddAll",
  2695. protocol: 'tests',
  2696. fn: function (){
  2697. var self=this;
  2698. return smalltalk.withContext(function($ctx1) {
  2699. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2700. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2701. $2=self._collection();
  2702. $ctx1.sendIdx["collection"]=1;
  2703. $3=$2;
  2704. $4=self._collection();
  2705. $ctx1.sendIdx["collection"]=2;
  2706. _st($3)._addAll_($4);
  2707. $ctx1.sendIdx["addAll:"]=1;
  2708. $5=_st($2)._yourself();
  2709. $ctx1.sendIdx["yourself"]=1;
  2710. $1=$5;
  2711. $6=self._collection();
  2712. $ctx1.sendIdx["collection"]=3;
  2713. self._assert_equals_($1,$6);
  2714. $ctx1.sendIdx["assert:equals:"]=1;
  2715. $8=self._collection();
  2716. $ctx1.sendIdx["collection"]=4;
  2717. $9=$8;
  2718. $10=self._collectionWithNewValue();
  2719. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2720. _st($9)._addAll_($10);
  2721. $ctx1.sendIdx["addAll:"]=2;
  2722. $11=_st($8)._yourself();
  2723. $ctx1.sendIdx["yourself"]=2;
  2724. $7=$11;
  2725. $12=self._collectionWithNewValue();
  2726. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2727. self._assert_equals_($7,$12);
  2728. $ctx1.sendIdx["assert:equals:"]=2;
  2729. $14=self._collectionWithNewValue();
  2730. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2731. _st($14)._addAll_(self._collection());
  2732. $15=_st($14)._yourself();
  2733. $13=$15;
  2734. self._assert_equals_($13,self._collectionWithNewValue());
  2735. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2736. args: [],
  2737. 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",
  2738. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2739. referencedClasses: []
  2740. }),
  2741. smalltalk.HashedCollectionTest);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "testAsDictionary",
  2745. protocol: 'tests',
  2746. fn: function (){
  2747. var self=this;
  2748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2749. return smalltalk.withContext(function($ctx1) {
  2750. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2751. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2752. args: [],
  2753. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2754. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2755. referencedClasses: ["Dictionary"]
  2756. }),
  2757. smalltalk.HashedCollectionTest);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "testComma",
  2761. protocol: 'tests',
  2762. fn: function (){
  2763. var self=this;
  2764. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2765. return smalltalk.withContext(function($ctx1) {
  2766. var $1;
  2767. self._should_raise_((function(){
  2768. return smalltalk.withContext(function($ctx2) {
  2769. $1=self._collection();
  2770. $ctx2.sendIdx["collection"]=1;
  2771. return _st($1).__comma(self._collection());
  2772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2773. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2774. args: [],
  2775. source: "testComma\x0a\x09self should: [ self collection, self collection ] raise: Error",
  2776. messageSends: ["should:raise:", ",", "collection"],
  2777. referencedClasses: ["Error"]
  2778. }),
  2779. smalltalk.HashedCollectionTest);
  2780. smalltalk.addMethod(
  2781. smalltalk.method({
  2782. selector: "testFrom",
  2783. protocol: 'tests',
  2784. fn: function (){
  2785. var self=this;
  2786. var associations;
  2787. return smalltalk.withContext(function($ctx1) {
  2788. var $1,$2,$3,$5,$4;
  2789. $1="a".__minus_gt((1));
  2790. $ctx1.sendIdx["->"]=1;
  2791. $2="b".__minus_gt((2));
  2792. $ctx1.sendIdx["->"]=2;
  2793. associations=[$1,$2];
  2794. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2795. $5="a".__minus_gt((1));
  2796. $ctx1.sendIdx["->"]=3;
  2797. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2798. self._assertSameContents_as_($3,$4);
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2800. args: [],
  2801. 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 }.",
  2802. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2803. referencedClasses: []
  2804. }),
  2805. smalltalk.HashedCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testNewFromPairs",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. var flattenedAssociations;
  2813. return smalltalk.withContext(function($ctx1) {
  2814. var $1,$3,$2;
  2815. flattenedAssociations=["a",(1),"b",(2)];
  2816. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2817. $3="a".__minus_gt((1));
  2818. $ctx1.sendIdx["->"]=1;
  2819. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2820. self._assertSameContents_as_($1,$2);
  2821. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2822. args: [],
  2823. 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 }.",
  2824. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2825. referencedClasses: []
  2826. }),
  2827. smalltalk.HashedCollectionTest);
  2828. smalltalk.addMethod(
  2829. smalltalk.method({
  2830. selector: "collectionClass",
  2831. protocol: 'fixture',
  2832. fn: function (){
  2833. var self=this;
  2834. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2835. return smalltalk.withContext(function($ctx1) {
  2836. return $HashedCollection();
  2837. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2838. args: [],
  2839. source: "collectionClass\x0a\x09^ HashedCollection",
  2840. messageSends: [],
  2841. referencedClasses: ["HashedCollection"]
  2842. }),
  2843. smalltalk.HashedCollectionTest.klass);
  2844. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2845. smalltalk.addMethod(
  2846. smalltalk.method({
  2847. selector: "collection",
  2848. protocol: 'fixture',
  2849. fn: function (){
  2850. var self=this;
  2851. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2852. return smalltalk.withContext(function($ctx1) {
  2853. var $2,$3,$1;
  2854. $2=_st($Dictionary())._new();
  2855. _st($2)._at_put_((1),(1));
  2856. $ctx1.sendIdx["at:put:"]=1;
  2857. _st($2)._at_put_("a",(2));
  2858. $ctx1.sendIdx["at:put:"]=2;
  2859. _st($2)._at_put_(true,(3));
  2860. $ctx1.sendIdx["at:put:"]=3;
  2861. _st($2)._at_put_((1).__at((3)),(-4));
  2862. $3=_st($2)._yourself();
  2863. $1=$3;
  2864. return $1;
  2865. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2866. args: [],
  2867. 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",
  2868. messageSends: ["at:put:", "new", "@", "yourself"],
  2869. referencedClasses: ["Dictionary"]
  2870. }),
  2871. smalltalk.DictionaryTest);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "collectionOfPrintStrings",
  2875. protocol: 'fixture',
  2876. fn: function (){
  2877. var self=this;
  2878. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2879. return smalltalk.withContext(function($ctx1) {
  2880. var $2,$3,$1;
  2881. $2=_st($Dictionary())._new();
  2882. _st($2)._at_put_((1),"1");
  2883. $ctx1.sendIdx["at:put:"]=1;
  2884. _st($2)._at_put_("a","2");
  2885. $ctx1.sendIdx["at:put:"]=2;
  2886. _st($2)._at_put_(true,"3");
  2887. $ctx1.sendIdx["at:put:"]=3;
  2888. _st($2)._at_put_((1).__at((3)),"-4");
  2889. $3=_st($2)._yourself();
  2890. $1=$3;
  2891. return $1;
  2892. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2893. args: [],
  2894. 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",
  2895. messageSends: ["at:put:", "new", "@", "yourself"],
  2896. referencedClasses: ["Dictionary"]
  2897. }),
  2898. smalltalk.DictionaryTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "collectionSize",
  2902. protocol: 'fixture',
  2903. fn: function (){
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) {
  2906. return (4);
  2907. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2908. args: [],
  2909. source: "collectionSize\x0a\x09^ 4",
  2910. messageSends: [],
  2911. referencedClasses: []
  2912. }),
  2913. smalltalk.DictionaryTest);
  2914. smalltalk.addMethod(
  2915. smalltalk.method({
  2916. selector: "collectionWithDuplicates",
  2917. protocol: 'fixture',
  2918. fn: function (){
  2919. var self=this;
  2920. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2921. return smalltalk.withContext(function($ctx1) {
  2922. var $2,$3,$1;
  2923. $2=_st($Dictionary())._new();
  2924. _st($2)._at_put_((1),(1));
  2925. $ctx1.sendIdx["at:put:"]=1;
  2926. _st($2)._at_put_("a",(2));
  2927. $ctx1.sendIdx["at:put:"]=2;
  2928. _st($2)._at_put_(true,(3));
  2929. $ctx1.sendIdx["at:put:"]=3;
  2930. _st($2)._at_put_((4),(-4));
  2931. $ctx1.sendIdx["at:put:"]=4;
  2932. _st($2)._at_put_("b",(1));
  2933. $ctx1.sendIdx["at:put:"]=5;
  2934. _st($2)._at_put_((3),(3));
  2935. $ctx1.sendIdx["at:put:"]=6;
  2936. _st($2)._at_put_(false,(12));
  2937. $3=_st($2)._yourself();
  2938. $1=$3;
  2939. return $1;
  2940. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2941. args: [],
  2942. 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",
  2943. messageSends: ["at:put:", "new", "yourself"],
  2944. referencedClasses: ["Dictionary"]
  2945. }),
  2946. smalltalk.DictionaryTest);
  2947. smalltalk.addMethod(
  2948. smalltalk.method({
  2949. selector: "collectionWithNewValue",
  2950. protocol: 'fixture',
  2951. fn: function (){
  2952. var self=this;
  2953. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2954. return smalltalk.withContext(function($ctx1) {
  2955. var $2,$3,$1;
  2956. $2=_st($Dictionary())._new();
  2957. _st($2)._at_put_((1),(1));
  2958. $ctx1.sendIdx["at:put:"]=1;
  2959. _st($2)._at_put_("a",(2));
  2960. $ctx1.sendIdx["at:put:"]=2;
  2961. _st($2)._at_put_(true,(3));
  2962. $ctx1.sendIdx["at:put:"]=3;
  2963. _st($2)._at_put_((1).__at((3)),(-4));
  2964. $ctx1.sendIdx["at:put:"]=4;
  2965. _st($2)._at_put_("new","N");
  2966. $3=_st($2)._yourself();
  2967. $1=$3;
  2968. return $1;
  2969. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2970. args: [],
  2971. 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",
  2972. messageSends: ["at:put:", "new", "@", "yourself"],
  2973. referencedClasses: ["Dictionary"]
  2974. }),
  2975. smalltalk.DictionaryTest);
  2976. smalltalk.addMethod(
  2977. smalltalk.method({
  2978. selector: "sampleNewValueAsCollection",
  2979. protocol: 'fixture',
  2980. fn: function (){
  2981. var self=this;
  2982. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2983. return smalltalk.withContext(function($ctx1) {
  2984. var $2,$3,$1;
  2985. $2=_st($Dictionary())._new();
  2986. _st($2)._at_put_("new","N");
  2987. $3=_st($2)._yourself();
  2988. $1=$3;
  2989. return $1;
  2990. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  2991. args: [],
  2992. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  2993. messageSends: ["at:put:", "new", "yourself"],
  2994. referencedClasses: ["Dictionary"]
  2995. }),
  2996. smalltalk.DictionaryTest);
  2997. smalltalk.addMethod(
  2998. smalltalk.method({
  2999. selector: "samplesDo:",
  3000. protocol: 'fixture',
  3001. fn: function (aBlock){
  3002. var self=this;
  3003. return smalltalk.withContext(function($ctx1) {
  3004. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3005. _st(aBlock)._value_value_(true,(3));
  3006. $ctx1.sendIdx["value:value:"]=1;
  3007. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3008. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3009. args: ["aBlock"],
  3010. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3011. messageSends: ["samplesDo:", "value:value:", "@"],
  3012. referencedClasses: []
  3013. }),
  3014. smalltalk.DictionaryTest);
  3015. smalltalk.addMethod(
  3016. smalltalk.method({
  3017. selector: "testAccessing",
  3018. protocol: 'tests',
  3019. fn: function (){
  3020. var self=this;
  3021. var d;
  3022. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3023. return smalltalk.withContext(function($ctx1) {
  3024. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3025. d=_st($Dictionary())._new();
  3026. _st(d)._at_put_("hello","world");
  3027. $ctx1.sendIdx["at:put:"]=1;
  3028. $1=_st(d)._at_("hello");
  3029. $ctx1.sendIdx["at:"]=1;
  3030. self._assert_equals_($1,"world");
  3031. $ctx1.sendIdx["assert:equals:"]=1;
  3032. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3033. return smalltalk.withContext(function($ctx2) {
  3034. return nil;
  3035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3036. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3037. self._assert_equals_($2,"world");
  3038. $ctx1.sendIdx["assert:equals:"]=2;
  3039. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3040. return smalltalk.withContext(function($ctx2) {
  3041. return nil;
  3042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3043. $ctx1.sendIdx["deny:"]=1;
  3044. $3=_st(d)._includesKey_("hello");
  3045. $ctx1.sendIdx["includesKey:"]=1;
  3046. self._assert_($3);
  3047. $ctx1.sendIdx["assert:"]=1;
  3048. $4=_st(d)._includesKey_("foo");
  3049. $ctx1.sendIdx["includesKey:"]=2;
  3050. self._deny_($4);
  3051. $ctx1.sendIdx["deny:"]=2;
  3052. _st(d)._at_put_((1),(2));
  3053. $ctx1.sendIdx["at:put:"]=2;
  3054. $5=_st(d)._at_((1));
  3055. $ctx1.sendIdx["at:"]=2;
  3056. self._assert_equals_($5,(2));
  3057. $ctx1.sendIdx["assert:equals:"]=3;
  3058. $6=d;
  3059. $7=(1).__at((3));
  3060. $ctx1.sendIdx["@"]=1;
  3061. _st($6)._at_put_($7,(3));
  3062. $9=d;
  3063. $10=(1).__at((3));
  3064. $ctx1.sendIdx["@"]=2;
  3065. $8=_st($9)._at_($10);
  3066. self._assert_equals_($8,(3));
  3067. $12=d;
  3068. $13=(1).__at((3));
  3069. $ctx1.sendIdx["@"]=3;
  3070. $11=_st($12)._includesKey_($13);
  3071. $ctx1.sendIdx["includesKey:"]=3;
  3072. self._assert_($11);
  3073. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3074. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3075. args: [],
  3076. 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)",
  3077. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3078. referencedClasses: ["Dictionary"]
  3079. }),
  3080. smalltalk.DictionaryTest);
  3081. smalltalk.addMethod(
  3082. smalltalk.method({
  3083. selector: "testAsHashedCollection",
  3084. protocol: 'tests',
  3085. fn: function (){
  3086. var self=this;
  3087. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3088. return smalltalk.withContext(function($ctx1) {
  3089. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  3090. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3091. args: [],
  3092. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3093. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3094. referencedClasses: ["HashedCollection"]
  3095. }),
  3096. smalltalk.DictionaryTest);
  3097. smalltalk.addMethod(
  3098. smalltalk.method({
  3099. selector: "testDynamicDictionaries",
  3100. protocol: 'tests',
  3101. fn: function (){
  3102. var self=this;
  3103. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3104. return smalltalk.withContext(function($ctx1) {
  3105. var $3,$2,$1;
  3106. $3="hello".__minus_gt((1));
  3107. $ctx1.sendIdx["->"]=1;
  3108. $2=smalltalk.HashedCollection._from_([$3]);
  3109. $1=_st($2)._asDictionary();
  3110. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3111. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3112. args: [],
  3113. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3114. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3115. referencedClasses: ["Dictionary"]
  3116. }),
  3117. smalltalk.DictionaryTest);
  3118. smalltalk.addMethod(
  3119. smalltalk.method({
  3120. selector: "testEquality",
  3121. protocol: 'tests',
  3122. fn: function (){
  3123. var self=this;
  3124. var d1,d2;
  3125. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3126. return smalltalk.withContext(function($ctx1) {
  3127. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3128. $2=_st($Dictionary())._new();
  3129. $ctx1.sendIdx["new"]=1;
  3130. $3=_st($Dictionary())._new();
  3131. $ctx1.sendIdx["new"]=2;
  3132. $1=_st($2).__eq($3);
  3133. $ctx1.sendIdx["="]=1;
  3134. self._assert_($1);
  3135. $ctx1.sendIdx["assert:"]=1;
  3136. $4=_st($Dictionary())._new();
  3137. $ctx1.sendIdx["new"]=3;
  3138. _st($4)._at_put_((1),(2));
  3139. $ctx1.sendIdx["at:put:"]=1;
  3140. $5=_st($4)._yourself();
  3141. $ctx1.sendIdx["yourself"]=1;
  3142. d1=$5;
  3143. $6=_st($Dictionary())._new();
  3144. $ctx1.sendIdx["new"]=4;
  3145. _st($6)._at_put_((1),(2));
  3146. $ctx1.sendIdx["at:put:"]=2;
  3147. $7=_st($6)._yourself();
  3148. $ctx1.sendIdx["yourself"]=2;
  3149. d2=$7;
  3150. $8=_st(d1).__eq(d2);
  3151. $ctx1.sendIdx["="]=2;
  3152. self._assert_($8);
  3153. $9=_st($Dictionary())._new();
  3154. $ctx1.sendIdx["new"]=5;
  3155. _st($9)._at_put_((1),(3));
  3156. $ctx1.sendIdx["at:put:"]=3;
  3157. $10=_st($9)._yourself();
  3158. $ctx1.sendIdx["yourself"]=3;
  3159. d2=$10;
  3160. $11=_st(d1).__eq(d2);
  3161. $ctx1.sendIdx["="]=3;
  3162. self._deny_($11);
  3163. $ctx1.sendIdx["deny:"]=1;
  3164. $12=_st($Dictionary())._new();
  3165. $ctx1.sendIdx["new"]=6;
  3166. _st($12)._at_put_((2),(2));
  3167. $ctx1.sendIdx["at:put:"]=4;
  3168. $13=_st($12)._yourself();
  3169. $ctx1.sendIdx["yourself"]=4;
  3170. d2=$13;
  3171. $14=_st(d1).__eq(d2);
  3172. $ctx1.sendIdx["="]=4;
  3173. self._deny_($14);
  3174. $ctx1.sendIdx["deny:"]=2;
  3175. $15=_st($Dictionary())._new();
  3176. _st($15)._at_put_((1),(2));
  3177. $ctx1.sendIdx["at:put:"]=5;
  3178. _st($15)._at_put_((3),(4));
  3179. $16=_st($15)._yourself();
  3180. d2=$16;
  3181. self._deny_(_st(d1).__eq(d2));
  3182. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3183. args: [],
  3184. 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.",
  3185. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3186. referencedClasses: ["Dictionary"]
  3187. }),
  3188. smalltalk.DictionaryTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "testKeys",
  3192. protocol: 'tests',
  3193. fn: function (){
  3194. var self=this;
  3195. var d;
  3196. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3197. return smalltalk.withContext(function($ctx1) {
  3198. d=_st($Dictionary())._new();
  3199. _st(d)._at_put_((1),(2));
  3200. $ctx1.sendIdx["at:put:"]=1;
  3201. _st(d)._at_put_((2),(3));
  3202. $ctx1.sendIdx["at:put:"]=2;
  3203. _st(d)._at_put_((3),(4));
  3204. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3205. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3206. args: [],
  3207. 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)",
  3208. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3209. referencedClasses: ["Dictionary"]
  3210. }),
  3211. smalltalk.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "testPointKey",
  3215. protocol: 'tests',
  3216. fn: function (){
  3217. var self=this;
  3218. var d;
  3219. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3220. return smalltalk.withContext(function($ctx1) {
  3221. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3222. d=_st($Dictionary())._new();
  3223. $1=d;
  3224. $2=(1).__at((1));
  3225. $ctx1.sendIdx["@"]=1;
  3226. _st($1)._at_put_($2,"foo");
  3227. $ctx1.sendIdx["at:put:"]=1;
  3228. $4=d;
  3229. $5=(1).__at((1));
  3230. $ctx1.sendIdx["@"]=2;
  3231. $3=_st($4)._at_($5);
  3232. $ctx1.sendIdx["at:"]=1;
  3233. self._assert_equals_($3,"foo");
  3234. $ctx1.sendIdx["assert:equals:"]=1;
  3235. $6=d;
  3236. $7=(1).__at((1));
  3237. $ctx1.sendIdx["@"]=3;
  3238. _st($6)._at_put_($7,"bar");
  3239. $9=d;
  3240. $10=(1).__at((1));
  3241. $ctx1.sendIdx["@"]=4;
  3242. $8=_st($9)._at_($10);
  3243. self._assert_equals_($8,"bar");
  3244. $ctx1.sendIdx["assert:equals:"]=2;
  3245. $11=d;
  3246. $12=(1).__at((1));
  3247. $ctx1.sendIdx["@"]=5;
  3248. _st($11)._removeKey_($12);
  3249. $14=d;
  3250. $15=(1).__at((1));
  3251. $ctx1.sendIdx["@"]=6;
  3252. $13=_st($14)._at_ifAbsent_($15,(function(){
  3253. return smalltalk.withContext(function($ctx2) {
  3254. return "baz";
  3255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3256. self._assert_equals_($13,"baz");
  3257. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3258. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3259. args: [],
  3260. 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)",
  3261. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3262. referencedClasses: ["Dictionary"]
  3263. }),
  3264. smalltalk.DictionaryTest);
  3265. smalltalk.addMethod(
  3266. smalltalk.method({
  3267. selector: "testPrintString",
  3268. protocol: 'tests',
  3269. fn: function (){
  3270. var self=this;
  3271. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3272. return smalltalk.withContext(function($ctx1) {
  3273. var $2,$3,$1;
  3274. $2=_st($Dictionary())._new();
  3275. _st($2)._at_put_("firstname","James");
  3276. $ctx1.sendIdx["at:put:"]=1;
  3277. _st($2)._at_put_("lastname","Bond");
  3278. $3=_st($2)._printString();
  3279. $1=$3;
  3280. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3281. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3282. args: [],
  3283. 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'')'",
  3284. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3285. referencedClasses: ["Dictionary"]
  3286. }),
  3287. smalltalk.DictionaryTest);
  3288. smalltalk.addMethod(
  3289. smalltalk.method({
  3290. selector: "testRemoveKey",
  3291. protocol: 'tests',
  3292. fn: function (){
  3293. var self=this;
  3294. var d,key;
  3295. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3296. return smalltalk.withContext(function($ctx1) {
  3297. var $1;
  3298. d=_st($Dictionary())._new();
  3299. _st(d)._at_put_((1),(2));
  3300. $ctx1.sendIdx["at:put:"]=1;
  3301. _st(d)._at_put_((2),(3));
  3302. $ctx1.sendIdx["at:put:"]=2;
  3303. _st(d)._at_put_((3),(4));
  3304. key=(2);
  3305. $1=_st(d)._keys();
  3306. $ctx1.sendIdx["keys"]=1;
  3307. self._assert_equals_($1,[(1), (2), (3)]);
  3308. $ctx1.sendIdx["assert:equals:"]=1;
  3309. _st(d)._removeKey_(key);
  3310. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3311. $ctx1.sendIdx["assert:equals:"]=2;
  3312. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3313. self._deny_(_st(d)._includesKey_((2)));
  3314. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3315. args: [],
  3316. 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)",
  3317. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3318. referencedClasses: ["Dictionary"]
  3319. }),
  3320. smalltalk.DictionaryTest);
  3321. smalltalk.addMethod(
  3322. smalltalk.method({
  3323. selector: "testRemoveKeyIfAbsent",
  3324. protocol: 'tests',
  3325. fn: function (){
  3326. var self=this;
  3327. var d,key;
  3328. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3329. return smalltalk.withContext(function($ctx1) {
  3330. var $1;
  3331. d=_st($Dictionary())._new();
  3332. _st(d)._at_put_((1),(2));
  3333. $ctx1.sendIdx["at:put:"]=1;
  3334. _st(d)._at_put_((2),(3));
  3335. $ctx1.sendIdx["at:put:"]=2;
  3336. _st(d)._at_put_((3),(4));
  3337. key=(2);
  3338. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3339. $ctx1.sendIdx["assert:equals:"]=1;
  3340. key=(3);
  3341. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3342. return smalltalk.withContext(function($ctx2) {
  3343. return (42);
  3344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3345. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3346. self._assert_equals_($1,(4));
  3347. $ctx1.sendIdx["assert:equals:"]=2;
  3348. key="why";
  3349. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3350. return smalltalk.withContext(function($ctx2) {
  3351. return (42);
  3352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3353. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3354. args: [],
  3355. 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.",
  3356. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3357. referencedClasses: ["Dictionary"]
  3358. }),
  3359. smalltalk.DictionaryTest);
  3360. smalltalk.addMethod(
  3361. smalltalk.method({
  3362. selector: "testValues",
  3363. protocol: 'tests',
  3364. fn: function (){
  3365. var self=this;
  3366. var d;
  3367. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3368. return smalltalk.withContext(function($ctx1) {
  3369. d=_st($Dictionary())._new();
  3370. _st(d)._at_put_((1),(2));
  3371. $ctx1.sendIdx["at:put:"]=1;
  3372. _st(d)._at_put_((2),(3));
  3373. $ctx1.sendIdx["at:put:"]=2;
  3374. _st(d)._at_put_((3),(4));
  3375. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3376. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3377. args: [],
  3378. 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)",
  3379. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3380. referencedClasses: ["Dictionary"]
  3381. }),
  3382. smalltalk.DictionaryTest);
  3383. smalltalk.addMethod(
  3384. smalltalk.method({
  3385. selector: "collectionClass",
  3386. protocol: 'fixture',
  3387. fn: function (){
  3388. var self=this;
  3389. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3390. return smalltalk.withContext(function($ctx1) {
  3391. return $Dictionary();
  3392. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3393. args: [],
  3394. source: "collectionClass\x0a\x09^ Dictionary",
  3395. messageSends: [],
  3396. referencedClasses: ["Dictionary"]
  3397. }),
  3398. smalltalk.DictionaryTest.klass);
  3399. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3400. smalltalk.addMethod(
  3401. smalltalk.method({
  3402. selector: "collectionFirst",
  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,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3409. args: [],
  3410. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3411. messageSends: ["subclassResponsibility"],
  3412. referencedClasses: []
  3413. }),
  3414. smalltalk.SequenceableCollectionTest);
  3415. smalltalk.addMethod(
  3416. smalltalk.method({
  3417. selector: "collectionFirstTwo",
  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,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3424. args: [],
  3425. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3426. messageSends: ["subclassResponsibility"],
  3427. referencedClasses: []
  3428. }),
  3429. smalltalk.SequenceableCollectionTest);
  3430. smalltalk.addMethod(
  3431. smalltalk.method({
  3432. selector: "collectionLast",
  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,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3439. args: [],
  3440. source: "collectionLast\x0a\x09self subclassResponsibility",
  3441. messageSends: ["subclassResponsibility"],
  3442. referencedClasses: []
  3443. }),
  3444. smalltalk.SequenceableCollectionTest);
  3445. smalltalk.addMethod(
  3446. smalltalk.method({
  3447. selector: "collectionLastTwo",
  3448. protocol: 'fixture',
  3449. fn: function (){
  3450. var self=this;
  3451. return smalltalk.withContext(function($ctx1) {
  3452. self._subclassResponsibility();
  3453. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3454. args: [],
  3455. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3456. messageSends: ["subclassResponsibility"],
  3457. referencedClasses: []
  3458. }),
  3459. smalltalk.SequenceableCollectionTest);
  3460. smalltalk.addMethod(
  3461. smalltalk.method({
  3462. selector: "nonIndexesDo:",
  3463. protocol: 'fixture',
  3464. fn: function (aBlock){
  3465. var self=this;
  3466. return smalltalk.withContext(function($ctx1) {
  3467. _st(aBlock)._value_((0));
  3468. $ctx1.sendIdx["value:"]=1;
  3469. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3470. $ctx1.sendIdx["value:"]=2;
  3471. _st(aBlock)._value_("z");
  3472. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3473. args: ["aBlock"],
  3474. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3475. messageSends: ["value:", "+", "collectionSize"],
  3476. referencedClasses: []
  3477. }),
  3478. smalltalk.SequenceableCollectionTest);
  3479. smalltalk.addMethod(
  3480. smalltalk.method({
  3481. selector: "samplesDo:",
  3482. protocol: 'fixture',
  3483. fn: function (aBlock){
  3484. var self=this;
  3485. return smalltalk.withContext(function($ctx1) {
  3486. _st(aBlock)._value_value_((1),self._collectionFirst());
  3487. $ctx1.sendIdx["value:value:"]=1;
  3488. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3489. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3490. args: ["aBlock"],
  3491. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3492. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3493. referencedClasses: []
  3494. }),
  3495. smalltalk.SequenceableCollectionTest);
  3496. smalltalk.addMethod(
  3497. smalltalk.method({
  3498. selector: "testBeginsWith",
  3499. protocol: 'tests',
  3500. fn: function (){
  3501. var self=this;
  3502. return smalltalk.withContext(function($ctx1) {
  3503. var $2,$1,$4,$5,$3,$7,$6;
  3504. $2=self._collection();
  3505. $ctx1.sendIdx["collection"]=1;
  3506. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3507. $ctx1.sendIdx["beginsWith:"]=1;
  3508. self._assert_($1);
  3509. $ctx1.sendIdx["assert:"]=1;
  3510. $4=self._collection();
  3511. $ctx1.sendIdx["collection"]=2;
  3512. $5=self._collection();
  3513. $ctx1.sendIdx["collection"]=3;
  3514. $3=_st($4)._beginsWith_($5);
  3515. $ctx1.sendIdx["beginsWith:"]=2;
  3516. self._assert_($3);
  3517. $ctx1.sendIdx["assert:"]=2;
  3518. $7=self._collection();
  3519. $ctx1.sendIdx["collection"]=4;
  3520. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3521. $ctx1.sendIdx["beginsWith:"]=3;
  3522. self._assert_($6);
  3523. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3524. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3525. args: [],
  3526. 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)",
  3527. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3528. referencedClasses: []
  3529. }),
  3530. smalltalk.SequenceableCollectionTest);
  3531. smalltalk.addMethod(
  3532. smalltalk.method({
  3533. selector: "testEndsWith",
  3534. protocol: 'tests',
  3535. fn: function (){
  3536. var self=this;
  3537. return smalltalk.withContext(function($ctx1) {
  3538. var $2,$1,$4,$5,$3,$7,$6;
  3539. $2=self._collection();
  3540. $ctx1.sendIdx["collection"]=1;
  3541. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3542. $ctx1.sendIdx["endsWith:"]=1;
  3543. self._assert_($1);
  3544. $ctx1.sendIdx["assert:"]=1;
  3545. $4=self._collection();
  3546. $ctx1.sendIdx["collection"]=2;
  3547. $5=self._collection();
  3548. $ctx1.sendIdx["collection"]=3;
  3549. $3=_st($4)._endsWith_($5);
  3550. $ctx1.sendIdx["endsWith:"]=2;
  3551. self._assert_($3);
  3552. $ctx1.sendIdx["assert:"]=2;
  3553. $7=self._collection();
  3554. $ctx1.sendIdx["collection"]=4;
  3555. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3556. $ctx1.sendIdx["endsWith:"]=3;
  3557. self._assert_($6);
  3558. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3559. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3560. args: [],
  3561. 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)",
  3562. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3563. referencedClasses: []
  3564. }),
  3565. smalltalk.SequenceableCollectionTest);
  3566. smalltalk.addMethod(
  3567. smalltalk.method({
  3568. selector: "testFirst",
  3569. protocol: 'tests',
  3570. fn: function (){
  3571. var self=this;
  3572. return smalltalk.withContext(function($ctx1) {
  3573. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3574. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3575. args: [],
  3576. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3577. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3578. referencedClasses: []
  3579. }),
  3580. smalltalk.SequenceableCollectionTest);
  3581. smalltalk.addMethod(
  3582. smalltalk.method({
  3583. selector: "testFirstN",
  3584. protocol: 'tests',
  3585. fn: function (){
  3586. var self=this;
  3587. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3588. return smalltalk.withContext(function($ctx1) {
  3589. var $2,$1,$4,$3,$6,$5,$7;
  3590. $2=self._collection();
  3591. $ctx1.sendIdx["collection"]=1;
  3592. $1=_st($2)._first_((2));
  3593. $ctx1.sendIdx["first:"]=1;
  3594. self._assert_equals_($1,self._collectionFirstTwo());
  3595. $ctx1.sendIdx["assert:equals:"]=1;
  3596. $4=self._collection();
  3597. $ctx1.sendIdx["collection"]=2;
  3598. $3=_st($4)._first_((0));
  3599. $ctx1.sendIdx["first:"]=2;
  3600. self._assert_equals_($3,_st(self._collectionClass())._new());
  3601. $ctx1.sendIdx["assert:equals:"]=2;
  3602. $6=self._collection();
  3603. $ctx1.sendIdx["collection"]=3;
  3604. $5=_st($6)._first_(self._collectionSize());
  3605. $ctx1.sendIdx["first:"]=3;
  3606. $7=self._collection();
  3607. $ctx1.sendIdx["collection"]=4;
  3608. self._assert_equals_($5,$7);
  3609. self._should_raise_((function(){
  3610. return smalltalk.withContext(function($ctx2) {
  3611. return _st(self._collection())._first_((33));
  3612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3613. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3614. args: [],
  3615. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3616. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3617. referencedClasses: ["Error"]
  3618. }),
  3619. smalltalk.SequenceableCollectionTest);
  3620. smalltalk.addMethod(
  3621. smalltalk.method({
  3622. selector: "testFourth",
  3623. protocol: 'tests',
  3624. fn: function (){
  3625. var self=this;
  3626. return smalltalk.withContext(function($ctx1) {
  3627. var $2,$1;
  3628. $2=self._collection();
  3629. $ctx1.sendIdx["collection"]=1;
  3630. $1=_st($2)._fourth();
  3631. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3632. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3633. args: [],
  3634. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3635. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3636. referencedClasses: []
  3637. }),
  3638. smalltalk.SequenceableCollectionTest);
  3639. smalltalk.addMethod(
  3640. smalltalk.method({
  3641. selector: "testLast",
  3642. protocol: 'tests',
  3643. fn: function (){
  3644. var self=this;
  3645. return smalltalk.withContext(function($ctx1) {
  3646. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3647. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3648. args: [],
  3649. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3650. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3651. referencedClasses: []
  3652. }),
  3653. smalltalk.SequenceableCollectionTest);
  3654. smalltalk.addMethod(
  3655. smalltalk.method({
  3656. selector: "testLastN",
  3657. protocol: 'tests',
  3658. fn: function (){
  3659. var self=this;
  3660. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3661. return smalltalk.withContext(function($ctx1) {
  3662. var $2,$1,$4,$3,$6,$5,$7;
  3663. $2=self._collection();
  3664. $ctx1.sendIdx["collection"]=1;
  3665. $1=_st($2)._last_((2));
  3666. $ctx1.sendIdx["last:"]=1;
  3667. self._assert_equals_($1,self._collectionLastTwo());
  3668. $ctx1.sendIdx["assert:equals:"]=1;
  3669. $4=self._collection();
  3670. $ctx1.sendIdx["collection"]=2;
  3671. $3=_st($4)._last_((0));
  3672. $ctx1.sendIdx["last:"]=2;
  3673. self._assert_equals_($3,_st(self._collectionClass())._new());
  3674. $ctx1.sendIdx["assert:equals:"]=2;
  3675. $6=self._collection();
  3676. $ctx1.sendIdx["collection"]=3;
  3677. $5=_st($6)._last_(self._collectionSize());
  3678. $ctx1.sendIdx["last:"]=3;
  3679. $7=self._collection();
  3680. $ctx1.sendIdx["collection"]=4;
  3681. self._assert_equals_($5,$7);
  3682. self._should_raise_((function(){
  3683. return smalltalk.withContext(function($ctx2) {
  3684. return _st(self._collection())._last_((33));
  3685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3686. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3687. args: [],
  3688. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3689. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3690. referencedClasses: ["Error"]
  3691. }),
  3692. smalltalk.SequenceableCollectionTest);
  3693. smalltalk.addMethod(
  3694. smalltalk.method({
  3695. selector: "testSecond",
  3696. protocol: 'tests',
  3697. fn: function (){
  3698. var self=this;
  3699. return smalltalk.withContext(function($ctx1) {
  3700. var $2,$1;
  3701. $2=self._collection();
  3702. $ctx1.sendIdx["collection"]=1;
  3703. $1=_st($2)._second();
  3704. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3705. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3706. args: [],
  3707. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3708. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3709. referencedClasses: []
  3710. }),
  3711. smalltalk.SequenceableCollectionTest);
  3712. smalltalk.addMethod(
  3713. smalltalk.method({
  3714. selector: "testThird",
  3715. protocol: 'tests',
  3716. fn: function (){
  3717. var self=this;
  3718. return smalltalk.withContext(function($ctx1) {
  3719. var $2,$1;
  3720. $2=self._collection();
  3721. $ctx1.sendIdx["collection"]=1;
  3722. $1=_st($2)._third();
  3723. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3724. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3725. args: [],
  3726. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3727. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3728. referencedClasses: []
  3729. }),
  3730. smalltalk.SequenceableCollectionTest);
  3731. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3732. smalltalk.addMethod(
  3733. smalltalk.method({
  3734. selector: "collection",
  3735. protocol: 'fixture',
  3736. fn: function (){
  3737. var self=this;
  3738. return smalltalk.withContext(function($ctx1) {
  3739. var $1;
  3740. $1=[(1), (2), (3), (-4)];
  3741. return $1;
  3742. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3743. args: [],
  3744. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3745. messageSends: [],
  3746. referencedClasses: []
  3747. }),
  3748. smalltalk.ArrayTest);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "collectionFirst",
  3752. protocol: 'fixture',
  3753. fn: function (){
  3754. var self=this;
  3755. return smalltalk.withContext(function($ctx1) {
  3756. return (1);
  3757. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3758. args: [],
  3759. source: "collectionFirst\x0a\x09^ 1",
  3760. messageSends: [],
  3761. referencedClasses: []
  3762. }),
  3763. smalltalk.ArrayTest);
  3764. smalltalk.addMethod(
  3765. smalltalk.method({
  3766. selector: "collectionFirstTwo",
  3767. protocol: 'fixture',
  3768. fn: function (){
  3769. var self=this;
  3770. return smalltalk.withContext(function($ctx1) {
  3771. var $1;
  3772. $1=[(1), (2)];
  3773. return $1;
  3774. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3775. args: [],
  3776. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3777. messageSends: [],
  3778. referencedClasses: []
  3779. }),
  3780. smalltalk.ArrayTest);
  3781. smalltalk.addMethod(
  3782. smalltalk.method({
  3783. selector: "collectionLast",
  3784. protocol: 'fixture',
  3785. fn: function (){
  3786. var self=this;
  3787. return smalltalk.withContext(function($ctx1) {
  3788. return (-4);
  3789. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3790. args: [],
  3791. source: "collectionLast\x0a\x09^ -4",
  3792. messageSends: [],
  3793. referencedClasses: []
  3794. }),
  3795. smalltalk.ArrayTest);
  3796. smalltalk.addMethod(
  3797. smalltalk.method({
  3798. selector: "collectionLastTwo",
  3799. protocol: 'fixture',
  3800. fn: function (){
  3801. var self=this;
  3802. return smalltalk.withContext(function($ctx1) {
  3803. var $1;
  3804. $1=[(3), (-4)];
  3805. return $1;
  3806. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3807. args: [],
  3808. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3809. messageSends: [],
  3810. referencedClasses: []
  3811. }),
  3812. smalltalk.ArrayTest);
  3813. smalltalk.addMethod(
  3814. smalltalk.method({
  3815. selector: "collectionOfPrintStrings",
  3816. protocol: 'fixture',
  3817. fn: function (){
  3818. var self=this;
  3819. return smalltalk.withContext(function($ctx1) {
  3820. var $1;
  3821. $1=["1", "2", "3", "-4"];
  3822. return $1;
  3823. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3824. args: [],
  3825. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3826. messageSends: [],
  3827. referencedClasses: []
  3828. }),
  3829. smalltalk.ArrayTest);
  3830. smalltalk.addMethod(
  3831. smalltalk.method({
  3832. selector: "collectionSize",
  3833. protocol: 'fixture',
  3834. fn: function (){
  3835. var self=this;
  3836. return smalltalk.withContext(function($ctx1) {
  3837. return (4);
  3838. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3839. args: [],
  3840. source: "collectionSize\x0a\x09^ 4",
  3841. messageSends: [],
  3842. referencedClasses: []
  3843. }),
  3844. smalltalk.ArrayTest);
  3845. smalltalk.addMethod(
  3846. smalltalk.method({
  3847. selector: "collectionWithDuplicates",
  3848. protocol: 'fixture',
  3849. fn: function (){
  3850. var self=this;
  3851. return smalltalk.withContext(function($ctx1) {
  3852. var $1;
  3853. $1=["a", "b", "c", (1), (2), (1), "a"];
  3854. return $1;
  3855. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3856. args: [],
  3857. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3858. messageSends: [],
  3859. referencedClasses: []
  3860. }),
  3861. smalltalk.ArrayTest);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "collectionWithNewValue",
  3865. protocol: 'fixture',
  3866. fn: function (){
  3867. var self=this;
  3868. return smalltalk.withContext(function($ctx1) {
  3869. var $1;
  3870. $1=[(1), (2), (3), (-4), "N"];
  3871. return $1;
  3872. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3873. args: [],
  3874. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3875. messageSends: [],
  3876. referencedClasses: []
  3877. }),
  3878. smalltalk.ArrayTest);
  3879. smalltalk.addMethod(
  3880. smalltalk.method({
  3881. selector: "sampleNewIndex",
  3882. protocol: 'fixture',
  3883. fn: function (){
  3884. var self=this;
  3885. return smalltalk.withContext(function($ctx1) {
  3886. return (5);
  3887. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3888. args: [],
  3889. source: "sampleNewIndex\x0a\x09^ 5",
  3890. messageSends: [],
  3891. referencedClasses: []
  3892. }),
  3893. smalltalk.ArrayTest);
  3894. smalltalk.addMethod(
  3895. smalltalk.method({
  3896. selector: "samplesDo:",
  3897. protocol: 'fixture',
  3898. fn: function (aBlock){
  3899. var self=this;
  3900. return smalltalk.withContext(function($ctx1) {
  3901. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3902. _st(aBlock)._value_value_((3),(3));
  3903. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3904. args: ["aBlock"],
  3905. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3906. messageSends: ["samplesDo:", "value:value:"],
  3907. referencedClasses: []
  3908. }),
  3909. smalltalk.ArrayTest);
  3910. smalltalk.addMethod(
  3911. smalltalk.method({
  3912. selector: "testAdd",
  3913. protocol: 'tests',
  3914. fn: function (){
  3915. var self=this;
  3916. var array;
  3917. return smalltalk.withContext(function($ctx1) {
  3918. array=self._collection();
  3919. _st(array)._add_((6));
  3920. self._assert_equals_(_st(array)._last(),(6));
  3921. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3922. args: [],
  3923. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3924. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3925. referencedClasses: []
  3926. }),
  3927. smalltalk.ArrayTest);
  3928. smalltalk.addMethod(
  3929. smalltalk.method({
  3930. selector: "testAddFirst",
  3931. protocol: 'tests',
  3932. fn: function (){
  3933. var self=this;
  3934. return smalltalk.withContext(function($ctx1) {
  3935. var $1,$2;
  3936. $1=self._collection();
  3937. _st($1)._addFirst_((0));
  3938. $2=_st($1)._yourself();
  3939. self._assert_equals_(_st($2)._first(),(0));
  3940. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3941. args: [],
  3942. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3943. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3944. referencedClasses: []
  3945. }),
  3946. smalltalk.ArrayTest);
  3947. smalltalk.addMethod(
  3948. smalltalk.method({
  3949. selector: "testPrintString",
  3950. protocol: 'tests',
  3951. fn: function (){
  3952. var self=this;
  3953. var array;
  3954. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3955. return smalltalk.withContext(function($ctx1) {
  3956. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3957. array=_st($Array())._new();
  3958. $1=_st(array)._printString();
  3959. $ctx1.sendIdx["printString"]=1;
  3960. self._assert_equals_($1,"an Array ()");
  3961. $ctx1.sendIdx["assert:equals:"]=1;
  3962. $2=array;
  3963. _st($2)._add_((1));
  3964. $ctx1.sendIdx["add:"]=1;
  3965. $3=_st($2)._add_((3));
  3966. $ctx1.sendIdx["add:"]=2;
  3967. $4=_st(array)._printString();
  3968. $ctx1.sendIdx["printString"]=2;
  3969. self._assert_equals_($4,"an Array (1 3)");
  3970. $ctx1.sendIdx["assert:equals:"]=2;
  3971. _st(array)._add_("foo");
  3972. $5=_st(array)._printString();
  3973. $ctx1.sendIdx["printString"]=3;
  3974. self._assert_equals_($5,"an Array (1 3 'foo')");
  3975. $ctx1.sendIdx["assert:equals:"]=3;
  3976. $6=array;
  3977. _st($6)._remove_((1));
  3978. $ctx1.sendIdx["remove:"]=1;
  3979. $7=_st($6)._remove_((3));
  3980. $8=_st(array)._printString();
  3981. $ctx1.sendIdx["printString"]=4;
  3982. self._assert_equals_($8,"an Array ('foo')");
  3983. $ctx1.sendIdx["assert:equals:"]=4;
  3984. _st(array)._addLast_((3));
  3985. $ctx1.sendIdx["addLast:"]=1;
  3986. $9=_st(array)._printString();
  3987. $ctx1.sendIdx["printString"]=5;
  3988. self._assert_equals_($9,"an Array ('foo' 3)");
  3989. $ctx1.sendIdx["assert:equals:"]=5;
  3990. _st(array)._addLast_((3));
  3991. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3992. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3993. args: [],
  3994. 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)'.",
  3995. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3996. referencedClasses: ["Array"]
  3997. }),
  3998. smalltalk.ArrayTest);
  3999. smalltalk.addMethod(
  4000. smalltalk.method({
  4001. selector: "testRemove",
  4002. protocol: 'tests',
  4003. fn: function (){
  4004. var self=this;
  4005. var array;
  4006. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4007. return smalltalk.withContext(function($ctx1) {
  4008. array=[(1), (2), (3), (4), (5)];
  4009. _st(array)._remove_((3));
  4010. $ctx1.sendIdx["remove:"]=1;
  4011. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4012. self._should_raise_((function(){
  4013. return smalltalk.withContext(function($ctx2) {
  4014. return _st(array)._remove_((3));
  4015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4016. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4017. args: [],
  4018. 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",
  4019. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4020. referencedClasses: ["Error"]
  4021. }),
  4022. smalltalk.ArrayTest);
  4023. smalltalk.addMethod(
  4024. smalltalk.method({
  4025. selector: "testRemoveFromTo",
  4026. protocol: 'tests',
  4027. fn: function (){
  4028. var self=this;
  4029. return smalltalk.withContext(function($ctx1) {
  4030. var $1,$2;
  4031. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4032. $ctx1.sendIdx["removeFrom:to:"]=1;
  4033. self._assert_equals_($1,[(4)]);
  4034. $ctx1.sendIdx["assert:equals:"]=1;
  4035. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4036. $ctx1.sendIdx["removeFrom:to:"]=2;
  4037. self._assert_equals_($2,[(1), (4)]);
  4038. $ctx1.sendIdx["assert:equals:"]=2;
  4039. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4040. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4041. args: [],
  4042. 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)",
  4043. messageSends: ["assert:equals:", "removeFrom:to:"],
  4044. referencedClasses: []
  4045. }),
  4046. smalltalk.ArrayTest);
  4047. smalltalk.addMethod(
  4048. smalltalk.method({
  4049. selector: "testRemoveIndex",
  4050. protocol: 'tests',
  4051. fn: function (){
  4052. var self=this;
  4053. return smalltalk.withContext(function($ctx1) {
  4054. var $1,$2;
  4055. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4056. $ctx1.sendIdx["removeIndex:"]=1;
  4057. self._assert_equals_($1,[(1), (3), (4)]);
  4058. $ctx1.sendIdx["assert:equals:"]=1;
  4059. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4060. $ctx1.sendIdx["removeIndex:"]=2;
  4061. self._assert_equals_($2,[(2), (3), (4)]);
  4062. $ctx1.sendIdx["assert:equals:"]=2;
  4063. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4064. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4065. args: [],
  4066. 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: #()",
  4067. messageSends: ["assert:equals:", "removeIndex:"],
  4068. referencedClasses: []
  4069. }),
  4070. smalltalk.ArrayTest);
  4071. smalltalk.addMethod(
  4072. smalltalk.method({
  4073. selector: "testRemoveLast",
  4074. protocol: 'tests',
  4075. fn: function (){
  4076. var self=this;
  4077. var array;
  4078. return smalltalk.withContext(function($ctx1) {
  4079. array=[(1), (2)];
  4080. _st(array)._removeLast();
  4081. self._assert_equals_(_st(array)._last(),(1));
  4082. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4083. args: [],
  4084. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4085. messageSends: ["removeLast", "assert:equals:", "last"],
  4086. referencedClasses: []
  4087. }),
  4088. smalltalk.ArrayTest);
  4089. smalltalk.addMethod(
  4090. smalltalk.method({
  4091. selector: "testReversed",
  4092. protocol: 'tests',
  4093. fn: function (){
  4094. var self=this;
  4095. var array;
  4096. return smalltalk.withContext(function($ctx1) {
  4097. array=[(5), (4), (3), (2), (1)];
  4098. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4099. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4100. args: [],
  4101. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4102. messageSends: ["assert:equals:", "reversed"],
  4103. referencedClasses: []
  4104. }),
  4105. smalltalk.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "testSort",
  4109. protocol: 'tests',
  4110. fn: function (){
  4111. var self=this;
  4112. var array;
  4113. return smalltalk.withContext(function($ctx1) {
  4114. array=[(3), (1), (4), (5), (2)];
  4115. _st(array)._sort();
  4116. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4117. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4118. args: [],
  4119. 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)",
  4120. messageSends: ["sort", "assert:equals:"],
  4121. referencedClasses: []
  4122. }),
  4123. smalltalk.ArrayTest);
  4124. smalltalk.addMethod(
  4125. smalltalk.method({
  4126. selector: "collectionClass",
  4127. protocol: 'fixture',
  4128. fn: function (){
  4129. var self=this;
  4130. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4131. return smalltalk.withContext(function($ctx1) {
  4132. return $Array();
  4133. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4134. args: [],
  4135. source: "collectionClass\x0a\x09^ Array",
  4136. messageSends: [],
  4137. referencedClasses: ["Array"]
  4138. }),
  4139. smalltalk.ArrayTest.klass);
  4140. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4141. smalltalk.addMethod(
  4142. smalltalk.method({
  4143. selector: "collection",
  4144. protocol: 'fixture',
  4145. fn: function (){
  4146. var self=this;
  4147. return smalltalk.withContext(function($ctx1) {
  4148. return "hello";
  4149. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4150. args: [],
  4151. source: "collection\x0a\x09^ 'hello'",
  4152. messageSends: [],
  4153. referencedClasses: []
  4154. }),
  4155. smalltalk.StringTest);
  4156. smalltalk.addMethod(
  4157. smalltalk.method({
  4158. selector: "collectionFirst",
  4159. protocol: 'fixture',
  4160. fn: function (){
  4161. var self=this;
  4162. return smalltalk.withContext(function($ctx1) {
  4163. return "h";
  4164. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4165. args: [],
  4166. source: "collectionFirst\x0a\x09^ 'h'",
  4167. messageSends: [],
  4168. referencedClasses: []
  4169. }),
  4170. smalltalk.StringTest);
  4171. smalltalk.addMethod(
  4172. smalltalk.method({
  4173. selector: "collectionFirstTwo",
  4174. protocol: 'fixture',
  4175. fn: function (){
  4176. var self=this;
  4177. return smalltalk.withContext(function($ctx1) {
  4178. return "he";
  4179. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4180. args: [],
  4181. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4182. messageSends: [],
  4183. referencedClasses: []
  4184. }),
  4185. smalltalk.StringTest);
  4186. smalltalk.addMethod(
  4187. smalltalk.method({
  4188. selector: "collectionLast",
  4189. protocol: 'fixture',
  4190. fn: function (){
  4191. var self=this;
  4192. return smalltalk.withContext(function($ctx1) {
  4193. return "o";
  4194. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4195. args: [],
  4196. source: "collectionLast\x0a\x09^ 'o'",
  4197. messageSends: [],
  4198. referencedClasses: []
  4199. }),
  4200. smalltalk.StringTest);
  4201. smalltalk.addMethod(
  4202. smalltalk.method({
  4203. selector: "collectionLastTwo",
  4204. protocol: 'fixture',
  4205. fn: function (){
  4206. var self=this;
  4207. return smalltalk.withContext(function($ctx1) {
  4208. return "lo";
  4209. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4210. args: [],
  4211. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4212. messageSends: [],
  4213. referencedClasses: []
  4214. }),
  4215. smalltalk.StringTest);
  4216. smalltalk.addMethod(
  4217. smalltalk.method({
  4218. selector: "collectionOfPrintStrings",
  4219. protocol: 'fixture',
  4220. fn: function (){
  4221. var self=this;
  4222. return smalltalk.withContext(function($ctx1) {
  4223. return "'h''e''l''l''o'";
  4224. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4225. args: [],
  4226. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4227. messageSends: [],
  4228. referencedClasses: []
  4229. }),
  4230. smalltalk.StringTest);
  4231. smalltalk.addMethod(
  4232. smalltalk.method({
  4233. selector: "collectionSize",
  4234. protocol: 'fixture',
  4235. fn: function (){
  4236. var self=this;
  4237. return smalltalk.withContext(function($ctx1) {
  4238. return (5);
  4239. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4240. args: [],
  4241. source: "collectionSize\x0a\x09^ 5",
  4242. messageSends: [],
  4243. referencedClasses: []
  4244. }),
  4245. smalltalk.StringTest);
  4246. smalltalk.addMethod(
  4247. smalltalk.method({
  4248. selector: "collectionWithDuplicates",
  4249. protocol: 'fixture',
  4250. fn: function (){
  4251. var self=this;
  4252. return smalltalk.withContext(function($ctx1) {
  4253. return "abbaerte";
  4254. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4255. args: [],
  4256. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4257. messageSends: [],
  4258. referencedClasses: []
  4259. }),
  4260. smalltalk.StringTest);
  4261. smalltalk.addMethod(
  4262. smalltalk.method({
  4263. selector: "collectionWithNewValue",
  4264. protocol: 'fixture',
  4265. fn: function (){
  4266. var self=this;
  4267. return smalltalk.withContext(function($ctx1) {
  4268. return "helloN";
  4269. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4270. args: [],
  4271. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4272. messageSends: [],
  4273. referencedClasses: []
  4274. }),
  4275. smalltalk.StringTest);
  4276. smalltalk.addMethod(
  4277. smalltalk.method({
  4278. selector: "sampleNewValueAsCollection",
  4279. protocol: 'fixture',
  4280. fn: function (){
  4281. var self=this;
  4282. return smalltalk.withContext(function($ctx1) {
  4283. return "N";
  4284. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4285. args: [],
  4286. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4287. messageSends: [],
  4288. referencedClasses: []
  4289. }),
  4290. smalltalk.StringTest);
  4291. smalltalk.addMethod(
  4292. smalltalk.method({
  4293. selector: "samplesDo:",
  4294. protocol: 'fixture',
  4295. fn: function (aBlock){
  4296. var self=this;
  4297. return smalltalk.withContext(function($ctx1) {
  4298. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4299. _st(aBlock)._value_value_((3),"l");
  4300. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4301. args: ["aBlock"],
  4302. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4303. messageSends: ["samplesDo:", "value:value:"],
  4304. referencedClasses: []
  4305. }),
  4306. smalltalk.StringTest);
  4307. smalltalk.addMethod(
  4308. smalltalk.method({
  4309. selector: "testAddAll",
  4310. protocol: 'tests',
  4311. fn: function (){
  4312. var self=this;
  4313. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4314. return smalltalk.withContext(function($ctx1) {
  4315. var $1;
  4316. self._should_raise_((function(){
  4317. return smalltalk.withContext(function($ctx2) {
  4318. $1=self._collection();
  4319. $ctx2.sendIdx["collection"]=1;
  4320. return _st($1)._addAll_(self._collection());
  4321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4322. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4323. args: [],
  4324. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4325. messageSends: ["should:raise:", "addAll:", "collection"],
  4326. referencedClasses: ["Error"]
  4327. }),
  4328. smalltalk.StringTest);
  4329. smalltalk.addMethod(
  4330. smalltalk.method({
  4331. selector: "testAddRemove",
  4332. protocol: 'tests',
  4333. fn: function (){
  4334. var self=this;
  4335. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4336. return smalltalk.withContext(function($ctx1) {
  4337. self._should_raise_((function(){
  4338. return smalltalk.withContext(function($ctx2) {
  4339. return "hello"._add_("a");
  4340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4341. $ctx1.sendIdx["should:raise:"]=1;
  4342. self._should_raise_((function(){
  4343. return smalltalk.withContext(function($ctx2) {
  4344. return "hello"._remove_("h");
  4345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4346. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4347. args: [],
  4348. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4349. messageSends: ["should:raise:", "add:", "remove:"],
  4350. referencedClasses: ["Error"]
  4351. }),
  4352. smalltalk.StringTest);
  4353. smalltalk.addMethod(
  4354. smalltalk.method({
  4355. selector: "testAsArray",
  4356. protocol: 'tests',
  4357. fn: function (){
  4358. var self=this;
  4359. return smalltalk.withContext(function($ctx1) {
  4360. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4361. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4362. args: [],
  4363. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4364. messageSends: ["assert:equals:", "asArray"],
  4365. referencedClasses: []
  4366. }),
  4367. smalltalk.StringTest);
  4368. smalltalk.addMethod(
  4369. smalltalk.method({
  4370. selector: "testAsLowerCase",
  4371. protocol: 'tests',
  4372. fn: function (){
  4373. var self=this;
  4374. return smalltalk.withContext(function($ctx1) {
  4375. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4376. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4377. args: [],
  4378. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4379. messageSends: ["assert:equals:", "asLowercase"],
  4380. referencedClasses: []
  4381. }),
  4382. smalltalk.StringTest);
  4383. smalltalk.addMethod(
  4384. smalltalk.method({
  4385. selector: "testAsNumber",
  4386. protocol: 'tests',
  4387. fn: function (){
  4388. var self=this;
  4389. return smalltalk.withContext(function($ctx1) {
  4390. var $1,$2;
  4391. $1="3"._asNumber();
  4392. $ctx1.sendIdx["asNumber"]=1;
  4393. self._assert_equals_($1,(3));
  4394. $ctx1.sendIdx["assert:equals:"]=1;
  4395. $2="-3"._asNumber();
  4396. $ctx1.sendIdx["asNumber"]=2;
  4397. self._assert_equals_($2,(-3));
  4398. $ctx1.sendIdx["assert:equals:"]=2;
  4399. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4400. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4401. args: [],
  4402. 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.",
  4403. messageSends: ["assert:equals:", "asNumber"],
  4404. referencedClasses: []
  4405. }),
  4406. smalltalk.StringTest);
  4407. smalltalk.addMethod(
  4408. smalltalk.method({
  4409. selector: "testAsUpperCase",
  4410. protocol: 'tests',
  4411. fn: function (){
  4412. var self=this;
  4413. return smalltalk.withContext(function($ctx1) {
  4414. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4415. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4416. args: [],
  4417. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4418. messageSends: ["assert:equals:", "asUppercase"],
  4419. referencedClasses: []
  4420. }),
  4421. smalltalk.StringTest);
  4422. smalltalk.addMethod(
  4423. smalltalk.method({
  4424. selector: "testAsciiValue",
  4425. protocol: 'tests',
  4426. fn: function (){
  4427. var self=this;
  4428. var characterA,characterU;
  4429. return smalltalk.withContext(function($ctx1) {
  4430. var $1;
  4431. characterA="A";
  4432. characterU="U";
  4433. $1=_st(characterA)._asciiValue();
  4434. $ctx1.sendIdx["asciiValue"]=1;
  4435. self._assert_equals_($1,(65));
  4436. $ctx1.sendIdx["assert:equals:"]=1;
  4437. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4438. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4439. args: [],
  4440. 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",
  4441. messageSends: ["assert:equals:", "asciiValue"],
  4442. referencedClasses: []
  4443. }),
  4444. smalltalk.StringTest);
  4445. smalltalk.addMethod(
  4446. smalltalk.method({
  4447. selector: "testAtPut",
  4448. protocol: 'tests',
  4449. fn: function (){
  4450. var self=this;
  4451. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4452. return smalltalk.withContext(function($ctx1) {
  4453. self._should_raise_((function(){
  4454. return smalltalk.withContext(function($ctx2) {
  4455. return "hello"._at_put_((1),"a");
  4456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4457. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4458. args: [],
  4459. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4460. messageSends: ["should:raise:", "at:put:"],
  4461. referencedClasses: ["Error"]
  4462. }),
  4463. smalltalk.StringTest);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "testCapitalized",
  4467. protocol: 'tests',
  4468. fn: function (){
  4469. var self=this;
  4470. return smalltalk.withContext(function($ctx1) {
  4471. var $1,$2,$3;
  4472. $1="test"._capitalized();
  4473. $ctx1.sendIdx["capitalized"]=1;
  4474. self._assert_equals_($1,"Test");
  4475. $ctx1.sendIdx["assert:equals:"]=1;
  4476. $2="Test"._capitalized();
  4477. $ctx1.sendIdx["capitalized"]=2;
  4478. self._assert_equals_($2,"Test");
  4479. $ctx1.sendIdx["assert:equals:"]=2;
  4480. self._assert_equals_(""._capitalized(),"");
  4481. $ctx1.sendIdx["assert:equals:"]=3;
  4482. $3="Test"._isCapitalized();
  4483. $ctx1.sendIdx["isCapitalized"]=1;
  4484. self._assert_equals_($3,true);
  4485. $ctx1.sendIdx["assert:equals:"]=4;
  4486. self._assert_equals_("test"._isCapitalized(),false);
  4487. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4488. args: [],
  4489. 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.",
  4490. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4491. referencedClasses: []
  4492. }),
  4493. smalltalk.StringTest);
  4494. smalltalk.addMethod(
  4495. smalltalk.method({
  4496. selector: "testCharCodeAt",
  4497. protocol: 'tests',
  4498. fn: function (){
  4499. var self=this;
  4500. return smalltalk.withContext(function($ctx1) {
  4501. var $1,$2,$3,$4,$5;
  4502. $1="jackie"._charCodeAt_((1));
  4503. $ctx1.sendIdx["charCodeAt:"]=1;
  4504. self._assert_equals_($1,(106));
  4505. $ctx1.sendIdx["assert:equals:"]=1;
  4506. $2="jackie"._charCodeAt_((2));
  4507. $ctx1.sendIdx["charCodeAt:"]=2;
  4508. self._assert_equals_($2,(97));
  4509. $ctx1.sendIdx["assert:equals:"]=2;
  4510. $3="jackie"._charCodeAt_((3));
  4511. $ctx1.sendIdx["charCodeAt:"]=3;
  4512. self._assert_equals_($3,(99));
  4513. $ctx1.sendIdx["assert:equals:"]=3;
  4514. $4="jackie"._charCodeAt_((4));
  4515. $ctx1.sendIdx["charCodeAt:"]=4;
  4516. self._assert_equals_($4,(107));
  4517. $ctx1.sendIdx["assert:equals:"]=4;
  4518. $5="jackie"._charCodeAt_((5));
  4519. $ctx1.sendIdx["charCodeAt:"]=5;
  4520. self._assert_equals_($5,(105));
  4521. $ctx1.sendIdx["assert:equals:"]=5;
  4522. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4523. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4524. args: [],
  4525. 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",
  4526. messageSends: ["assert:equals:", "charCodeAt:"],
  4527. referencedClasses: []
  4528. }),
  4529. smalltalk.StringTest);
  4530. smalltalk.addMethod(
  4531. smalltalk.method({
  4532. selector: "testCopyFromTo",
  4533. protocol: 'tests',
  4534. fn: function (){
  4535. var self=this;
  4536. return smalltalk.withContext(function($ctx1) {
  4537. var $1;
  4538. $1="jackie"._copyFrom_to_((1),(3));
  4539. $ctx1.sendIdx["copyFrom:to:"]=1;
  4540. self._assert_equals_($1,"jac");
  4541. $ctx1.sendIdx["assert:equals:"]=1;
  4542. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4543. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4544. args: [],
  4545. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4546. messageSends: ["assert:equals:", "copyFrom:to:"],
  4547. referencedClasses: []
  4548. }),
  4549. smalltalk.StringTest);
  4550. smalltalk.addMethod(
  4551. smalltalk.method({
  4552. selector: "testCopyWithoutAll",
  4553. protocol: 'tests',
  4554. fn: function (){
  4555. var self=this;
  4556. return smalltalk.withContext(function($ctx1) {
  4557. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4558. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4559. args: [],
  4560. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4561. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4562. referencedClasses: []
  4563. }),
  4564. smalltalk.StringTest);
  4565. smalltalk.addMethod(
  4566. smalltalk.method({
  4567. selector: "testEquality",
  4568. protocol: 'tests',
  4569. fn: function (){
  4570. var self=this;
  4571. return smalltalk.withContext(function($ctx1) {
  4572. var $1,$2,$3;
  4573. self._assert_equals_("hello","hello");
  4574. $ctx1.sendIdx["assert:equals:"]=1;
  4575. $1="hello".__eq("world");
  4576. $ctx1.sendIdx["="]=1;
  4577. self._deny_($1);
  4578. $ctx1.sendIdx["deny:"]=1;
  4579. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4580. return smalltalk.withContext(function($ctx2) {
  4581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4582. $ctx1.sendIdx["="]=2;
  4583. self._deny_($2);
  4584. $ctx1.sendIdx["deny:"]=2;
  4585. $3="hello"._yourself();
  4586. $ctx1.sendIdx["yourself"]=1;
  4587. self._assert_equals_("hello",$3);
  4588. $ctx1.sendIdx["assert:equals:"]=2;
  4589. self._assert_equals_("hello"._yourself(),"hello");
  4590. self._deny_("".__eq((0)));
  4591. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4592. args: [],
  4593. 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",
  4594. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4595. referencedClasses: []
  4596. }),
  4597. smalltalk.StringTest);
  4598. smalltalk.addMethod(
  4599. smalltalk.method({
  4600. selector: "testIdentity",
  4601. protocol: 'tests',
  4602. fn: function (){
  4603. var self=this;
  4604. return smalltalk.withContext(function($ctx1) {
  4605. var $1,$2,$4,$3,$5;
  4606. $1="hello".__eq_eq("hello");
  4607. $ctx1.sendIdx["=="]=1;
  4608. self._assert_($1);
  4609. $ctx1.sendIdx["assert:"]=1;
  4610. $2="hello".__eq_eq("world");
  4611. $ctx1.sendIdx["=="]=2;
  4612. self._deny_($2);
  4613. $ctx1.sendIdx["deny:"]=1;
  4614. $4="hello"._yourself();
  4615. $ctx1.sendIdx["yourself"]=1;
  4616. $3="hello".__eq_eq($4);
  4617. $ctx1.sendIdx["=="]=3;
  4618. self._assert_($3);
  4619. $ctx1.sendIdx["assert:"]=2;
  4620. $5=_st("hello"._yourself()).__eq_eq("hello");
  4621. $ctx1.sendIdx["=="]=4;
  4622. self._assert_($5);
  4623. self._deny_("".__eq_eq((0)));
  4624. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4625. args: [],
  4626. 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",
  4627. messageSends: ["assert:", "==", "deny:", "yourself"],
  4628. referencedClasses: []
  4629. }),
  4630. smalltalk.StringTest);
  4631. smalltalk.addMethod(
  4632. smalltalk.method({
  4633. selector: "testIdentityHash",
  4634. protocol: 'tests',
  4635. fn: function (){
  4636. var self=this;
  4637. return smalltalk.withContext(function($ctx1) {
  4638. var $1,$2,$4,$3;
  4639. $1="foo"._identityHash();
  4640. $ctx1.sendIdx["identityHash"]=1;
  4641. $2="foo"._identityHash();
  4642. $ctx1.sendIdx["identityHash"]=2;
  4643. self._assert_equals_($1,$2);
  4644. $4="foo"._identityHash();
  4645. $ctx1.sendIdx["identityHash"]=3;
  4646. $3=_st($4).__eq("bar"._identityHash());
  4647. self._deny_($3);
  4648. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4649. args: [],
  4650. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4651. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4652. referencedClasses: []
  4653. }),
  4654. smalltalk.StringTest);
  4655. smalltalk.addMethod(
  4656. smalltalk.method({
  4657. selector: "testIncludesSubString",
  4658. protocol: 'tests',
  4659. fn: function (){
  4660. var self=this;
  4661. return smalltalk.withContext(function($ctx1) {
  4662. var $1;
  4663. $1="amber"._includesSubString_("ber");
  4664. $ctx1.sendIdx["includesSubString:"]=1;
  4665. self._assert_($1);
  4666. self._deny_("amber"._includesSubString_("zork"));
  4667. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4668. args: [],
  4669. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4670. messageSends: ["assert:", "includesSubString:", "deny:"],
  4671. referencedClasses: []
  4672. }),
  4673. smalltalk.StringTest);
  4674. smalltalk.addMethod(
  4675. smalltalk.method({
  4676. selector: "testIsVowel",
  4677. protocol: 'tests',
  4678. fn: function (){
  4679. var self=this;
  4680. var vowel,consonant;
  4681. return smalltalk.withContext(function($ctx1) {
  4682. var $1;
  4683. vowel="u";
  4684. consonant="z";
  4685. $1=_st(vowel)._isVowel();
  4686. $ctx1.sendIdx["isVowel"]=1;
  4687. self._assert_equals_($1,true);
  4688. $ctx1.sendIdx["assert:equals:"]=1;
  4689. self._assert_equals_(_st(consonant)._isVowel(),false);
  4690. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4691. args: [],
  4692. 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",
  4693. messageSends: ["assert:equals:", "isVowel"],
  4694. referencedClasses: []
  4695. }),
  4696. smalltalk.StringTest);
  4697. smalltalk.addMethod(
  4698. smalltalk.method({
  4699. selector: "testJoin",
  4700. protocol: 'tests',
  4701. fn: function (){
  4702. var self=this;
  4703. return smalltalk.withContext(function($ctx1) {
  4704. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4705. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4706. args: [],
  4707. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4708. messageSends: ["assert:equals:", "join:"],
  4709. referencedClasses: []
  4710. }),
  4711. smalltalk.StringTest);
  4712. smalltalk.addMethod(
  4713. smalltalk.method({
  4714. selector: "testRemoveAll",
  4715. protocol: 'tests',
  4716. fn: function (){
  4717. var self=this;
  4718. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4719. return smalltalk.withContext(function($ctx1) {
  4720. self._should_raise_((function(){
  4721. return smalltalk.withContext(function($ctx2) {
  4722. return _st(self._collection())._removeAll();
  4723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4724. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4725. args: [],
  4726. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4727. messageSends: ["should:raise:", "removeAll", "collection"],
  4728. referencedClasses: ["Error"]
  4729. }),
  4730. smalltalk.StringTest);
  4731. smalltalk.addMethod(
  4732. smalltalk.method({
  4733. selector: "testReversed",
  4734. protocol: 'tests',
  4735. fn: function (){
  4736. var self=this;
  4737. return smalltalk.withContext(function($ctx1) {
  4738. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4739. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4740. args: [],
  4741. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4742. messageSends: ["assert:equals:", "reversed"],
  4743. referencedClasses: []
  4744. }),
  4745. smalltalk.StringTest);
  4746. smalltalk.addMethod(
  4747. smalltalk.method({
  4748. selector: "testStreamContents",
  4749. protocol: 'tests',
  4750. fn: function (){
  4751. var self=this;
  4752. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4753. return smalltalk.withContext(function($ctx1) {
  4754. var $1;
  4755. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4756. return smalltalk.withContext(function($ctx2) {
  4757. _st(aStream)._nextPutAll_("hello");
  4758. $ctx2.sendIdx["nextPutAll:"]=1;
  4759. _st(aStream)._space();
  4760. $1=_st(aStream)._nextPutAll_("world");
  4761. return $1;
  4762. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4763. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4764. args: [],
  4765. 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'",
  4766. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4767. referencedClasses: ["String"]
  4768. }),
  4769. smalltalk.StringTest);
  4770. smalltalk.addMethod(
  4771. smalltalk.method({
  4772. selector: "testSubStrings",
  4773. protocol: 'tests',
  4774. fn: function (){
  4775. var self=this;
  4776. return smalltalk.withContext(function($ctx1) {
  4777. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4778. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4779. args: [],
  4780. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4781. messageSends: ["assert:equals:", "subStrings:"],
  4782. referencedClasses: []
  4783. }),
  4784. smalltalk.StringTest);
  4785. smalltalk.addMethod(
  4786. smalltalk.method({
  4787. selector: "testTrim",
  4788. protocol: 'tests',
  4789. fn: function (){
  4790. var self=this;
  4791. return smalltalk.withContext(function($ctx1) {
  4792. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4793. $ctx1.sendIdx["assert:equals:"]=1;
  4794. self._assert_equals_("jackie "._trimRight(),"jackie");
  4795. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4796. args: [],
  4797. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4798. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4799. referencedClasses: []
  4800. }),
  4801. smalltalk.StringTest);
  4802. smalltalk.addMethod(
  4803. smalltalk.method({
  4804. selector: "collectionClass",
  4805. protocol: 'fixture',
  4806. fn: function (){
  4807. var self=this;
  4808. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4809. return smalltalk.withContext(function($ctx1) {
  4810. return $String();
  4811. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4812. args: [],
  4813. source: "collectionClass\x0a\x09^ String",
  4814. messageSends: [],
  4815. referencedClasses: ["String"]
  4816. }),
  4817. smalltalk.StringTest.klass);
  4818. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  4819. smalltalk.addMethod(
  4820. smalltalk.method({
  4821. selector: "collection",
  4822. protocol: 'fixture',
  4823. fn: function (){
  4824. var self=this;
  4825. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4826. return smalltalk.withContext(function($ctx1) {
  4827. var $2,$3,$1;
  4828. $2=_st($Set())._new();
  4829. _st($2)._add_((1));
  4830. $ctx1.sendIdx["add:"]=1;
  4831. _st($2)._add_((2));
  4832. $ctx1.sendIdx["add:"]=2;
  4833. _st($2)._add_((3));
  4834. $ctx1.sendIdx["add:"]=3;
  4835. _st($2)._add_((-4));
  4836. $3=_st($2)._yourself();
  4837. $1=$3;
  4838. return $1;
  4839. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  4840. args: [],
  4841. 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",
  4842. messageSends: ["add:", "new", "yourself"],
  4843. referencedClasses: ["Set"]
  4844. }),
  4845. smalltalk.SetTest);
  4846. smalltalk.addMethod(
  4847. smalltalk.method({
  4848. selector: "collectionOfPrintStrings",
  4849. protocol: 'fixture',
  4850. fn: function (){
  4851. var self=this;
  4852. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4853. return smalltalk.withContext(function($ctx1) {
  4854. var $2,$3,$1;
  4855. $2=_st($Set())._new();
  4856. _st($2)._add_("1");
  4857. $ctx1.sendIdx["add:"]=1;
  4858. _st($2)._add_("2");
  4859. $ctx1.sendIdx["add:"]=2;
  4860. _st($2)._add_("3");
  4861. $ctx1.sendIdx["add:"]=3;
  4862. _st($2)._add_("-4");
  4863. $3=_st($2)._yourself();
  4864. $1=$3;
  4865. return $1;
  4866. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  4867. args: [],
  4868. 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",
  4869. messageSends: ["add:", "new", "yourself"],
  4870. referencedClasses: ["Set"]
  4871. }),
  4872. smalltalk.SetTest);
  4873. smalltalk.addMethod(
  4874. smalltalk.method({
  4875. selector: "collectionSize",
  4876. protocol: 'fixture',
  4877. fn: function (){
  4878. var self=this;
  4879. return smalltalk.withContext(function($ctx1) {
  4880. return (4);
  4881. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  4882. args: [],
  4883. source: "collectionSize\x0a\x09^ 4",
  4884. messageSends: [],
  4885. referencedClasses: []
  4886. }),
  4887. smalltalk.SetTest);
  4888. smalltalk.addMethod(
  4889. smalltalk.method({
  4890. selector: "collectionWithDuplicates",
  4891. protocol: 'fixture',
  4892. fn: function (){
  4893. var self=this;
  4894. return smalltalk.withContext(function($ctx1) {
  4895. var $2,$3,$1;
  4896. $2=self._collection();
  4897. _st($2)._add_("yet another");
  4898. $3=_st($2)._yourself();
  4899. $1=$3;
  4900. return $1;
  4901. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  4902. args: [],
  4903. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  4904. messageSends: ["add:", "collection", "yourself"],
  4905. referencedClasses: []
  4906. }),
  4907. smalltalk.SetTest);
  4908. smalltalk.addMethod(
  4909. smalltalk.method({
  4910. selector: "collectionWithNewValue",
  4911. protocol: 'fixture',
  4912. fn: function (){
  4913. var self=this;
  4914. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4915. return smalltalk.withContext(function($ctx1) {
  4916. var $2,$3,$1;
  4917. $2=_st($Set())._new();
  4918. _st($2)._add_((1));
  4919. $ctx1.sendIdx["add:"]=1;
  4920. _st($2)._add_((2));
  4921. $ctx1.sendIdx["add:"]=2;
  4922. _st($2)._add_((3));
  4923. $ctx1.sendIdx["add:"]=3;
  4924. _st($2)._add_("N");
  4925. $ctx1.sendIdx["add:"]=4;
  4926. _st($2)._add_((-4));
  4927. $3=_st($2)._yourself();
  4928. $1=$3;
  4929. return $1;
  4930. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  4931. args: [],
  4932. 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",
  4933. messageSends: ["add:", "new", "yourself"],
  4934. referencedClasses: ["Set"]
  4935. }),
  4936. smalltalk.SetTest);
  4937. smalltalk.addMethod(
  4938. smalltalk.method({
  4939. selector: "testAddAll",
  4940. protocol: 'tests',
  4941. fn: function (){
  4942. var self=this;
  4943. return smalltalk.withContext(function($ctx1) {
  4944. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  4945. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  4946. $2=self._collection();
  4947. $ctx1.sendIdx["collection"]=1;
  4948. $3=$2;
  4949. $4=self._collection();
  4950. $ctx1.sendIdx["collection"]=2;
  4951. _st($3)._addAll_($4);
  4952. $ctx1.sendIdx["addAll:"]=1;
  4953. $5=_st($2)._yourself();
  4954. $ctx1.sendIdx["yourself"]=1;
  4955. $1=$5;
  4956. $6=self._collection();
  4957. $ctx1.sendIdx["collection"]=3;
  4958. self._assert_equals_($1,$6);
  4959. $ctx1.sendIdx["assert:equals:"]=1;
  4960. $8=self._collection();
  4961. $ctx1.sendIdx["collection"]=4;
  4962. $9=$8;
  4963. $10=self._collectionWithNewValue();
  4964. $ctx1.sendIdx["collectionWithNewValue"]=1;
  4965. _st($9)._addAll_($10);
  4966. $ctx1.sendIdx["addAll:"]=2;
  4967. $11=_st($8)._yourself();
  4968. $ctx1.sendIdx["yourself"]=2;
  4969. $7=$11;
  4970. $12=self._collectionWithNewValue();
  4971. $ctx1.sendIdx["collectionWithNewValue"]=2;
  4972. self._assert_equals_($7,$12);
  4973. $ctx1.sendIdx["assert:equals:"]=2;
  4974. $14=self._collectionWithNewValue();
  4975. $ctx1.sendIdx["collectionWithNewValue"]=3;
  4976. _st($14)._addAll_(self._collection());
  4977. $15=_st($14)._yourself();
  4978. $13=$15;
  4979. self._assert_equals_($13,self._collectionWithNewValue());
  4980. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  4981. args: [],
  4982. 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",
  4983. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  4984. referencedClasses: []
  4985. }),
  4986. smalltalk.SetTest);
  4987. smalltalk.addMethod(
  4988. smalltalk.method({
  4989. selector: "testAddRemove",
  4990. protocol: 'tests',
  4991. fn: function (){
  4992. var self=this;
  4993. var set;
  4994. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4995. return smalltalk.withContext(function($ctx1) {
  4996. var $1,$2;
  4997. set=_st($Set())._new();
  4998. self._assert_(_st(set)._isEmpty());
  4999. $ctx1.sendIdx["assert:"]=1;
  5000. _st(set)._add_((3));
  5001. $ctx1.sendIdx["add:"]=1;
  5002. $1=_st(set)._includes_((3));
  5003. $ctx1.sendIdx["includes:"]=1;
  5004. self._assert_($1);
  5005. $ctx1.sendIdx["assert:"]=2;
  5006. _st(set)._add_((5));
  5007. $2=_st(set)._includes_((5));
  5008. $ctx1.sendIdx["includes:"]=2;
  5009. self._assert_($2);
  5010. _st(set)._remove_((3));
  5011. self._deny_(_st(set)._includes_((3)));
  5012. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5013. args: [],
  5014. 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)",
  5015. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5016. referencedClasses: ["Set"]
  5017. }),
  5018. smalltalk.SetTest);
  5019. smalltalk.addMethod(
  5020. smalltalk.method({
  5021. selector: "testAt",
  5022. protocol: 'tests',
  5023. fn: function (){
  5024. var self=this;
  5025. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5026. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5027. return smalltalk.withContext(function($ctx1) {
  5028. self._should_raise_((function(){
  5029. return smalltalk.withContext(function($ctx2) {
  5030. return _st(_st($Set())._new())._at_put_((1),(2));
  5031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5032. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5033. args: [],
  5034. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5035. messageSends: ["should:raise:", "at:put:", "new"],
  5036. referencedClasses: ["Set", "Error"]
  5037. }),
  5038. smalltalk.SetTest);
  5039. smalltalk.addMethod(
  5040. smalltalk.method({
  5041. selector: "testCollect",
  5042. protocol: 'tests',
  5043. fn: function (){
  5044. var self=this;
  5045. return smalltalk.withContext(function($ctx1) {
  5046. var $2,$1;
  5047. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5048. $2=[(5), (6), (8)]._asSet();
  5049. $ctx1.sendIdx["asSet"]=1;
  5050. $1=_st($2)._collect_((function(x){
  5051. return smalltalk.withContext(function($ctx2) {
  5052. return _st(x).__backslash_backslash((3));
  5053. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5054. self._assert_equals_($1,[(0), (2)]._asSet());
  5055. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5056. args: [],
  5057. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5058. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5059. referencedClasses: []
  5060. }),
  5061. smalltalk.SetTest);
  5062. smalltalk.addMethod(
  5063. smalltalk.method({
  5064. selector: "testComma",
  5065. protocol: 'tests',
  5066. fn: function (){
  5067. var self=this;
  5068. return smalltalk.withContext(function($ctx1) {
  5069. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5070. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5071. $2=self._collection();
  5072. $ctx1.sendIdx["collection"]=1;
  5073. $3=self._collection();
  5074. $ctx1.sendIdx["collection"]=2;
  5075. $1=_st($2).__comma($3);
  5076. $ctx1.sendIdx[","]=1;
  5077. $4=self._collection();
  5078. $ctx1.sendIdx["collection"]=3;
  5079. self._assert_equals_($1,$4);
  5080. $ctx1.sendIdx["assert:equals:"]=1;
  5081. $6=self._collection();
  5082. $ctx1.sendIdx["collection"]=4;
  5083. $7=self._collectionWithNewValue();
  5084. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5085. $5=_st($6).__comma($7);
  5086. $ctx1.sendIdx[","]=2;
  5087. $8=self._collectionWithNewValue();
  5088. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5089. self._assert_equals_($5,$8);
  5090. $ctx1.sendIdx["assert:equals:"]=2;
  5091. $10=self._collectionWithNewValue();
  5092. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5093. $9=_st($10).__comma(self._collection());
  5094. self._assert_equals_($9,self._collectionWithNewValue());
  5095. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5096. args: [],
  5097. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  5098. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5099. referencedClasses: []
  5100. }),
  5101. smalltalk.SetTest);
  5102. smalltalk.addMethod(
  5103. smalltalk.method({
  5104. selector: "testComparing",
  5105. protocol: 'tests',
  5106. fn: function (){
  5107. var self=this;
  5108. return smalltalk.withContext(function($ctx1) {
  5109. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5110. $1=[(0), (2)]._asSet();
  5111. $ctx1.sendIdx["asSet"]=1;
  5112. $2=[(0), (2)]._asSet();
  5113. $ctx1.sendIdx["asSet"]=2;
  5114. self._assert_equals_($1,$2);
  5115. $ctx1.sendIdx["assert:equals:"]=1;
  5116. $3=[(2), (0)]._asSet();
  5117. $ctx1.sendIdx["asSet"]=3;
  5118. $4=[(0), (2)]._asSet();
  5119. $ctx1.sendIdx["asSet"]=4;
  5120. self._assert_equals_($3,$4);
  5121. $6=[(0), (2), (3)]._asSet();
  5122. $ctx1.sendIdx["asSet"]=5;
  5123. $7=[(0), (2)]._asSet();
  5124. $ctx1.sendIdx["asSet"]=6;
  5125. $5=_st($6).__eq($7);
  5126. $ctx1.sendIdx["="]=1;
  5127. self._deny_($5);
  5128. $ctx1.sendIdx["deny:"]=1;
  5129. $9=[(1), (2)]._asSet();
  5130. $ctx1.sendIdx["asSet"]=7;
  5131. $8=_st($9).__eq([(0), (2)]._asSet());
  5132. self._deny_($8);
  5133. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5134. args: [],
  5135. 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",
  5136. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5137. referencedClasses: []
  5138. }),
  5139. smalltalk.SetTest);
  5140. smalltalk.addMethod(
  5141. smalltalk.method({
  5142. selector: "testPrintString",
  5143. protocol: 'tests',
  5144. fn: function (){
  5145. var self=this;
  5146. var set;
  5147. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5148. return smalltalk.withContext(function($ctx1) {
  5149. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5150. set=_st($Set())._new();
  5151. $1=_st(set)._printString();
  5152. $ctx1.sendIdx["printString"]=1;
  5153. self._assert_equals_($1,"a Set ()");
  5154. $ctx1.sendIdx["assert:equals:"]=1;
  5155. $2=set;
  5156. _st($2)._add_((1));
  5157. $ctx1.sendIdx["add:"]=1;
  5158. $3=_st($2)._add_((3));
  5159. $ctx1.sendIdx["add:"]=2;
  5160. $4=_st(set)._printString();
  5161. $ctx1.sendIdx["printString"]=2;
  5162. self._assert_equals_($4,"a Set (1 3)");
  5163. $ctx1.sendIdx["assert:equals:"]=2;
  5164. _st(set)._add_("foo");
  5165. $ctx1.sendIdx["add:"]=3;
  5166. $5=_st(set)._printString();
  5167. $ctx1.sendIdx["printString"]=3;
  5168. self._assert_equals_($5,"a Set (1 3 'foo')");
  5169. $ctx1.sendIdx["assert:equals:"]=3;
  5170. $6=set;
  5171. _st($6)._remove_((1));
  5172. $ctx1.sendIdx["remove:"]=1;
  5173. $7=_st($6)._remove_((3));
  5174. $8=_st(set)._printString();
  5175. $ctx1.sendIdx["printString"]=4;
  5176. self._assert_equals_($8,"a Set ('foo')");
  5177. $ctx1.sendIdx["assert:equals:"]=4;
  5178. _st(set)._add_((3));
  5179. $ctx1.sendIdx["add:"]=4;
  5180. $9=_st(set)._printString();
  5181. $ctx1.sendIdx["printString"]=5;
  5182. self._assert_equals_($9,"a Set ('foo' 3)");
  5183. $ctx1.sendIdx["assert:equals:"]=5;
  5184. _st(set)._add_((3));
  5185. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5186. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5187. args: [],
  5188. 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)'",
  5189. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5190. referencedClasses: ["Set"]
  5191. }),
  5192. smalltalk.SetTest);
  5193. smalltalk.addMethod(
  5194. smalltalk.method({
  5195. selector: "testUnboxedObjects",
  5196. protocol: 'tests',
  5197. fn: function (){
  5198. var self=this;
  5199. return smalltalk.withContext(function($ctx1) {
  5200. var $4,$3,$2,$1;
  5201. $4="foo"._yourself();
  5202. $ctx1.sendIdx["yourself"]=1;
  5203. $3=[$4,"foo"._yourself()];
  5204. $2=_st($3)._asSet();
  5205. $1=_st($2)._asArray();
  5206. self._assert_equals_($1,["foo"]);
  5207. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5208. args: [],
  5209. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5210. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5211. referencedClasses: []
  5212. }),
  5213. smalltalk.SetTest);
  5214. smalltalk.addMethod(
  5215. smalltalk.method({
  5216. selector: "testUnicity",
  5217. protocol: 'tests',
  5218. fn: function (){
  5219. var self=this;
  5220. var set;
  5221. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5222. return smalltalk.withContext(function($ctx1) {
  5223. var $1;
  5224. set=_st($Set())._new();
  5225. _st(set)._add_((21));
  5226. $ctx1.sendIdx["add:"]=1;
  5227. _st(set)._add_("hello");
  5228. $ctx1.sendIdx["add:"]=2;
  5229. _st(set)._add_((21));
  5230. $ctx1.sendIdx["add:"]=3;
  5231. $1=_st(set)._size();
  5232. $ctx1.sendIdx["size"]=1;
  5233. self._assert_equals_($1,(2));
  5234. $ctx1.sendIdx["assert:equals:"]=1;
  5235. _st(set)._add_("hello");
  5236. self._assert_equals_(_st(set)._size(),(2));
  5237. $ctx1.sendIdx["assert:equals:"]=2;
  5238. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5239. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5240. args: [],
  5241. 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')",
  5242. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5243. referencedClasses: ["Set"]
  5244. }),
  5245. smalltalk.SetTest);
  5246. smalltalk.addMethod(
  5247. smalltalk.method({
  5248. selector: "collectionClass",
  5249. protocol: 'fixture',
  5250. fn: function (){
  5251. var self=this;
  5252. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5253. return smalltalk.withContext(function($ctx1) {
  5254. return $Set();
  5255. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5256. args: [],
  5257. source: "collectionClass\x0a\x09^ Set",
  5258. messageSends: [],
  5259. referencedClasses: ["Set"]
  5260. }),
  5261. smalltalk.SetTest.klass);
  5262. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5263. smalltalk.addMethod(
  5264. smalltalk.method({
  5265. selector: "testShow",
  5266. protocol: 'tests',
  5267. fn: function (){
  5268. var self=this;
  5269. var originalTranscript;
  5270. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5271. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5272. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5273. return smalltalk.withContext(function($ctx1) {
  5274. originalTranscript=_st($Transcript())._current();
  5275. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5276. $ctx1.sendIdx["register:"]=1;
  5277. self._shouldnt_raise_((function(){
  5278. return smalltalk.withContext(function($ctx2) {
  5279. return _st($Transcript())._show_("Hello console!");
  5280. $ctx2.sendIdx["show:"]=1;
  5281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5282. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5283. self._shouldnt_raise_((function(){
  5284. return smalltalk.withContext(function($ctx2) {
  5285. return _st($Transcript())._show_(console);
  5286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5287. _st($Transcript())._register_(originalTranscript);
  5288. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5289. args: [],
  5290. 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.",
  5291. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5292. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5293. }),
  5294. smalltalk.ConsoleTranscriptTest);
  5295. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5296. smalltalk.addMethod(
  5297. smalltalk.method({
  5298. selector: "jsObject",
  5299. protocol: 'accessing',
  5300. fn: function (){
  5301. var self=this;
  5302. return smalltalk.withContext(function($ctx1) {
  5303. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5304. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5305. args: [],
  5306. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5307. messageSends: [],
  5308. referencedClasses: []
  5309. }),
  5310. smalltalk.JSObjectProxyTest);
  5311. smalltalk.addMethod(
  5312. smalltalk.method({
  5313. selector: "testAtIfAbsent",
  5314. protocol: 'tests',
  5315. fn: function (){
  5316. var self=this;
  5317. var testObject;
  5318. return smalltalk.withContext(function($ctx1) {
  5319. var $1,$2,$3;
  5320. testObject=self._jsObject();
  5321. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5322. return smalltalk.withContext(function($ctx2) {
  5323. return "Property does not exist";
  5324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5325. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5326. self._assert_equals_($1,"Property does not exist");
  5327. $ctx1.sendIdx["assert:equals:"]=1;
  5328. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5329. return smalltalk.withContext(function($ctx2) {
  5330. return "Property does not exist";
  5331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5332. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5333. self._assert_equals_($2,nil);
  5334. $ctx1.sendIdx["assert:equals:"]=2;
  5335. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5336. return smalltalk.withContext(function($ctx2) {
  5337. return "Property does not exist";
  5338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5339. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5340. self._assert_equals_($3,(1));
  5341. $ctx1.sendIdx["assert:equals:"]=3;
  5342. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5343. return smalltalk.withContext(function($ctx2) {
  5344. return "Property does not exist";
  5345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5346. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5347. args: [],
  5348. 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.",
  5349. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5350. referencedClasses: []
  5351. }),
  5352. smalltalk.JSObjectProxyTest);
  5353. smalltalk.addMethod(
  5354. smalltalk.method({
  5355. selector: "testAtIfPresent",
  5356. protocol: 'tests',
  5357. fn: function (){
  5358. var self=this;
  5359. var testObject;
  5360. return smalltalk.withContext(function($ctx1) {
  5361. var $2,$1,$4,$3,$6,$5;
  5362. testObject=self._jsObject();
  5363. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5364. return smalltalk.withContext(function($ctx2) {
  5365. $2=_st(x)._asString();
  5366. $ctx2.sendIdx["asString"]=1;
  5367. return "hello ".__comma($2);
  5368. $ctx2.sendIdx[","]=1;
  5369. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5370. $ctx1.sendIdx["at:ifPresent:"]=1;
  5371. self._assert_equals_($1,nil);
  5372. $ctx1.sendIdx["assert:equals:"]=1;
  5373. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5374. return smalltalk.withContext(function($ctx2) {
  5375. $4=_st(x)._asString();
  5376. $ctx2.sendIdx["asString"]=2;
  5377. return "hello ".__comma($4);
  5378. $ctx2.sendIdx[","]=2;
  5379. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5380. $ctx1.sendIdx["at:ifPresent:"]=2;
  5381. self._assert_equals_($3,"hello nil");
  5382. $ctx1.sendIdx["assert:equals:"]=2;
  5383. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5384. return smalltalk.withContext(function($ctx2) {
  5385. $6=_st(x)._asString();
  5386. $ctx2.sendIdx["asString"]=3;
  5387. return "hello ".__comma($6);
  5388. $ctx2.sendIdx[","]=3;
  5389. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5390. $ctx1.sendIdx["at:ifPresent:"]=3;
  5391. self._assert_equals_($5,"hello 1");
  5392. $ctx1.sendIdx["assert:equals:"]=3;
  5393. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5394. return smalltalk.withContext(function($ctx2) {
  5395. return "hello ".__comma(_st(x)._asString());
  5396. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5397. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5398. args: [],
  5399. 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'.",
  5400. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5401. referencedClasses: []
  5402. }),
  5403. smalltalk.JSObjectProxyTest);
  5404. smalltalk.addMethod(
  5405. smalltalk.method({
  5406. selector: "testAtIfPresentIfAbsent",
  5407. protocol: 'tests',
  5408. fn: function (){
  5409. var self=this;
  5410. var testObject;
  5411. return smalltalk.withContext(function($ctx1) {
  5412. var $2,$1,$4,$3,$6,$5;
  5413. testObject=self._jsObject();
  5414. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5415. return smalltalk.withContext(function($ctx2) {
  5416. $2=_st(x)._asString();
  5417. $ctx2.sendIdx["asString"]=1;
  5418. return "hello ".__comma($2);
  5419. $ctx2.sendIdx[","]=1;
  5420. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5421. return smalltalk.withContext(function($ctx2) {
  5422. return "not present";
  5423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5424. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5425. self._assert_equals_($1,"not present");
  5426. $ctx1.sendIdx["assert:equals:"]=1;
  5427. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5428. return smalltalk.withContext(function($ctx2) {
  5429. $4=_st(x)._asString();
  5430. $ctx2.sendIdx["asString"]=2;
  5431. return "hello ".__comma($4);
  5432. $ctx2.sendIdx[","]=2;
  5433. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5434. return smalltalk.withContext(function($ctx2) {
  5435. return "not present";
  5436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5437. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5438. self._assert_equals_($3,"hello nil");
  5439. $ctx1.sendIdx["assert:equals:"]=2;
  5440. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5441. return smalltalk.withContext(function($ctx2) {
  5442. $6=_st(x)._asString();
  5443. $ctx2.sendIdx["asString"]=3;
  5444. return "hello ".__comma($6);
  5445. $ctx2.sendIdx[","]=3;
  5446. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5447. return smalltalk.withContext(function($ctx2) {
  5448. return "not present";
  5449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5450. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5451. self._assert_equals_($5,"hello 1");
  5452. $ctx1.sendIdx["assert:equals:"]=3;
  5453. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5454. return smalltalk.withContext(function($ctx2) {
  5455. return "hello ".__comma(_st(x)._asString());
  5456. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5457. return smalltalk.withContext(function($ctx2) {
  5458. return "not present";
  5459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5460. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5461. args: [],
  5462. 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'.",
  5463. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5464. referencedClasses: []
  5465. }),
  5466. smalltalk.JSObjectProxyTest);
  5467. smalltalk.addMethod(
  5468. smalltalk.method({
  5469. selector: "testAtPut",
  5470. protocol: 'tests',
  5471. fn: function (){
  5472. var self=this;
  5473. var testObject;
  5474. return smalltalk.withContext(function($ctx1) {
  5475. var $2,$1;
  5476. testObject=self._jsObject();
  5477. $2=_st(testObject)._at_("abc");
  5478. $ctx1.sendIdx["at:"]=1;
  5479. $1=_st($2).__tild_eq("xyz");
  5480. self._assert_($1);
  5481. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5482. $ctx1.sendIdx["assert:equals:"]=1;
  5483. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5484. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5485. args: [],
  5486. 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'",
  5487. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5488. referencedClasses: []
  5489. }),
  5490. smalltalk.JSObjectProxyTest);
  5491. smalltalk.addMethod(
  5492. smalltalk.method({
  5493. selector: "testDNU",
  5494. protocol: 'tests',
  5495. fn: function (){
  5496. var self=this;
  5497. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5498. return smalltalk.withContext(function($ctx1) {
  5499. self._should_raise_((function(){
  5500. return smalltalk.withContext(function($ctx2) {
  5501. return _st(self._jsObject())._foo();
  5502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5503. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5504. args: [],
  5505. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5506. messageSends: ["should:raise:", "foo", "jsObject"],
  5507. referencedClasses: ["MessageNotUnderstood"]
  5508. }),
  5509. smalltalk.JSObjectProxyTest);
  5510. smalltalk.addMethod(
  5511. smalltalk.method({
  5512. selector: "testMessageSend",
  5513. protocol: 'tests',
  5514. fn: function (){
  5515. var self=this;
  5516. return smalltalk.withContext(function($ctx1) {
  5517. var $2,$1,$4,$3;
  5518. $2=self._jsObject();
  5519. $ctx1.sendIdx["jsObject"]=1;
  5520. $1=_st($2)._a();
  5521. self._assert_equals_($1,(1));
  5522. $ctx1.sendIdx["assert:equals:"]=1;
  5523. $4=self._jsObject();
  5524. $ctx1.sendIdx["jsObject"]=2;
  5525. $3=_st($4)._b();
  5526. self._assert_equals_($3,(2));
  5527. $ctx1.sendIdx["assert:equals:"]=2;
  5528. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5529. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5530. args: [],
  5531. 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",
  5532. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5533. referencedClasses: []
  5534. }),
  5535. smalltalk.JSObjectProxyTest);
  5536. smalltalk.addMethod(
  5537. smalltalk.method({
  5538. selector: "testMethodWithArguments",
  5539. protocol: 'tests',
  5540. fn: function (){
  5541. var self=this;
  5542. return smalltalk.withContext(function($ctx1) {
  5543. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5544. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5545. args: [],
  5546. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5547. messageSends: ["assert:equals:", "c:", "jsObject"],
  5548. referencedClasses: []
  5549. }),
  5550. smalltalk.JSObjectProxyTest);
  5551. smalltalk.addMethod(
  5552. smalltalk.method({
  5553. selector: "testPrinting",
  5554. protocol: 'tests',
  5555. fn: function (){
  5556. var self=this;
  5557. return smalltalk.withContext(function($ctx1) {
  5558. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5559. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5560. args: [],
  5561. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5562. messageSends: ["assert:equals:", "printString", "jsObject"],
  5563. referencedClasses: []
  5564. }),
  5565. smalltalk.JSObjectProxyTest);
  5566. smalltalk.addMethod(
  5567. smalltalk.method({
  5568. selector: "testPropertyThatReturnsEmptyString",
  5569. protocol: 'tests',
  5570. fn: function (){
  5571. var self=this;
  5572. var object;
  5573. return smalltalk.withContext(function($ctx1) {
  5574. var $1;
  5575. object=self._jsObject();
  5576. $1=_st(object)._d();
  5577. $ctx1.sendIdx["d"]=1;
  5578. self._assert_equals_($1,"");
  5579. $ctx1.sendIdx["assert:equals:"]=1;
  5580. _st(object)._d_("hello");
  5581. self._assert_equals_(_st(object)._d(),"hello");
  5582. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5583. args: [],
  5584. 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'",
  5585. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5586. referencedClasses: []
  5587. }),
  5588. smalltalk.JSObjectProxyTest);
  5589. smalltalk.addMethod(
  5590. smalltalk.method({
  5591. selector: "testPropertyThatReturnsUndefined",
  5592. protocol: 'tests',
  5593. fn: function (){
  5594. var self=this;
  5595. var object;
  5596. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5597. return smalltalk.withContext(function($ctx1) {
  5598. object=self._jsObject();
  5599. self._shouldnt_raise_((function(){
  5600. return smalltalk.withContext(function($ctx2) {
  5601. return _st(object)._e();
  5602. $ctx2.sendIdx["e"]=1;
  5603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5604. self._assert_(_st(_st(object)._e())._isNil());
  5605. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5606. args: [],
  5607. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5608. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5609. referencedClasses: ["MessageNotUnderstood"]
  5610. }),
  5611. smalltalk.JSObjectProxyTest);
  5612. smalltalk.addMethod(
  5613. smalltalk.method({
  5614. selector: "testValue",
  5615. protocol: 'tests',
  5616. fn: function (){
  5617. var self=this;
  5618. var testObject;
  5619. return smalltalk.withContext(function($ctx1) {
  5620. testObject=self._jsObject();
  5621. _st(testObject)._at_put_("value","aValue");
  5622. self._assert_equals_(_st(testObject)._value(),"aValue");
  5623. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5624. args: [],
  5625. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5626. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5627. referencedClasses: []
  5628. }),
  5629. smalltalk.JSObjectProxyTest);
  5630. smalltalk.addMethod(
  5631. smalltalk.method({
  5632. selector: "testYourself",
  5633. protocol: 'tests',
  5634. fn: function (){
  5635. var self=this;
  5636. var object;
  5637. return smalltalk.withContext(function($ctx1) {
  5638. var $1,$2;
  5639. $1=self._jsObject();
  5640. _st($1)._d_("test");
  5641. $2=_st($1)._yourself();
  5642. object=$2;
  5643. self._assert_equals_(_st(object)._d(),"test");
  5644. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5645. args: [],
  5646. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5647. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5648. referencedClasses: []
  5649. }),
  5650. smalltalk.JSObjectProxyTest);
  5651. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5652. smalltalk.addMethod(
  5653. smalltalk.method({
  5654. selector: "testCatchingException",
  5655. protocol: 'tests',
  5656. fn: function (){
  5657. var self=this;
  5658. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5659. return smalltalk.withContext(function($ctx1) {
  5660. _st((function(){
  5661. return smalltalk.withContext(function($ctx2) {
  5662. return self._throwException();
  5663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5664. return smalltalk.withContext(function($ctx2) {
  5665. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5666. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5667. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5668. args: [],
  5669. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5670. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5671. referencedClasses: ["Error"]
  5672. }),
  5673. smalltalk.JavaScriptExceptionTest);
  5674. smalltalk.addMethod(
  5675. smalltalk.method({
  5676. selector: "testRaisingException",
  5677. protocol: 'tests',
  5678. fn: function (){
  5679. var self=this;
  5680. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5681. return smalltalk.withContext(function($ctx1) {
  5682. self._should_raise_((function(){
  5683. return smalltalk.withContext(function($ctx2) {
  5684. return self._throwException();
  5685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5686. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5687. args: [],
  5688. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5689. messageSends: ["should:raise:", "throwException"],
  5690. referencedClasses: ["JavaScriptException"]
  5691. }),
  5692. smalltalk.JavaScriptExceptionTest);
  5693. smalltalk.addMethod(
  5694. smalltalk.method({
  5695. selector: "throwException",
  5696. protocol: 'helpers',
  5697. fn: function (){
  5698. var self=this;
  5699. return smalltalk.withContext(function($ctx1) {
  5700. throw 'test';
  5701. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5702. args: [],
  5703. source: "throwException\x0a\x09<throw 'test'>",
  5704. messageSends: [],
  5705. referencedClasses: []
  5706. }),
  5707. smalltalk.JavaScriptExceptionTest);
  5708. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5709. smalltalk.addMethod(
  5710. smalltalk.method({
  5711. selector: "testValue",
  5712. protocol: 'tests',
  5713. fn: function (){
  5714. var self=this;
  5715. var messageSend;
  5716. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5717. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5718. return smalltalk.withContext(function($ctx1) {
  5719. var $1,$2;
  5720. $1=_st($MessageSend())._new();
  5721. $ctx1.sendIdx["new"]=1;
  5722. _st($1)._receiver_(_st($Object())._new());
  5723. _st($1)._selector_("asString");
  5724. $2=_st($1)._yourself();
  5725. messageSend=$2;
  5726. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5727. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5728. args: [],
  5729. 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'",
  5730. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5731. referencedClasses: ["MessageSend", "Object"]
  5732. }),
  5733. smalltalk.MessageSendTest);
  5734. smalltalk.addMethod(
  5735. smalltalk.method({
  5736. selector: "testValueWithArguments",
  5737. protocol: 'tests',
  5738. fn: function (){
  5739. var self=this;
  5740. var messageSend;
  5741. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5742. return smalltalk.withContext(function($ctx1) {
  5743. var $1,$2;
  5744. $1=_st($MessageSend())._new();
  5745. _st($1)._receiver_((2));
  5746. _st($1)._selector_("+");
  5747. $2=_st($1)._yourself();
  5748. messageSend=$2;
  5749. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5750. $ctx1.sendIdx["assert:equals:"]=1;
  5751. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5752. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5753. args: [],
  5754. 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",
  5755. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5756. referencedClasses: ["MessageSend"]
  5757. }),
  5758. smalltalk.MessageSendTest);
  5759. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5760. smalltalk.addMethod(
  5761. smalltalk.method({
  5762. selector: "codeGeneratorClass",
  5763. protocol: 'accessing',
  5764. fn: function (){
  5765. var self=this;
  5766. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5767. return smalltalk.withContext(function($ctx1) {
  5768. return $CodeGenerator();
  5769. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5770. args: [],
  5771. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5772. messageSends: [],
  5773. referencedClasses: ["CodeGenerator"]
  5774. }),
  5775. smalltalk.MethodInheritanceTest);
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "compiler",
  5779. protocol: 'factory',
  5780. fn: function (){
  5781. var self=this;
  5782. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5783. return smalltalk.withContext(function($ctx1) {
  5784. var $2,$3,$1;
  5785. $2=_st($Compiler())._new();
  5786. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5787. $3=_st($2)._yourself();
  5788. $1=$3;
  5789. return $1;
  5790. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5791. args: [],
  5792. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5793. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5794. referencedClasses: ["Compiler"]
  5795. }),
  5796. smalltalk.MethodInheritanceTest);
  5797. smalltalk.addMethod(
  5798. smalltalk.method({
  5799. selector: "deinstallBottom",
  5800. protocol: 'testing',
  5801. fn: function (){
  5802. var self=this;
  5803. return smalltalk.withContext(function($ctx1) {
  5804. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5805. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5806. args: [],
  5807. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5808. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5809. referencedClasses: []
  5810. }),
  5811. smalltalk.MethodInheritanceTest);
  5812. smalltalk.addMethod(
  5813. smalltalk.method({
  5814. selector: "deinstallMiddle",
  5815. protocol: 'testing',
  5816. fn: function (){
  5817. var self=this;
  5818. return smalltalk.withContext(function($ctx1) {
  5819. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5820. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5821. args: [],
  5822. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5823. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5824. referencedClasses: []
  5825. }),
  5826. smalltalk.MethodInheritanceTest);
  5827. smalltalk.addMethod(
  5828. smalltalk.method({
  5829. selector: "deinstallTop",
  5830. protocol: 'testing',
  5831. fn: function (){
  5832. var self=this;
  5833. return smalltalk.withContext(function($ctx1) {
  5834. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5835. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5836. args: [],
  5837. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5838. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5839. referencedClasses: []
  5840. }),
  5841. smalltalk.MethodInheritanceTest);
  5842. smalltalk.addMethod(
  5843. smalltalk.method({
  5844. selector: "installBottom:",
  5845. protocol: 'testing',
  5846. fn: function (aString){
  5847. var self=this;
  5848. return smalltalk.withContext(function($ctx1) {
  5849. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5850. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5851. args: ["aString"],
  5852. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5853. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5854. referencedClasses: []
  5855. }),
  5856. smalltalk.MethodInheritanceTest);
  5857. smalltalk.addMethod(
  5858. smalltalk.method({
  5859. selector: "installMiddle:",
  5860. protocol: 'testing',
  5861. fn: function (aString){
  5862. var self=this;
  5863. return smalltalk.withContext(function($ctx1) {
  5864. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5865. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5866. args: ["aString"],
  5867. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5868. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5869. referencedClasses: []
  5870. }),
  5871. smalltalk.MethodInheritanceTest);
  5872. smalltalk.addMethod(
  5873. smalltalk.method({
  5874. selector: "installTop:",
  5875. protocol: 'testing',
  5876. fn: function (aString){
  5877. var self=this;
  5878. return smalltalk.withContext(function($ctx1) {
  5879. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5880. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5881. args: ["aString"],
  5882. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5883. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5884. referencedClasses: []
  5885. }),
  5886. smalltalk.MethodInheritanceTest);
  5887. smalltalk.addMethod(
  5888. smalltalk.method({
  5889. selector: "setUp",
  5890. protocol: 'initialization',
  5891. fn: function (){
  5892. var self=this;
  5893. return smalltalk.withContext(function($ctx1) {
  5894. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5895. $ctx1.sendIdx["new"]=1;
  5896. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5897. $ctx1.sendIdx["new"]=2;
  5898. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5899. self["@method"]=nil;
  5900. self["@performBlock"]=(function(){
  5901. return smalltalk.withContext(function($ctx2) {
  5902. return self._error_("performBlock not initialized");
  5903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5904. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5905. args: [],
  5906. 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' ]",
  5907. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5908. referencedClasses: []
  5909. }),
  5910. smalltalk.MethodInheritanceTest);
  5911. smalltalk.addMethod(
  5912. smalltalk.method({
  5913. selector: "shouldMNU",
  5914. protocol: 'testing',
  5915. fn: function (){
  5916. var self=this;
  5917. return smalltalk.withContext(function($ctx1) {
  5918. self._shouldMNUTop();
  5919. self._shouldMNUMiddle();
  5920. self._shouldMNUBottom();
  5921. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  5922. args: [],
  5923. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  5924. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  5925. referencedClasses: []
  5926. }),
  5927. smalltalk.MethodInheritanceTest);
  5928. smalltalk.addMethod(
  5929. smalltalk.method({
  5930. selector: "shouldMNUBottom",
  5931. protocol: 'testing',
  5932. fn: function (){
  5933. var self=this;
  5934. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5935. return smalltalk.withContext(function($ctx1) {
  5936. self._should_raise_((function(){
  5937. return smalltalk.withContext(function($ctx2) {
  5938. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5940. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  5941. args: [],
  5942. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  5943. messageSends: ["should:raise:", "value:"],
  5944. referencedClasses: ["MessageNotUnderstood"]
  5945. }),
  5946. smalltalk.MethodInheritanceTest);
  5947. smalltalk.addMethod(
  5948. smalltalk.method({
  5949. selector: "shouldMNUMiddle",
  5950. protocol: 'testing',
  5951. fn: function (){
  5952. var self=this;
  5953. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5954. return smalltalk.withContext(function($ctx1) {
  5955. self._should_raise_((function(){
  5956. return smalltalk.withContext(function($ctx2) {
  5957. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5959. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  5960. args: [],
  5961. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  5962. messageSends: ["should:raise:", "value:"],
  5963. referencedClasses: ["MessageNotUnderstood"]
  5964. }),
  5965. smalltalk.MethodInheritanceTest);
  5966. smalltalk.addMethod(
  5967. smalltalk.method({
  5968. selector: "shouldMNUTop",
  5969. protocol: 'testing',
  5970. fn: function (){
  5971. var self=this;
  5972. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5973. return smalltalk.withContext(function($ctx1) {
  5974. self._should_raise_((function(){
  5975. return smalltalk.withContext(function($ctx2) {
  5976. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  5977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5978. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  5979. args: [],
  5980. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  5981. messageSends: ["should:raise:", "value:"],
  5982. referencedClasses: ["MessageNotUnderstood"]
  5983. }),
  5984. smalltalk.MethodInheritanceTest);
  5985. smalltalk.addMethod(
  5986. smalltalk.method({
  5987. selector: "shouldReturn:",
  5988. protocol: 'testing',
  5989. fn: function (anObject){
  5990. var self=this;
  5991. var result;
  5992. return smalltalk.withContext(function($ctx1) {
  5993. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5994. $ctx1.sendIdx["value:"]=1;
  5995. self._assert_equals_(["top",anObject],["top",result]);
  5996. $ctx1.sendIdx["assert:equals:"]=1;
  5997. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5998. $ctx1.sendIdx["value:"]=2;
  5999. self._assert_equals_(["middle",anObject],["middle",result]);
  6000. $ctx1.sendIdx["assert:equals:"]=2;
  6001. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6002. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6003. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6004. args: ["anObject"],
  6005. 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 }",
  6006. messageSends: ["value:", "assert:equals:"],
  6007. referencedClasses: []
  6008. }),
  6009. smalltalk.MethodInheritanceTest);
  6010. smalltalk.addMethod(
  6011. smalltalk.method({
  6012. selector: "shouldReturn:and:and:",
  6013. protocol: 'testing',
  6014. fn: function (anObject,anObject2,anObject3){
  6015. var self=this;
  6016. var result;
  6017. return smalltalk.withContext(function($ctx1) {
  6018. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6019. $ctx1.sendIdx["value:"]=1;
  6020. self._assert_equals_(["top",anObject],["top",result]);
  6021. $ctx1.sendIdx["assert:equals:"]=1;
  6022. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6023. $ctx1.sendIdx["value:"]=2;
  6024. self._assert_equals_(["middle",anObject2],["middle",result]);
  6025. $ctx1.sendIdx["assert:equals:"]=2;
  6026. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6027. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6028. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6029. args: ["anObject", "anObject2", "anObject3"],
  6030. 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 }",
  6031. messageSends: ["value:", "assert:equals:"],
  6032. referencedClasses: []
  6033. }),
  6034. smalltalk.MethodInheritanceTest);
  6035. smalltalk.addMethod(
  6036. smalltalk.method({
  6037. selector: "targetClassBottom",
  6038. protocol: 'accessing',
  6039. fn: function (){
  6040. var self=this;
  6041. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6042. return smalltalk.withContext(function($ctx1) {
  6043. return $JavaScriptException();
  6044. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6045. args: [],
  6046. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6047. messageSends: [],
  6048. referencedClasses: ["JavaScriptException"]
  6049. }),
  6050. smalltalk.MethodInheritanceTest);
  6051. smalltalk.addMethod(
  6052. smalltalk.method({
  6053. selector: "targetClassMiddle",
  6054. protocol: 'accessing',
  6055. fn: function (){
  6056. var self=this;
  6057. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6058. return smalltalk.withContext(function($ctx1) {
  6059. return $Error();
  6060. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6061. args: [],
  6062. source: "targetClassMiddle\x0a\x09^ Error",
  6063. messageSends: [],
  6064. referencedClasses: ["Error"]
  6065. }),
  6066. smalltalk.MethodInheritanceTest);
  6067. smalltalk.addMethod(
  6068. smalltalk.method({
  6069. selector: "targetClassTop",
  6070. protocol: 'accessing',
  6071. fn: function (){
  6072. var self=this;
  6073. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6074. return smalltalk.withContext(function($ctx1) {
  6075. return $Object();
  6076. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6077. args: [],
  6078. source: "targetClassTop\x0a\x09^ Object",
  6079. messageSends: [],
  6080. referencedClasses: ["Object"]
  6081. }),
  6082. smalltalk.MethodInheritanceTest);
  6083. smalltalk.addMethod(
  6084. smalltalk.method({
  6085. selector: "tearDown",
  6086. protocol: 'initialization',
  6087. fn: function (){
  6088. var self=this;
  6089. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6090. return smalltalk.withContext(function($ctx1) {
  6091. _st((function(){
  6092. return smalltalk.withContext(function($ctx2) {
  6093. return self._deinstallTop();
  6094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6095. return smalltalk.withContext(function($ctx2) {
  6096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6097. $ctx1.sendIdx["on:do:"]=1;
  6098. _st((function(){
  6099. return smalltalk.withContext(function($ctx2) {
  6100. return self._deinstallMiddle();
  6101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6102. return smalltalk.withContext(function($ctx2) {
  6103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6104. $ctx1.sendIdx["on:do:"]=2;
  6105. _st((function(){
  6106. return smalltalk.withContext(function($ctx2) {
  6107. return self._deinstallBottom();
  6108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6109. return smalltalk.withContext(function($ctx2) {
  6110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6111. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6112. args: [],
  6113. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6114. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6115. referencedClasses: ["Error"]
  6116. }),
  6117. smalltalk.MethodInheritanceTest);
  6118. smalltalk.addMethod(
  6119. smalltalk.method({
  6120. selector: "testMNU11",
  6121. protocol: 'tests',
  6122. fn: function (){
  6123. var self=this;
  6124. return smalltalk.withContext(function($ctx1) {
  6125. self["@performBlock"]=(function(x){
  6126. return smalltalk.withContext(function($ctx2) {
  6127. return _st(x)._foo();
  6128. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6129. self._shouldMNU();
  6130. $ctx1.sendIdx["shouldMNU"]=1;
  6131. self._installTop_("foo ^ false");
  6132. $ctx1.sendIdx["installTop:"]=1;
  6133. self._installTop_("foo ^ true");
  6134. self._deinstallTop();
  6135. self._shouldMNU();
  6136. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6137. args: [],
  6138. 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",
  6139. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6140. referencedClasses: []
  6141. }),
  6142. smalltalk.MethodInheritanceTest);
  6143. smalltalk.addMethod(
  6144. smalltalk.method({
  6145. selector: "testMNU22",
  6146. protocol: 'tests',
  6147. fn: function (){
  6148. var self=this;
  6149. return smalltalk.withContext(function($ctx1) {
  6150. self["@performBlock"]=(function(x){
  6151. return smalltalk.withContext(function($ctx2) {
  6152. return _st(x)._foo();
  6153. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6154. self._shouldMNU();
  6155. $ctx1.sendIdx["shouldMNU"]=1;
  6156. self._installMiddle_("foo ^ false");
  6157. $ctx1.sendIdx["installMiddle:"]=1;
  6158. self._installMiddle_("foo ^ true");
  6159. self._deinstallMiddle();
  6160. self._shouldMNU();
  6161. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6162. args: [],
  6163. 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",
  6164. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6165. referencedClasses: []
  6166. }),
  6167. smalltalk.MethodInheritanceTest);
  6168. smalltalk.addMethod(
  6169. smalltalk.method({
  6170. selector: "testReturns1",
  6171. protocol: 'tests',
  6172. fn: function (){
  6173. var self=this;
  6174. return smalltalk.withContext(function($ctx1) {
  6175. self["@performBlock"]=(function(x){
  6176. return smalltalk.withContext(function($ctx2) {
  6177. return _st(x)._foo();
  6178. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6179. self._installTop_("foo ^ false");
  6180. $ctx1.sendIdx["installTop:"]=1;
  6181. self._shouldReturn_(false);
  6182. $ctx1.sendIdx["shouldReturn:"]=1;
  6183. self._installTop_("foo ^ true");
  6184. self._shouldReturn_(true);
  6185. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6186. args: [],
  6187. 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",
  6188. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6189. referencedClasses: []
  6190. }),
  6191. smalltalk.MethodInheritanceTest);
  6192. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6193. smalltalk.addMethod(
  6194. smalltalk.method({
  6195. selector: "testAbs",
  6196. protocol: 'tests',
  6197. fn: function (){
  6198. var self=this;
  6199. return smalltalk.withContext(function($ctx1) {
  6200. var $1;
  6201. $1=(4)._abs();
  6202. $ctx1.sendIdx["abs"]=1;
  6203. self._assert_equals_($1,(4));
  6204. $ctx1.sendIdx["assert:equals:"]=1;
  6205. self._assert_equals_((-4)._abs(),(4));
  6206. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6207. args: [],
  6208. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6209. messageSends: ["assert:equals:", "abs"],
  6210. referencedClasses: []
  6211. }),
  6212. smalltalk.NumberTest);
  6213. smalltalk.addMethod(
  6214. smalltalk.method({
  6215. selector: "testArithmetic",
  6216. protocol: 'tests',
  6217. fn: function (){
  6218. var self=this;
  6219. return smalltalk.withContext(function($ctx1) {
  6220. var $1,$2,$3,$5,$4;
  6221. $1=(1.5).__plus((1));
  6222. $ctx1.sendIdx["+"]=1;
  6223. self._assert_equals_($1,(2.5));
  6224. $ctx1.sendIdx["assert:equals:"]=1;
  6225. $2=(2).__minus((1));
  6226. $ctx1.sendIdx["-"]=1;
  6227. self._assert_equals_($2,(1));
  6228. $ctx1.sendIdx["assert:equals:"]=2;
  6229. self._assert_equals_((-2).__minus((1)),(-3));
  6230. $ctx1.sendIdx["assert:equals:"]=3;
  6231. self._assert_equals_((12).__slash((2)),(6));
  6232. $ctx1.sendIdx["assert:equals:"]=4;
  6233. $3=(3).__star((4));
  6234. $ctx1.sendIdx["*"]=1;
  6235. self._assert_equals_($3,(12));
  6236. $ctx1.sendIdx["assert:equals:"]=5;
  6237. self._assert_equals_((7).__slash_slash((2)),(3));
  6238. $ctx1.sendIdx["assert:equals:"]=6;
  6239. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6240. $ctx1.sendIdx["assert:equals:"]=7;
  6241. $5=(1).__plus((2));
  6242. $ctx1.sendIdx["+"]=2;
  6243. $4=_st($5).__star((3));
  6244. $ctx1.sendIdx["*"]=2;
  6245. self._assert_equals_($4,(9));
  6246. $ctx1.sendIdx["assert:equals:"]=8;
  6247. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6248. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6249. args: [],
  6250. 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",
  6251. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6252. referencedClasses: []
  6253. }),
  6254. smalltalk.NumberTest);
  6255. smalltalk.addMethod(
  6256. smalltalk.method({
  6257. selector: "testAsNumber",
  6258. protocol: 'tests',
  6259. fn: function (){
  6260. var self=this;
  6261. return smalltalk.withContext(function($ctx1) {
  6262. self._assert_equals_((3)._asNumber(),(3));
  6263. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6264. args: [],
  6265. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6266. messageSends: ["assert:equals:", "asNumber"],
  6267. referencedClasses: []
  6268. }),
  6269. smalltalk.NumberTest);
  6270. smalltalk.addMethod(
  6271. smalltalk.method({
  6272. selector: "testCeiling",
  6273. protocol: 'tests',
  6274. fn: function (){
  6275. var self=this;
  6276. return smalltalk.withContext(function($ctx1) {
  6277. var $1,$2;
  6278. $1=(1.2)._ceiling();
  6279. $ctx1.sendIdx["ceiling"]=1;
  6280. self._assert_equals_($1,(2));
  6281. $ctx1.sendIdx["assert:equals:"]=1;
  6282. $2=(-1.2)._ceiling();
  6283. $ctx1.sendIdx["ceiling"]=2;
  6284. self._assert_equals_($2,(-1));
  6285. $ctx1.sendIdx["assert:equals:"]=2;
  6286. self._assert_equals_((1)._ceiling(),(1));
  6287. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6288. args: [],
  6289. 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.",
  6290. messageSends: ["assert:equals:", "ceiling"],
  6291. referencedClasses: []
  6292. }),
  6293. smalltalk.NumberTest);
  6294. smalltalk.addMethod(
  6295. smalltalk.method({
  6296. selector: "testComparison",
  6297. protocol: 'tests',
  6298. fn: function (){
  6299. var self=this;
  6300. return smalltalk.withContext(function($ctx1) {
  6301. var $1,$2,$3,$4;
  6302. $1=(3).__gt((2));
  6303. $ctx1.sendIdx[">"]=1;
  6304. self._assert_($1);
  6305. $ctx1.sendIdx["assert:"]=1;
  6306. $2=(2).__lt((3));
  6307. $ctx1.sendIdx["<"]=1;
  6308. self._assert_($2);
  6309. $ctx1.sendIdx["assert:"]=2;
  6310. self._deny_((3).__lt((2)));
  6311. $ctx1.sendIdx["deny:"]=1;
  6312. self._deny_((2).__gt((3)));
  6313. $3=(3).__gt_eq((3));
  6314. $ctx1.sendIdx[">="]=1;
  6315. self._assert_($3);
  6316. $ctx1.sendIdx["assert:"]=3;
  6317. self._assert_((3.1).__gt_eq((3)));
  6318. $ctx1.sendIdx["assert:"]=4;
  6319. $4=(3).__lt_eq((3));
  6320. $ctx1.sendIdx["<="]=1;
  6321. self._assert_($4);
  6322. $ctx1.sendIdx["assert:"]=5;
  6323. self._assert_((3).__lt_eq((3.1)));
  6324. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6325. args: [],
  6326. 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",
  6327. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6328. referencedClasses: []
  6329. }),
  6330. smalltalk.NumberTest);
  6331. smalltalk.addMethod(
  6332. smalltalk.method({
  6333. selector: "testCopying",
  6334. protocol: 'tests',
  6335. fn: function (){
  6336. var self=this;
  6337. return smalltalk.withContext(function($ctx1) {
  6338. var $1;
  6339. $1=_st((1)._copy()).__eq_eq((1));
  6340. $ctx1.sendIdx["=="]=1;
  6341. self._assert_($1);
  6342. $ctx1.sendIdx["assert:"]=1;
  6343. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6344. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6345. args: [],
  6346. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6347. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6348. referencedClasses: []
  6349. }),
  6350. smalltalk.NumberTest);
  6351. smalltalk.addMethod(
  6352. smalltalk.method({
  6353. selector: "testEquality",
  6354. protocol: 'tests',
  6355. fn: function (){
  6356. var self=this;
  6357. return smalltalk.withContext(function($ctx1) {
  6358. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6359. $1=(1).__eq((1));
  6360. $ctx1.sendIdx["="]=1;
  6361. self._assert_($1);
  6362. $ctx1.sendIdx["assert:"]=1;
  6363. $2=(0).__eq((0));
  6364. $ctx1.sendIdx["="]=2;
  6365. self._assert_($2);
  6366. $ctx1.sendIdx["assert:"]=2;
  6367. $3=(1).__eq((0));
  6368. $ctx1.sendIdx["="]=3;
  6369. self._deny_($3);
  6370. $ctx1.sendIdx["deny:"]=1;
  6371. $5=(1)._yourself();
  6372. $ctx1.sendIdx["yourself"]=1;
  6373. $4=_st($5).__eq((1));
  6374. $ctx1.sendIdx["="]=4;
  6375. self._assert_($4);
  6376. $ctx1.sendIdx["assert:"]=3;
  6377. $7=(1)._yourself();
  6378. $ctx1.sendIdx["yourself"]=2;
  6379. $6=(1).__eq($7);
  6380. $ctx1.sendIdx["="]=5;
  6381. self._assert_($6);
  6382. $ctx1.sendIdx["assert:"]=4;
  6383. $9=(1)._yourself();
  6384. $ctx1.sendIdx["yourself"]=3;
  6385. $8=_st($9).__eq((1)._yourself());
  6386. $ctx1.sendIdx["="]=6;
  6387. self._assert_($8);
  6388. $10=(0).__eq(false);
  6389. $ctx1.sendIdx["="]=7;
  6390. self._deny_($10);
  6391. $ctx1.sendIdx["deny:"]=2;
  6392. $11=false.__eq((0));
  6393. $ctx1.sendIdx["="]=8;
  6394. self._deny_($11);
  6395. $ctx1.sendIdx["deny:"]=3;
  6396. $12="".__eq((0));
  6397. $ctx1.sendIdx["="]=9;
  6398. self._deny_($12);
  6399. $ctx1.sendIdx["deny:"]=4;
  6400. self._deny_((0).__eq(""));
  6401. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6402. args: [],
  6403. 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 = ''",
  6404. messageSends: ["assert:", "=", "deny:", "yourself"],
  6405. referencedClasses: []
  6406. }),
  6407. smalltalk.NumberTest);
  6408. smalltalk.addMethod(
  6409. smalltalk.method({
  6410. selector: "testFloor",
  6411. protocol: 'tests',
  6412. fn: function (){
  6413. var self=this;
  6414. return smalltalk.withContext(function($ctx1) {
  6415. var $1,$2;
  6416. $1=(1.2)._floor();
  6417. $ctx1.sendIdx["floor"]=1;
  6418. self._assert_equals_($1,(1));
  6419. $ctx1.sendIdx["assert:equals:"]=1;
  6420. $2=(-1.2)._floor();
  6421. $ctx1.sendIdx["floor"]=2;
  6422. self._assert_equals_($2,(-2));
  6423. $ctx1.sendIdx["assert:equals:"]=2;
  6424. self._assert_equals_((1)._floor(),(1));
  6425. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6426. args: [],
  6427. 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.",
  6428. messageSends: ["assert:equals:", "floor"],
  6429. referencedClasses: []
  6430. }),
  6431. smalltalk.NumberTest);
  6432. smalltalk.addMethod(
  6433. smalltalk.method({
  6434. selector: "testHexNumbers",
  6435. protocol: 'tests',
  6436. fn: function (){
  6437. var self=this;
  6438. return smalltalk.withContext(function($ctx1) {
  6439. var $1,$2,$3,$4,$5;
  6440. self._assert_equals_((9),(9));
  6441. $ctx1.sendIdx["assert:equals:"]=1;
  6442. $1=(10)._truncated();
  6443. $ctx1.sendIdx["truncated"]=1;
  6444. self._assert_equals_($1,(10));
  6445. $ctx1.sendIdx["assert:equals:"]=2;
  6446. $2=(11)._truncated();
  6447. $ctx1.sendIdx["truncated"]=2;
  6448. self._assert_equals_($2,(11));
  6449. $ctx1.sendIdx["assert:equals:"]=3;
  6450. $3=(12)._truncated();
  6451. $ctx1.sendIdx["truncated"]=3;
  6452. self._assert_equals_($3,(12));
  6453. $ctx1.sendIdx["assert:equals:"]=4;
  6454. $4=(13)._truncated();
  6455. $ctx1.sendIdx["truncated"]=4;
  6456. self._assert_equals_($4,(13));
  6457. $ctx1.sendIdx["assert:equals:"]=5;
  6458. $5=(14)._truncated();
  6459. $ctx1.sendIdx["truncated"]=5;
  6460. self._assert_equals_($5,(14));
  6461. $ctx1.sendIdx["assert:equals:"]=6;
  6462. self._assert_equals_((15)._truncated(),(15));
  6463. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6464. args: [],
  6465. 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",
  6466. messageSends: ["assert:equals:", "truncated"],
  6467. referencedClasses: []
  6468. }),
  6469. smalltalk.NumberTest);
  6470. smalltalk.addMethod(
  6471. smalltalk.method({
  6472. selector: "testIdentity",
  6473. protocol: 'tests',
  6474. fn: function (){
  6475. var self=this;
  6476. return smalltalk.withContext(function($ctx1) {
  6477. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6478. $1=(1).__eq_eq((1));
  6479. $ctx1.sendIdx["=="]=1;
  6480. self._assert_($1);
  6481. $ctx1.sendIdx["assert:"]=1;
  6482. $2=(0).__eq_eq((0));
  6483. $ctx1.sendIdx["=="]=2;
  6484. self._assert_($2);
  6485. $ctx1.sendIdx["assert:"]=2;
  6486. $3=(1).__eq_eq((0));
  6487. $ctx1.sendIdx["=="]=3;
  6488. self._deny_($3);
  6489. $ctx1.sendIdx["deny:"]=1;
  6490. $5=(1)._yourself();
  6491. $ctx1.sendIdx["yourself"]=1;
  6492. $4=_st($5).__eq_eq((1));
  6493. $ctx1.sendIdx["=="]=4;
  6494. self._assert_($4);
  6495. $ctx1.sendIdx["assert:"]=3;
  6496. $7=(1)._yourself();
  6497. $ctx1.sendIdx["yourself"]=2;
  6498. $6=(1).__eq_eq($7);
  6499. $ctx1.sendIdx["=="]=5;
  6500. self._assert_($6);
  6501. $ctx1.sendIdx["assert:"]=4;
  6502. $9=(1)._yourself();
  6503. $ctx1.sendIdx["yourself"]=3;
  6504. $8=_st($9).__eq_eq((1)._yourself());
  6505. $ctx1.sendIdx["=="]=6;
  6506. self._assert_($8);
  6507. self._deny_((1).__eq_eq((2)));
  6508. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6509. args: [],
  6510. 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",
  6511. messageSends: ["assert:", "==", "deny:", "yourself"],
  6512. referencedClasses: []
  6513. }),
  6514. smalltalk.NumberTest);
  6515. smalltalk.addMethod(
  6516. smalltalk.method({
  6517. selector: "testInvalidHexNumbers",
  6518. protocol: 'tests',
  6519. fn: function (){
  6520. var self=this;
  6521. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6522. return smalltalk.withContext(function($ctx1) {
  6523. self._should_raise_((function(){
  6524. return smalltalk.withContext(function($ctx2) {
  6525. return (16)._rG();
  6526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6527. $ctx1.sendIdx["should:raise:"]=1;
  6528. self._should_raise_((function(){
  6529. return smalltalk.withContext(function($ctx2) {
  6530. return (16)._rg();
  6531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6532. $ctx1.sendIdx["should:raise:"]=2;
  6533. self._should_raise_((function(){
  6534. return smalltalk.withContext(function($ctx2) {
  6535. return (16)._rH();
  6536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6537. $ctx1.sendIdx["should:raise:"]=3;
  6538. self._should_raise_((function(){
  6539. return smalltalk.withContext(function($ctx2) {
  6540. return (16)._rh();
  6541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6542. $ctx1.sendIdx["should:raise:"]=4;
  6543. self._should_raise_((function(){
  6544. return smalltalk.withContext(function($ctx2) {
  6545. return (16)._rI();
  6546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6547. $ctx1.sendIdx["should:raise:"]=5;
  6548. self._should_raise_((function(){
  6549. return smalltalk.withContext(function($ctx2) {
  6550. return (16)._ri();
  6551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6552. $ctx1.sendIdx["should:raise:"]=6;
  6553. self._should_raise_((function(){
  6554. return smalltalk.withContext(function($ctx2) {
  6555. return (16)._rJ();
  6556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6557. $ctx1.sendIdx["should:raise:"]=7;
  6558. self._should_raise_((function(){
  6559. return smalltalk.withContext(function($ctx2) {
  6560. return (16)._rj();
  6561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6562. $ctx1.sendIdx["should:raise:"]=8;
  6563. self._should_raise_((function(){
  6564. return smalltalk.withContext(function($ctx2) {
  6565. return (16)._rK();
  6566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6567. $ctx1.sendIdx["should:raise:"]=9;
  6568. self._should_raise_((function(){
  6569. return smalltalk.withContext(function($ctx2) {
  6570. return (16)._rk();
  6571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6572. $ctx1.sendIdx["should:raise:"]=10;
  6573. self._should_raise_((function(){
  6574. return smalltalk.withContext(function($ctx2) {
  6575. return (16)._rL();
  6576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6577. $ctx1.sendIdx["should:raise:"]=11;
  6578. self._should_raise_((function(){
  6579. return smalltalk.withContext(function($ctx2) {
  6580. return (16)._rl();
  6581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6582. $ctx1.sendIdx["should:raise:"]=12;
  6583. self._should_raise_((function(){
  6584. return smalltalk.withContext(function($ctx2) {
  6585. return (16)._rM();
  6586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6587. $ctx1.sendIdx["should:raise:"]=13;
  6588. self._should_raise_((function(){
  6589. return smalltalk.withContext(function($ctx2) {
  6590. return (16)._rm();
  6591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6592. $ctx1.sendIdx["should:raise:"]=14;
  6593. self._should_raise_((function(){
  6594. return smalltalk.withContext(function($ctx2) {
  6595. return (16)._rN();
  6596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6597. $ctx1.sendIdx["should:raise:"]=15;
  6598. self._should_raise_((function(){
  6599. return smalltalk.withContext(function($ctx2) {
  6600. return (16)._rn();
  6601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6602. $ctx1.sendIdx["should:raise:"]=16;
  6603. self._should_raise_((function(){
  6604. return smalltalk.withContext(function($ctx2) {
  6605. return (16)._rO();
  6606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6607. $ctx1.sendIdx["should:raise:"]=17;
  6608. self._should_raise_((function(){
  6609. return smalltalk.withContext(function($ctx2) {
  6610. return (16)._ro();
  6611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6612. $ctx1.sendIdx["should:raise:"]=18;
  6613. self._should_raise_((function(){
  6614. return smalltalk.withContext(function($ctx2) {
  6615. return (16)._rP();
  6616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6617. $ctx1.sendIdx["should:raise:"]=19;
  6618. self._should_raise_((function(){
  6619. return smalltalk.withContext(function($ctx2) {
  6620. return (16)._rp();
  6621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6622. $ctx1.sendIdx["should:raise:"]=20;
  6623. self._should_raise_((function(){
  6624. return smalltalk.withContext(function($ctx2) {
  6625. return (16)._rQ();
  6626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6627. $ctx1.sendIdx["should:raise:"]=21;
  6628. self._should_raise_((function(){
  6629. return smalltalk.withContext(function($ctx2) {
  6630. return (16)._rq();
  6631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6632. $ctx1.sendIdx["should:raise:"]=22;
  6633. self._should_raise_((function(){
  6634. return smalltalk.withContext(function($ctx2) {
  6635. return (16)._rR();
  6636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6637. $ctx1.sendIdx["should:raise:"]=23;
  6638. self._should_raise_((function(){
  6639. return smalltalk.withContext(function($ctx2) {
  6640. return (16)._rr();
  6641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6642. $ctx1.sendIdx["should:raise:"]=24;
  6643. self._should_raise_((function(){
  6644. return smalltalk.withContext(function($ctx2) {
  6645. return (16)._rS();
  6646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6647. $ctx1.sendIdx["should:raise:"]=25;
  6648. self._should_raise_((function(){
  6649. return smalltalk.withContext(function($ctx2) {
  6650. return (16)._rs();
  6651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6652. $ctx1.sendIdx["should:raise:"]=26;
  6653. self._should_raise_((function(){
  6654. return smalltalk.withContext(function($ctx2) {
  6655. return (16)._rT();
  6656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6657. $ctx1.sendIdx["should:raise:"]=27;
  6658. self._should_raise_((function(){
  6659. return smalltalk.withContext(function($ctx2) {
  6660. return (16)._rt();
  6661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6662. $ctx1.sendIdx["should:raise:"]=28;
  6663. self._should_raise_((function(){
  6664. return smalltalk.withContext(function($ctx2) {
  6665. return (16)._rU();
  6666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6667. $ctx1.sendIdx["should:raise:"]=29;
  6668. self._should_raise_((function(){
  6669. return smalltalk.withContext(function($ctx2) {
  6670. return (16)._ru();
  6671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6672. $ctx1.sendIdx["should:raise:"]=30;
  6673. self._should_raise_((function(){
  6674. return smalltalk.withContext(function($ctx2) {
  6675. return (16)._rV();
  6676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6677. $ctx1.sendIdx["should:raise:"]=31;
  6678. self._should_raise_((function(){
  6679. return smalltalk.withContext(function($ctx2) {
  6680. return (16)._rv();
  6681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6682. $ctx1.sendIdx["should:raise:"]=32;
  6683. self._should_raise_((function(){
  6684. return smalltalk.withContext(function($ctx2) {
  6685. return (16)._rW();
  6686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6687. $ctx1.sendIdx["should:raise:"]=33;
  6688. self._should_raise_((function(){
  6689. return smalltalk.withContext(function($ctx2) {
  6690. return (16)._rw();
  6691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6692. $ctx1.sendIdx["should:raise:"]=34;
  6693. self._should_raise_((function(){
  6694. return smalltalk.withContext(function($ctx2) {
  6695. return (16)._rX();
  6696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6697. $ctx1.sendIdx["should:raise:"]=35;
  6698. self._should_raise_((function(){
  6699. return smalltalk.withContext(function($ctx2) {
  6700. return (16)._rx();
  6701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6702. $ctx1.sendIdx["should:raise:"]=36;
  6703. self._should_raise_((function(){
  6704. return smalltalk.withContext(function($ctx2) {
  6705. return (16)._rY();
  6706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6707. $ctx1.sendIdx["should:raise:"]=37;
  6708. self._should_raise_((function(){
  6709. return smalltalk.withContext(function($ctx2) {
  6710. return (16)._ry();
  6711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6712. $ctx1.sendIdx["should:raise:"]=38;
  6713. self._should_raise_((function(){
  6714. return smalltalk.withContext(function($ctx2) {
  6715. return (16)._rZ();
  6716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6717. $ctx1.sendIdx["should:raise:"]=39;
  6718. self._should_raise_((function(){
  6719. return smalltalk.withContext(function($ctx2) {
  6720. return (16)._rz();
  6721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6722. $ctx1.sendIdx["should:raise:"]=40;
  6723. self._should_raise_((function(){
  6724. return smalltalk.withContext(function($ctx2) {
  6725. return (11259375)._Z();
  6726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6727. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6728. args: [],
  6729. 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.",
  6730. 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"],
  6731. referencedClasses: ["MessageNotUnderstood"]
  6732. }),
  6733. smalltalk.NumberTest);
  6734. smalltalk.addMethod(
  6735. smalltalk.method({
  6736. selector: "testLog",
  6737. protocol: 'tests',
  6738. fn: function (){
  6739. var self=this;
  6740. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6741. return smalltalk.withContext(function($ctx1) {
  6742. self._assert_equals_((10000)._log(),(4));
  6743. $ctx1.sendIdx["assert:equals:"]=1;
  6744. self._assert_equals_((512)._log_((2)),(9));
  6745. $ctx1.sendIdx["assert:equals:"]=2;
  6746. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6747. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6748. args: [],
  6749. 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.",
  6750. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6751. referencedClasses: ["Number"]
  6752. }),
  6753. smalltalk.NumberTest);
  6754. smalltalk.addMethod(
  6755. smalltalk.method({
  6756. selector: "testMinMax",
  6757. protocol: 'tests',
  6758. fn: function (){
  6759. var self=this;
  6760. return smalltalk.withContext(function($ctx1) {
  6761. self._assert_equals_((2)._max_((5)),(5));
  6762. $ctx1.sendIdx["assert:equals:"]=1;
  6763. self._assert_equals_((2)._min_((5)),(2));
  6764. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6765. args: [],
  6766. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6767. messageSends: ["assert:equals:", "max:", "min:"],
  6768. referencedClasses: []
  6769. }),
  6770. smalltalk.NumberTest);
  6771. smalltalk.addMethod(
  6772. smalltalk.method({
  6773. selector: "testNegated",
  6774. protocol: 'tests',
  6775. fn: function (){
  6776. var self=this;
  6777. return smalltalk.withContext(function($ctx1) {
  6778. var $1;
  6779. $1=(3)._negated();
  6780. $ctx1.sendIdx["negated"]=1;
  6781. self._assert_equals_($1,(-3));
  6782. $ctx1.sendIdx["assert:equals:"]=1;
  6783. self._assert_equals_((-3)._negated(),(3));
  6784. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6785. args: [],
  6786. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6787. messageSends: ["assert:equals:", "negated"],
  6788. referencedClasses: []
  6789. }),
  6790. smalltalk.NumberTest);
  6791. smalltalk.addMethod(
  6792. smalltalk.method({
  6793. selector: "testPrintShowingDecimalPlaces",
  6794. protocol: 'tests',
  6795. fn: function (){
  6796. var self=this;
  6797. return smalltalk.withContext(function($ctx1) {
  6798. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6799. $1=(23)._printShowingDecimalPlaces_((2));
  6800. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6801. self._assert_equals_($1,"23.00");
  6802. $ctx1.sendIdx["assert:equals:"]=1;
  6803. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6804. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6805. self._assert_equals_($2,"23.57");
  6806. $ctx1.sendIdx["assert:equals:"]=2;
  6807. $4=(234.567)._negated();
  6808. $ctx1.sendIdx["negated"]=1;
  6809. $3=_st($4)._printShowingDecimalPlaces_((5));
  6810. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6811. self._assert_equals_($3,"-234.56700");
  6812. $ctx1.sendIdx["assert:equals:"]=3;
  6813. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6814. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6815. self._assert_equals_($5,"23");
  6816. $ctx1.sendIdx["assert:equals:"]=4;
  6817. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6818. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6819. self._assert_equals_($6,"24");
  6820. $ctx1.sendIdx["assert:equals:"]=5;
  6821. $8=(23.4567)._negated();
  6822. $ctx1.sendIdx["negated"]=2;
  6823. $7=_st($8)._printShowingDecimalPlaces_((0));
  6824. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6825. self._assert_equals_($7,"-23");
  6826. $ctx1.sendIdx["assert:equals:"]=6;
  6827. $10=(23.5567)._negated();
  6828. $ctx1.sendIdx["negated"]=3;
  6829. $9=_st($10)._printShowingDecimalPlaces_((0));
  6830. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6831. self._assert_equals_($9,"-24");
  6832. $ctx1.sendIdx["assert:equals:"]=7;
  6833. $11=(100000000)._printShowingDecimalPlaces_((1));
  6834. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6835. self._assert_equals_($11,"100000000.0");
  6836. $ctx1.sendIdx["assert:equals:"]=8;
  6837. $12=(0.98)._printShowingDecimalPlaces_((5));
  6838. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6839. self._assert_equals_($12,"0.98000");
  6840. $ctx1.sendIdx["assert:equals:"]=9;
  6841. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6842. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6843. self._assert_equals_($13,"-0.98");
  6844. $ctx1.sendIdx["assert:equals:"]=10;
  6845. $14=(2.567)._printShowingDecimalPlaces_((2));
  6846. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6847. self._assert_equals_($14,"2.57");
  6848. $ctx1.sendIdx["assert:equals:"]=11;
  6849. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6850. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6851. self._assert_equals_($15,"-2.57");
  6852. $ctx1.sendIdx["assert:equals:"]=12;
  6853. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6854. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6855. args: [],
  6856. 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'.",
  6857. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6858. referencedClasses: []
  6859. }),
  6860. smalltalk.NumberTest);
  6861. smalltalk.addMethod(
  6862. smalltalk.method({
  6863. selector: "testRaisedTo",
  6864. protocol: 'tests',
  6865. fn: function (){
  6866. var self=this;
  6867. return smalltalk.withContext(function($ctx1) {
  6868. var $1,$2,$3;
  6869. $1=(2)._raisedTo_((4));
  6870. $ctx1.sendIdx["raisedTo:"]=1;
  6871. self._assert_equals_($1,(16));
  6872. $ctx1.sendIdx["assert:equals:"]=1;
  6873. $2=(2)._raisedTo_((0));
  6874. $ctx1.sendIdx["raisedTo:"]=2;
  6875. self._assert_equals_($2,(1));
  6876. $ctx1.sendIdx["assert:equals:"]=2;
  6877. $3=(2)._raisedTo_((-3));
  6878. $ctx1.sendIdx["raisedTo:"]=3;
  6879. self._assert_equals_($3,(0.125));
  6880. $ctx1.sendIdx["assert:equals:"]=3;
  6881. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6882. $ctx1.sendIdx["assert:equals:"]=4;
  6883. self._assert_equals_((2).__star_star((4)),(16));
  6884. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6885. args: [],
  6886. 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.",
  6887. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6888. referencedClasses: []
  6889. }),
  6890. smalltalk.NumberTest);
  6891. smalltalk.addMethod(
  6892. smalltalk.method({
  6893. selector: "testRounded",
  6894. protocol: 'tests',
  6895. fn: function (){
  6896. var self=this;
  6897. return smalltalk.withContext(function($ctx1) {
  6898. var $1,$2;
  6899. $1=(3)._rounded();
  6900. $ctx1.sendIdx["rounded"]=1;
  6901. self._assert_equals_($1,(3));
  6902. $ctx1.sendIdx["assert:equals:"]=1;
  6903. $2=(3.212)._rounded();
  6904. $ctx1.sendIdx["rounded"]=2;
  6905. self._assert_equals_($2,(3));
  6906. $ctx1.sendIdx["assert:equals:"]=2;
  6907. self._assert_equals_((3.51)._rounded(),(4));
  6908. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6909. args: [],
  6910. 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",
  6911. messageSends: ["assert:equals:", "rounded"],
  6912. referencedClasses: []
  6913. }),
  6914. smalltalk.NumberTest);
  6915. smalltalk.addMethod(
  6916. smalltalk.method({
  6917. selector: "testSign",
  6918. protocol: 'tests',
  6919. fn: function (){
  6920. var self=this;
  6921. return smalltalk.withContext(function($ctx1) {
  6922. var $1,$2;
  6923. $1=(5)._sign();
  6924. $ctx1.sendIdx["sign"]=1;
  6925. self._assert_equals_($1,(1));
  6926. $ctx1.sendIdx["assert:equals:"]=1;
  6927. $2=(0)._sign();
  6928. $ctx1.sendIdx["sign"]=2;
  6929. self._assert_equals_($2,(0));
  6930. $ctx1.sendIdx["assert:equals:"]=2;
  6931. self._assert_equals_((-1.4)._sign(),(-1));
  6932. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  6933. args: [],
  6934. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  6935. messageSends: ["assert:equals:", "sign"],
  6936. referencedClasses: []
  6937. }),
  6938. smalltalk.NumberTest);
  6939. smalltalk.addMethod(
  6940. smalltalk.method({
  6941. selector: "testSqrt",
  6942. protocol: 'tests',
  6943. fn: function (){
  6944. var self=this;
  6945. return smalltalk.withContext(function($ctx1) {
  6946. var $1;
  6947. $1=(4)._sqrt();
  6948. $ctx1.sendIdx["sqrt"]=1;
  6949. self._assert_equals_($1,(2));
  6950. $ctx1.sendIdx["assert:equals:"]=1;
  6951. self._assert_equals_((16)._sqrt(),(4));
  6952. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  6953. args: [],
  6954. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  6955. messageSends: ["assert:equals:", "sqrt"],
  6956. referencedClasses: []
  6957. }),
  6958. smalltalk.NumberTest);
  6959. smalltalk.addMethod(
  6960. smalltalk.method({
  6961. selector: "testSquared",
  6962. protocol: 'tests',
  6963. fn: function (){
  6964. var self=this;
  6965. return smalltalk.withContext(function($ctx1) {
  6966. self._assert_equals_((4)._squared(),(16));
  6967. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  6968. args: [],
  6969. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  6970. messageSends: ["assert:equals:", "squared"],
  6971. referencedClasses: []
  6972. }),
  6973. smalltalk.NumberTest);
  6974. smalltalk.addMethod(
  6975. smalltalk.method({
  6976. selector: "testTimesRepeat",
  6977. protocol: 'tests',
  6978. fn: function (){
  6979. var self=this;
  6980. var i;
  6981. return smalltalk.withContext(function($ctx1) {
  6982. i=(0);
  6983. (0)._timesRepeat_((function(){
  6984. return smalltalk.withContext(function($ctx2) {
  6985. i=_st(i).__plus((1));
  6986. $ctx2.sendIdx["+"]=1;
  6987. return i;
  6988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6989. $ctx1.sendIdx["timesRepeat:"]=1;
  6990. self._assert_equals_(i,(0));
  6991. $ctx1.sendIdx["assert:equals:"]=1;
  6992. (5)._timesRepeat_((function(){
  6993. return smalltalk.withContext(function($ctx2) {
  6994. i=_st(i).__plus((1));
  6995. return i;
  6996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6997. self._assert_equals_(i,(5));
  6998. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  6999. args: [],
  7000. 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",
  7001. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7002. referencedClasses: []
  7003. }),
  7004. smalltalk.NumberTest);
  7005. smalltalk.addMethod(
  7006. smalltalk.method({
  7007. selector: "testTo",
  7008. protocol: 'tests',
  7009. fn: function (){
  7010. var self=this;
  7011. return smalltalk.withContext(function($ctx1) {
  7012. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7013. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7014. args: [],
  7015. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7016. messageSends: ["assert:equals:", "to:"],
  7017. referencedClasses: []
  7018. }),
  7019. smalltalk.NumberTest);
  7020. smalltalk.addMethod(
  7021. smalltalk.method({
  7022. selector: "testToBy",
  7023. protocol: 'tests',
  7024. fn: function (){
  7025. var self=this;
  7026. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7027. return smalltalk.withContext(function($ctx1) {
  7028. var $1;
  7029. $1=(0)._to_by_((6),(2));
  7030. $ctx1.sendIdx["to:by:"]=1;
  7031. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7032. self._should_raise_((function(){
  7033. return smalltalk.withContext(function($ctx2) {
  7034. return (1)._to_by_((4),(0));
  7035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7036. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7037. args: [],
  7038. 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",
  7039. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7040. referencedClasses: ["Error"]
  7041. }),
  7042. smalltalk.NumberTest);
  7043. smalltalk.addMethod(
  7044. smalltalk.method({
  7045. selector: "testTrigonometry",
  7046. protocol: 'tests',
  7047. fn: function (){
  7048. var self=this;
  7049. return smalltalk.withContext(function($ctx1) {
  7050. self._assert_equals_((0)._cos(),(1));
  7051. $ctx1.sendIdx["assert:equals:"]=1;
  7052. self._assert_equals_((0)._sin(),(0));
  7053. $ctx1.sendIdx["assert:equals:"]=2;
  7054. self._assert_equals_((0)._tan(),(0));
  7055. $ctx1.sendIdx["assert:equals:"]=3;
  7056. self._assert_equals_((1)._arcCos(),(0));
  7057. $ctx1.sendIdx["assert:equals:"]=4;
  7058. self._assert_equals_((0)._arcSin(),(0));
  7059. $ctx1.sendIdx["assert:equals:"]=5;
  7060. self._assert_equals_((0)._arcTan(),(0));
  7061. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7062. args: [],
  7063. 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.",
  7064. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7065. referencedClasses: []
  7066. }),
  7067. smalltalk.NumberTest);
  7068. smalltalk.addMethod(
  7069. smalltalk.method({
  7070. selector: "testTruncated",
  7071. protocol: 'tests',
  7072. fn: function (){
  7073. var self=this;
  7074. return smalltalk.withContext(function($ctx1) {
  7075. var $1,$2;
  7076. $1=(3)._truncated();
  7077. $ctx1.sendIdx["truncated"]=1;
  7078. self._assert_equals_($1,(3));
  7079. $ctx1.sendIdx["assert:equals:"]=1;
  7080. $2=(3.212)._truncated();
  7081. $ctx1.sendIdx["truncated"]=2;
  7082. self._assert_equals_($2,(3));
  7083. $ctx1.sendIdx["assert:equals:"]=2;
  7084. self._assert_equals_((3.51)._truncated(),(3));
  7085. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7086. args: [],
  7087. 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",
  7088. messageSends: ["assert:equals:", "truncated"],
  7089. referencedClasses: []
  7090. }),
  7091. smalltalk.NumberTest);
  7092. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7093. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7094. smalltalk.addMethod(
  7095. smalltalk.method({
  7096. selector: "foo",
  7097. protocol: 'not yet classified',
  7098. fn: function (){
  7099. var self=this;
  7100. return smalltalk.withContext(function($ctx1) {
  7101. var $1;
  7102. $1=self["@foo"];
  7103. return $1;
  7104. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7105. args: [],
  7106. source: "foo\x0a\x09^ foo",
  7107. messageSends: [],
  7108. referencedClasses: []
  7109. }),
  7110. smalltalk.ObjectMock);
  7111. smalltalk.addMethod(
  7112. smalltalk.method({
  7113. selector: "foo:",
  7114. protocol: 'not yet classified',
  7115. fn: function (anObject){
  7116. var self=this;
  7117. return smalltalk.withContext(function($ctx1) {
  7118. self["@foo"]=anObject;
  7119. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7120. args: ["anObject"],
  7121. source: "foo: anObject\x0a\x09foo := anObject",
  7122. messageSends: [],
  7123. referencedClasses: []
  7124. }),
  7125. smalltalk.ObjectMock);
  7126. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7127. smalltalk.addMethod(
  7128. smalltalk.method({
  7129. selector: "notDefined",
  7130. protocol: 'tests',
  7131. fn: function (){
  7132. var self=this;
  7133. return smalltalk.withContext(function($ctx1) {
  7134. return void 0;;
  7135. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7136. args: [],
  7137. source: "notDefined\x0a\x09<return void 0;>",
  7138. messageSends: [],
  7139. referencedClasses: []
  7140. }),
  7141. smalltalk.ObjectTest);
  7142. smalltalk.addMethod(
  7143. smalltalk.method({
  7144. selector: "testBasicAccess",
  7145. protocol: 'tests',
  7146. fn: function (){
  7147. var self=this;
  7148. var o;
  7149. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7150. return smalltalk.withContext(function($ctx1) {
  7151. var $1;
  7152. o=_st($Object())._new();
  7153. _st(o)._basicAt_put_("a",(1));
  7154. $1=_st(o)._basicAt_("a");
  7155. $ctx1.sendIdx["basicAt:"]=1;
  7156. self._assert_equals_($1,(1));
  7157. $ctx1.sendIdx["assert:equals:"]=1;
  7158. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7159. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7160. args: [],
  7161. 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",
  7162. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7163. referencedClasses: ["Object"]
  7164. }),
  7165. smalltalk.ObjectTest);
  7166. smalltalk.addMethod(
  7167. smalltalk.method({
  7168. selector: "testBasicPerform",
  7169. protocol: 'tests',
  7170. fn: function (){
  7171. var self=this;
  7172. var o;
  7173. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7174. return smalltalk.withContext(function($ctx1) {
  7175. o=_st($Object())._new();
  7176. _st(o)._basicAt_put_("func",(function(){
  7177. return smalltalk.withContext(function($ctx2) {
  7178. return "hello";
  7179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7180. $ctx1.sendIdx["basicAt:put:"]=1;
  7181. _st(o)._basicAt_put_("func2",(function(a){
  7182. return smalltalk.withContext(function($ctx2) {
  7183. return _st(a).__plus((1));
  7184. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7185. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7186. $ctx1.sendIdx["assert:equals:"]=1;
  7187. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7188. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7189. args: [],
  7190. 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",
  7191. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7192. referencedClasses: ["Object"]
  7193. }),
  7194. smalltalk.ObjectTest);
  7195. smalltalk.addMethod(
  7196. smalltalk.method({
  7197. selector: "testDNU",
  7198. protocol: 'tests',
  7199. fn: function (){
  7200. var self=this;
  7201. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7202. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7203. return smalltalk.withContext(function($ctx1) {
  7204. self._should_raise_((function(){
  7205. return smalltalk.withContext(function($ctx2) {
  7206. return _st(_st($Object())._new())._foo();
  7207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7208. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7209. args: [],
  7210. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7211. messageSends: ["should:raise:", "foo", "new"],
  7212. referencedClasses: ["Object", "MessageNotUnderstood"]
  7213. }),
  7214. smalltalk.ObjectTest);
  7215. smalltalk.addMethod(
  7216. smalltalk.method({
  7217. selector: "testEquality",
  7218. protocol: 'tests',
  7219. fn: function (){
  7220. var self=this;
  7221. var o;
  7222. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7223. return smalltalk.withContext(function($ctx1) {
  7224. var $1,$2,$4,$3;
  7225. o=_st($Object())._new();
  7226. $ctx1.sendIdx["new"]=1;
  7227. $1=_st(o).__eq(_st($Object())._new());
  7228. $ctx1.sendIdx["="]=1;
  7229. self._deny_($1);
  7230. $2=_st(o).__eq(o);
  7231. $ctx1.sendIdx["="]=2;
  7232. self._assert_($2);
  7233. $ctx1.sendIdx["assert:"]=1;
  7234. $4=_st(o)._yourself();
  7235. $ctx1.sendIdx["yourself"]=1;
  7236. $3=_st($4).__eq(o);
  7237. $ctx1.sendIdx["="]=3;
  7238. self._assert_($3);
  7239. $ctx1.sendIdx["assert:"]=2;
  7240. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7241. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7242. args: [],
  7243. 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)",
  7244. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7245. referencedClasses: ["Object"]
  7246. }),
  7247. smalltalk.ObjectTest);
  7248. smalltalk.addMethod(
  7249. smalltalk.method({
  7250. selector: "testHalt",
  7251. protocol: 'tests',
  7252. fn: function (){
  7253. var self=this;
  7254. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7256. return smalltalk.withContext(function($ctx1) {
  7257. self._should_raise_((function(){
  7258. return smalltalk.withContext(function($ctx2) {
  7259. return _st(_st($Object())._new())._halt();
  7260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7261. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7262. args: [],
  7263. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7264. messageSends: ["should:raise:", "halt", "new"],
  7265. referencedClasses: ["Object", "Error"]
  7266. }),
  7267. smalltalk.ObjectTest);
  7268. smalltalk.addMethod(
  7269. smalltalk.method({
  7270. selector: "testIdentity",
  7271. protocol: 'tests',
  7272. fn: function (){
  7273. var self=this;
  7274. var o;
  7275. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7276. return smalltalk.withContext(function($ctx1) {
  7277. var $1,$2,$4,$3;
  7278. o=_st($Object())._new();
  7279. $ctx1.sendIdx["new"]=1;
  7280. $1=_st(o).__eq_eq(_st($Object())._new());
  7281. $ctx1.sendIdx["=="]=1;
  7282. self._deny_($1);
  7283. $2=_st(o).__eq_eq(o);
  7284. $ctx1.sendIdx["=="]=2;
  7285. self._assert_($2);
  7286. $ctx1.sendIdx["assert:"]=1;
  7287. $4=_st(o)._yourself();
  7288. $ctx1.sendIdx["yourself"]=1;
  7289. $3=_st($4).__eq_eq(o);
  7290. $ctx1.sendIdx["=="]=3;
  7291. self._assert_($3);
  7292. $ctx1.sendIdx["assert:"]=2;
  7293. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7294. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7295. args: [],
  7296. 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",
  7297. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7298. referencedClasses: ["Object"]
  7299. }),
  7300. smalltalk.ObjectTest);
  7301. smalltalk.addMethod(
  7302. smalltalk.method({
  7303. selector: "testIfNil",
  7304. protocol: 'tests',
  7305. fn: function (){
  7306. var self=this;
  7307. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7308. return smalltalk.withContext(function($ctx1) {
  7309. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7310. $2=_st($Object())._new();
  7311. $ctx1.sendIdx["new"]=1;
  7312. $1=_st($2)._isNil();
  7313. self._deny_($1);
  7314. $ctx1.sendIdx["deny:"]=1;
  7315. $5=_st($Object())._new();
  7316. $ctx1.sendIdx["new"]=2;
  7317. if(($receiver = $5) == nil || $receiver == null){
  7318. $4=true;
  7319. } else {
  7320. $4=$5;
  7321. };
  7322. $3=_st($4).__eq(true);
  7323. self._deny_($3);
  7324. $7=_st($Object())._new();
  7325. $ctx1.sendIdx["new"]=3;
  7326. if(($receiver = $7) == nil || $receiver == null){
  7327. $6=$7;
  7328. } else {
  7329. $6=true;
  7330. };
  7331. self._assert_equals_($6,true);
  7332. $ctx1.sendIdx["assert:equals:"]=1;
  7333. $9=_st($Object())._new();
  7334. $ctx1.sendIdx["new"]=4;
  7335. if(($receiver = $9) == nil || $receiver == null){
  7336. $8=false;
  7337. } else {
  7338. $8=true;
  7339. };
  7340. self._assert_equals_($8,true);
  7341. $ctx1.sendIdx["assert:equals:"]=2;
  7342. $11=_st($Object())._new();
  7343. if(($receiver = $11) == nil || $receiver == null){
  7344. $10=false;
  7345. } else {
  7346. $10=true;
  7347. };
  7348. self._assert_equals_($10,true);
  7349. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7350. args: [],
  7351. 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",
  7352. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7353. referencedClasses: ["Object"]
  7354. }),
  7355. smalltalk.ObjectTest);
  7356. smalltalk.addMethod(
  7357. smalltalk.method({
  7358. selector: "testInstVars",
  7359. protocol: 'tests',
  7360. fn: function (){
  7361. var self=this;
  7362. var o;
  7363. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7364. return smalltalk.withContext(function($ctx1) {
  7365. var $1,$2;
  7366. o=_st($ObjectMock())._new();
  7367. $1=_st(o)._instVarAt_("foo");
  7368. $ctx1.sendIdx["instVarAt:"]=1;
  7369. self._assert_equals_($1,nil);
  7370. $ctx1.sendIdx["assert:equals:"]=1;
  7371. _st(o)._instVarAt_put_("foo",(1));
  7372. $2=_st(o)._instVarAt_("foo");
  7373. $ctx1.sendIdx["instVarAt:"]=2;
  7374. self._assert_equals_($2,(1));
  7375. $ctx1.sendIdx["assert:equals:"]=2;
  7376. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7377. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7378. args: [],
  7379. 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",
  7380. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7381. referencedClasses: ["ObjectMock"]
  7382. }),
  7383. smalltalk.ObjectTest);
  7384. smalltalk.addMethod(
  7385. smalltalk.method({
  7386. selector: "testNilUndefined",
  7387. protocol: 'tests',
  7388. fn: function (){
  7389. var self=this;
  7390. return smalltalk.withContext(function($ctx1) {
  7391. self._assert_equals_(self._notDefined(),nil);
  7392. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7393. args: [],
  7394. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7395. messageSends: ["assert:equals:", "notDefined"],
  7396. referencedClasses: []
  7397. }),
  7398. smalltalk.ObjectTest);
  7399. smalltalk.addMethod(
  7400. smalltalk.method({
  7401. selector: "testYourself",
  7402. protocol: 'tests',
  7403. fn: function (){
  7404. var self=this;
  7405. var o;
  7406. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7407. return smalltalk.withContext(function($ctx1) {
  7408. o=_st($ObjectMock())._new();
  7409. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7410. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7411. args: [],
  7412. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7413. messageSends: ["new", "assert:", "==", "yourself"],
  7414. referencedClasses: ["ObjectMock"]
  7415. }),
  7416. smalltalk.ObjectTest);
  7417. smalltalk.addMethod(
  7418. smalltalk.method({
  7419. selector: "testidentityHash",
  7420. protocol: 'tests',
  7421. fn: function (){
  7422. var self=this;
  7423. var o1,o2;
  7424. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7425. return smalltalk.withContext(function($ctx1) {
  7426. var $2,$3,$1,$5,$4;
  7427. o1=_st($Object())._new();
  7428. $ctx1.sendIdx["new"]=1;
  7429. o2=_st($Object())._new();
  7430. $2=_st(o1)._identityHash();
  7431. $ctx1.sendIdx["identityHash"]=1;
  7432. $3=_st(o1)._identityHash();
  7433. $ctx1.sendIdx["identityHash"]=2;
  7434. $1=_st($2).__eq_eq($3);
  7435. $ctx1.sendIdx["=="]=1;
  7436. self._assert_($1);
  7437. $5=_st(o1)._identityHash();
  7438. $ctx1.sendIdx["identityHash"]=3;
  7439. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7440. self._deny_($4);
  7441. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7442. args: [],
  7443. 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",
  7444. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7445. referencedClasses: ["Object"]
  7446. }),
  7447. smalltalk.ObjectTest);
  7448. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7449. smalltalk.addMethod(
  7450. smalltalk.method({
  7451. selector: "testAccessing",
  7452. protocol: 'tests',
  7453. fn: function (){
  7454. var self=this;
  7455. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7456. return smalltalk.withContext(function($ctx1) {
  7457. var $2,$1,$3,$6,$5,$4;
  7458. $2=_st($Point())._x_y_((3),(4));
  7459. $ctx1.sendIdx["x:y:"]=1;
  7460. $1=_st($2)._x();
  7461. $ctx1.sendIdx["x"]=1;
  7462. self._assert_equals_($1,(3));
  7463. $ctx1.sendIdx["assert:equals:"]=1;
  7464. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7465. $ctx1.sendIdx["y"]=1;
  7466. self._assert_equals_($3,(4));
  7467. $ctx1.sendIdx["assert:equals:"]=2;
  7468. $6=_st($Point())._new();
  7469. $ctx1.sendIdx["new"]=1;
  7470. $5=_st($6)._x_((3));
  7471. $4=_st($5)._x();
  7472. self._assert_equals_($4,(3));
  7473. $ctx1.sendIdx["assert:equals:"]=3;
  7474. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7475. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7476. args: [],
  7477. 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",
  7478. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7479. referencedClasses: ["Point"]
  7480. }),
  7481. smalltalk.PointTest);
  7482. smalltalk.addMethod(
  7483. smalltalk.method({
  7484. selector: "testArithmetic",
  7485. protocol: 'tests',
  7486. fn: function (){
  7487. var self=this;
  7488. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7489. return smalltalk.withContext(function($ctx1) {
  7490. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7491. $2=(3).__at((4));
  7492. $ctx1.sendIdx["@"]=1;
  7493. $3=(3).__at((4));
  7494. $ctx1.sendIdx["@"]=2;
  7495. $1=_st($2).__star($3);
  7496. $4=_st($Point())._x_y_((9),(16));
  7497. $ctx1.sendIdx["x:y:"]=1;
  7498. self._assert_equals_($1,$4);
  7499. $ctx1.sendIdx["assert:equals:"]=1;
  7500. $6=(3).__at((4));
  7501. $ctx1.sendIdx["@"]=3;
  7502. $7=(3).__at((4));
  7503. $ctx1.sendIdx["@"]=4;
  7504. $5=_st($6).__plus($7);
  7505. $8=_st($Point())._x_y_((6),(8));
  7506. $ctx1.sendIdx["x:y:"]=2;
  7507. self._assert_equals_($5,$8);
  7508. $ctx1.sendIdx["assert:equals:"]=2;
  7509. $10=(3).__at((4));
  7510. $ctx1.sendIdx["@"]=5;
  7511. $11=(3).__at((4));
  7512. $ctx1.sendIdx["@"]=6;
  7513. $9=_st($10).__minus($11);
  7514. $12=_st($Point())._x_y_((0),(0));
  7515. $ctx1.sendIdx["x:y:"]=3;
  7516. self._assert_equals_($9,$12);
  7517. $ctx1.sendIdx["assert:equals:"]=3;
  7518. $14=(6).__at((8));
  7519. $ctx1.sendIdx["@"]=7;
  7520. $13=_st($14).__slash((3).__at((4)));
  7521. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7522. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7523. args: [],
  7524. 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)",
  7525. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7526. referencedClasses: ["Point"]
  7527. }),
  7528. smalltalk.PointTest);
  7529. smalltalk.addMethod(
  7530. smalltalk.method({
  7531. selector: "testAt",
  7532. protocol: 'tests',
  7533. fn: function (){
  7534. var self=this;
  7535. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7536. return smalltalk.withContext(function($ctx1) {
  7537. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7538. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7539. args: [],
  7540. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7541. messageSends: ["assert:equals:", "@", "x:y:"],
  7542. referencedClasses: ["Point"]
  7543. }),
  7544. smalltalk.PointTest);
  7545. smalltalk.addMethod(
  7546. smalltalk.method({
  7547. selector: "testEgality",
  7548. protocol: 'tests',
  7549. fn: function (){
  7550. var self=this;
  7551. return smalltalk.withContext(function($ctx1) {
  7552. var $2,$3,$1,$5,$4;
  7553. $2=(3).__at((4));
  7554. $ctx1.sendIdx["@"]=1;
  7555. $3=(3).__at((4));
  7556. $ctx1.sendIdx["@"]=2;
  7557. $1=_st($2).__eq($3);
  7558. $ctx1.sendIdx["="]=1;
  7559. self._assert_($1);
  7560. $5=(3).__at((5));
  7561. $ctx1.sendIdx["@"]=3;
  7562. $4=_st($5).__eq((3).__at((6)));
  7563. self._deny_($4);
  7564. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7565. args: [],
  7566. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7567. messageSends: ["assert:", "=", "@", "deny:"],
  7568. referencedClasses: []
  7569. }),
  7570. smalltalk.PointTest);
  7571. smalltalk.addMethod(
  7572. smalltalk.method({
  7573. selector: "testNew",
  7574. protocol: 'tests',
  7575. fn: function (){
  7576. var self=this;
  7577. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7578. return smalltalk.withContext(function($ctx1) {
  7579. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7580. $3=_st($Point())._new();
  7581. $ctx1.sendIdx["new"]=1;
  7582. $2=_st($3)._x_((3));
  7583. $ctx1.sendIdx["x:"]=1;
  7584. $1=_st($2)._y();
  7585. $ctx1.sendIdx["y"]=1;
  7586. self._assert_equals_($1,nil);
  7587. $ctx1.sendIdx["assert:equals:"]=1;
  7588. $7=_st($Point())._new();
  7589. $ctx1.sendIdx["new"]=2;
  7590. $6=_st($7)._x_((3));
  7591. $5=_st($6)._x();
  7592. $ctx1.sendIdx["x"]=1;
  7593. $4=_st($5).__eq((0));
  7594. $ctx1.sendIdx["="]=1;
  7595. self._deny_($4);
  7596. $ctx1.sendIdx["deny:"]=1;
  7597. $10=_st($Point())._new();
  7598. $ctx1.sendIdx["new"]=3;
  7599. $9=_st($10)._y_((4));
  7600. $ctx1.sendIdx["y:"]=1;
  7601. $8=_st($9)._x();
  7602. self._assert_equals_($8,nil);
  7603. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7604. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7605. args: [],
  7606. 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",
  7607. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7608. referencedClasses: ["Point"]
  7609. }),
  7610. smalltalk.PointTest);
  7611. smalltalk.addMethod(
  7612. smalltalk.method({
  7613. selector: "testTranslateBy",
  7614. protocol: 'tests',
  7615. fn: function (){
  7616. var self=this;
  7617. return smalltalk.withContext(function($ctx1) {
  7618. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7619. $2=(3).__at((3));
  7620. $ctx1.sendIdx["@"]=1;
  7621. $3=(0).__at((1));
  7622. $ctx1.sendIdx["@"]=2;
  7623. $1=_st($2)._translateBy_($3);
  7624. $ctx1.sendIdx["translateBy:"]=1;
  7625. $4=(3).__at((4));
  7626. $ctx1.sendIdx["@"]=3;
  7627. self._assert_equals_($1,$4);
  7628. $ctx1.sendIdx["assert:equals:"]=1;
  7629. $6=(3).__at((3));
  7630. $ctx1.sendIdx["@"]=4;
  7631. $8=(1)._negated();
  7632. $ctx1.sendIdx["negated"]=1;
  7633. $7=(0).__at($8);
  7634. $ctx1.sendIdx["@"]=5;
  7635. $5=_st($6)._translateBy_($7);
  7636. $ctx1.sendIdx["translateBy:"]=2;
  7637. $9=(3).__at((2));
  7638. $ctx1.sendIdx["@"]=6;
  7639. self._assert_equals_($5,$9);
  7640. $ctx1.sendIdx["assert:equals:"]=2;
  7641. $11=(3).__at((3));
  7642. $ctx1.sendIdx["@"]=7;
  7643. $12=(2).__at((3));
  7644. $ctx1.sendIdx["@"]=8;
  7645. $10=_st($11)._translateBy_($12);
  7646. $ctx1.sendIdx["translateBy:"]=3;
  7647. $13=(5).__at((6));
  7648. $ctx1.sendIdx["@"]=9;
  7649. self._assert_equals_($10,$13);
  7650. $ctx1.sendIdx["assert:equals:"]=3;
  7651. $15=(3).__at((3));
  7652. $ctx1.sendIdx["@"]=10;
  7653. $16=_st((3)._negated()).__at((0));
  7654. $ctx1.sendIdx["@"]=11;
  7655. $14=_st($15)._translateBy_($16);
  7656. self._assert_equals_($14,(0).__at((3)));
  7657. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7658. args: [],
  7659. 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.",
  7660. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7661. referencedClasses: []
  7662. }),
  7663. smalltalk.PointTest);
  7664. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7665. smalltalk.addMethod(
  7666. smalltalk.method({
  7667. selector: "testNextIfAbsent",
  7668. protocol: 'tests',
  7669. fn: function (){
  7670. var self=this;
  7671. var queue;
  7672. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7673. return smalltalk.withContext(function($ctx1) {
  7674. var $2,$1;
  7675. queue=_st($Queue())._new();
  7676. _st(queue)._nextPut_("index1");
  7677. $2=_st(queue)._nextIfAbsent_("empty");
  7678. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7679. $1=_st($2).__eq("index1");
  7680. $ctx1.sendIdx["="]=1;
  7681. self._assert_($1);
  7682. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7683. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7684. args: [],
  7685. 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'",
  7686. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7687. referencedClasses: ["Queue"]
  7688. }),
  7689. smalltalk.QueueTest);
  7690. smalltalk.addMethod(
  7691. smalltalk.method({
  7692. selector: "testQueueNext",
  7693. protocol: 'tests',
  7694. fn: function (){
  7695. var self=this;
  7696. var queue;
  7697. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7698. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7699. return smalltalk.withContext(function($ctx1) {
  7700. var $1,$2,$4,$3,$6,$5;
  7701. queue=_st($Queue())._new();
  7702. $1=queue;
  7703. _st($1)._nextPut_("index1");
  7704. $ctx1.sendIdx["nextPut:"]=1;
  7705. $2=_st($1)._nextPut_("index2");
  7706. $4=_st(queue)._next();
  7707. $ctx1.sendIdx["next"]=1;
  7708. $3=_st($4).__eq("index1");
  7709. $ctx1.sendIdx["="]=1;
  7710. self._assert_($3);
  7711. $6=_st(queue)._next();
  7712. $ctx1.sendIdx["next"]=2;
  7713. $5=_st($6).__eq("index");
  7714. self._deny_($5);
  7715. self._should_raise_((function(){
  7716. return smalltalk.withContext(function($ctx2) {
  7717. return _st(queue)._next();
  7718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7719. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7720. args: [],
  7721. 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",
  7722. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7723. referencedClasses: ["Queue", "Error"]
  7724. }),
  7725. smalltalk.QueueTest);
  7726. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7727. smalltalk.addMethod(
  7728. smalltalk.method({
  7729. selector: "testAtRandomNumber",
  7730. protocol: 'tests',
  7731. fn: function (){
  7732. var self=this;
  7733. var val;
  7734. return smalltalk.withContext(function($ctx1) {
  7735. (100)._timesRepeat_((function(){
  7736. return smalltalk.withContext(function($ctx2) {
  7737. val=(10)._atRandom();
  7738. val;
  7739. self._assert_(_st(val).__gt((0)));
  7740. $ctx2.sendIdx["assert:"]=1;
  7741. return self._assert_(_st(val).__lt((11)));
  7742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7743. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7744. args: [],
  7745. 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]",
  7746. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7747. referencedClasses: []
  7748. }),
  7749. smalltalk.RandomTest);
  7750. smalltalk.addMethod(
  7751. smalltalk.method({
  7752. selector: "testAtRandomSequenceableCollection",
  7753. protocol: 'tests',
  7754. fn: function (){
  7755. var self=this;
  7756. var val;
  7757. return smalltalk.withContext(function($ctx1) {
  7758. var $3,$4,$2,$1;
  7759. (100)._timesRepeat_((function(){
  7760. return smalltalk.withContext(function($ctx2) {
  7761. val="abc"._atRandom();
  7762. val;
  7763. $3=_st(val).__eq("a");
  7764. $ctx2.sendIdx["="]=1;
  7765. $4=_st(val).__eq("b");
  7766. $ctx2.sendIdx["="]=2;
  7767. $2=_st($3).__or($4);
  7768. $1=_st($2).__or(_st(val).__eq("c"));
  7769. $ctx2.sendIdx["|"]=1;
  7770. return self._assert_($1);
  7771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7772. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7773. args: [],
  7774. 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].",
  7775. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7776. referencedClasses: []
  7777. }),
  7778. smalltalk.RandomTest);
  7779. smalltalk.addMethod(
  7780. smalltalk.method({
  7781. selector: "textNext",
  7782. protocol: 'tests',
  7783. fn: function (){
  7784. var self=this;
  7785. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7786. return smalltalk.withContext(function($ctx1) {
  7787. var $1;
  7788. (10000)._timesRepeat_((function(){
  7789. var current,next;
  7790. return smalltalk.withContext(function($ctx2) {
  7791. next=_st(_st($Random())._new())._next();
  7792. next;
  7793. self._assert_(_st(next).__gt_eq((0)));
  7794. $ctx2.sendIdx["assert:"]=1;
  7795. self._assert_(_st(next).__lt((1)));
  7796. $1=_st(current).__eq(next);
  7797. $ctx2.sendIdx["="]=1;
  7798. self._deny_($1);
  7799. return _st(next).__eq(current);
  7800. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7801. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7802. args: [],
  7803. 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 ]",
  7804. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7805. referencedClasses: ["Random"]
  7806. }),
  7807. smalltalk.RandomTest);
  7808. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7809. smalltalk.addMethod(
  7810. smalltalk.method({
  7811. selector: "collectionClass",
  7812. protocol: 'accessing',
  7813. fn: function (){
  7814. var self=this;
  7815. return smalltalk.withContext(function($ctx1) {
  7816. var $1;
  7817. $1=_st(self._class())._collectionClass();
  7818. return $1;
  7819. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7820. args: [],
  7821. source: "collectionClass\x0a\x09^ self class collectionClass",
  7822. messageSends: ["collectionClass", "class"],
  7823. referencedClasses: []
  7824. }),
  7825. smalltalk.StreamTest);
  7826. smalltalk.addMethod(
  7827. smalltalk.method({
  7828. selector: "newCollection",
  7829. protocol: 'accessing',
  7830. fn: function (){
  7831. var self=this;
  7832. return smalltalk.withContext(function($ctx1) {
  7833. var $1;
  7834. $1=_st(self._collectionClass())._new();
  7835. return $1;
  7836. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7837. args: [],
  7838. source: "newCollection\x0a\x09^ self collectionClass new",
  7839. messageSends: ["new", "collectionClass"],
  7840. referencedClasses: []
  7841. }),
  7842. smalltalk.StreamTest);
  7843. smalltalk.addMethod(
  7844. smalltalk.method({
  7845. selector: "newStream",
  7846. protocol: 'accessing',
  7847. fn: function (){
  7848. var self=this;
  7849. return smalltalk.withContext(function($ctx1) {
  7850. var $1;
  7851. $1=_st(_st(self._collectionClass())._new())._stream();
  7852. return $1;
  7853. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7854. args: [],
  7855. source: "newStream\x0a\x09^ self collectionClass new stream",
  7856. messageSends: ["stream", "new", "collectionClass"],
  7857. referencedClasses: []
  7858. }),
  7859. smalltalk.StreamTest);
  7860. smalltalk.addMethod(
  7861. smalltalk.method({
  7862. selector: "testAtStartAtEnd",
  7863. protocol: 'tests',
  7864. fn: function (){
  7865. var self=this;
  7866. var stream;
  7867. return smalltalk.withContext(function($ctx1) {
  7868. var $1,$2,$3,$4;
  7869. stream=self._newStream();
  7870. $1=_st(stream)._atStart();
  7871. $ctx1.sendIdx["atStart"]=1;
  7872. self._assert_($1);
  7873. $ctx1.sendIdx["assert:"]=1;
  7874. $2=_st(stream)._atEnd();
  7875. $ctx1.sendIdx["atEnd"]=1;
  7876. self._assert_($2);
  7877. $ctx1.sendIdx["assert:"]=2;
  7878. _st(stream)._nextPutAll_(self._newCollection());
  7879. $3=_st(stream)._atEnd();
  7880. $ctx1.sendIdx["atEnd"]=2;
  7881. self._assert_($3);
  7882. $4=_st(stream)._atStart();
  7883. $ctx1.sendIdx["atStart"]=2;
  7884. self._deny_($4);
  7885. $ctx1.sendIdx["deny:"]=1;
  7886. _st(stream)._position_((1));
  7887. self._deny_(_st(stream)._atEnd());
  7888. $ctx1.sendIdx["deny:"]=2;
  7889. self._deny_(_st(stream)._atStart());
  7890. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7891. args: [],
  7892. 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",
  7893. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7894. referencedClasses: []
  7895. }),
  7896. smalltalk.StreamTest);
  7897. smalltalk.addMethod(
  7898. smalltalk.method({
  7899. selector: "testContents",
  7900. protocol: 'tests',
  7901. fn: function (){
  7902. var self=this;
  7903. var stream;
  7904. return smalltalk.withContext(function($ctx1) {
  7905. var $1,$2;
  7906. stream=self._newStream();
  7907. $1=stream;
  7908. $2=self._newCollection();
  7909. $ctx1.sendIdx["newCollection"]=1;
  7910. _st($1)._nextPutAll_($2);
  7911. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7912. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7913. args: [],
  7914. 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",
  7915. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7916. referencedClasses: []
  7917. }),
  7918. smalltalk.StreamTest);
  7919. smalltalk.addMethod(
  7920. smalltalk.method({
  7921. selector: "testIsEmpty",
  7922. protocol: 'tests',
  7923. fn: function (){
  7924. var self=this;
  7925. var stream;
  7926. return smalltalk.withContext(function($ctx1) {
  7927. var $1;
  7928. stream=self._newStream();
  7929. $1=_st(stream)._isEmpty();
  7930. $ctx1.sendIdx["isEmpty"]=1;
  7931. self._assert_($1);
  7932. _st(stream)._nextPutAll_(self._newCollection());
  7933. self._deny_(_st(stream)._isEmpty());
  7934. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7935. args: [],
  7936. 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",
  7937. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7938. referencedClasses: []
  7939. }),
  7940. smalltalk.StreamTest);
  7941. smalltalk.addMethod(
  7942. smalltalk.method({
  7943. selector: "testPosition",
  7944. protocol: 'tests',
  7945. fn: function (){
  7946. var self=this;
  7947. var collection,stream;
  7948. return smalltalk.withContext(function($ctx1) {
  7949. var $1,$2,$3;
  7950. collection=self._newCollection();
  7951. stream=self._newStream();
  7952. _st(stream)._nextPutAll_(collection);
  7953. $1=_st(stream)._position();
  7954. $ctx1.sendIdx["position"]=1;
  7955. self._assert_equals_($1,_st(collection)._size());
  7956. $ctx1.sendIdx["assert:equals:"]=1;
  7957. _st(stream)._position_((0));
  7958. $2=_st(stream)._position();
  7959. $ctx1.sendIdx["position"]=2;
  7960. self._assert_equals_($2,(0));
  7961. $ctx1.sendIdx["assert:equals:"]=2;
  7962. _st(stream)._next();
  7963. $ctx1.sendIdx["next"]=1;
  7964. $3=_st(stream)._position();
  7965. $ctx1.sendIdx["position"]=3;
  7966. self._assert_equals_($3,(1));
  7967. $ctx1.sendIdx["assert:equals:"]=3;
  7968. _st(stream)._next();
  7969. self._assert_equals_(_st(stream)._position(),(2));
  7970. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7971. args: [],
  7972. 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",
  7973. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7974. referencedClasses: []
  7975. }),
  7976. smalltalk.StreamTest);
  7977. smalltalk.addMethod(
  7978. smalltalk.method({
  7979. selector: "testReading",
  7980. protocol: 'tests',
  7981. fn: function (){
  7982. var self=this;
  7983. var stream,collection;
  7984. return smalltalk.withContext(function($ctx1) {
  7985. var $1,$2,$3;
  7986. collection=self._newCollection();
  7987. stream=self._newStream();
  7988. $1=stream;
  7989. _st($1)._nextPutAll_(collection);
  7990. $2=_st($1)._position_((0));
  7991. _st(collection)._do_((function(each){
  7992. return smalltalk.withContext(function($ctx2) {
  7993. $3=_st(stream)._next();
  7994. $ctx2.sendIdx["next"]=1;
  7995. return self._assert_equals_($3,each);
  7996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7997. self._assert_(_st(_st(stream)._next())._isNil());
  7998. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7999. args: [],
  8000. 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",
  8001. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8002. referencedClasses: []
  8003. }),
  8004. smalltalk.StreamTest);
  8005. smalltalk.addMethod(
  8006. smalltalk.method({
  8007. selector: "testStreamContents",
  8008. protocol: 'tests',
  8009. fn: function (){
  8010. var self=this;
  8011. return smalltalk.withContext(function($ctx1) {
  8012. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8013. args: [],
  8014. source: "testStreamContents",
  8015. messageSends: [],
  8016. referencedClasses: []
  8017. }),
  8018. smalltalk.StreamTest);
  8019. smalltalk.addMethod(
  8020. smalltalk.method({
  8021. selector: "testWrite",
  8022. protocol: 'tests',
  8023. fn: function (){
  8024. var self=this;
  8025. var stream,collection;
  8026. return smalltalk.withContext(function($ctx1) {
  8027. collection=self._newCollection();
  8028. stream=self._newStream();
  8029. _st(collection)._do_((function(each){
  8030. return smalltalk.withContext(function($ctx2) {
  8031. return _st(stream).__lt_lt(each);
  8032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8033. self._assert_equals_(_st(stream)._contents(),collection);
  8034. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8035. args: [],
  8036. 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",
  8037. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8038. referencedClasses: []
  8039. }),
  8040. smalltalk.StreamTest);
  8041. smalltalk.addMethod(
  8042. smalltalk.method({
  8043. selector: "testWriting",
  8044. protocol: 'tests',
  8045. fn: function (){
  8046. var self=this;
  8047. var stream,collection;
  8048. return smalltalk.withContext(function($ctx1) {
  8049. var $1;
  8050. collection=self._newCollection();
  8051. stream=self._newStream();
  8052. $ctx1.sendIdx["newStream"]=1;
  8053. _st(collection)._do_((function(each){
  8054. return smalltalk.withContext(function($ctx2) {
  8055. return _st(stream)._nextPut_(each);
  8056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8057. $1=_st(stream)._contents();
  8058. $ctx1.sendIdx["contents"]=1;
  8059. self._assert_equals_($1,collection);
  8060. $ctx1.sendIdx["assert:equals:"]=1;
  8061. stream=self._newStream();
  8062. _st(stream)._nextPutAll_(collection);
  8063. self._assert_equals_(_st(stream)._contents(),collection);
  8064. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8065. args: [],
  8066. 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",
  8067. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8068. referencedClasses: []
  8069. }),
  8070. smalltalk.StreamTest);
  8071. smalltalk.addMethod(
  8072. smalltalk.method({
  8073. selector: "collectionClass",
  8074. protocol: 'accessing',
  8075. fn: function (){
  8076. var self=this;
  8077. return smalltalk.withContext(function($ctx1) {
  8078. return nil;
  8079. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8080. args: [],
  8081. source: "collectionClass\x0a\x09^ nil",
  8082. messageSends: [],
  8083. referencedClasses: []
  8084. }),
  8085. smalltalk.StreamTest.klass);
  8086. smalltalk.addMethod(
  8087. smalltalk.method({
  8088. selector: "isAbstract",
  8089. protocol: 'testing',
  8090. fn: function (){
  8091. var self=this;
  8092. return smalltalk.withContext(function($ctx1) {
  8093. var $1;
  8094. $1=_st(self._collectionClass())._isNil();
  8095. return $1;
  8096. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8097. args: [],
  8098. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8099. messageSends: ["isNil", "collectionClass"],
  8100. referencedClasses: []
  8101. }),
  8102. smalltalk.StreamTest.klass);
  8103. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8104. smalltalk.addMethod(
  8105. smalltalk.method({
  8106. selector: "newCollection",
  8107. protocol: 'accessing',
  8108. fn: function (){
  8109. var self=this;
  8110. return smalltalk.withContext(function($ctx1) {
  8111. var $1;
  8112. $1=[true,(1),(3).__at((4)),"foo"];
  8113. return $1;
  8114. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8115. args: [],
  8116. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8117. messageSends: ["@"],
  8118. referencedClasses: []
  8119. }),
  8120. smalltalk.ArrayStreamTest);
  8121. smalltalk.addMethod(
  8122. smalltalk.method({
  8123. selector: "collectionClass",
  8124. protocol: 'accessing',
  8125. fn: function (){
  8126. var self=this;
  8127. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8128. return smalltalk.withContext(function($ctx1) {
  8129. return $Array();
  8130. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8131. args: [],
  8132. source: "collectionClass\x0a\x09^ Array",
  8133. messageSends: [],
  8134. referencedClasses: ["Array"]
  8135. }),
  8136. smalltalk.ArrayStreamTest.klass);
  8137. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8138. smalltalk.addMethod(
  8139. smalltalk.method({
  8140. selector: "newCollection",
  8141. protocol: 'accessing',
  8142. fn: function (){
  8143. var self=this;
  8144. return smalltalk.withContext(function($ctx1) {
  8145. return "hello world";
  8146. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8147. args: [],
  8148. source: "newCollection\x0a\x09^ 'hello world'",
  8149. messageSends: [],
  8150. referencedClasses: []
  8151. }),
  8152. smalltalk.StringStreamTest);
  8153. smalltalk.addMethod(
  8154. smalltalk.method({
  8155. selector: "collectionClass",
  8156. protocol: 'accessing',
  8157. fn: function (){
  8158. var self=this;
  8159. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8160. return smalltalk.withContext(function($ctx1) {
  8161. return $String();
  8162. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8163. args: [],
  8164. source: "collectionClass\x0a\x09^ String",
  8165. messageSends: [],
  8166. referencedClasses: ["String"]
  8167. }),
  8168. smalltalk.StringStreamTest.klass);
  8169. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8170. smalltalk.addMethod(
  8171. smalltalk.method({
  8172. selector: "testCopying",
  8173. protocol: 'tests',
  8174. fn: function (){
  8175. var self=this;
  8176. return smalltalk.withContext(function($ctx1) {
  8177. self._assert_equals_(nil._copy(),nil);
  8178. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8179. args: [],
  8180. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8181. messageSends: ["assert:equals:", "copy"],
  8182. referencedClasses: []
  8183. }),
  8184. smalltalk.UndefinedTest);
  8185. smalltalk.addMethod(
  8186. smalltalk.method({
  8187. selector: "testDeepCopy",
  8188. protocol: 'tests',
  8189. fn: function (){
  8190. var self=this;
  8191. return smalltalk.withContext(function($ctx1) {
  8192. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8193. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8194. args: [],
  8195. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8196. messageSends: ["assert:", "=", "deepCopy"],
  8197. referencedClasses: []
  8198. }),
  8199. smalltalk.UndefinedTest);
  8200. smalltalk.addMethod(
  8201. smalltalk.method({
  8202. selector: "testIfNil",
  8203. protocol: 'tests',
  8204. fn: function (){
  8205. var self=this;
  8206. return smalltalk.withContext(function($ctx1) {
  8207. var $1,$3,$2,$4,$6,$5;
  8208. if(($receiver = nil) == nil || $receiver == null){
  8209. $1=true;
  8210. } else {
  8211. $1=nil;
  8212. };
  8213. self._assert_equals_($1,true);
  8214. $ctx1.sendIdx["assert:equals:"]=1;
  8215. if(($receiver = nil) == nil || $receiver == null){
  8216. $3=nil;
  8217. } else {
  8218. $3=true;
  8219. };
  8220. $2=_st($3).__eq(true);
  8221. $ctx1.sendIdx["="]=1;
  8222. self._deny_($2);
  8223. $ctx1.sendIdx["deny:"]=1;
  8224. if(($receiver = nil) == nil || $receiver == null){
  8225. $4=true;
  8226. } else {
  8227. $4=false;
  8228. };
  8229. self._assert_equals_($4,true);
  8230. if(($receiver = nil) == nil || $receiver == null){
  8231. $6=false;
  8232. } else {
  8233. $6=true;
  8234. };
  8235. $5=_st($6).__eq(true);
  8236. self._deny_($5);
  8237. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8238. args: [],
  8239. 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",
  8240. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8241. referencedClasses: []
  8242. }),
  8243. smalltalk.UndefinedTest);
  8244. smalltalk.addMethod(
  8245. smalltalk.method({
  8246. selector: "testIsNil",
  8247. protocol: 'tests',
  8248. fn: function (){
  8249. var self=this;
  8250. return smalltalk.withContext(function($ctx1) {
  8251. self._assert_(nil._isNil());
  8252. self._deny_(nil._notNil());
  8253. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8254. args: [],
  8255. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8256. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8257. referencedClasses: []
  8258. }),
  8259. smalltalk.UndefinedTest);
  8260. });